Patchwork [1,of,2] gpg: treat "ERRSIG" as a valid keyid but no fingerprint

login
register
mail settings
Submitter elson.wei@gmail.com
Date June 20, 2013, 2:32 p.m.
Message ID <5d7e94383feede6e5b62.1371738768@ElsonWei-NB>
Download mbox | patch
Permalink /patch/1737/
State Changes Requested, archived
Delegated to: tonfa
Headers show

Comments

elson.wei@gmail.com - June 20, 2013, 2:32 p.m.
# HG changeset patch
# User Wei, Elson <elson.wei@gmail.com>
# Date 1371690961 -28800
#      Thu Jun 20 09:16:01 2013 +0800
# Node ID 5d7e94383feede6e5b62d4009a3877e479f72591
# Parent  401b3ad26e66f6b69937e1aa808da07065c408a6
gpg: treat "ERRSIG" as a valid keyid but no fingerprint

Patch

# HG changeset patch
# User Wei, Elson <elson.wei@gmail.com>
# Date 1371690961 -28800
#      Thu Jun 20 09:16:01 2013 +0800
# Node ID 5d7e94383feede6e5b62d4009a3877e479f72591
# Parent  401b3ad26e66f6b69937e1aa808da07065c408a6
gpg: treat "ERRSIG" as a valid keyid but no fingerprint

diff --git a/hgext/gpg.py b/hgext/gpg.py
--- a/hgext/gpg.py
+++ b/hgext/gpg.py
@@ -48,7 +48,6 @@ 
                     pass
         keys = []
         key, fingerprint = None, None
-        err = ""
         for l in ret.splitlines():
             # see DETAILS in the gnupg documentation
             # filter the logger output
@@ -56,8 +55,7 @@ 
                 continue
             l = l[9:]
             if l.startswith("ERRSIG"):
-                err = _("error while verifying signature")
-                break
+                keys.append(l.split(" ", 2)[:2] + ["", ""])
             elif l.startswith("VALIDSIG"):
                 # fingerprint of the primary key
                 fingerprint = l.split()[10]
@@ -69,11 +67,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 +115,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