Page MenuHome GnuPG

gpg2 --gen-revoke 0x${FINGERPRINT} produces infinite output stream
Closed, ResolvedPublic

Description

gpg2 appears to be unable to generate a revocation certificate for a secret key
when the secret key is specified by fingerprint.

Instead, it produces an infinite stream of output to its log. The output begins
like this:

gpg: '0x762421547769C18A83EA34F4D563B7FE19E7DB0C' matches multiple secret keys:
gpg: sec rsa2048/19E7DB0C 2015-12-12 alice <alice@example.org>
gpg: sec rsa2048/19E7DB0C 2015-12-12 alice <alice@example.org>

and the final line repeats forever until the process is killed.

This appears to be due to a loop in gen_revoke in g10/revoke.c, perhaps due to
keydb_search continuing to return the same result when searching by full
fingerprint.

This does not appear to be a problem with gpg 1.4.x

I think the following patch should work around the problem, but i doubt it's a
complete fix.

  • a/g10/revoke.c

+++ b/g10/revoke.c
@@ -640,7 +640,8 @@ gen_revoke (const char *uname)

    }

  rc = keydb_search (kdbhd, &desc, 1, NULL);
  • if (gpg_err_code (rc) == GPG_ERR_NOT_FOUND)

+ if (gpg_err_code (rc) == GPG_ERR_NOT_FOUND
+ || desc.mode == KEYDB_SEARCH_MODE_FPR20)

/* Not ambiguous.  */
{
}

Details

Version
2.1.10

Event Timeline

dkg set Version to 2.1.10.
dkg added a subscriber: dkg.

Just to be clear: you tested with, say, a long key id, and the output was fine?
In other words, the problem only occurs when specifying a fingerprint?

I found the bug. I'll try to create a patch soon. Thanks for reporting this.

This should be fixed in 2e4e10c. Please let me know if it works for you (and
feel free to mark this bug as resolved if it does).

neal added a project: Restricted Project.Dec 15 2015, 12:22 PM

I assume that this patch solved the problem. Thanks for reporting!

neal claimed this task.
neal removed a project: Restricted Project.