diff options
author | Dave Reisner <dreisner@archlinux.org> | 2018-06-09 15:24:42 -0400 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2018-06-18 13:15:51 +1000 |
commit | a92a36070ad520afe45cb6dacf1de2f0caac612d (patch) | |
tree | 0f87e50d129d61f019c7076d4941611ec7109287 /scripts/libmakepkg/util/pkgbuild.sh.in | |
parent | 5cf6f614eb418a9e89c0cbfa5fbfac0d502ff668 (diff) | |
download | 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/pkgbuild.sh.in')
-rw-r--r-- | scripts/libmakepkg/util/pkgbuild.sh.in | 6 |
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" |