[pacman-dev] [PATCH] pacman-key: fix broken logic around updating trust database
Dan McGee
dan at archlinux.org
Mon Aug 29 11:54:55 EDT 2011
Any option that flips UPDATEDB=1 doesn't work right now due to what we
thought was a good idea in commit cab1379a1ab14. Fix this by not
including the update operation in the option count and special casing
it where necessary.
Also, bring back the helpful "Updating trust database" message.
Signed-off-by: Dan McGee <dan at archlinux.org>
---
Allan broke it! :)
But in all seriousness, this code is getting a bit hacky/dirty, so open to
other suggestions if we can clean anything up.
scripts/pacman-key.sh.in | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in
index 1bac3d3..0b46b10 100644
--- a/scripts/pacman-key.sh.in
+++ b/scripts/pacman-key.sh.in
@@ -419,13 +419,16 @@ PACMAN_KEYRING_DIR=${PACMAN_KEYRING_DIR:-$(get_from "$CONFIG" "GPGDir" || echo "
GPG_PACMAN=(gpg --homedir ${PACMAN_KEYRING_DIR} --no-permission-warning)
# check only a single operation has been given
+# don't include UPDATEDB in here as other opts can induce it
numopt=$(( ADD + DELETE + EDITKEY + EXPORT + FINGER + IMPORT + IMPORT_TRUSTDB +
- INIT + LISTKEYS + LISTSIGS + POPULATE + RECEIVE + UPDATEDB + VERIFY ))
+ INIT + LISTKEYS + LISTSIGS + POPULATE + RECEIVE + VERIFY ))
case $numopt in
0)
- error "$(gettext "no operation specified (use -h for help)")"
- exit 1
+ if (( ! UPDATEDB )); then
+ error "$(gettext "no operation specified (use -h for help)")"
+ exit 1
+ fi
;;
[!1])
error "$(gettext "Multiple operations specified")"
@@ -450,6 +453,9 @@ esac
(( RECEIVE )) && receive_keys
(( VERIFY )) && "${GPG_PACMAN[@]}" --verify $SIGNATURE
-(( UPDATEDB )) && "${GPG_PACMAN[@]}" --batch --check-trustdb
+if (( UPDATEDB )); then
+ msg "$(gettext "Updating trust database...")"
+ "${GPG_PACMAN[@]}" --batch --check-trustdb
+fi
# vim: set ts=2 sw=2 noet:
--
1.7.6.1
More information about the pacman-dev
mailing list