Skip to content

fix: preserve existing file mode in atomic_write - #3

Draft
PavanaSakethaRam wants to merge 1 commit into
developfrom
fix/issue-2-20261019173248-cdffd791
Draft

PavanaSakethaRam wants to merge 1 commit into
developfrom
fix/issue-2-20261019173248-cdffd791

Conversation

@PavanaSakethaRam

Copy link
Copy Markdown
Collaborator

Summary

  • Preserve an existing file's Unix permissions when atomic_write replaces it.
  • Apply the permissions to the temporary file before the atomic rename.
  • Keep the current private mode for newly created files.
  • Add regression tests for replacement and new-file behavior.

Verification

  • The replacement regression fails on develop (0600 instead of 0644) and passes with this change.
  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --locked --offline
  • cargo test --workspace --locked --offline (952 passed, 3 ignored)
  • cargo clippy --no-default-features --all-targets --locked --offline
  • cargo test --no-default-features --locked --offline (952 passed, 3 ignored)
  • cargo doc --no-deps --locked --offline

Fixes #2

Jarvis produced the initial regression and patch, but reached its request limit before its publication step. I reviewed, refined, and verified the patch locally before opening this draft.

Keep the original Unix permissions on the temporary file before it replaces an existing file. Cover replacement and new-file behavior with regression tests.

Refs #2

Signed-off-by: Pavan Saketh Ram <pavan.sakethram@gmail.com>
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

Successfully merging this pull request may close these issues.

1 participant