Subject: Re: What's cooking in git.git (Jul 2017, #04; Thu, 13)

From: Junio C Hamano <[email-masked]>
Date: Tue, 18 Jul 2017 14:38:32 -0700

Santiago Torres <[email-masked]> writes:

> ... It seems Debian oldstable and other variants still ship gpg1,
> which doesn't have it. Would it make sense to have a fallthrough branch
> on the switch statement for gpg2.1 instead? something like the attached patch.

If the problem of leftover agent is limited to a narrow versions of
GPG2, alternatively we could unconditionally attempt to use gpgconf
and ignore the failure ;-), but as long as we know all problematic
ones identify themselves as "gpg (GnuPG) 2.1*", then your patch
(with s/;&/;;/ of course ;-)) sounds very sensible.

> Thanks,

Thank *you* for working on this.

> From 07ab87c1ddb31197a3a5c124ad5a2462a460d4e3 Mon Sep 17 00:00:00 2001
> From: Santiago Torres <[email-masked]>
> Date: Tue, 18 Jul 2017 13:16:11 -0400
> Subject: [RFC/PATCH] t: lib-gpg: flush gpg agent on startup

Perhaps it is about time we lost RFC/ mark from here.

>
> When running gpg-relevant tests, a gpg-daemon is spawned for each
> GNUPGHOME used. This daemon may stay running after the test and cache
> file descriptors for the trash directories, even after the trash
> directory is removed. This leads to ENOENT errors when attempting to
> create files if tests are run multiple times.
>
> Add a cleanup script to force flushing the gpg-agent for that GNUPGHOME
> (if any) before setting up the GPG relevant-environment.
>
> Helped-by: Junio C Hamano <[email-masked]>
> Signed-off-by: Santiago Torres <[email-masked]>
> ---
>  t/lib-gpg.sh | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
> index ec2aa8f68..ffb20a438 100755
> --- a/t/lib-gpg.sh
> +++ b/t/lib-gpg.sh
> @@ -10,6 +10,8 @@ then
>  	'gpg (GnuPG) 1.0.6'*)
>  		say "Your version of gpg (1.0.6) is too buggy for testing"
>  		;;
> +	'gpg (GnuPG) 2.1'*)
> +		GNUPGHOME="$(pwd)/gpghome" gpgconf --kill all ;&
>  	*)
>  		# Available key info:
>  		# * Type DSA and Elgamal, size 2048 bits, no expiration date,