diff options
author | happysalada <raphael@megzari.com> | 2021-06-24 19:52:02 +0900 |
---|---|---|
committer | Raphael Megzari <raphael@megzari.com> | 2021-07-06 09:27:18 +0900 |
commit | bf99a819a16089a8df03cc06262f06b31dfb683c (patch) | |
tree | d2d036bf0fdefa378f6e242e9e07020b438ad5a8 /pkgs/stdenv | |
parent | 1a71a5fb082c6cfeeccedd8f5c06b0d77a57463c (diff) | |
download | nixpkgs-bf99a819a16089a8df03cc06262f06b31dfb683c.tar nixpkgs-bf99a819a16089a8df03cc06262f06b31dfb683c.tar.gz nixpkgs-bf99a819a16089a8df03cc06262f06b31dfb683c.tar.bz2 nixpkgs-bf99a819a16089a8df03cc06262f06b31dfb683c.tar.lz nixpkgs-bf99a819a16089a8df03cc06262f06b31dfb683c.tar.xz nixpkgs-bf99a819a16089a8df03cc06262f06b31dfb683c.tar.zst nixpkgs-bf99a819a16089a8df03cc06262f06b31dfb683c.zip |
setup.sh: fatal: This word should yield a string, but it contains an array
remove implicit array comparison in case
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r-- | pkgs/stdenv/generic/setup.sh | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 388fcbaf7d8..83a623ef080 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -364,16 +364,13 @@ findInputs() { local var="${!varRef}" unset -v varVar varRef - # TODO(@Ericson2314): Restore using associative array once Darwin - # nix-shell doesn't use impure bash. This should replace the O(n) - # case with an O(1) hash map lookup, assuming bash is implemented - # well :D. - local varSlice="${var}[*]" - # ${..-} to hack around old bash empty array problem - case "${!varSlice-}" in - *" $pkg "*) return 0 ;; - esac - unset -v varSlice + # var is a reference to an array and can sometimes be undefined + # so checking the array with "${!var}[@]" does not work + # check if $pkgs is in the var ref array + # TODO(@Ericson2314): Restore using associative array + if [[ "${var}[*]" = *" $pkg "* ]]; then + return 0 + fi eval "$var"'+=("$pkg")' |