Skip to content

fs::Permissions set_readonly is odd on Unix. #41984

@twmb

Description

@twmb
  • set_readonly(true) wipes out write permissions, leaving existing executable permissions in place. This seems contrary to what I would expect this function to do: make something only readable. I would expect set_readonly(true) to set the permissions to 0o444.

  • set_readonly(false) adds write permissions to make permissions not readonly, as opposed to wiping out read permissions. Setting permissions to not readonly itself is a bit odd to begin with. Any combination of permissions that are not just read is technically not read only. I don't have a good solution to this, but I think more clarifying documentation would suffice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions