On 11.01.2022 14:40, Taylor Blau wrote:
On Tue, Jan 11, 2022 at 06:26:21PM +0100, Fabian Stelzer wrote:
> 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.
Thanks. Interesting
> 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.
Yeah. I checked the other uses of GNUPGHOME and the NOT_USED seems fine (and
more consistent with existing tests). So let's use it.
Even if some other (non gpg related) test accidentally pollutes this gpghome
it would surely not do so with the actual signing key used in the test
suite.
Thanks, I'll send a new patch in a second
Thanks,
Taylor
[1]: https://lore.kernel.org/git/xmqqbn3l3kmc.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxxx/