unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Proposed fix for test failures due to long socket paths
@ 2017-02-14 21:42 David Bremner
  2017-02-14 21:42 ` [PATCH 1/2] configure: add test for gpgconf --create-socketdir David Bremner
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: David Bremner @ 2017-02-14 21:42 UTC (permalink / raw)
  To: notmuch; +Cc: aidecode

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] configure: add test for gpgconf --create-socketdir
  2017-02-14 21:42 Proposed fix for test failures due to long socket paths David Bremner
@ 2017-02-14 21:42 ` David Bremner
  2017-02-14 22:02   ` David Bremner
  2017-02-14 21:42 ` [PATCH 2/2] test: use gpgconf --create-socketdir if available David Bremner
  2017-02-21 12:19 ` Proposed fix for test failures due to long socket paths David Bremner
  2 siblings, 1 reply; 8+ messages in thread
From: David Bremner @ 2017-02-14 21:42 UTC (permalink / raw)
  To: notmuch; +Cc: aidecode, 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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] test: use gpgconf --create-socketdir if available
  2017-02-14 21:42 Proposed fix for test failures due to long socket paths David Bremner
  2017-02-14 21:42 ` [PATCH 1/2] configure: add test for gpgconf --create-socketdir David Bremner
@ 2017-02-14 21:42 ` David Bremner
  2017-02-15 18:17   ` Daniel Kahn Gillmor
  2017-02-19 10:24   ` Tomi Ollila
  2017-02-21 12:19 ` Proposed fix for test failures due to long socket paths David Bremner
  2 siblings, 2 replies; 8+ messages in thread
From: David Bremner @ 2017-02-14 21:42 UTC (permalink / raw)
  To: notmuch; +Cc: aidecode, 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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] configure: add test for gpgconf --create-socketdir
  2017-02-14 21:42 ` [PATCH 1/2] configure: add test for gpgconf --create-socketdir David Bremner
@ 2017-02-14 22:02   ` David Bremner
  0 siblings, 0 replies; 8+ messages in thread
From: David Bremner @ 2017-02-14 22:02 UTC (permalink / raw)
  To: notmuch; +Cc: aidecode


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

d

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] test: use gpgconf --create-socketdir if available
  2017-02-14 21:42 ` [PATCH 2/2] test: use gpgconf --create-socketdir if available David Bremner
@ 2017-02-15 18:17   ` Daniel Kahn Gillmor
  2017-02-15 18:59     ` David Bremner
  2017-02-19 10:24   ` Tomi Ollila
  1 sibling, 1 reply; 8+ messages in thread
From: Daniel Kahn Gillmor @ 2017-02-15 18:17 UTC (permalink / raw)
  To: David Bremner, notmuch

[-- Attachment #1: Type: text/plain, Size: 809 bytes --]

On Tue 2017-02-14 16:42:39 -0500, David Bremner wrote:
> This enables the shortened socket pathes in /run or equivalent. The
> explicit call to gpgconf is needed for nonstandard GNUPGHOME settings.

For the current GnuPG 2.1.18, this pair of patches looks reasonable to
me, and it should indeed solve builds in deeply-nested paths.

That said, i currently consider this a workaround to a bug that should
really be fixed in GnuPG itself, as i noted on gnupg-users:

  https://lists.gnupg.org/pipermail/gnupg-users/2017-February/057692.html
  id:87k28rl6o8.fsf@alice.fifthhorseman.net

I'd love to not see this kind of workaround cruft pile up, because it
tends to cause problems in the future.  is there a way that we can mark
this sort of thing for fairly prompt removal once it's fixed upstream?

     --dkg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] test: use gpgconf --create-socketdir if available
  2017-02-15 18:17   ` Daniel Kahn Gillmor
@ 2017-02-15 18:59     ` David Bremner
  0 siblings, 0 replies; 8+ messages in thread
From: David Bremner @ 2017-02-15 18:59 UTC (permalink / raw)
  To: Daniel Kahn Gillmor, notmuch

Daniel Kahn Gillmor <dkg@fifthhorseman.net> writes:

> I'd love to not see this kind of workaround cruft pile up, because it
> tends to cause problems in the future.  is there a way that we can mark
> this sort of thing for fairly prompt removal once it's fixed upstream?

Maybe once a gnupg bug is filed, write to this list with the suggestion
that we back out the workaround when the bug is fixed upstream
(although we have to think about how long to support gnupg
2.1.18. Thanks debian!). We can then tag that message as a bug in
nmbug.

d

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] test: use gpgconf --create-socketdir if available
  2017-02-14 21:42 ` [PATCH 2/2] test: use gpgconf --create-socketdir if available David Bremner
  2017-02-15 18:17   ` Daniel Kahn Gillmor
@ 2017-02-19 10:24   ` Tomi Ollila
  1 sibling, 0 replies; 8+ messages in thread
From: Tomi Ollila @ 2017-02-19 10:24 UTC (permalink / raw)
  To: David Bremner

On Tue, Feb 14 2017, David Bremner <david@tethera.net> wrote:

> This enables the shortened socket pathes in /run or equivalent. The
> explicit call to gpgconf is needed for nonstandard GNUPGHOME settings.

2½ comments inline:

__> ---
>  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

 '==' is bashishm (well, maybe works in zsh too), standard
with [ ... ] and (builtin) test(1) is just single '=' for equality.

> +	gpgconf --kill gpg-agent
> +	gpgconf --remove-socketdir
> +    fi
> +}
> +
>  _exit_common () {
>  	code=$?
>  	trap - EXIT
> +	_shutdown_gpg_agent

better put `set +ex` _before_ `_shutdown_gpg_agent` so that possible failure
there may not stop exit processing

>  	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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Proposed fix for test failures due to long socket paths
  2017-02-14 21:42 Proposed fix for test failures due to long socket paths David Bremner
  2017-02-14 21:42 ` [PATCH 1/2] configure: add test for gpgconf --create-socketdir David Bremner
  2017-02-14 21:42 ` [PATCH 2/2] test: use gpgconf --create-socketdir if available David Bremner
@ 2017-02-21 12:19 ` David Bremner
  2 siblings, 0 replies; 8+ messages in thread
From: David Bremner @ 2017-02-21 12:19 UTC (permalink / raw)
  To: notmuch; +Cc: aidecode

David Bremner <david@tethera.net> writes:

> 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.

Pushed the series (with Tomi's changes) to release and master

d

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-02-21 12:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-14 21:42 Proposed fix for test failures due to long socket paths David Bremner
2017-02-14 21:42 ` [PATCH 1/2] configure: add test for gpgconf --create-socketdir David Bremner
2017-02-14 22:02   ` David Bremner
2017-02-14 21:42 ` [PATCH 2/2] test: use gpgconf --create-socketdir if available David Bremner
2017-02-15 18:17   ` Daniel Kahn Gillmor
2017-02-15 18:59     ` David Bremner
2017-02-19 10:24   ` Tomi Ollila
2017-02-21 12:19 ` Proposed fix for test failures due to long socket paths David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).