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

Re: [PATCH] t/gpg: simplify test for unknown key

From
Taylor Blau <me@ttaylorr.com>
Date
Jan 11, 2022, 19:40 UTC
Message-ID
<Yd3dQkGxG1hbjThH@nand.local>
In-Reply-To
<20220111172621.qwupg4oyosvpeguu@fs>
On Tue, Jan 11, 2022 at 06:26:21PM +0100, Fabian Stelzer wrote:
Show 11 quoted lines
> > I was about to submit
> > exactly this patch for you but with:
> >
> > 	-       test_must_fail git verify-commit thirteenth-signed 2>actual &&
> > 	+       test_must_fail env GNUPGHOME="$GNUPGHOME_NOT_USED" git verify-commit initial 2>actual &&
> >
> > Both of those are probably a good thing to do here. I.e.:
> >
> > 1. Didn't we have portability issues with "ENV_VAR=VALUE shell_function ..." ?
>
> I'm not good with portability stuff and trust your judgment on this.

See [1] and the ensuing discussion for a good summary. Re-reading that thread and comparing it with what we see with `git grep test_must_fail env -- t` confirms that that

    test_must_fail env GNUPGHOME="$GNUPGHOME_NOT_USED" git verify-commit ...
is the right thing to do here.
Show 10 quoted lines
> > 2. You're pointing to a nonexisting ./empty_home, but shouldn't we use
> >    $GNUPGHOME_NOT_USED? The existing "show unknown signature with custom format"
> >    test in the same file does that.
>
> I was not aware of $GNUPGHOME_NOT_USED but it is used in a similar fashion.
> However it is set to the old value of $GNUPGHOME before we change it in
> lib-gpg.sh which seems wrong to me. Wouldn't it then just pick up the gpg
> homedir of whatever the test environment has?
> Using the variable is good, but i would set it to a known empty directory
> or?

Yeah, t7510 captures the value of $GNUPGHOME as $GNUPGHOME_NOT_USED before sourcing t/lib-gpg.sh. So long as nobody else has tampered with $GNUPGHOME, they should get `$TRASH_DIRECTORY/gnupg-home-not-used`.

But I'm less certain that there isn't somebody accidentally ignoring the "not-used" portion of the test $GNUPGHOME ;).

And I don't think that reasoning through it all is that worthwhile, so I'm fine with what a much more direct ./empty_home here.

Thanks, Taylor

[1]: https://lore.kernel.org/git/xmqqbn3l3kmc.fsf@gitster.mtv.corp.google.com/
Previous: Fabian StelzerNext: Fabian Stelzer
Message 5 of 10 in “t/gpg: simplify test for unknown key”
  1. t/gpg: simplify test for unknown keyFabian Stelzer, Jan 7, 2022
  2. Junio C HamanoJan 7, 2022
  3. Ævar Arnfjörð BjarmasonJan 11, 2022
  4. Fabian StelzerJan 11, 2022
  5. Taylor BlauJan 11, 2022
  6. Fabian StelzerJan 12, 2022
  7. t/gpg: simplify test for unknown keyFabian Stelzer, Jan 12, 2022
  8. Taylor BlauJan 12, 2022
  9. Junio C HamanoJan 12, 2022
  10. Josh SteadmonJan 14, 2022

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.