[Pkg-gnupg-maint] Bug#315677: Bug#317654: Bug#315677, 317654: keyring_rebuild_cache: Assertion `keyblock->pkt->pkttype == PKT_PUBLIC_KEY' failed.

Werner Koch wk at gnupg.org
Fri Jul 17 10:11:50 UTC 2009


> I have a copy of my broken .gnupg directory. If I enable that, I can
> still reproduce the problem (and I'm now on an amd64 system, so it's
> cross-architecture):

Data formats are indded architecture neutral.

I committed the change below, which might help you.  At least it gives
some insight into the actual problem and replaces an assert which is
anyway wrong because it is triggered by external data and not by an
logical error.

Shalom-Salam,

   Werner

===================================================================
--- keyring.c   (revision 5080)
+++ keyring.c   (working copy)
@@ -1399,7 +1399,20 @@
           log_error ("keyring_get_keyblock failed: %s\n", g10_errstr(rc));
           goto leave;
         }
-      assert (keyblock->pkt->pkttype == PKT_PUBLIC_KEY);
+      if ( keyblock->pkt->pkttype != PKT_PUBLIC_KEY)
+        {
+          /* We had a few reports about corrupted keyrings; if we have
+             been called directly from the command line we delete such
+             a keyblock instead of bailing out.  */
+          log_error ("unexpected keyblock found (pkttype=%d)%s\n",
+                     keyblock->pkt->pkttype, noisy? " - deleted":"");
+          if (noisy)
+            continue;
+          log_info ("Hint: backup your keys and try running `%s'\n",
+                    "gpg --rebuild-keydb-caches");
+          rc = G10ERR_INV_KEYRING;
+          goto leave;
+        }
 
       /* check all signature to set the signature's cache flags */
       for (node=keyblock; node; node=node->next)



-- 
Die Gedanken sind frei.  Auschnahme regelt ein Bundeschgesetz.






More information about the Pkg-gnupg-maint mailing list