lol

bash: use default PATH in FHS environments

If bash is executed within an environment where PATH is not set, it uses
the DEFAULT_PATH_VALUE compiled into bash to set PATH. In nixpkgs we set
this to /no-such-path by default. This makes sense in a nixpkgs/NixOS
environment since paths like /bin or /usr/bin should not be used.
However, when bash is used inside an FHS environment, this produces
results that differ from distributions which follow the FHS standard.

Before this change:
$ steam-run env -i /bin/bash -c 'echo $PATH'
/no-such-path

After this change:
$ steam-run env -i /bin/bash -c 'echo $PATH'
/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:.

authored by

Daniel Fullmer and committed by
Jonathan Ringer
0a800749 f4676c4c

+11 -2
+1 -1
pkgs/build-support/build-fhs-userenv-bubblewrap/env.nix
··· 41 41 basePkgs = with pkgs; 42 42 [ glibcLocales 43 43 (if isMultiBuild then glibc_multi else glibc) 44 - (toString gcc.cc.lib) bashInteractive coreutils less shadow su 44 + (toString gcc.cc.lib) bashInteractiveFHS coreutils less shadow su 45 45 gawk diffutils findutils gnused gnugrep 46 46 gnutar gzip bzip2 xz 47 47 ];
+1 -1
pkgs/build-support/build-fhs-userenv/env.nix
··· 45 45 basePkgs = with pkgs; 46 46 [ glibcLocales 47 47 (if isMultiBuild then glibc_multi else glibc) 48 - (toString gcc.cc.lib) bashInteractive coreutils less shadow su 48 + (toString gcc.cc.lib) bashInteractiveFHS coreutils less shadow su 49 49 gawk diffutils findutils gnused gnugrep 50 50 gnutar gzip bzip2 xz 51 51 ];
+3
pkgs/shells/bash/5.1.nix
··· 10 10 , readline81 ? null 11 11 , withDocs ? false 12 12 , texinfo ? null 13 + , forFHSEnv ? false 13 14 }: 14 15 15 16 with lib; ··· 39 40 NIX_CFLAGS_COMPILE = '' 40 41 -DSYS_BASHRC="/etc/bashrc" 41 42 -DSYS_BASH_LOGOUT="/etc/bash_logout" 43 + '' + optionalString (!forFHSEnv) '' 42 44 -DDEFAULT_PATH_VALUE="/no-such-path" 43 45 -DSTANDARD_UTILS_PATH="/no-such-path" 46 + '' + '' 44 47 -DNON_INTERACTIVE_LOGIN_SHELLS 45 48 -DSSH_SOURCE_BASHRC 46 49 '';
+6
pkgs/top-level/all-packages.nix
··· 11550 11550 interactive = true; 11551 11551 withDocs = true; 11552 11552 }; 11553 + bashInteractiveFHS = callPackage ../shells/bash/5.1.nix { 11554 + binutils = stdenv.cc.bintools; 11555 + interactive = true; 11556 + withDocs = true; 11557 + forFHSEnv = true; 11558 + }; 11553 11559 11554 11560 bash-completion = callPackage ../shells/bash/bash-completion { }; 11555 11561