Preserve file modes during atomic saves - #64
Open
OskarEichler wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Copy the existing store mode to the temporary file before an atomic rename. This prevents an atomic transaction from replacing a deliberately restricted file with the process-default creation mode.
Reproduction
Create a PStore, chmod it to modes such as 0600, 0640, 0750 or 06750, then commit an atomic transaction. Current master recreates the path with a mode derived from 0666 and umask; this change retains the original permission and special-mode bits.
Verification
Compatibility and limits
The change only affects changed atomic writes. It preserves permission bits, not ownership, ACLs, extended attributes, hard-link identity, or broader crash, NFS and Windows semantics. Local bounded measurements show the extra stat and chmod cost only on atomic replacement.