-
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
WIP: Correctly detect if executable with os.stat() #7813
Conversation
Closes Issue pypa#6364: use os.stat() rather than os.access() to correctly determine if srcfile has any executable bits set. os.access() will always return False in cases where the directory is mounted noexec, which can lead to a false negative and the resulting script not being executable.
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.
👍
One minor comment, and as you mentioned it would be nice to have a test for this.
I'm taking a look at this again now, but to be perfectly honest am not initially sure how to go about incorporating https://github.com/lovelysystems/lovely-pytest-docker (or similar tool) here. Doing some reading but comments appreciated. Specifically, I'm not seeing how to properly communicate with the container. The examples in https://github.com/lovelysystems/lovely-pytest-docker and https://github.com/avast/pytest-docker all use Docker web apps that listen on a port and accept requests to check a certain status. In this case, we just want to check the flags of the resulting I know that the check on the file itself could be done with something like Currently I have a fixture and test callable that takes the fixture as its arg in |
As suggested by @chrahunt.
Hello! I am an automated bot and I have noticed that this pull request is not currently able to be merged. If you are able to either merge the |
I think that our new direct-from-zip wheel installation logic should cover this case, since we derive the file mode from the zip itself. We still don't have a concrete test for it, though. |
Closing since this is fairly out of date and bitrotten. Please feel free to file a new PR for this! ^>^ |
Closes #6364.
Use
os.stat()
rather thanos.access()
to correctly determine ifsrcfile
has any executable bits set.os.access()
will always return False in cases where the directory is mounted noexec, which can lead to a false negative and the resulting script not being executable.WIP: working on adding tests as described at #6364 (comment).
This fix does seem to work if modifying the
run_test
script from the link above, e.g.pip install --upgrade /pip
; using this development version of pip including this commit, installing the local version results in the script having correct executable permissions.