Skip to content

Commit

Permalink
Don’t source bashrc in pure mode
Browse files Browse the repository at this point in the history
Pure mode should not try to source the user’s bashrc file. These may
have many impurities that the user does not expect to get into their
shell.

Fixes #3090
  • Loading branch information
matthewbauer committed Oct 9, 2019
1 parent a7e9286 commit 65f6d5d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/nix-build/nix-build.cc
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ static void _main(int argc, char * * argv)
auto rcfile = (Path) tmpDir + "/rc";
writeFile(rcfile, fmt(
(keepTmp ? "" : "rm -rf '%1%'; "s) +
"[ -n \"$PS1\" ] && [ -e ~/.bashrc ] && source ~/.bashrc; "
(pure ? "" : "[ -n \"$PS1\" ] && [ -e ~/.bashrc ] && source ~/.bashrc;")
"%2%"
"dontAddDisableDepTrack=1; "
"[ -e $stdenv/setup ] && source $stdenv/setup; "
Expand Down

2 comments on commit 65f6d5d

@nixos-discourse
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/shellhook-is-using-my-bashrc-aliases/12094/2

@nixos-discourse
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/using-custom-version-of-bash-inside-nix-shell/11265/12

Please sign in to comment.