-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
docs: Permissions.readonly() also ignores root user special permissions #130289
docs: Permissions.readonly() also ignores root user special permissions #130289
Conversation
r? @ChrisDenton rustbot has assigned @ChrisDenton. Use |
I'm not really sure about this. I agree it's technically redundant but we've been really keen to emphasise the shortcomings of maybe @the8472 has some thoughts here? |
I think it'd be better to make this a broader statement that says that it only looks at a very limited set of properties of the file metadata and is not an accurate "will this file be non-writable" test and then refer to the platform-specific notes for more details. E.g. on unix you can also create a file as read-only but have a writable file descriptor open. |
And "not accurate" can be expanded to "has both false positives and false negatives". |
I'm sorry, I have somehow missed GitHub notifications about this PR. It makes sense to make the 'Note' section shorter and explain this caveat in the 'Unix' section instead. Will change. |
afa1bd2
to
df9e232
Compare
I have pushed changes:
|
df9e232
to
9318a23
Compare
The root user can write to files without any (write) access bits set. But this is not taken into account by `std::fs::Permissions.readonly()`.
9318a23
to
edfdfbe
Compare
Thanks! @bors r+ rollup |
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#130289 (docs: Permissions.readonly() also ignores root user special permissions) - rust-lang#134583 (docs: `transmute<&mut T, &mut MaybeUninit<T>>` is unsound when exposed to safe code) - rust-lang#134611 (Align `{i686,x86_64}-win7-windows-msvc` to their parent targets) - rust-lang#134629 (compiletest: Allow using a specific debugger when running debuginfo tests) - rust-lang#134642 (Implement `PointerLike` for `isize`, `NonNull`, `Cell`, `UnsafeCell`, and `SyncUnsafeCell`.) - rust-lang#134660 (Fix spacing of markdown code block fences in compiler rustdoc) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#130289 (docs: Permissions.readonly() also ignores root user special permissions) - rust-lang#134583 (docs: `transmute<&mut T, &mut MaybeUninit<T>>` is unsound when exposed to safe code) - rust-lang#134611 (Align `{i686,x86_64}-win7-windows-msvc` to their parent targets) - rust-lang#134629 (compiletest: Allow using a specific debugger when running debuginfo tests) - rust-lang#134642 (Implement `PointerLike` for `isize`, `NonNull`, `Cell`, `UnsafeCell`, and `SyncUnsafeCell`.) - rust-lang#134660 (Fix spacing of markdown code block fences in compiler rustdoc) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#130289 - intgr-forks:Permissions-readonly-vs-unix-root, r=ChrisDenton docs: Permissions.readonly() also ignores root user special permissions The root user can write to files without any (write) permission bits set. But this is not taken into account by `std::fs::Permissions.readonly()`. The rustdoc for `readonly()` also mentions shortcomings later: > On Unix-based platforms this checks if any of the owner, group or others write permission bits are set. It does not check if the current user is in the file’s assigned group. It also does not check ACLs. But since this part already clarifies how it works -- it checks write permission bits -- I think it's not necessary to repeat the root user shortcomings here.
The root user can write to files without any (write) permission bits set. But this is not taken into account by
std::fs::Permissions.readonly()
.The rustdoc for
readonly()
also mentions shortcomings later:But since this part already clarifies how it works -- it checks write permission bits -- I think it's not necessary to repeat the root user shortcomings here.