mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
substituteAll: Enumerate environment variables more reliably
Getting the names of all environment variables is tricky. The previous implementation easily got confused by multi-line variables. The new one is more reliable but not still not perfect. This works around a segfault in Bash 4.3, where the expression "${!var}" (where var="-9") crashes under certain conditions. http://hydra.nixos.org/build/16693445
This commit is contained in:
parent
103f5658a4
commit
78b01de68d
@ -386,7 +386,7 @@ substituteAll() {
|
||||
local output="$2"
|
||||
|
||||
# Select all environment variables that start with a lowercase character.
|
||||
for envVar in $(env | sed "s/^[^a-z].*//" | sed "s/^\([^=]*\)=.*/\1/"); do
|
||||
for envVar in $(env | sed -e $'s/^\([a-z][^=]*\)=.*/\\1/; t \n d'); do
|
||||
if [ "$NIX_DEBUG" = "1" ]; then
|
||||
echo "$envVar -> ${!envVar}"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user