Skip to content

_virtual_env: handle PermissionError#737

Merged
woodruffw merged 4 commits intomainfrom
ww/fix-noexec-tmpdir
Feb 12, 2024
Merged

_virtual_env: handle PermissionError#737
woodruffw merged 4 commits intomainfrom
ww/fix-noexec-tmpdir

Conversation

@woodruffw
Copy link
Copy Markdown
Member

@woodruffw woodruffw commented Feb 10, 2024

WIP, needs tests.

Closes #732

See #732

Signed-off-by: William Woodruff <william@trailofbits.com>
@woodruffw woodruffw self-assigned this Feb 10, 2024
@woodruffw
Copy link
Copy Markdown
Member Author

Just thinking out loud: this is going to be really annoying to test. I guess we could mock it out, but that won't guarantee that I got the exact callsite right here.

@woodruffw
Copy link
Copy Markdown
Member Author

I looked into this a bit more, and I mis-diagnosed this slightly originally: the error here isn't from our own code, but from venv itself: the _setup_pip function uses subprocess internally, which then explodes for the original noexec reason. So current patch is wrong.

Ref: https://github.com/python/cpython/blob/a5f49ce65ef83c41c9cc87566fe59be766d0f3ca/Lib/venv/__init__.py#L357-L360

Signed-off-by: William Woodruff <william@trailofbits.com>
Signed-off-by: William Woodruff <william@trailofbits.com>
@woodruffw woodruffw marked this pull request as ready for review February 12, 2024 18:39
Signed-off-by: William Woodruff <william@trailofbits.com>
@woodruffw woodruffw requested a review from di February 12, 2024 18:44
@woodruffw woodruffw merged commit db8b260 into main Feb 12, 2024
@woodruffw woodruffw deleted the ww/fix-noexec-tmpdir branch February 12, 2024 18:51
@woodruffw woodruffw mentioned this pull request Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PermissionError: [Errno 13] Permission denied: '/tmp/tmpzrluurcb/bin/python3'

2 participants