Dave Huseby <[email protected]> writes:

> Fix the way GPG keyrings are imported during testing to prevent GPG from 
> prompting for approval to change the default config. This appears to have no
> adverse affects on GPG users with "normal" configurations but fixes the
> always-interactive prompting I see with my multi-keyring setup.

I do not quite follow.  If you are personally setting "always
interactive" somehow, would it be possible to solve the issue more
directly by unsetting "always interactive" here?  After all, the
"${GNUPGHOME}" we see in the test helper library is not referring to
your setting but our throw-away setting used only during the test,
so...

> v2: fixed the whitespace.

This line goes below "---"

>
> Signed-off-by: Dave Huseby <[email protected]>
> ---
>  t/lib-gpg.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
> index 8d28652b72..e72e0554f1 100755
> --- a/t/lib-gpg.sh
> +++ b/t/lib-gpg.sh
> @@ -32,8 +32,8 @@ then
>               GNUPGHOME="$(pwd)/gpghome" &&
>               export GNUPGHOME &&
>               (gpgconf --kill gpg-agent >/dev/null 2>&1 || : ) &&
> -             gpg --homedir "${GNUPGHOME}" 2>/dev/null --import \
> -                     "$TEST_DIRECTORY"/lib-gpg/keyring.gpg &&
> +             gpg --import-options merge-only --homedir "${GNUPGHOME}" 
> 2>/dev/null \
> +                     --import "$TEST_DIRECTORY"/lib-gpg/keyring.gpg &&

This patch, without any explanation in the proposed log message,
gives an impression that '--import-options merge-only' somehow must
be inserted before '--homedir "${GNUPGHOME}"'.  If that is truly
required, the reason why it must be done before --homedir needs to
be explained in the log message.  If not, inserting before --homedir
is making the patch unnecessarily misleading.  If the lines were
like so:

-               gpg --homedir "${GNUPGHOME}" 2>/dev/null --import \
-                       "$TEST_DIRECTORY"/lib-gpg/keyring.gpg &&
+               gpg --homedir "${GNUPGHOME}" 2>/dev/null \
+                       --import-options merge-only \
+                       --import "$TEST_DIRECTORY"/lib-gpg/keyring.gpg &&

the patch wouldn't have forced readers wonder why the new option
has to come first.

But as I said earlier, there needs a better explanation why it helps
to have --import-options to squelch prompts---the cause-effect linkage
is a bit too weak to make a convincing case to support why this is
the right fix to a problem worth fixing.

Thanks.

>               gpg --homedir "${GNUPGHOME}" 2>/dev/null --import-ownertrust \
>                       "$TEST_DIRECTORY"/lib-gpg/ownertrust &&
>               gpg --homedir "${GNUPGHOME}" </dev/null >/dev/null 2>&1 \

Reply via email to