summary refs log tree commit diff
diff options
context:
space:
mode:
authorJames Kay <james@hadean.com>2021-12-02 13:42:40 +0000
committerArtturin <Artturin@artturin.com>2023-06-11 23:14:54 +0300
commit40fbc979883a11c91138a4ef45f0eeeddd4a9637 (patch)
treed39445d30b535688b47b9f00e200094690975a8d
parent4e6190bec3fac06953919f5e3af5579d178aee5b (diff)
downloadnixpkgs-40fbc979883a11c91138a4ef45f0eeeddd4a9637.tar
nixpkgs-40fbc979883a11c91138a4ef45f0eeeddd4a9637.tar.gz
nixpkgs-40fbc979883a11c91138a4ef45f0eeeddd4a9637.tar.bz2
nixpkgs-40fbc979883a11c91138a4ef45f0eeeddd4a9637.tar.lz
nixpkgs-40fbc979883a11c91138a4ef45f0eeeddd4a9637.tar.xz
nixpkgs-40fbc979883a11c91138a4ef45f0eeeddd4a9637.tar.zst
nixpkgs-40fbc979883a11c91138a4ef45f0eeeddd4a9637.zip
makeWrapper: fix flag handling
When `--add-flags` is not used, `flagsBefore` is unset.  This causes an error when invoking `makeWrapper` from a context that sets `-o nounset`, as is done in `buildDotnetModule`.
This change makes `makeWrapper` safe for use in these conditions.
-rw-r--r--pkgs/build-support/setup-hooks/make-wrapper.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/pkgs/build-support/setup-hooks/make-wrapper.sh b/pkgs/build-support/setup-hooks/make-wrapper.sh
index 4932e934ec1..11b332bfc3e 100644
--- a/pkgs/build-support/setup-hooks/make-wrapper.sh
+++ b/pkgs/build-support/setup-hooks/make-wrapper.sh
@@ -166,11 +166,11 @@ makeShellWrapper() {
         elif [[ "$p" == "--add-flags" ]]; then
             flags="${params[$((n + 1))]}"
             n=$((n + 1))
-            flagsBefore="$flagsBefore $flags"
+            flagsBefore="${flagsBefore-} $flags"
         elif [[ "$p" == "--append-flags" ]]; then
             flags="${params[$((n + 1))]}"
             n=$((n + 1))
-            flagsAfter="$flagsAfter $flags"
+            flagsAfter="${flagsAfter-} $flags"
         elif [[ "$p" == "--argv0" ]]; then
             argv0="${params[$((n + 1))]}"
             n=$((n + 1))
@@ -183,7 +183,7 @@ makeShellWrapper() {
     done
 
     echo exec ${argv0:+-a \"$argv0\"} \""$original"\" \
-         "$flagsBefore" '"$@"' "$flagsAfter" >> "$wrapper"
+         "${flagsBefore-}" '"$@"' "${flagsAfter-}" >> "$wrapper"
 
     chmod +x "$wrapper"
 }