doc/stdenv.xml document substitution env variables

The filtering of environment variables that start with an uppercase
letter is documented in the manual.

+11 -2
+9 -1
doc/stdenv.xml
··· 1169 echo @foo@ 1170 </programlisting> 1171 1172 - That is, no substitution is performed for undefined variables.</para></listitem> 1173 </varlistentry> 1174 1175
··· 1169 echo @foo@ 1170 </programlisting> 1171 1172 + 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> 1182 1183
+1
pkgs/build-support/substitute/substitute-all.nix
··· 2 3 args: 4 5 stdenv.mkDerivation ({ 6 name = if args ? name then args.name else baseNameOf (toString args.src); 7 builder = ./substitute-all.sh;
··· 2 3 args: 4 5 + # see the substituteAll in the nixpkgs documentation for usage and constaints 6 stdenv.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
··· 445 446 # 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
··· 445 446 # 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