libmakepkg: fix linting arrays of empty strings
[[ ${array[@]} ]] will resolve to false if array only contains empty strings. This means that values such as "depends=('')" can be inserted into a pkgbuild and bypass the linting. This causes makepkg to successfully build the package while pacman refuses to install it because of the unmet dependency on ''. Instead check the length of the array. Signed-off-by: morganamilo <morganamilo@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
79a528735e
commit
2c91d08e62
1 changed files with 2 additions and 2 deletions
|
@ -60,7 +60,7 @@ extract_global_variable() {
|
|||
|
||||
if (( isarray )); then
|
||||
array_build ref "$attr"
|
||||
[[ ${ref[@]} ]] && array_build "$outputvar" "$attr"
|
||||
(( ${#ref[@]} )) && array_build "$outputvar" "$attr"
|
||||
else
|
||||
[[ ${!attr} ]] && printf -v "$outputvar" %s "${!attr}"
|
||||
fi
|
||||
|
@ -144,7 +144,7 @@ get_pkgbuild_all_split_attributes() {
|
|||
done
|
||||
done
|
||||
|
||||
[[ ${all_list[@]} ]] && array_build "$outputvar" all_list
|
||||
(( ${#all_list[@]} )) && array_build "$outputvar" all_list
|
||||
}
|
||||
|
||||
##
|
||||
|
|
Loading…
Add table
Reference in a new issue