git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 1/1] t/lib-gpg.sh: fix GPG keyring import options

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 20, 2019, 01:15 UTC
Message-ID
<xmqqo966wdkr.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20190319232013.t5pmbgfgojjbczqh@localhost>
Dave Huseby <dhuseby@linuxfoundation.org> 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 "---"
Show 18 quoted lines
>
> Signed-off-by: Dave Huseby <dhuseby@linuxfoundation.org>
> ---
>  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 \
Previous: Dave HusebyNext: SZEDER Gábor
Message 2 of 3 in “t/lib-gpg.sh: fix GPG keyring import options”
  1. 1/1 t/lib-gpg.sh: fix GPG keyring import optionsDave Huseby, Mar 19, 2019
  2. Junio C HamanoMar 20, 2019
  3. SZEDER GáborMar 20, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.