[pkg-gnupg-maint] Bug#846834: Bug#846834: gnupg: ERRSIG rc codes are no longer correct (breaks 0install)

Werner Koch wk at gnupg.org
Sat Dec 3 20:39:42 UTC 2016


On Sat,  3 Dec 2016 16:29, talex5 at gmail.com said:

> (33554441 is 0x0x2000009)

As a quick fix you can mask the low 16 bits which are the actual error
code. The higher bits are
used to indicate the source of the error.  These structured error codes
are used in all GnuPG components for size about 2003.

For testing error codes we always use a gpg_err_code(rc) inline
functions and thus we did not noticed this change.  The reason we see
this now in 2.1.16 is that somewhere in the code we added the error
sources to an error code (code taken from gpg-1.4 used 0 for the error
source) and this ended up in the ERRSIG status line.

I agree that this breaks the API and needs to be fixed.  If we want to
know the full error code with source we need to add a new arg to the
ERRSIG line but we can't change the existing values.

Masking the error code in your code won't harm and is probably the
fastest fix.  I also pushed a commit with the real fix:

commit ef10c348bffc7dad19e1832bebc453755d209420
Author: Werner Koch <wk at gnupg.org>
Date:   Sat Dec 3 21:35:45 2016 +0100

    gpg: Fix error code arg in ERRSIG status line.
    
    * g10/mainproc.c (check_sig_and_print): Use gpg_err_code to return an
    error code in ERRSIG.
    --
    
    Debian-bug-id: 846834
    Signed-off-by: Werner Koch <wk at gnupg.org>

	Modified   g10/mainproc.c
diff --git a/g10/mainproc.c b/g10/mainproc.c
index 30e19fe..ac2ab03 100644
--- a/g10/mainproc.c
+++ b/g10/mainproc.c
@@ -2223,7 +2223,7 @@ check_sig_and_print (CTX c, kbnode_t node)
       snprintf (buf, sizeof buf, "%08lX%08lX %d %d %02x %lu %d",
                 (ulong)sig->keyid[0], (ulong)sig->keyid[1],
                 sig->pubkey_algo, sig->digest_algo,
-                sig->sig_class, (ulong)sig->timestamp, rc);
+                sig->sig_class, (ulong)sig->timestamp, gpg_err_code (rc));
       write_status_text (STATUS_ERRSIG, buf);
       if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY)
         {


Shalom-Salam,

   Werner


-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-gnupg-maint/attachments/20161203/bb80f9b0/attachment.sig>


More information about the pkg-gnupg-maint mailing list