Repository navigation
fix: apply unix permissions at creation - #1104
Conversation
Its-Just-Nans
commented
Oct 19, 2026
- The PR title must conform to Conventional Commits and start with one of the types specified by the Angular convention.
|
@Pr0methean The branch protection on master is gone ? |
There was a problem hiding this comment.
Review Summary
This PR applies Unix permissions at file-creation time via OpenOptions::mode(), which closes the race window where a newly-created file is temporarily accessible with the process's default umask permissions before the subsequent set_permissions call. The intent and approach are correct.
One blocking issue must be fixed before merge:
The new use std::os::unix::fs::OpenOptionsExt; import on line 7 is unconditional and will cause a compilation failure on Windows and any other non-Unix target, breaking the existing cross-platform build matrix required by CI. It needs a #[cfg(unix)] attribute (see inline comment).
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
There was a problem hiding this comment.
@Its-Just-Nans Is there any reason to still have lines 573-577 (which set the permissions after writing the file) with this change?
|
What did you mean by #1105 (comment)
Also, on windows, the permissions are still deferred |
|
I mean that it only applies to normal files, i.e. files that aren't folders or symlinks. (The "owner-writable" detail was wrong; I hadn't yet had a chance to look up whether creating a file while opening it for writing, but also making it impossible to open for writing again, was allowed.) |
Yes you're right. The *Specifically on:
|
Clarify that permission issues during extraction apply only to directories and symlinks on Unix. Signed-off-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
|
@Its-Just-Nans One pre-existing quirk I noticed while testing this change is that if an archive contains two files with equivalent paths, and the first is read-only, we won't be allowed to overwrite it and extraction will return an error. In old versions where permissions were set in a second pass, that wouldn't have happened. Is this likely to be the behavior everyone wants? If we were going to change file permissions to overwrite them, we'd first have to make sure the overwritten file came from the archive, so it'd be a complicated change. |
Yes you're right. you're commit is good |