Backport patch to tweak STATUS_FAILURE handling

The latest gnupg2 release[1] included a commit[2] which broke gpgme
handling of gnupg2 status updates (through `--status-fd`). This was
fixed in gpgme git master[3].  This commit backports this patch to make
gpgme work again.

[1] https://bodhi.fedoraproject.org/updates/FEDORA-2018-3fc05e009d
[2] https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=commit;h=0336e5d1a7b9d46e06c838e6a98aecfcc9542882
[3] https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gpgme.git;a=commit;h=b99502274ae5efdf6df0d967900ec3d1e64373d7
This commit is contained in:
Jonathan Lebon 2018-04-17 12:26:59 -04:00
parent f1ba1b7b36
commit 7222860723
2 changed files with 53 additions and 1 deletions

View File

@ -0,0 +1,47 @@
From b99502274ae5efdf6df0d967900ec3d1e64373d7 Mon Sep 17 00:00:00 2001
From: Werner Koch <wk@gnupg.org>
Date: Thu, 12 Apr 2018 20:36:30 +0200
Subject: [PATCH] core: Tweak STATUS_FAILURE handling.
* src/op-support.c (_gpgme_parse_failure): Ignore failures with
location "gpg-exit".
* tests/gpg/t-verify.c (main): Adjust for the now working checking of
the second key.
Signed-off-by: Werner Koch <wk@gnupg.org>
---
src/op-support.c | 10 +++++++++-
tests/gpg/t-verify.c | 8 +++++---
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/op-support.c b/src/op-support.c
index 43cb1c76..e55875f9 100644
--- a/src/op-support.c
+++ b/src/op-support.c
@@ -400,7 +400,13 @@ _gpgme_parse_plaintext (char *args, char **filenamep)
/* Parse a FAILURE status line and return the error code. ARGS is
- modified to contain the location part. */
+ * modified to contain the location part. Note that for now we ignore
+ * failure codes with a location of gpg-exit; they are too trouble
+ * some. Instead we should eventually record that error in the
+ * context and provide a function to return a fuller error
+ * description; this could then also show the location of the error
+ * (e.g. "option- parser") to make it easier for the user to detect
+ * the actual error. */
gpgme_error_t
_gpgme_parse_failure (char *args)
{
@@ -418,6 +424,8 @@ _gpgme_parse_failure (char *args)
*where = '\0';
where = args;
+ if (!strcmp (where, "gpg-exit"))
+ return 0;
return atoi (which);
}
--
2.14.3

View File

@ -11,7 +11,7 @@
Name: gpgme Name: gpgme
Summary: GnuPG Made Easy - high level crypto API Summary: GnuPG Made Easy - high level crypto API
Version: 1.10.0 Version: 1.10.0
Release: 3%{?dist} Release: 4%{?dist}
License: LGPLv2+ License: LGPLv2+
URL: https://gnupg.org/related_software/gpgme/ URL: https://gnupg.org/related_software/gpgme/
@ -19,6 +19,8 @@ Source0: ftp://ftp.gnupg.org/gcrypt/gpgme/gpgme-%{version}.tar.bz2
Source2: gpgme-multilib.h Source2: gpgme-multilib.h
## upstream patches ## upstream patches
# https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gpgme.git;a=commit;h=b99502274ae5efdf6df0d967900ec3d1e64373d7
Patch1000: 0001-core-Tweak-STATUS_FAILURE-handling.patch
## downstream patches ## downstream patches
# Don't add extra libs/cflags in gpgme-config/cmake equivalent # Don't add extra libs/cflags in gpgme-config/cmake equivalent
@ -235,6 +237,9 @@ fi
%{python3_sitearch}/gpg/ %{python3_sitearch}/gpg/
%changelog %changelog
* Tue Apr 17 2018 Jonathan Lebon <jonathan@jlebon.com> - 1.10.0-4
- Backport patch to tweak STATUS_FAILURE handling
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.0-3 * Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild