Skip to content
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

Retain suid/sgid/sticky bits in Metadata.permissions #44624

Merged
merged 3 commits into from
Sep 22, 2017

Conversation

tmerr
Copy link
Contributor

@tmerr tmerr commented Sep 16, 2017

Most users would expect set_permissions(Metadata.permissions()) to be
non-destructive. While we can't guarantee this, we can at least pass
the needed info to chmod.

Also update the PermissionsExt documentation to disambiguate what it
contains, and to refer to the underlying value as st_mode rather than
its type mode_t.

Closes #44147

Most users would expect set_permissions(Metadata.permissions()) to be
non-destructive. While we can't guarantee this, we can at least pass
the needed info to chmod.

Also update the PermissionsExt documentation to disambiguate what it
contains, and to refer to the underlying value as `st_mode` rather than
its type `mode_t`.

Closes rust-lang#44147
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @sfackler (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@sfackler
Copy link
Member

@alexcrichton do you remember why we're masking at all here? It seems kind of weird.

@alexcrichton
Copy link
Member

This line of code as added in 2015 back in the days of std::old_io. Back in those days the old_io module had a FilePermissions structure which only respected these 9 bits. Compound that with the fact that I wasn't aware there were suid/sgid bits in 2015 you probably get this line of code.

@tmerr can you add a test for this?

@sfackler
Copy link
Member

I don't feel super strongly, but it might be nice to just drop the mask entirely - it doesn't seem like it's really buying us anything.

@tmerr
Copy link
Contributor Author

tmerr commented Sep 16, 2017

OK sounds reasonable @sfackler. For the test I guess I could set a directory's permisisons to 0, then to 0o1777, then read them back. (ignoring suid/sgid here since whether they're honored is apparently implementation defined?)

@sfackler
Copy link
Member

Sure, that seems reasonable.

@tmerr
Copy link
Contributor Author

tmerr commented Sep 18, 2017

OK, removed mask and added test case

@carols10cents carols10cents added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 18, 2017
@alexcrichton
Copy link
Member

ping @sfackler, mind taking another look?

@sfackler
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Sep 22, 2017

📌 Commit 6ae9fc2 has been approved by sfackler

@bors
Copy link
Contributor

bors commented Sep 22, 2017

⌛ Testing commit 6ae9fc2 with merge ee409a4...

bors added a commit that referenced this pull request Sep 22, 2017
Retain suid/sgid/sticky bits in Metadata.permissions

Most users would expect set_permissions(Metadata.permissions()) to be
non-destructive. While we can't guarantee this, we can at least pass
the needed info to chmod.

Also update the PermissionsExt documentation to disambiguate what it
contains, and to refer to the underlying value as `st_mode` rather than
its type `mode_t`.

Closes #44147
@bors
Copy link
Contributor

bors commented Sep 22, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: sfackler
Pushing ee409a4 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants