From f7bd44bae0d7cb7f9838490b5eece075da83899e Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Fri, 4 Mar 2016 10:23:24 +0100 Subject: [PATCH] apt-key del should correctly handle keyids prefixed with 0x --- cmdline/apt-key.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmdline/apt-key.in b/cmdline/apt-key.in index 80eee6265..cfd4be35d 100644 --- a/cmdline/apt-key.in +++ b/cmdline/apt-key.in @@ -191,6 +191,10 @@ remove_key_from_keyring() { for KEY in "$@"; do local FINGERPRINTS="${GPGHOMEDIR}/keyringfile.keylst" get_fingerprints_of_keyring "$KEYRINGFILE" > "$FINGERPRINTS" + + # strip leading 0x, if present: + KEY="$(printf %s "$KEY" | sed s/^0x//)" + # check if the key is in this keyring if ! grep -iq "^[0-9A-F]*${KEY}$" "$FINGERPRINTS"; then continue -- 2.45.2