From f18317885a51ec613d05762c04a7e5cd745d5768 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Sat, 23 Jan 2016 15:44:52 +0300 Subject: [PATCH] fhs-userenv: don't use bash login mode Login mode can cause hidden problems, e.g. #12406. Generally we don't want to read user's .bash_profile when we don't start an interactive shell inside a chroot. --- pkgs/build-support/build-fhs-userenv/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/build-fhs-userenv/default.nix b/pkgs/build-support/build-fhs-userenv/default.nix index 5db0d98b79a8..4177846c4336 100644 --- a/pkgs/build-support/build-fhs-userenv/default.nix +++ b/pkgs/build-support/build-fhs-userenv/default.nix @@ -12,6 +12,8 @@ let ''; init = run: writeText "${name}-init" '' + source /etc/profile + # Make /tmp directory mkdir -m 1777 /tmp @@ -44,7 +46,7 @@ in runCommand name { cat <$out/bin/${name} #! ${stdenv.shell} export CHROOTENV_EXTRA_BINDS="${lib.concatStringsSep ":" extraBindMounts}:\$CHROOTENV_EXTRA_BINDS" - exec ${chroot-user}/bin/chroot-user ${env} ${bash'} -l ${init runScript} "\$(pwd)" "\$@" + exec ${chroot-user}/bin/chroot-user ${env} ${bash'} ${init runScript} "\$(pwd)" "\$@" EOF chmod +x $out/bin/${name} ${extraInstallCommands}