Patchwork [1,of,3,V3] gpg: treat "ERRSIG" as a valid key id but no fingerprint

login
register
mail settings
Submitter elson.wei@gmail.com
Date July 10, 2013, 5:04 a.m.
Message ID <578a4d336d183f41239f.1373432654@ElsonWei-NB.PrimeVOLT>
Download mbox | patch
Permalink /patch/1825/
State Superseded, archived
Headers show

Comments

elson.wei@gmail.com - July 10, 2013, 5:04 a.m.
# HG changeset patch
# User Wei, Elson <elson.wei@gmail.com>
# Date 1373432623 -28800
#      Wed Jul 10 13:03:43 2013 +0800
# Node ID 578a4d336d183f41239f9568919333ef0561c1b7
# Parent  83d0df2ddf3f2a07ed347afcfa30ddacc18b4c3d
gpg: treat "ERRSIG" as a valid key id but no fingerprint

Patch

# HG changeset patch
# User Wei, Elson <elson.wei@gmail.com>
# Date 1373432623 -28800
#      Wed Jul 10 13:03:43 2013 +0800
# Node ID 578a4d336d183f41239f9568919333ef0561c1b7
# Parent  83d0df2ddf3f2a07ed347afcfa30ddacc18b4c3d
gpg: treat "ERRSIG" as a valid key id but no fingerprint

diff --git a/hgext/gpg.py b/hgext/gpg.py
--- a/hgext/gpg.py
+++ b/hgext/gpg.py
@@ -48,19 +48,19 @@ 
                     pass
         keys = []
         key, fingerprint = None, None
-        err = ""
         for l in ret.splitlines():
             # see DETAILS in the gnupg documentation
             # filter the logger output
             if not l.startswith("[GNUPG:]"):
                 continue
             l = l[9:]
-            if l.startswith("ERRSIG"):
-                err = _("error while verifying signature")
-                break
-            elif l.startswith("VALIDSIG"):
+            if l.startswith("VALIDSIG"):
                 # fingerprint of the primary key
                 fingerprint = l.split()[10]
+            elif l.startswith("ERRSIG"):
+                key = l.split(" ", 3)[:2]
+                key.append("")
+                fingerprint = None
             elif (l.startswith("GOODSIG") or
                   l.startswith("EXPSIG") or
                   l.startswith("EXPKEYSIG") or
@@ -69,11 +69,9 @@ 
                     keys.append(key + [fingerprint])
                 key = l.split(" ", 2)
                 fingerprint = None
-        if err:
-            return err, []
         if key is not None:
             keys.append(key + [fingerprint])
-        return err, keys
+        return keys
 
 def newgpg(ui, **opts):
     """create a new gpg instance"""
@@ -119,10 +117,7 @@ 
 
     data = node2txt(repo, node, version)
     sig = binascii.a2b_base64(sig)
-    err, keys = mygpg.verify(data, sig)
-    if err:
-        ui.warn("%s:%d %s\n" % (fn, ln , err))
-        return None
+    keys = mygpg.verify(data, sig)
 
     validkeys = []
     # warn for expired key and/or sigs