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

Consider warning users about shell path hashing on upgrade #6863

Open
chrahunt opened this issue Aug 12, 2019 · 2 comments
Open

Consider warning users about shell path hashing on upgrade #6863

chrahunt opened this issue Aug 12, 2019 · 2 comments
Labels
C: cli Command line interface related things (optparse, option grouping etc) C: scripts How scripts and entry points are managed state: awaiting PR Feature discussed, PR is needed type: enhancement Improvements to functionality

Comments

@chrahunt
Copy link
Member

chrahunt commented Aug 12, 2019

What's the problem this feature will solve?

Shells can remember paths to commands, so subsequent invocations do not have to search PATH. This causes confusing behavior when executing pip install --upgrade pip, but a regular pip invocation still resolves to the system pip (at /usr/bin/pip) and import fails.

Describe the solution you'd like

On package upgrade, check whether the parent process is bash (or any shell that does this). If so, check whether the script that was just installed also exists anywhere else in PATH. If so, print a warning to the user that they may need to execute e.g. hash <script1> <script2> ... before the scripts will work correctly.

Example where this would've helped: #6332.

Alternative Solutions

  1. Ongoing user support
  2. Unconditionally ask users to close and reopen their shell

Additional context

@triage-new-issues triage-new-issues bot added the S: needs triage Issues/PRs that need to be triaged label Aug 12, 2019
@chrahunt chrahunt added C: cli Command line interface related things (optparse, option grouping etc) C: scripts How scripts and entry points are managed state: needs discussion This needs some more discussion and removed S: needs triage Issues/PRs that need to be triaged labels Aug 12, 2019
@uranusjr
Copy link
Member

+1 on this; I see more and more tools providing similar help messages nowadays. It is a good approach IMO. (Although we might want to perform some basic platform/shell detection for this; suggesting hash in e.g. PowerShell would be very confusing to users.)

@pradyunsg pradyunsg added state: awaiting PR Feature discussed, PR is needed type: enhancement Improvements to functionality and removed state: needs discussion This needs some more discussion labels Aug 12, 2019
@pradyunsg
Copy link
Member

I'm on board.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: cli Command line interface related things (optparse, option grouping etc) C: scripts How scripts and entry points are managed state: awaiting PR Feature discussed, PR is needed type: enhancement Improvements to functionality
Projects
None yet
Development

No branches or pull requests

3 participants