about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2016-09-08T13·09-0400
committerShea Levy <shea@shealevy.com>2016-09-08T13·09-0400
commita5f2750ebb1fb59679079139810e48b53abc51de (patch)
treed7beb4f36e17643ca9d0fe49f75f74f94a17b353 /src
parent312bab008d835dd9c8939b803d2bc7af4f82a811 (diff)
Fix early removal of rc-file for nix-shell
BASH_ENV causes all non-interactive shells called via eg. /etc/bashrc to
remove the rc-file before the main shell gets to run it. Completion
scripts will often do this. Fixes #976.

Adapted from and fixes #1034.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/nix-build/nix-build.cc2
1 files changed, 0 insertions, 2 deletions
diff --git a/src/nix-build/nix-build.cc b/src/nix-build/nix-build.cc
index 50fcf16abdf0..57970ca51660 100755
--- a/src/nix-build/nix-build.cc
+++ b/src/nix-build/nix-build.cc
@@ -410,7 +410,6 @@ int main(int argc, char ** argv)
                 auto rcfile = (Path) tmpDir + "/rc";
                 writeFile(rcfile, (format(
                         "rm -rf '%1%'; "
-                        "unset BASH_ENV; "
                         "[ -n \"$PS1\" ] && [ -e ~/.bashrc ] && source ~/.bashrc; "
                         "%2%"
                         "dontAddDisableDepTrack=1; "
@@ -425,7 +424,6 @@ int main(int argc, char ** argv)
                         "unset TZ; %4%"
                         "%5%"
                         ) % (Path) tmpDir % (pure ? "" : "p=$PATH") % (pure ? "" : "PATH=$PATH:$p; unset p; ") % (getenv("TZ") ? (string("export TZ='") + getenv("TZ") + "'; ") : "") % envCommand).str());
-                setenv("BASH_ENV", rcfile.c_str(), 1);
                 if (interactive)
                     execlp(getEnv("NIX_BUILD_SHELL", "bash").c_str(), "bash", "--rcfile", rcfile.c_str(), NULL);
                 else