Skip to content

Documentation for std::fs::set_permissions doesn't cover symlink behavior #75942

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

Closed
sunfishcode opened this issue Aug 26, 2020 · 3 comments · Fixed by #139546
Closed

Documentation for std::fs::set_permissions doesn't cover symlink behavior #75942

sunfishcode opened this issue Aug 26, 2020 · 3 comments · Fixed by #139546
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@sunfishcode
Copy link
Member

The documentation for std::fs::set_permissions doesn't say what it does if the given path names a symlink.

Experimentally, it seems that on Unix-family platforms it follows symlinks, while on Windows it does not. Though surprising, it's likely just a result of using the chmod and SetFileAttributes functions on their respective platform. The documentation does say that use of those functions isn't guaranteed, so it'd be useful to document what guarantees are intended, if any.

@sunfishcode sunfishcode added A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. labels Aug 26, 2020
@lolbinarycat lolbinarycat added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Mar 27, 2025
@lolbinarycat
Copy link
Contributor

requesting prioritization due to possible relation to CVE-2025-27591.

@ChrisDenton ChrisDenton added the I-libs-api-nominated Nominated for discussion during a libs-api team meeting. label Mar 27, 2025
@ChrisDenton
Copy link
Member

Note that libs/libs-api doesn't generally use prioritisation labels, So I've nominated it for @rust-lang/libs-api discussion.

@ChrisDenton ChrisDenton added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Mar 27, 2025
@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Mar 27, 2025
@Amanieu
Copy link
Member

Amanieu commented Apr 1, 2025

We discussed this in the @rust-lang/libs-api meeting. Considering that on Unix it's not possible to manipulate the permissions of a symlink (there isn't even a syscall for it on Linux), the question was whether we should change the Windows behavior. The consensus was to leave the behavior as it is and document the difference.

One open question was whether this affects WASI since it needs to support both Unix and Windows host platforms. We may revisit this decision if it turns out to cause problems in WASI.

@Amanieu Amanieu removed the I-libs-api-nominated Nominated for discussion during a libs-api team meeting. label Apr 1, 2025
ChrisDenton added a commit to ChrisDenton/rust that referenced this issue Apr 28, 2025
…5942, r=thomcc

std(docs): clarify how std::fs::set_permisions works with symlinks

fixes rust-lang#75942
fixes rust-lang#124201
ChrisDenton added a commit to ChrisDenton/rust that referenced this issue Apr 28, 2025
…5942, r=thomcc

std(docs): clarify how std::fs::set_permisions works with symlinks

fixes rust-lang#75942
fixes rust-lang#124201
ChrisDenton added a commit to ChrisDenton/rust that referenced this issue Apr 28, 2025
…5942, r=thomcc

std(docs): clarify how std::fs::set_permisions works with symlinks

fixes rust-lang#75942
fixes rust-lang#124201
@bors bors closed this as completed in 8808d5a Apr 28, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Apr 28, 2025
Rollup merge of rust-lang#139546 - lolbinarycat:std-set_permissions-75942, r=thomcc

std(docs): clarify how std::fs::set_permisions works with symlinks

fixes rust-lang#75942
fixes rust-lang#124201
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants