[PATCH 2/2] test: use gpgconf --create-socketdir if available

2017-02-14 Thread David Bremner
This enables the shortened socket pathes in /run or equivalent. The
explicit call to gpgconf is needed for nonstandard GNUPGHOME settings.
---
 test/test-lib.sh | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index 86e792a8..9aa6163b 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -229,9 +229,18 @@ test_fixed=0
 test_broken=0
 test_success=0
 
+
+_shutdown_gpg_agent () {
+if [ ${NOTMUCH_HAVE_GPGCONF_SOCKETDIR} == 1 ]; then
+   gpgconf --kill gpg-agent
+   gpgconf --remove-socketdir
+fi
+}
+
 _exit_common () {
code=$?
trap - EXIT
+   _shutdown_gpg_agent
set +ex
rm -rf "$TEST_TMPDIR"
 }
@@ -1276,6 +1285,11 @@ test_init_ () {
 
 . ./test-lib-common.sh || exit 1
 
+# we need the setting of GNUPGHOME in test-lib-common.sh
+if [ ${NOTMUCH_HAVE_GPGCONF_SOCKETDIR} == 1 ]; then
+gpgconf --create-socketdir
+fi
+
 emacs_generate_script
 
 
-- 
2.11.0

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Proposed fix for test failures due to long socket paths

2017-02-14 Thread David Bremner
Amadeusz Żołnowski found a bug in the test suite that causes gpg
failures when the path of the test directory is sufficiently long.
His current solution in Gentoo is to move the sockets into /tmp. It
seems cleaner to enable gnupg's built in /run based short pathed
sockets.  As far as I know the gpgconf option used here is available
in gnupg 2.1.13 and later. Amadeusz reported that the problem was
"fixed" in Gentoo by downgrading gnupg to 2.1.15. So while I'm not
100% sure, it seems like a fix for very recent gnupg is all that is
required. Testing of these patches with older gpg would be
particularly welcome.

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 1/2] configure: add test for gpgconf --create-socketdir

2017-02-14 Thread David Bremner
This is primarily intended for use in the test suite (since notmuch
builds fine without gnupg installed). Thus we only write the variable
to sh.config.
---
 configure | 16 
 1 file changed, 16 insertions(+)

diff --git a/configure b/configure
index f1773044..46063b5d 100755
--- a/configure
+++ b/configure
@@ -602,6 +602,19 @@ if [ $WITH_DOCS = "1" ] ; then
 fi
 fi
 
+have_gpgconf_socketdir=0
+printf "Checking for gpgconf --{create,remove}-socketdir... "
+if gpgconf --dump-options > /dev/null ; then
+if gpgconf --dump-options | grep -q create-socketdir ; then
+   printf "Yes.\n"
+   have_gpgconf_socketdir=1
+else
+   printf "No.\n"
+fi
+else
+printf "No. (missing or broken gpgconf?)\n"
+fi
+
 libdir_in_ldconfig=0
 
 printf "Checking which platform we are on... "
@@ -1179,6 +1192,9 @@ NOTMUCH_PYTHON=${python}
 # Are the ruby development files (and ruby) available? If not skip
 # building/testing ruby bindings.
 NOTMUCH_HAVE_RUBY_DEV=${have_ruby_dev}
+
+# Recent enough gnupg to support gpgconf --create-socketdir?
+NOTMUCH_HAVE_GPGCONF_SOCKETDIR=${have_gpgconf_socketdir}
 EOF
 
 # Finally, after everything configured, inform the user how to continue.
-- 
2.11.0

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 1/2] configure: add test for gpgconf --create-socketdir

2017-02-14 Thread David Bremner

Note that Amadeusz's actual address is aide...@aidecoe.name, you might
want to correct in any followups.

d

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch