Patchwork [2,of,2] gpg: show "Unknow KEYID xxx" when the status is ERRSIG

login
register
mail settings
Submitter elson.wei@gmail.com
Date June 20, 2013, 7:34 a.m.
Message ID <bd6499180bf4c81642a4.1371713655@ElsonWei-NB.PrimeVOLT>
Download mbox | patch
Permalink /patch/1736/
State Superseded, archived
Headers show

Comments

elson.wei@gmail.com - June 20, 2013, 7:34 a.m.
# HG changeset patch
# User Wei, Elson <elson.wei@gmail.com>
# Date 1371691052 -28800
#      Thu Jun 20 09:17:32 2013 +0800
# Node ID bd6499180bf4c81642a41571fc0f89b5e14b300e
# Parent  5d7e94383feede6e5b62d4009a3877e479f72591
gpg: show "Unknow KEYID xxx" when the status is ERRSIG
tonfa - June 21, 2013, 9:03 a.m.
On Thu, Jun 20, 2013 at 9:34 AM, <elson.wei@gmail.com> wrote:

> # HG changeset patch
> # User Wei, Elson <elson.wei@gmail.com>
> # Date 1371691052 -28800
> #      Thu Jun 20 09:17:32 2013 +0800
> # Node ID bd6499180bf4c81642a41571fc0f89b5e14b300e
> # Parent  5d7e94383feede6e5b62d4009a3877e479f72591
> gpg: show "Unknow KEYID xxx" when the status is ERRSIG
>
> diff --git a/hgext/gpg.py b/hgext/gpg.py
> --- a/hgext/gpg.py
> +++ b/hgext/gpg.py
> @@ -120,6 +120,9 @@
>      validkeys = []
>      # warn for expired key and/or sigs
>      for key in keys:
> +        if key[0] == "ERRSIG":
> +            ui.write(_("%s Unknown KEYID \"%s\"\n") % (prefix, key[1]))
> +            continue
>          if key[0] == "BADSIG":
>              ui.write(_("%s Bad signature from \"%s\"\n") % (prefix,
> key[2]))
>              continue
>

And now that you send different input, please harden the valid sig check
(add an elif ... GOODSIG to append, also maybe raise an exception when an
unexpected value comes).

> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/hgext/gpg.py b/hgext/gpg.py
--- a/hgext/gpg.py
+++ b/hgext/gpg.py
@@ -120,6 +120,9 @@ 
     validkeys = []
     # warn for expired key and/or sigs
     for key in keys:
+        if key[0] == "ERRSIG":
+            ui.write(_("%s Unknown KEYID \"%s\"\n") % (prefix, key[1]))
+            continue
         if key[0] == "BADSIG":
             ui.write(_("%s Bad signature from \"%s\"\n") % (prefix, key[2]))
             continue