gpg --import cannot display user ID
Closed, ResolvedPublic


The current master branch of gnupg (commit 24ae5af102cb53bd7abfb9f25aca93debb785a2f) displays [User ID not found] when attempting to import a key:

$ gpg --import damien.asc
gpg: key A8DC7067E25EFBABB: 17 signatures not checked to due to missing keys
gpg: key A8DC7067E25EFBABB: public key "[User ID not found]" imported
gpg: Total number processed: 1
gpg:               imported: 1

It also happens when the imported key is already present in the keyring:

$ gpg --import damien.asc 
gpg: key A8DC7067E25FBABB: 17 signatures not checked due to missing keys
gpg: key A8DC7067E25FBABB: "[User ID not found]" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1

This is independent of the actual key imported.

The bug is not present in GnuPG 2.2.4 and also not present in tag gnupg-2.3-base, so it must have been introduced somewhere in the 2.3 branch.

gouttegd created this task.Feb 20 2018, 4:06 PM
gouttegd created this object in space S1 Public.
werner edited projects, added gnupg (gpg23); removed gnupg.Feb 20 2018, 4:22 PM

Bissecting between gnupg-2.3-base and master pinpointed commit ecbbafb88d920e713439b6b1b8e1b41a6f8d0e38 as the origin of the bug. This commit changed MAX_FINGERPRINT_LEN from 20 to 32, but the get_user_id_byfpr function in g10/getkey.c still assumes the old value.

werner claimed this task.Feb 20 2018, 5:04 PM
werner added a subscriber: werner.

Thanks for tracking this down. I'll fix.

werner triaged this task as High priority.Apr 17 2018, 8:26 PM
werner closed this task as Resolved.Apr 5 2019, 5:05 PM

Well, it took long to fix. My original plan was to fix it while reworking getkey.c but that I have not yet come to work on that.