[Pkg-gnupg-commit] [gpgme] 01/02: import changes from upstream, use speedup from Colin Watson
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Tue Sep 19 15:41:52 UTC 2017
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch master
in repository gpgme.
commit dfcf893d772768dc3f3494cd132ad7530de03be1
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date: Tue Sep 19 10:10:25 2017 -0400
import changes from upstream, use speedup from Colin Watson
---
.../patches/0046-python-Improve-keylist-test.patch | 26 ++++
...47-python-Support-parallel-build-in-tests.patch | 26 ++++
...e-of-bugs-pointed-out-by-clang-compiler-w.patch | 26 ++++
...Restore-get_max_fds-optimization-on-Linux.patch | 146 +++++++++++++++++++++
debian/patches/series | 4 +
5 files changed, 228 insertions(+)
diff --git a/debian/patches/0046-python-Improve-keylist-test.patch b/debian/patches/0046-python-Improve-keylist-test.patch
new file mode 100644
index 0000000..68a3d8d
--- /dev/null
+++ b/debian/patches/0046-python-Improve-keylist-test.patch
@@ -0,0 +1,26 @@
+From: Justus Winter <justus at g10code.com>
+Date: Mon, 21 Aug 2017 10:54:10 +0200
+Subject: python: Improve keylist test.
+
+* lang/python/tests/t-keylist.py: Check a keylist matching no keys.
+
+Signed-off-by: Justus Winter <justus at g10code.com>
+(cherry picked from commit 70c8be9efe8de40bec0f0673589f3c9be7136674)
+---
+ lang/python/tests/t-keylist.py | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/lang/python/tests/t-keylist.py b/lang/python/tests/t-keylist.py
+index 76c793e..4505d3c 100755
+--- a/lang/python/tests/t-keylist.py
++++ b/lang/python/tests/t-keylist.py
+@@ -229,6 +229,9 @@ alpha_keys = list(c.op_keylist_all(b"Alpha"))
+ assert len(alpha_keys) == 1, "Expected only one key for 'Alpha', got %r" % len(alpha_keys)
+
+
++# Check negative result.
++assert len(list(c.keylist("no such key in sight"))) == 0
++
+
+ for i, key in enumerate(c.keylist()):
+ try:
diff --git a/debian/patches/0047-python-Support-parallel-build-in-tests.patch b/debian/patches/0047-python-Support-parallel-build-in-tests.patch
new file mode 100644
index 0000000..81d7c0b
--- /dev/null
+++ b/debian/patches/0047-python-Support-parallel-build-in-tests.patch
@@ -0,0 +1,26 @@
+From: Alon Bar-Lev <alon.barlev at gmail.com>
+Date: Thu, 3 Aug 2017 21:41:35 +0300
+Subject: python: Support parallel build in tests
+
+* lang/python/tests/Makefile.am: Depend xcheck with all which was lost
+due to the check hack.
+
+Signed-off-by: Alon Bar-Lev <alon.barlev at gmail.com>
+(cherry picked from commit 57c12593082e4ad302041269f1c35f2fe7d2fb1a)
+---
+ lang/python/tests/Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lang/python/tests/Makefile.am b/lang/python/tests/Makefile.am
+index d0dde1d..beb5a30 100644
+--- a/lang/python/tests/Makefile.am
++++ b/lang/python/tests/Makefile.am
+@@ -71,7 +71,7 @@ check: xcheck
+
+ .PHONY: xcheck
+
+-xcheck:
++xcheck: all
+ $(TESTS_ENVIRONMENT) $(PYTHON) $(srcdir)/run-tests.py \
+ --interpreters="$(PYTHONS)" --srcdir=$(srcdir) $(TESTFLAGS) \
+ $(XTESTS)
diff --git a/debian/patches/0048-Fix-a-couple-of-bugs-pointed-out-by-clang-compiler-w.patch b/debian/patches/0048-Fix-a-couple-of-bugs-pointed-out-by-clang-compiler-w.patch
new file mode 100644
index 0000000..890dd5f
--- /dev/null
+++ b/debian/patches/0048-Fix-a-couple-of-bugs-pointed-out-by-clang-compiler-w.patch
@@ -0,0 +1,26 @@
+From: Marcus Brinkmann <marcus.brinkmann at ruhr-uni-bochum.de>
+Date: Wed, 23 Aug 2017 15:38:11 +0200
+Subject: Fix a couple of bugs pointed out by clang compiler warnings.
+
+* src/engine-gpgconf.c (gpgconf_config_dir_cb): Fix cast.
+* src/key.c (_gpgme_key_add_sig): Fix pointer reference.
+
+Signed-off-by: Marcus Brinkmann <mb at g10code.com>
+(cherry picked from commit bfb3a01a0c55aa327dcab061fa808672362cb09d)
+---
+ src/key.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/key.c b/src/key.c
+index e2e30db..bb4d5fd 100644
+--- a/src/key.c
++++ b/src/key.c
+@@ -292,7 +292,7 @@ _gpgme_key_add_sig (gpgme_key_t key, char *src)
+ &sig->comment, dst);
+ }
+ else
+- sig->uid = '\0';
++ sig->uid[0] = '\0';
+
+ if (!uid->signatures)
+ uid->signatures = sig;
diff --git a/debian/patches/reduce-spurious-close/0049-core-Restore-get_max_fds-optimization-on-Linux.patch b/debian/patches/reduce-spurious-close/0049-core-Restore-get_max_fds-optimization-on-Linux.patch
new file mode 100644
index 0000000..b671e5a
--- /dev/null
+++ b/debian/patches/reduce-spurious-close/0049-core-Restore-get_max_fds-optimization-on-Linux.patch
@@ -0,0 +1,146 @@
+From: Colin Watson <cjwatson at debian.org>
+Date: Sat, 16 Sep 2017 04:16:45 +0100
+Subject: core: Restore get_max_fds optimization on Linux
+
+* src/posix-io.c (get_max_fds): Restore Linux optimization, this time
+using open/getdents/close rather than opendir/readdir/closedir.
+--
+
+opendir/readdir/closedir may allocate/free memory, and aren't required
+to do so in an async-signal-safe way. On the other hand, opening
+/proc/self/fd directly and iterating over it using getdents is safe.
+
+(getdents is not strictly speaking documented to be async-signal-safe
+because it's not in POSIX. However, the Linux implementation is
+essentially just a souped-up read. Python >= 3.2.3 makes the same
+assumption.)
+
+Signed-off-by: Colin Watson <cjwatson at debian.org>
+---
+ src/posix-io.c | 99 ++++++++++++++++++++++++++++++++++++++--------------------
+ 1 file changed, 66 insertions(+), 33 deletions(-)
+
+diff --git a/src/posix-io.c b/src/posix-io.c
+index a351806..dfed68c 100644
+--- a/src/posix-io.c
++++ b/src/posix-io.c
+@@ -48,6 +48,7 @@
+ #include <sys/resource.h>
+
+ #if __linux__
++# include <sys/syscall.h>
+ # include <sys/types.h>
+ # include <dirent.h>
+ #endif /*__linux__ */
+@@ -279,6 +280,20 @@ _gpgme_io_set_nonblocking (int fd)
+ }
+
+
++#ifdef __linux__
++/* This is not declared in public headers; getdents(2) says that we must
++ * define it ourselves. */
++struct linux_dirent
++{
++ unsigned long d_ino;
++ unsigned long d_off;
++ unsigned short d_reclen;
++ char d_name[];
++};
++
++# define DIR_BUF_SIZE 1024
++#endif /* __linux__ */
++
+ static long int
+ get_max_fds (void)
+ {
+@@ -291,39 +306,57 @@ get_max_fds (void)
+ * than for example doing 4096 close calls where almost all of them
+ * will fail.
+ *
+- * Unfortunately we can't call opendir between fork and exec in a
+- * multi-threaded process because opendir uses malloc and thus a
+- * mutex which may deadlock with a malloc in another thread. Thus
+- * the code is not used until we can have a opendir variant which
+- * does not use malloc. */
+-/* #ifdef __linux__ */
+-/* { */
+-/* DIR *dir = NULL; */
+-/* struct dirent *dir_entry; */
+-/* const char *s; */
+-/* int x; */
+-
+-/* dir = opendir ("/proc/self/fd"); */
+-/* if (dir) */
+-/* { */
+-/* while ((dir_entry = readdir (dir))) */
+-/* { */
+-/* s = dir_entry->d_name; */
+-/* if ( *s < '0' || *s > '9') */
+-/* continue; */
+-/* x = atoi (s); */
+-/* if (x > fds) */
+-/* fds = x; */
+-/* } */
+-/* closedir (dir); */
+-/* } */
+-/* if (fds != -1) */
+-/* { */
+-/* fds++; */
+-/* source = "/proc"; */
+-/* } */
+-/* } */
+-/* #endif /\* __linux__ *\/ */
++ * We can't use the normal opendir/readdir/closedir interface between
++ * fork and exec in a multi-threaded process because opendir uses
++ * malloc and thus a mutex which may deadlock with a malloc in another
++ * thread. However, the underlying getdents system call is safe. */
++#ifdef __linux__
++ {
++ int dir_fd;
++ char dir_buf[DIR_BUF_SIZE];
++ struct linux_dirent *dir_entry;
++ int r, pos;
++ const char *s;
++ int x;
++
++ dir_fd = open ("/proc/self/fd", O_RDONLY | O_DIRECTORY);
++ if (dir_fd != -1)
++ {
++ for (;;)
++ {
++ r = syscall(SYS_getdents, dir_fd, dir_buf, DIR_BUF_SIZE);
++ if (r == -1)
++ {
++ /* Fall back to other methods. */
++ fds = -1;
++ break;
++ }
++ if (r == 0)
++ break;
++
++ for (pos = 0; pos < r; pos += dir_entry->d_reclen)
++ {
++ dir_entry = (struct linux_dirent *) (dir_buf + pos);
++ s = dir_entry->d_name;
++ if (*s < '0' || *s > '9')
++ continue;
++ /* atoi is not guaranteed to be async-signal-safe. */
++ for (x = 0; *s >= '0' && *s <= '9'; s++)
++ x = x * 10 + (*s - '0');
++ if (!*s && x > fds && x != dir_fd)
++ fds = x;
++ }
++ }
++
++ close (dir_fd);
++ }
++ if (fds != -1)
++ {
++ fds++;
++ source = "/proc";
++ }
++ }
++#endif /* __linux__ */
+
+ #ifdef RLIMIT_NOFILE
+ if (fds == -1)
diff --git a/debian/patches/series b/debian/patches/series
index 8a3b072..c05b8b8 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -43,3 +43,7 @@
0043-doc-Clarify-import-keys-operation.patch
0044-doc-Clarify-import-keys-operation-further.patch
python-3.6/0045-Try-to-find-python-3.6-as-well.patch
+0046-python-Improve-keylist-test.patch
+0047-python-Support-parallel-build-in-tests.patch
+0048-Fix-a-couple-of-bugs-pointed-out-by-clang-compiler-w.patch
+reduce-spurious-close/0049-core-Restore-get_max_fds-optimization-on-Linux.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gpgme.git
More information about the Pkg-gnupg-commit
mailing list