[Pkg-gnupg-commit] [gnupg2] 01/05: Upstream patches, fixing unnecessary delay (Closes: #851298)
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Wed Jan 18 20:17:16 UTC 2017
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch master
in repository gnupg2.
commit 4f3043974efb3303024c59b8b471f5d649dcd575
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date: Wed Jan 18 11:48:02 2017 -0500
Upstream patches, fixing unnecessary delay (Closes: #851298)
I've advanced the build-dependency version for libgpg-error-dev to
1.26-2 because that's where we noted the fixed symbol versioning for
gpgrt_yield. I want to avoid building gnupg2 against a recent
libgpg-error and then installing it against something that predates
1.25 and accidentally fails to yield properly.
(see in particular the comments in debian/patches/
0061-agent-Reduce-sleep-time-in-the-progress-callback.patch)
---
debian/control | 2 +-
.../0059-gpg-Remove-unused-definitions.patch | 61 ++++++++++
...conf-Allow-all-for-launch-kill-and-reload.patch | 134 +++++++++++++++++++++
...educe-sleep-time-in-the-progress-callback.patch | 42 +++++++
.../0062-common-Fix-flushing-copy-buffers.patch | 68 +++++++++++
debian/patches/series | 4 +
6 files changed, 310 insertions(+), 1 deletion(-)
diff --git a/debian/control b/debian/control
index c976558..01a79ce 100644
--- a/debian/control
+++ b/debian/control
@@ -20,7 +20,7 @@ Build-Depends:
libcurl4-gnutls-dev,
libgcrypt20-dev (>= 1.7.0),
libgnutls28-dev (>= 3.0),
- libgpg-error-dev (>= 1.24),
+ libgpg-error-dev (>= 1.26-2~),
libksba-dev (>= 1.3.4),
libldap2-dev,
libnpth0-dev (>= 1.2),
diff --git a/debian/patches/0059-gpg-Remove-unused-definitions.patch b/debian/patches/0059-gpg-Remove-unused-definitions.patch
new file mode 100644
index 0000000..1ee72d7
--- /dev/null
+++ b/debian/patches/0059-gpg-Remove-unused-definitions.patch
@@ -0,0 +1,61 @@
+From: Werner Koch <wk at gnupg.org>
+Date: Tue, 17 Jan 2017 12:43:13 +0100
+Subject: gpg: Remove unused definitions.
+
+* g10/keydb.h (rt_UNKNOWN, rt_RING): Remove constants.
+(keyblock_pos_struct, KBPOS): Remove struct and type.
+
+Signed-off-by: Werner Koch <wk at gnupg.org>
+(cherry picked from commit 701f54eccf3da3319dd6d74f46b852c64d90bc52)
+---
+ g10/keydb.h | 24 ++----------------------
+ 1 file changed, 2 insertions(+), 22 deletions(-)
+
+diff --git a/g10/keydb.h b/g10/keydb.h
+index 8daa9ee0f..c9f5b1c4a 100644
+--- a/g10/keydb.h
++++ b/g10/keydb.h
+@@ -61,12 +61,6 @@ struct kbnode_struct {
+ #define is_cloned_kbnode(a) ((a)->private_flag & 2)
+
+
+-enum resource_type {
+- rt_UNKNOWN = 0,
+- rt_RING = 1
+-};
+-
+-
+ /* Bit flags used with build_pk_list. */
+ enum
+ {
+@@ -75,28 +69,14 @@ enum
+ PK_LIST_CONFIG = 4, /* Specified via config file. */
+ PK_LIST_FROM_FILE = 8 /* Take key from file with that name. */
+ };
++
+ /* To store private data in the flags the private data must be left
+- shifted by this value. */
++ * shifted by this value. */
+ enum
+ {
+ PK_LIST_SHIFT = 4
+ };
+
+-/****************
+- * A data structure to hold information about the external position
+- * of a keyblock.
+- */
+-struct keyblock_pos_struct {
+- int resno; /* resource number */
+- enum resource_type rt;
+- off_t offset; /* position information */
+- unsigned count; /* length of the keyblock in packets */
+- iobuf_t fp; /* Used by enum_keyblocks. */
+- int secret; /* working on a secret keyring */
+- PACKET *pkt; /* ditto */
+- int valid;
+-};
+-typedef struct keyblock_pos_struct KBPOS;
+
+ /* Structure to hold a couple of public key certificates. */
+ typedef struct pk_list *PK_LIST; /* Deprecated. */
diff --git a/debian/patches/0060-gpgconf-Allow-all-for-launch-kill-and-reload.patch b/debian/patches/0060-gpgconf-Allow-all-for-launch-kill-and-reload.patch
new file mode 100644
index 0000000..1852f43
--- /dev/null
+++ b/debian/patches/0060-gpgconf-Allow-all-for-launch-kill-and-reload.patch
@@ -0,0 +1,134 @@
+From: Werner Koch <wk at gnupg.org>
+Date: Wed, 18 Jan 2017 10:01:55 +0100
+Subject: gpgconf: Allow "all" for --launch, --kill, and --reload.
+
+* tools/gpgconf-comp.c (gc_component_launch): Allow -1 for COMPONENT.
+(gc_component_kill): Ditto.
+(gc_component_reload): For robustness change the condition to < 0.
+* tools/gpgconf.c (main) <aLaunch, aKill, aReload>: Support argument
+"all".
+
+Signed-off-by: Werner Koch <wk at gnupg.org>
+(cherry picked from commit 2312248b2e3adffa52d8a3ac4f24fe2c88f0f569)
+---
+ doc/tools.texi | 15 +++++++++------
+ tools/gpgconf-comp.c | 21 +++++++++++++++++++--
+ tools/gpgconf.c | 14 +++++++++++++-
+ 3 files changed, 41 insertions(+), 9 deletions(-)
+
+diff --git a/doc/tools.texi b/doc/tools.texi
+index f0e6fe70c..bdef6a261 100644
+--- a/doc/tools.texi
++++ b/doc/tools.texi
+@@ -336,9 +336,10 @@ force an update of that file this command can be used:
+
+ @item --reload [@var{component}]
+ @opindex reload
+-Reload all or the given component. This is basically the same as sending
+-a SIGHUP to the component. Components which don't support reloading are
+-ignored.
++Reload all or the given component. This is basically the same as
++sending a SIGHUP to the component. Components which don't support
++reloading are ignored. Without @var{component} or by using "all" for
++ at var{component} all components which are daemons are reloaded.
+
+ @item --launch [@var{component}]
+ @opindex launch
+@@ -346,14 +347,16 @@ If the @var{component} is not already running, start it.
+ @command{component} must be a daemon. This is in general not required
+ because the system starts these daemons as needed. However, external
+ software making direct use of @command{gpg-agent} or @command{dirmngr}
+-may use this command to ensure that they are started.
++may use this command to ensure that they are started. Using "all" for
++ at var{component} launches all components which are daemons.
+
+ @item --kill [@var{component}]
+ @opindex kill
+ Kill the given component. Components which support killing are
+ @command{gpg-agent} and @command{scdaemon}. Components which don't
+-support reloading are ignored. Note that as of now reload and kill
+-have the same effect for @command{scdaemon}.
++support reloading are ignored. Using "all" for @var{component} kills
++all components running as daemons. Note that as of now reload and
++kill have the same effect for @command{scdaemon}.
+
+ @item --create-socketdir
+ @opindex create-socketdir
+diff --git a/tools/gpgconf-comp.c b/tools/gpgconf-comp.c
+index 2dcf0758e..300f63da6 100644
+--- a/tools/gpgconf-comp.c
++++ b/tools/gpgconf-comp.c
+@@ -1263,6 +1263,14 @@ gc_component_launch (int component)
+ int i;
+ pid_t pid;
+
++ if (component < 0)
++ {
++ err = gc_component_launch (GC_COMPONENT_GPG_AGENT);
++ if (!err)
++ err = gc_component_launch (GC_COMPONENT_DIRMNGR);
++ return err;
++ }
++
+ if (!(component == GC_COMPONENT_GPG_AGENT
+ || component == GC_COMPONENT_DIRMNGR))
+ {
+@@ -1304,7 +1312,16 @@ gc_component_kill (int component)
+ for (backend = 0; backend < GC_BACKEND_NR; backend++)
+ runtime[backend] = 0;
+
+- if (component >= 0)
++ if (component < 0)
++ {
++ for (component = 0; component < GC_COMPONENT_NR; component++)
++ {
++ option = gc_component[component].options;
++ for (; option && option->name; option++)
++ runtime[option->backend] = 1;
++ }
++ }
++ else
+ {
+ assert (component < GC_COMPONENT_NR);
+ option = gc_component[component].options;
+@@ -1333,7 +1350,7 @@ gc_component_reload (int component)
+ for (backend = 0; backend < GC_BACKEND_NR; backend++)
+ runtime[backend] = 0;
+
+- if (component == -1)
++ if (component < 0)
+ {
+ for (component = 0; component < GC_COMPONENT_NR; component++)
+ {
+diff --git a/tools/gpgconf.c b/tools/gpgconf.c
+index a1034e663..c69b1c3e2 100644
+--- a/tools/gpgconf.c
++++ b/tools/gpgconf.c
+@@ -589,6 +589,18 @@ main (int argc, char **argv)
+ es_putc ('\n', es_stderr);
+ exit (2);
+ }
++ else if (!strcmp (fname, "all"))
++ {
++ if (cmd == aLaunch)
++ {
++ if (gc_component_launch (-1))
++ exit (1);
++ }
++ else
++ {
++ gc_component_kill (-1);
++ }
++ }
+ else
+ {
+ /* Launch/Kill a given component. */
+@@ -617,7 +629,7 @@ main (int argc, char **argv)
+ break;
+
+ case aReload:
+- if (!fname)
++ if (!fname || !strcmp (fname, "all"))
+ {
+ /* Reload all. */
+ gc_component_reload (-1);
diff --git a/debian/patches/0061-agent-Reduce-sleep-time-in-the-progress-callback.patch b/debian/patches/0061-agent-Reduce-sleep-time-in-the-progress-callback.patch
new file mode 100644
index 0000000..337aee4
--- /dev/null
+++ b/debian/patches/0061-agent-Reduce-sleep-time-in-the-progress-callback.patch
@@ -0,0 +1,42 @@
+From: Werner Koch <wk at gnupg.org>
+Date: Wed, 18 Jan 2017 10:13:04 +0100
+Subject: agent: Reduce sleep time in the progress callback.
+
+* agent/gpg-agent.c (agent_libgcrypt_progress_cb): Reduce sleep time
+from 100ms to 1ms or use gpgrt_yield when build against a recent
+libgpg-error.
+--
+
+Debian-bug-id: 851298
+Signed-off-by: Werner Koch <wk at gnupg.org>
+(cherry picked from commit 3d356d165aed7d76a3ea811b1d24ed0a05ac90d4)
+---
+ agent/gpg-agent.c | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
+index 6bd0c3b57..f665078ba 100644
+--- a/agent/gpg-agent.c
++++ b/agent/gpg-agent.c
+@@ -1770,11 +1770,19 @@ agent_libgcrypt_progress_cb (void *data, const char *what, int printchar,
+
+ /* Libgcrypt < 1.8 does not know about nPth and thus when it reads
+ * from /dev/random this will block the process. To mitigate this
+- * problem we take a short nap when Libgcrypt tells us that it needs
++ * problem we yield the thread when Libgcrypt tells us that it needs
+ * more entropy. This way other threads have chance to run. */
+ #if GCRYPT_VERSION_NUMBER < 0x010800 /* 1.8.0 */
+ if (what && !strcmp (what, "need_entropy"))
+- npth_usleep (100000); /* 100ms */
++ {
++#if GPGRT_VERSION_NUMBER < 0x011900 /* 1.25 */
++ /* In older gpg-error versions gpgrt_yield is buggy for use with
++ * nPth and thus we need to resort to a sleep call. */
++ npth_usleep (1000); /* 1ms */
++#else
++ gpgrt_yield ();
++#endif
++ }
+ #endif
+ }
+
diff --git a/debian/patches/0062-common-Fix-flushing-copy-buffers.patch b/debian/patches/0062-common-Fix-flushing-copy-buffers.patch
new file mode 100644
index 0000000..ae23022
--- /dev/null
+++ b/debian/patches/0062-common-Fix-flushing-copy-buffers.patch
@@ -0,0 +1,68 @@
+From: Justus Winter <justus at g10code.com>
+Date: Wed, 18 Jan 2017 18:14:41 +0100
+Subject: common: Fix flushing copy buffers.
+
+* common/exectool.c (copy_buffer_flush): Write and flush the data, but
+do not hide EAGAIN from the caller.
+(gnupg_exec_tool_stream): Retry on EAGAIN.
+
+GnuPG-bug-id: 2425
+Signed-off-by: Justus Winter <justus at g10code.com>
+(cherry picked from commit 34fa2d79a07a079be472c3ff486debfdac8c6070)
+---
+ common/exectool.c | 26 +++++++++++++++++++-------
+ 1 file changed, 19 insertions(+), 7 deletions(-)
+
+diff --git a/common/exectool.c b/common/exectool.c
+index 4593abdc2..0067fc63a 100644
+--- a/common/exectool.c
++++ b/common/exectool.c
+@@ -276,15 +276,23 @@ static gpg_error_t
+ copy_buffer_flush (struct copy_buffer *c, estream_t sink)
+ {
+ gpg_error_t err;
++ size_t nwritten;
+
+- while (c->nread > 0)
+- {
+- err = copy_buffer_do_copy (c, NULL, sink);
+- if (err)
+- return err;
+- }
++ nwritten = 0;
++ err = es_write (sink, c->writep, c->nread, &nwritten);
++
++ assert (nwritten <= c->nread);
++ c->writep += nwritten;
++ c->nread -= nwritten;
++ assert (c->writep - c->buffer <= sizeof c->buffer);
++
++ if (err)
++ return err;
+
+- return 0;
++ if (es_fflush (sink))
++ err = my_error_from_syserror ();
++
++ return err;
+ }
+
+
+@@ -444,6 +452,8 @@ gnupg_exec_tool_stream (const char *pgmname, const char *argv[],
+ if (es_feof (input))
+ {
+ err = copy_buffer_flush (cpbuf_in, fds[0].stream);
++ if (err == GPG_ERR_EAGAIN)
++ continue; /* Retry next time. */
+ if (err)
+ {
+ log_error ("error feeding data to '%s': %s\n",
+@@ -470,6 +480,8 @@ gnupg_exec_tool_stream (const char *pgmname, const char *argv[],
+ if (es_feof (inextra))
+ {
+ err = copy_buffer_flush (cpbuf_extra, fds[3].stream);
++ if (err == GPG_ERR_EAGAIN)
++ continue; /* Retry next time. */
+ if (err)
+ {
+ log_error ("error feeding data to '%s': %s\n",
diff --git a/debian/patches/series b/debian/patches/series
index 15de52f..d83fb62 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -56,3 +56,7 @@ gpg-agent-idling/0004-agent-Avoid-scheduled-checks-on-socket-when-inotify-.patch
0056-gpg-Sync-print-of-additional-sig-data-in-edit-key.patch
0057-gpg-Clean-bogus-subkey-binding-when-cleaning-a-key.patch
0058-build-Handle-packages-with-dashes-in-find-version.patch
+0059-gpg-Remove-unused-definitions.patch
+0060-gpgconf-Allow-all-for-launch-kill-and-reload.patch
+0061-agent-Reduce-sleep-time-in-the-progress-callback.patch
+0062-common-Fix-flushing-copy-buffers.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git
More information about the Pkg-gnupg-commit
mailing list