support long keyids in "apt-key del" instead of ignoring them
authorJames McCoy <jamessan@debian.org>
Fri, 28 Nov 2014 13:21:06 +0000 (14:21 +0100)
committerDavid Kalnischkies <david@kalnischkies.de>
Fri, 28 Nov 2014 15:15:39 +0000 (16:15 +0100)
apt-key given a long keyid reports just "OK" all the time, but doesn't
delete the mentioned key as it doesn't find the key.

Note: In debian/experimental this was closed with
29f1b977100aeb6d6ebd38923eeb7a623e264ffe which just added the testcase
as the rewrite of apt-key had fixed this as well.

Closes: 754436

cmdline/apt-key.in
test/integration/test-apt-key

index 0774cf4..b4e0710 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 -q "^pub:[^:]*:[^:]*:[^:]*:[0-9A-F]*$2:"; then
        return
     fi
     if [ ! -w "$1" ]; then
index 68b3f97..47230cb 100755 (executable)
@@ -105,3 +105,9 @@ testfileequal ./aptkey.list 'pub   2048R/528144E2 2011-01-16'
 testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
 testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~
 testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~
+
+msgtest 'Test key removal with' '8 byte key ID'
+cleanplate
+cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
+testsuccess --nomsg aptkey --fakeroot del 5A90D141DBAC8DAE
+testempty aptkey list