summaryrefslogtreecommitdiffstats
path: root/scripts/libmakepkg/util
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2018-06-09 21:24:42 +0200
committerAllan McRae <allan@archlinux.org>2018-06-18 05:15:51 +0200
commita92a36070ad520afe45cb6dacf1de2f0caac612d (patch)
tree0f87e50d129d61f019c7076d4941611ec7109287 /scripts/libmakepkg/util
parent5cf6f614eb418a9e89c0cbfa5fbfac0d502ff668 (diff)
downloadpacman-a92a36070ad520afe45cb6dacf1de2f0caac612d.tar.gz
pacman-a92a36070ad520afe45cb6dacf1de2f0caac612d.tar.xz
makepkg: fix initialization when extracting arrays
Assuming that everything is a string leads to code which is effectively: a= a+=('bar') This creates an array with 2 elements instead of one. Using proper array initialization fixes this. https://lists.archlinux.org/pipermail/pacman-dev/2018-June/022591.html Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts/libmakepkg/util')
-rw-r--r--scripts/libmakepkg/util/pkgbuild.sh.in6
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/libmakepkg/util/pkgbuild.sh.in b/scripts/libmakepkg/util/pkgbuild.sh.in
index 10d154d1..3f8669ab 100644
--- a/scripts/libmakepkg/util/pkgbuild.sh.in
+++ b/scripts/libmakepkg/util/pkgbuild.sh.in
@@ -106,7 +106,11 @@ get_pkgbuild_attribute() {
local pkgname=$1 attrname=$2 isarray=$3 outputvar=$4
- printf -v "$outputvar" %s ''
+ if (( isarray )); then
+ eval "$outputvar=()"
+ else
+ printf -v "$outputvar" %s ''
+ fi
if [[ $pkgname ]]; then
extract_global_variable "$attrname" "$isarray" "$outputvar"