Skip to content

Conversation

amol-
Copy link
Contributor

@amol- amol- commented Aug 6, 2025

When writing files to cache pip does copy the permissions from the cache directory, this is an expected behaviour to ensure that any user that has access to the cache has also access to its content.

Copying the permissions explicitly is necessary due to the use of adjacent_tmp_file which by virtue of tempfile.mkstemp (indirectly via NamedTemporaryFile) causes all files to be created with 600 permissions.

This is not happening for selfcheck/XXXXX by the way, which makes the selfcheck unaccessible by users different from the one that created the cache.

This PullRequest creates an helper method copy_directory_permissions which allows both the cache and the selfcheck file to share the same logic in copying directory permissions and thus ensure consistency in cache files permissions.

@amol- amol- marked this pull request as draft August 6, 2025 11:50
@amol- amol- force-pushed the selfcheck-permissions branch from 1db6780 to 2e4aaa2 Compare August 6, 2025 15:31
@amol- amol- marked this pull request as ready for review August 6, 2025 15:55
@notatallshaw
Copy link
Member

Hi @amol- thanks for your PR to pip. Please be aware it take the maintainers some time to review as we are all doing this on a volunteer basis.

Copy link
Member

@ichard26 ichard26 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR! This is on the right track. I have some small suggestions, but otherwise, this should be ready to merged very soon!

amol- and others added 2 commits August 14, 2025 18:25
@ichard26
Copy link
Member

pre-commit.ci autofix

@amol-
Copy link
Contributor Author

amol- commented Aug 19, 2025

@ichard26 is there anything else I can help with to have this one merged? Happy to do what I can

@ichard26 ichard26 merged commit f49a2d9 into pypa:main Aug 25, 2025
34 checks passed
@ichard26
Copy link
Member

@amol- Nope, we just needed someone to press the shiny green merge button. Given that no one seems interested in reviewing this, I'll merge this now. Thank you for the reminder!

Sorry about the delay. I've been busy with non-OSS commitments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants