]> git.saurik.com Git - apt.git/commitdiff
keyids in "apt-key del" should be case-insensitive
authorDavid Kalnischkies <david@kalnischkies.de>
Tue, 7 Apr 2015 20:34:34 +0000 (22:34 +0200)
committerDavid Kalnischkies <david@kalnischkies.de>
Tue, 7 Apr 2015 20:34:34 +0000 (22:34 +0200)
gnupg is case-insensitive about keyids, so back then apt-key called it
directly any keyid was accepted, but now that we work more with the
keyid ourself we regressed to require uppercase keyids by accident.

This is also inconsistent with other apt-key commands which still use
gnupg directly. A single case-insensitive grep and we are fine again.

Closes: 781696
cmdline/apt-key.in
test/integration/test-apt-key

index b4e0710006882c72c968dd604f22a6efa4001005..1da311d351212c5a6b2704442995943e5ed39262 100644 (file)
@@ -180,7 +180,7 @@ update() {
 remove_key_from_keyring() {
     local GPG="$GPG_CMD --keyring $1"
     # check if the key is in this keyring: the key id is in the 5 column at the end
-    if ! $GPG --with-colons --list-keys 2>&1 | grep -q "^pub:[^:]*:[^:]*:[^:]*:[0-9A-F]*$2:"; then
+    if ! $GPG --with-colons --list-keys 2>&1 | grep -iq "^pub:[^:]*:[^:]*:[^:]*:[0-9A-F]*$2:"; then
        return
     fi
     if [ ! -w "$1" ]; then
index 47230cb55368f5020368b72210531dd3a5119471..b4f823ef18d8ff05034cb2073e01b3895fbed617 100755 (executable)
@@ -111,3 +111,9 @@ cleanplate
 cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
 testsuccess --nomsg aptkey --fakeroot del 5A90D141DBAC8DAE
 testempty aptkey list
+
+msgtest 'Test key removal with' 'lowercase key ID' #keylength somewher between 8byte and short
+cleanplate
+cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
+testsuccess --nomsg aptkey --fakeroot del d141dbac8dae
+testempty aptkey list