-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Extra bits returned by the Permissions struct on unix #45330
Comments
The name |
But that's not the behavior the method had in the previous releases. Isn't better to add a |
Sure, but it sounds like what you're proposing is still a backwards-breaking change, right? The set{g,u}id/sticky bit wasn't exposed before either. |
Yeah, even that is a breaking change, but it affects way less use cases (things breaks only if the node has the set{g,u}id/sticky bit, which isn't so much common), while the current code affects all the calls to the method. Also, I think the motivation in #44147 is still valid, and that needs only a I'm ok with either masking to |
Hmmm I don't have a strong preference either keeping it unmasked or switching to 0o7777. Our current behavior associates Permissions more closely with Metadata since it exposes its st_mode bits, while this proposed behavior associates Permissions more closely with set_permissions, since we could think of mode() as the portion of the file mode that can be set by set_permissions aka a chmod. Either way makes sense to me, which is why I went with @sfackler's slight preference for changing to no mask for the PR. Are there any known cases where the new behavior breaks existing code? |
There was a small breakage in a test of one of my projects, where I wanted to check if the permissions of a file were exactly the ones I wanted. It's not too much, but it's annoying anyway. I think a decision on this should be made, either keeping the current behavior or reverting to the old one: the next release is going to be in a month, and it doesn't make sense to change the behavior of a method in a release and revert the change in the next one. |
Until September,
PermissionsExt::mode
on unix returned the permissions of the file masked with0o777
, which was hiding the set{u,g}id/sticky bits. Then, #44147 and #44624 changed the standard library to avoid masking the permissions at all.The fix indeed exposed the missing bits, but it also exposed some extra ones, like the ones specifying if the node is a file or a directory. For example, now the permissions of a directory are like
0o40755
.I think those bits are out of place in the permissions, as the information is provided by the
Metadata
struct already. Can we revert to masking with0o7777
to preserve the set{u,g}id/sticky but discard the extra ones?The text was updated successfully, but these errors were encountered: