Git development
 help / color / mirror / Atom feed
* [PATCH] t7004: check a missing key without deleting gpghome
@ 2026-10-08  9:07 Harald Nordgren via GitGitGadget
  2026-10-08 19:40 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Harald Nordgren via GitGitGadget @ 2026-10-08  9:07 UTC (permalink / raw)
  To: git; +Cc: Harald Nordgren, Harald Nordgren

From: Harald Nordgren <haraldnordgren@gmail.com>

The "verify signed tag fails when public key is not present" test
deletes gpghome to lose the key, and this sometimes fails on Alpine
with

    rm: can't remove 'gpghome/S.gpg-agent.extra': No such file or directory

Point GNUPGHOME at an unused directory for the verification, which is
how t7510 checks a signature whose key is unknown.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
---
    t7004: check a missing key without deleting gpghome
    
    Fix flaky test by checking missing key without deleting gpghome.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2443%2FHaraldNordgren%2Fflaky-gpg-http2-tests-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2443/HaraldNordgren/flaky-gpg-http2-tests-v1
Pull-Request: https://github.com/git/git/pull/2443

 t/t7004-tag.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 8c795d7218..a0c2c9a3a1 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -11,6 +11,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
 . ./test-lib.sh
+GNUPGHOME_NOT_USED=$GNUPGHOME
 . "$TEST_DIRECTORY"/lib-gpg.sh
 . "$TEST_DIRECTORY"/lib-terminal.sh
 
@@ -1525,8 +1526,7 @@ test_expect_success GPGSM 'git tag -s fails if gpgsm is misconfigured (bad signa
 # try to verify without gpg:
 
 test_expect_success GPG 'verify signed tag fails when public key is not present' '
-	rm -rf gpghome &&
-	test_must_fail git tag -v signed-tag
+	test_must_fail env GNUPGHOME="$GNUPGHOME_NOT_USED" git tag -v signed-tag
 '
 
 test_expect_success 'git tag -a fails if tag annotation is empty' '

base-commit: 6de20f6092dcf9bdb1c8efe03db4b70c82b423dd
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] t7004: check a missing key without deleting gpghome
  2026-10-08  9:07 [PATCH] t7004: check a missing key without deleting gpghome Harald Nordgren via GitGitGadget
@ 2026-10-08 19:40 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2026-10-08 19:40 UTC (permalink / raw)
  To: Harald Nordgren via GitGitGadget; +Cc: git, Harald Nordgren

"Harald Nordgren via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Harald Nordgren <haraldnordgren@gmail.com>
>
> The "verify signed tag fails when public key is not present" test
> deletes gpghome to lose the key, and this sometimes fails on Alpine
> with
>
>     rm: can't remove 'gpghome/S.gpg-agent.extra': No such file or directory
>
> Point GNUPGHOME at an unused directory for the verification, which is
> how t7510 checks a signature whose key is unknown.
>
> Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
> ---

Interesting.  It is curious why removal "sometimes" fails but it
is coming from clean-up the gpg-agent tries to do, probably.

In any case, it is a very good idea to borrow solution from an
existing test.  Nicely done.

Will queue.  Thanks.

>     t7004: check a missing key without deleting gpghome
>     
>     Fix flaky test by checking missing key without deleting gpghome.
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2443%2FHaraldNordgren%2Fflaky-gpg-http2-tests-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2443/HaraldNordgren/flaky-gpg-http2-tests-v1
> Pull-Request: https://github.com/git/git/pull/2443
>
>  t/t7004-tag.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
> index 8c795d7218..a0c2c9a3a1 100755
> --- a/t/t7004-tag.sh
> +++ b/t/t7004-tag.sh
> @@ -11,6 +11,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
>  export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
>  
>  . ./test-lib.sh
> +GNUPGHOME_NOT_USED=$GNUPGHOME
>  . "$TEST_DIRECTORY"/lib-gpg.sh
>  . "$TEST_DIRECTORY"/lib-terminal.sh
>  
> @@ -1525,8 +1526,7 @@ test_expect_success GPGSM 'git tag -s fails if gpgsm is misconfigured (bad signa
>  # try to verify without gpg:
>  
>  test_expect_success GPG 'verify signed tag fails when public key is not present' '
> -	rm -rf gpghome &&
> -	test_must_fail git tag -v signed-tag
> +	test_must_fail env GNUPGHOME="$GNUPGHOME_NOT_USED" git tag -v signed-tag
>  '
>  
>  test_expect_success 'git tag -a fails if tag annotation is empty' '
>
> base-commit: 6de20f6092dcf9bdb1c8efe03db4b70c82b423dd

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-08 19:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-08  9:07 [PATCH] t7004: check a missing key without deleting gpghome Harald Nordgren via GitGitGadget
2026-10-08 19:40 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox