Skip to content

gh-112431: Unconditionally call hash -r #112432

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

Merged
merged 2 commits into from
Nov 28, 2023
Merged

gh-112431: Unconditionally call hash -r #112432

merged 2 commits into from
Nov 28, 2023

Conversation

J-M0
Copy link
Contributor

@J-M0 J-M0 commented Nov 26, 2023

The script calls hash -r in two places to make sure the shell picks up the environment changes the script makes. Before that, it checks to see if the shell running the script is bash or zsh.

hash -r is specified by POSIX and is not exclusive to bash and zsh. This guard prevents the script from calling hash -r in other #!/bin/sh-compatible shells like dash.

Bonus points: this also gets rid of the problematic test -o.

The script calls `hash -r` in two places to make sure the shell picks
up the environment changes the script makes. Before that, it checks to
see if the shell running the script is bash or zsh.

`hash -r` is specified by POSIX and is not exclusive to bash and zsh.
This guard prevents the script from calling `hash -r` in other
`#!/bin/sh`-compatible shells like dash.
@bedevere-app
Copy link

bedevere-app bot commented Nov 26, 2023

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@bedevere-app
Copy link

bedevere-app bot commented Nov 27, 2023

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@vsajip vsajip merged commit a194938 into python:main Nov 28, 2023
@vsajip vsajip added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Nov 28, 2023
@miss-islington-app
Copy link

Thanks @J-M0 for the PR, and @vsajip for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @J-M0 for the PR, and @vsajip for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 28, 2023
The `activate` script calls `hash -r` in two places to make sure the shell picks
up the environment changes the script makes. Before that, it checks to
see if the shell running the script is bash or zsh.

`hash -r` is specified by POSIX and is not exclusive to bash and zsh.
This guard prevents the script from calling `hash -r` in other
`GH-!/bin/sh`-compatible shells like dash.
(cherry picked from commit a194938)

Co-authored-by: James Morris <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Nov 28, 2023

GH-112492 is a backport of this pull request to the 3.11 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 28, 2023
The `activate` script calls `hash -r` in two places to make sure the shell picks
up the environment changes the script makes. Before that, it checks to
see if the shell running the script is bash or zsh.

`hash -r` is specified by POSIX and is not exclusive to bash and zsh.
This guard prevents the script from calling `hash -r` in other
`GH-!/bin/sh`-compatible shells like dash.
(cherry picked from commit a194938)

Co-authored-by: James Morris <[email protected]>
@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Nov 28, 2023
@bedevere-app
Copy link

bedevere-app bot commented Nov 28, 2023

GH-112493 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Nov 28, 2023
vsajip pushed a commit that referenced this pull request Nov 28, 2023
gh-112431: Unconditionally call `hash -r` (GH-112432)

The `activate` script calls `hash -r` in two places to make sure the shell picks
up the environment changes the script makes. Before that, it checks to
see if the shell running the script is bash or zsh.

`hash -r` is specified by POSIX and is not exclusive to bash and zsh.
This guard prevents the script from calling `hash -r` in other
`GH-!/bin/sh`-compatible shells like dash.
(cherry picked from commit a194938)

Co-authored-by: James Morris <[email protected]>
vsajip pushed a commit that referenced this pull request Nov 28, 2023
gh-112431: Unconditionally call `hash -r` (GH-112432)

The `activate` script calls `hash -r` in two places to make sure the shell picks
up the environment changes the script makes. Before that, it checks to
see if the shell running the script is bash or zsh.

`hash -r` is specified by POSIX and is not exclusive to bash and zsh.
This guard prevents the script from calling `hash -r` in other
`GH-!/bin/sh`-compatible shells like dash.
(cherry picked from commit a194938)

Co-authored-by: James Morris <[email protected]>
@J-M0 J-M0 deleted the venv_hash branch January 3, 2024 18:26
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
The `activate` script calls `hash -r` in two places to make sure the shell picks
up the environment changes the script makes. Before that, it checks to
see if the shell running the script is bash or zsh.

`hash -r` is specified by POSIX and is not exclusive to bash and zsh.
This guard prevents the script from calling `hash -r` in other
`#!/bin/sh`-compatible shells like dash.
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
The `activate` script calls `hash -r` in two places to make sure the shell picks
up the environment changes the script makes. Before that, it checks to
see if the shell running the script is bash or zsh.

`hash -r` is specified by POSIX and is not exclusive to bash and zsh.
This guard prevents the script from calling `hash -r` in other
`#!/bin/sh`-compatible shells like dash.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants