Ensure selfcheck file inherits directory permissions #13528
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 oftempfile.mkstemp
(indirectly viaNamedTemporaryFile
) causes all files to be created with600
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.