Skip to content

docs: Permissions.readonly() also ignores root user special permissions #130289

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions library/std/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1869,8 +1869,10 @@ impl Permissions {
///
/// # Note
///
/// This function does not take Access Control Lists (ACLs) or Unix group
/// membership into account.
/// This function does not take Access Control Lists (ACLs), Unix group
/// membership and other nuances into account.
/// Therefore the return value of this function cannot be relied upon
/// to predict whether attempts to read or write the file will actually succeed.
///
/// # Windows
///
Expand All @@ -1885,10 +1887,13 @@ impl Permissions {
/// # Unix (including macOS)
///
/// 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.
/// Therefore the return value of this function cannot be relied upon
/// to predict whether attempts to read or write the file will actually succeed.
/// write permission bits are set. It does not consider anything else, including:
///
/// * Whether the current user is in the file's assigned group.
/// * Permissions granted by ACL.
/// * That `root` user can write to files that do not have any write bits set.
/// * Writable files on a filesystem that is mounted read-only.
///
/// The [`PermissionsExt`] trait gives direct access to the permission bits but
/// also does not read ACLs.
///
Expand Down
Loading