3
0
Fork 0
forked from mirrors/nixpkgs

stdenv/setup.sh: undo local -n change

It's better than the eval solution this is adding back, but until we can
rely on a particular version of bash in nix-shell, this just breaks too
much stuff.

See c94f3d5575
and https://github.com/NixOS/nix/pull/1483 for the better long-term
solution.
This commit is contained in:
Dan Peebles 2017-07-24 13:09:32 -04:00
parent 1dd6e7dcbc
commit 2829ea57cb

View file

@ -17,9 +17,10 @@ runHook() {
shift
local var="$hookName"
if [[ "$hookName" =~ Hook$ ]]; then var+=s; else var+=Hooks; fi
local -n var
eval "local -a dummy=(\"\${$var[@]}\")"
local hook
for hook in "_callImplicitHook 0 $hookName" "${var[@]}"; do
for hook in "_callImplicitHook 0 $hookName" "${dummy[@]}"; do
_eval "$hook" "$@"
done
return 0
@ -33,9 +34,9 @@ runOneHook() {
shift
local var="$hookName"
if [[ "$hookName" =~ Hook$ ]]; then var+=s; else var+=Hooks; fi
local -n var
eval "local -a dummy=(\"\${$var[@]}\")"
local hook
for hook in "_callImplicitHook 1 $hookName" "${var[@]}"; do
for hook in "_callImplicitHook 1 $hookName" "${dummy[@]}"; do
if _eval "$hook" "$@"; then
return 0
fi