summaryrefslogtreecommitdiffstats
path: root/scripts/libmakepkg/lint_pkgbuild/variable.sh.in
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2016-02-07 12:27:31 +0100
committerAllan McRae <allan@archlinux.org>2016-02-20 05:01:53 +0100
commit3cb1669e07106e9108976a76b7d2f37e659bce6c (patch)
tree49a88fefd123ee8e892c305e41e1c7b6981db298 /scripts/libmakepkg/lint_pkgbuild/variable.sh.in
parent0fa695d0e3862bf343804892c51d3793dd90be60 (diff)
downloadpacman-3cb1669e07106e9108976a76b7d2f37e659bce6c.tar.gz
pacman-3cb1669e07106e9108976a76b7d2f37e659bce6c.tar.xz
libmakepkg: increase robustness of the detection of array variables
Extract array detection into its own utility function that ensures extglob is enabled. Suggested-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts/libmakepkg/lint_pkgbuild/variable.sh.in')
-rw-r--r--scripts/libmakepkg/lint_pkgbuild/variable.sh.in6
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/libmakepkg/lint_pkgbuild/variable.sh.in b/scripts/libmakepkg/lint_pkgbuild/variable.sh.in
index 183e7401..30c99090 100644
--- a/scripts/libmakepkg/lint_pkgbuild/variable.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/variable.sh.in
@@ -43,7 +43,7 @@ lint_variable() {
for i in ${array[@]} ${arch_array[@]}; do
eval "keys=(\"\${!$i[@]}\")"
if (( ${#keys[*]} > 0 )); then
- if [[ "$(declare -p $i)" != "declare -a "* ]]; then
+ if ! is_array $i; then
error "$(gettext "%s should be an array")" "$i"
ret=1
fi
@@ -57,7 +57,7 @@ lint_variable() {
v="${i}_${a}"
eval "keys=(\"\${!${v}[@]}\")"
if (( ${#keys[*]} > 0 )); then
- if [[ "$(declare -p $v)" != "declare -a "* ]]; then
+ if ! is_array $v; then
error "$(gettext "%s_%s should be an array")" "$i" "$a"
ret=1
fi
@@ -68,7 +68,7 @@ lint_variable() {
for i in ${string[@]}; do
eval "keys=(\"\${!$i[@]}\")"
if (( ${#keys[*]} > 0 )); then
- if [[ "$(declare -p $i)" == "declare -a "* ]]; then
+ if is_array $i; then
error "$(gettext "%s should not be an array")" "$i"
ret=1
fi