MSYS2-packages/pacman/0031-libmakepkg-fix-compatibility-with-bash-5.2-patsub_re.patch
مهدي شينون (Mehdi Chinoune) 2673230b92 Revert "pacman: Update to 6.1.0"
This reverts commit 7edf29e04a729623e4177d97e49a130cd681cd71.
2024-05-07 16:15:46 +01:00

41 lines
1.5 KiB
Diff

From 4cfaf53950c1e2bbef7262e2e9b608f4f5a280d5 Mon Sep 17 00:00:00 2001
From: Allan McRae <allan@archlinux.org>
Date: Mon, 12 Dec 2022 18:37:59 +1000
Subject: [PATCH 31/N] libmakepkg: fix compatibility with bash-5.2
patsub_replacement
Bash-5.2 introduced the patsub_replacement shell option, which is enabled
by default. Apparently is it supposed to handle a sed-like idiom, but
what it does achieve is making any substitution involving a "&" requiring
special care.
For makepkg's DLAGENTS, we replace "%o" and "%u" if present. Any "&" in
the replacement fields triggers patsub_replacement unless quoted. This is
particularly important for the URL field.
Add relevant quotes to avoid issues.
Signed-off-by: Allan McRae <allan@archlinux.org>
---
scripts/libmakepkg/source/file.sh.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/libmakepkg/source/file.sh.in b/scripts/libmakepkg/source/file.sh.in
index 905a5e2..c368041 100644
--- a/scripts/libmakepkg/source/file.sh.in
+++ b/scripts/libmakepkg/source/file.sh.in
@@ -60,11 +60,11 @@ download_file() {
# replace %o by the temporary dlfile if it exists
if [[ ${cmdline[*]} = *%o* ]]; then
dlfile=$filename.part
- cmdline=("${cmdline[@]//%o/$dlfile}")
+ cmdline=("${cmdline[@]//%o/"$dlfile"}")
fi
# add the URL, either in place of %u or at the end
if [[ ${cmdline[*]} = *%u* ]]; then
- cmdline=("${cmdline[@]//%u/$url}")
+ cmdline=("${cmdline[@]//%u/"$url"}")
else
cmdline+=("$url")
fi