-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix permissions on dist-info files created by adjacent_temp_file #8144
Conversation
892dae0
to
0437803
Compare
b4b0d9d
to
15fa666
Compare
15fa666
to
388ca92
Compare
Alright, fix coming. |
Co-Authored-By: Pradyun Gedam <[email protected]>
# type: (str, **Any) -> Iterator[NamedTemporaryFileResult] | ||
with adjacent_tmp_file(path, **kwargs) as f: | ||
yield f | ||
os.chmod(f.name, 0o644) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be 0o666 - current_umask()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH this is becoming complex for little benefits. How about
with open(path + ".pip", **kwargs) as f:
yield f
replace(f.name, path)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I was wondering whether this needs to be more generic, but didn’t know how.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sbidoul Oops, I missed your last comment (stale GitHub tab). Why were we using adjacent_tmp_file()
in the first place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@uranusjr it came from a suggestion of @chrahunt.
It made sense at first glance but it has generated so much trouble...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I traced the NamedTemporaryFile()
implementation and I think there is a point to use it instead of straight up open
, but I’m not sure for how much benefit. I’d vote for using the tempfile-chmod method for now (we need to fix this in the 20.1 release), and let @chrahunt chime in before trying to remove the temp file call. At least it would be simple since the calls are now wrapped in a function.
Testing this in Fedora. |
Before:
After:
Hence, fixes the problem. |
Hurray! Thanks for the testing @hroncok! Much appreciated! ^>^ |
Gonna go ahead and merge this, since it has approvals from multiple folks and has a positive report that this fixes the issue from someone who's reported the issue. |
This comment has been minimized.
This comment has been minimized.
Running with umask = 027 causes the permission calculation here to go awry: https://github.com/pypa/pip/pull/8144/files#diff-81eaeaa2196a8c5382958f2d9f22b593R570
I'd have expected a bitwise AND so the result would be 0640. |
Fix #8139. This does not contain the fix (yet) because I want to see the tests fail first; I can’t do that on Windows :p