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

fix: error out for nonexistent or non-dir --venv #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

scop
Copy link
Collaborator

@scop scop commented Aug 13, 2023

Previously, the bin dir of a given explicit venv was simply added to $PATH with no checks.

This may have caused unintended executables to be invoked when given a nonexistent or non-directory argument. Whatever might be in $PATH would have been run, with venv-run becoming essentially a no-op.

Previously, the bin dir of a given explicit venv was simply added to
`$PATH` with no checks.

This may have caused unintended executables to be invoked when given a
nonexistent or non-directory argument. Whatever might be in `$PATH`
would have been run, with `venv-run` becoming essentially a no-op.
Copy link
Owner

@guludo guludo left a comment

Choose a reason for hiding this comment

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

I think the rationale makes sense. Thanks.

The solution proposed with the current patch only checks for the path being a directory, but I think we could look and see that the directory looks like a virtual environment.

I'd like to suggest that we extract parts of guess() that can be reused into separate function(s) so that do can do the same type of validation when guessing and when the venv is explicitly passed via CLI. That would make the check on a explicit env consistent with the way we check when guessing.

Also, it would be good to have a test case for this.

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.

2 participants