microsoft / inshellisense

IDE style command line auto complete
MIT License
8.21k stars 179 forks source link

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

Closed russelldavis closed 2 months ago

russelldavis commented 3 months ago

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: https://github.com/microsoft/inshellisense/blob/9db5beea23e1f371ff80e3bc1390d19ed882942a/shell/shellIntegration.bash#L4-L13

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

cpendery commented 3 months ago

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