···1169echo @foo@
1170</programlisting>
11711172- That is, no substitution is performed for undefined variables.</para></listitem>
000000001173 </varlistentry>
11741175
···1169echo @foo@
1170</programlisting>
11711172+ That is, no substitution is performed for undefined variables.</para>
1173+1174+ <para>Environment variables that start with an uppercase letter are filtered out,
1175+ to prevent global variables (like <literal>HOME</literal>) from accidentally
1176+ getting substituted.
1177+ The variables also have to be valid bash “names”, as
1178+ defined in the bash manpage (alphanumeric or <literal>_</literal>, must not
1179+ start with a number).</para>
1180+ </listitem>
1181 </varlistentry>
11821183
+1
pkgs/build-support/substitute/substitute-all.nix
···23args:
405stdenv.mkDerivation ({
6 name = if args ? name then args.name else baseNameOf (toString args.src);
7 builder = ./substitute-all.sh;
···23args:
45+# see the substituteAll in the nixpkgs documentation for usage and constaints
6stdenv.mkDerivation ({
7 name = if args ? name then args.name else baseNameOf (toString args.src);
8 builder = ./substitute-all.sh;
+1-1
pkgs/stdenv/generic/setup.sh
···445446 # Select all environment variables that start with a lowercase character.
447 # Will not work with nix attribute names (and thus env variables) containing '\n'.
448- for envVar in $(env | sed -e $'s/^\([a-z][^=]*\)=.*/\\1/; t \n d'); do
449 if [ "$NIX_DEBUG" = "1" ]; then
450 echo "$envVar -> ${!envVar}"
451 fi
···445446 # Select all environment variables that start with a lowercase character.
447 # Will not work with nix attribute names (and thus env variables) containing '\n'.
448+ for envVar in $(set | sed -e $'s/^\([a-z][^=]*\)=.*/\\1/; t \n d'); do
449 if [ "$NIX_DEBUG" = "1" ]; then
450 echo "$envVar -> ${!envVar}"
451 fi