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

shellIntegration.bash incorrectly sources /etc/profile and ~/.bash_profile #213

Closed
russelldavis opened this issue Mar 20, 2024 · 1 comment · Fixed by #214 or #232
Closed

shellIntegration.bash incorrectly sources /etc/profile and ~/.bash_profile #213

russelldavis opened this issue Mar 20, 2024 · 1 comment · Fixed by #214 or #232
Labels
bug Something isn't working

Comments

@russelldavis
Copy link
Contributor

Describe the bug
When starting is, it sources all three of ~/.bashrc, /etc/profile, and ~/.bash_profile. This is not how bash startup is supposed to work.

For interactive shells, bash either sources /etc/profile and ~/.bash_profile (for login shells), or ~/.bashrc only (for non-login shells). See https://www.gnu.org/software/bash/manual/bash.html#Bash-Startup-Files

is should act like a non-login shell and only source ~/.bashrc, i.e., these lines should be deleted:

if [ -r /etc/profile ]; then
. /etc/profile
fi
if [ -r ~/.bash_profile ]; then
. ~/.bash_profile
elif [ -r ~/.bash_login ]; then
. ~/.bash_login
elif [ -r ~/.profile ]; then
. ~/.profile
fi

If you wanted, you could provide a --login option like bash does and instead load /etc/profile and ~/.bash_profile in that case, though I'm not sure there's a good use case for that.

Environment

  • OS: macOS Sonoma
  • Output of is --version: 0.0.1-rc.10
  • Nodejs Version: 20.11.1
  • Shell: bash
  • Shell Version: 5.2.21
@cpendery
Copy link
Member

Reopening this since I think adding the --login option could be useful for some users

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants