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.
This commit is contained in:
Nikolay Amiantov 2016-01-23 15:44:52 +03:00
parent 29785c5b7a
commit f18317885a

View file

@ -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 <<EOF >$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}