summary refs log tree commit diff
path: root/pkgs/build-support/setup-hooks/make-binary-wrapper
diff options
context:
space:
mode:
authorArtturi <Artturin@artturin.com>2023-09-20 09:41:44 +0300
committerGitHub <noreply@github.com>2023-09-20 09:41:44 +0300
commit6096abb0089146ef85e897ccf258289011c3a02a (patch)
treea466861fb7632c994ba5a4dbb12ae0c40465bd94 /pkgs/build-support/setup-hooks/make-binary-wrapper
parent6f27ba80ea1125aa94dd1cc499dcf9a4d20a70a0 (diff)
parentdf8b425f8990cf8c6cd8a4477a70995bdd4fe2a4 (diff)
downloadnixpkgs-6096abb0089146ef85e897ccf258289011c3a02a.tar
nixpkgs-6096abb0089146ef85e897ccf258289011c3a02a.tar.gz
nixpkgs-6096abb0089146ef85e897ccf258289011c3a02a.tar.bz2
nixpkgs-6096abb0089146ef85e897ccf258289011c3a02a.tar.lz
nixpkgs-6096abb0089146ef85e897ccf258289011c3a02a.tar.xz
nixpkgs-6096abb0089146ef85e897ccf258289011c3a02a.tar.zst
nixpkgs-6096abb0089146ef85e897ccf258289011c3a02a.zip
Merge pull request #255208 from rhendric/rhendric/make-binary-wrapper
Diffstat (limited to 'pkgs/build-support/setup-hooks/make-binary-wrapper')
-rw-r--r--pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh b/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh
index 88a50befd73..6cd01f6bf63 100644
--- a/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh
+++ b/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh
@@ -193,8 +193,23 @@ makeCWrapper() {
 
 addFlags() {
     local n flag before after var
+
+    # Disable file globbing, since bash will otherwise try to find
+    # filenames matching the the value to be prefixed/suffixed if
+    # it contains characters considered wildcards, such as `?` and
+    # `*`. We want the value as is, except we also want to split
+    # it on on the separator; hence we can't quote it.
+    local reenableGlob=0
+    if [[ ! -o noglob ]]; then
+        reenableGlob=1
+    fi
+    set -o noglob
     # shellcheck disable=SC2086
     before=($1) after=($2)
+    if (( reenableGlob )); then
+        set +o noglob
+    fi
+
     var="argv_tmp"
     printf '%s\n' "char **$var = calloc(${#before[@]} + argc + ${#after[@]} + 1, sizeof(*$var));"
     printf '%s\n' "assert($var != NULL);"