summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLevente Polyak <anthraxx@archlinux.org>2022-06-22 00:51:22 +0200
committerLevente Polyak <anthraxx@archlinux.org>2022-06-22 00:51:22 +0200
commitf386c131426927cca3f771408dbc70a05602a44d (patch)
tree23e5852c01553f791ec0b578708b0e5591109ad7
parent49d889cb8db18124a3d05b1012605b50a6cefca8 (diff)
downloaddevtools-f386c131426927cca3f771408dbc70a05602a44d.tar.xz
export-pkgbuild-keys: fix export for packages without validpgpkeys
In case the validpgpkeys array is empty or undefined, the empty printf line only included a single line break which lead to mapfile -t consuming it as an array with 1 element consisting of an empty string. Fix this by only calling the printf in case the validpgpkeys array is not empty. Without any output, the mapfile -t will simply produce an empty array. Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
-rw-r--r--export-pkgbuild-keys.in4
1 files changed, 3 insertions, 1 deletions
diff --git a/export-pkgbuild-keys.in b/export-pkgbuild-keys.in
index c10e4d1..8697b3d 100644
--- a/export-pkgbuild-keys.in
+++ b/export-pkgbuild-keys.in
@@ -37,7 +37,9 @@ fi
mapfile -t validpgpkeys < <(
# shellcheck source=PKGBUILD.proto
. ./PKGBUILD
- printf "%s\n" "${validpgpkeys[@]}"
+ if (( ${#validpgpkeys[@]} )); then
+ printf "%s\n" "${validpgpkeys[@]}"
+ fi
)
msg "Exporting ${#validpgpkeys[@]} PGP keys..."