Skip to content
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

No failure or warning for home_dir paths which break fragile shebang parsing #1039

Closed
JDLH opened this issue Apr 18, 2017 · 4 comments
Closed

Comments

@JDLH
Copy link

JDLH commented Apr 18, 2017

Virtualenv uses shebang parsing of the home_dir path. That is, it creates files (e.g. bin/pip) which begin with:

#!"/path/to/home/dir/bin/python3.6"

The #! is known as a shebang. The path after the shebang is parsed by the kernel on Linux and Mac OS X (though not on Windows). This kernel parsing is fragile: it can't tolerate

All those issues propose various fixes. Some of the fixes involve proposing changes upstream to distutil or pip. The upstream teams are resisting some changes because they are OS-specific or fragile. It is taking time to work that out.

In the meantime I think virtualenv should check the home_dir path for any of these flaws. On Mac OS and Linux, it should fail with an error if a path has any of these problems. Maybe there should be a way to override the error if a user explicitly asks to.

This issue is for the adding of a warning message to virtualenv, to reduce the impact of fragile shebang parsing until the above underlying issues are fixed, somehow.

It seems to me that adding this warning message should be a logically simple fix to virtualenv/virtualenv.py. Around line 685:688, next to the check for os.path.exists(home_dir), add a similar check for is_valid(home_dir). Function is_valid() checks for all the fragilities exposed by the above issues.

The warning message could alternatively be a fatal error message. If so, then having an option like -f to override the error might also be a good addition.

@stale
Copy link

stale bot commented Jan 14, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Just add a comment if you want to keep it open. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 14, 2019
@JDLH
Copy link
Author

JDLH commented Jan 15, 2019

This issue asks for a warning message as a workaround while we wait for a fix to the underlying problem. #53 tracks the fix to the underlying problem. According to #53 (comment), "It appears this bug is fixed by pip 10.0.0, released 2018-04-14." So, I think it's fine for this issue to be closed as "won't fix" also.

@stale stale bot removed the wontfix label Jan 15, 2019
@stale
Copy link

stale bot commented Apr 15, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Just add a comment if you want to keep it open. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 15, 2019
@gaborbernat
Copy link
Contributor

This has been fixed on our rewrite branch, with #1366 now in full swing.

@pypa pypa locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants