3
0
Fork 0
forked from mirrors/nixpkgs

Fix bashrc regression

Interactive non-login shells should not source /etc/profile, otherwise
environment variables set by the user will get clobbered.  For
example:

  $ export PERL5LIB=/foo
  $ bash
  $ echo $PERL5LIB
  /home/eelco/.nix-profile/lib/perl5/site_perl:/nix/var/nix/profiles/default/lib/perl5/site_perl:/run/current-system/sw/lib/perl5/site_perl:/home/eelco/.nix-profile/lib/perl5/site_perl:/nix/var/nix/profiles/default/lib/perl5/site_perl:/run/current-system/sw/lib/perl5/site_perl
This commit is contained in:
Eelco Dolstra 2013-09-25 00:25:22 +02:00
parent 78721f57eb
commit cfd20debfb

View file

@ -151,11 +151,10 @@ in
if [ -n "$__ETC_PROFILE_SOURCED" ]; then return; fi
__ETC_PROFILE_SOURCED=1
if [ -z "$__BASH_SHELL_INIT_DONE" ]; then
__BASH_SHELL_INIT_DONE=1
${cfg.shellInit}
fi
# Prevent this file from being sourced by interactive non-login child shells.
export __ETC_PROFILE_DONE=1
${cfg.shellInit}
${cfg.loginShellInit}
# Read system-wide modifications.
@ -176,9 +175,11 @@ in
if [ -n "$__ETC_BASHRC_SOURCED" -o -n "$NOSYSBASHRC" ]; then return; fi
__ETC_BASHRC_SOURCED=1
if [ -z "$__BASH_SHELL_INIT_DONE" ]; then
__BASH_SHELL_INIT_DONE=1
${cfg.shellInit}
# If the profile was not loaded in a parent process, source
# it. But otherwise don't do it because we don't want to
# clobber overridden values of $PATH, etc.
if [ -z "$__ETC_PROFILE_DONE" ]; then
. /etc/profile
fi
# We are not always an interactive shell.