Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data.write(to:options:) crashes if [.atomic, .withoutOverwriting] are passed together #1098

Open
weissi opened this issue Dec 16, 2024 · 0 comments

Comments

@weissi
Copy link

weissi commented Dec 16, 2024

if options.contains(.withoutOverwriting) && options.contains(.atomic) {
fatalError("withoutOverwriting is not supported with atomic")
}

Severe, source breaking bug here. In 5.10 and below, [.atomic, .withoutOverwriting] worked just fine (possibly not achieving the desired behaviour). We've got to back out this change because

  1. It's source breaking (works in 5.10, crashes in 6.0)
  2. The docs don't mention that .atomic and .withoutOverwriting are mutually exclusive
  3. They shouldn't be mutually exclusive
    3.1. On Linux, the man page for open's example for O_TMPFILE contains how to implement [.atomic, .withoutOverwriting]
    3.2. On systems that lack O_TMPFILE, this can still be approximated with write to .tmp_XXXXXX, then rename tmp file (and remove if that fails). That still prevents half-written files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant