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

Re: [PATCH] t/lib-gpg: fix ssh-keygen -Y check-novalidate with openssh-9.0

From
Todd Zullinger <tmz@pobox.com>
Date
May 26, 2023, 05:28 UTC
Message-ID
<ZHBDbGjid-33cJb4@pobox.com>
In-Reply-To
<xmqqsfbjeltg.fsf@gitster.g>
Junio C Hamano wrote:
Show 39 quoted lines
> While I was trying to see if the symptom reproduces in my
> environment roughly based on Debian testing, I had this trivial test
> script
> 
>     #!/bin/sh
> 
>     test_description='heh???'
> 
>     . ./test-lib.sh
>     . "$TEST_DIRECTORY/lib-gpg.sh"
> 
>     test_expect_success setup '
>             : test_have_prereq GPG &&
>             test_have_prereq GPGSSH_VERIFYTIME
>     '
> 
>     test_done
> 
> and noticed that GPGSSH_VERIFYTIME prerequisite does not pass
> regardless of the version of ssh-keygen installed, without first
> triggering GPG prereq to cause "$GNUPGHOME" to get created.
> Otherwise, this part
> 
> 	# Set up keys with key lifetimes
> 	ssh-keygen -t ed25519 -N "" -C "timeboxed valid key" -f "${GPGSSH_KEY_TIMEBOXEDVALID}" >/dev/null &&
> 
> because GPGSSH_KEY_TIMEBOXEDVALID is defined to be created under
> GNUPGHOME, would not work.
> 
> I notice that GPGSM lazy prereq forces GPG prereq to be triggered
> by starting it like so:
> 
>     test_lazy_prereq GPGSM '
>             test_have_prereq GPG &&
> 
> and I think we should do the same for GPGSSH_VERIFYTIME for
> completeness in the longer term.  The current users of the
> prerequisite all seem to trigger GPG prerequisite check so
> this is not all that urgent, though.
Good idea. Perhaps:
	test_lazy_prereq GPGSSH_VERIFYTIME '
		test_have_prereq GPGSSH &&

is best there? The GPGSSH prereq creates ${GNUPGHOME}. It may not be common, but there may be folks who want to run the SSH tests and don't care about GPG.

Something like this? (Sorry to distract you further in the RC period. :)

-- 8< --
Subject: [PATCH] t/lib-gpg: require GPGSSH for GPGSSH_VERIFYTIME prereq

The GPGSSH_VERIFYTIME prequeq makes use of "${GNUPGHOME}" but does not create it. Require GPGSSH which creates the "${GNUPGHOME}" directory.

Additionally, it makes sense to require GPGSSH in GPGSSH_VERIFYTIME because the latter builds on the former. If we can't use GPGSSH, there's little point in checking whether GPGSSH_VERIFYTIME is usable.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Todd Zullinger <tmz@pobox.com>
---
 t/lib-gpg.sh | 1 +
 1 file changed, 1 insertion(+)
diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
index 114785586a..db63aeb6ed 100644
--- a/t/lib-gpg.sh
+++ b/t/lib-gpg.sh
@@ -135,6 +135,7 @@ test_lazy_prereq GPGSSH '
 '
 
 test_lazy_prereq GPGSSH_VERIFYTIME '
+	test_have_prereq GPGSSH &&
 	# Check if ssh-keygen has a verify-time option by passing an invalid date to it
 	ssh-keygen -Overify-time=INVALID -Y check-novalidate -s doesnotmatter 2>&1 | grep -q -F "Invalid \"verify-time\"" &&
 
-- 8< --
-- 
Todd
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 5 in “t/lib-gpg: fix ssh-keygen -Y check-novalidate with openssh-9.0”
  1. t/lib-gpg: fix ssh-keygen -Y check-novalidate with openssh-9.0Todd Zullinger, May 25, 2023
  2. Junio C HamanoMay 26, 2023
  3. Todd ZullingerMay 26, 2023
  4. Junio C HamanoJun 1, 2023
  5. t/lib-gpg: require GPGSSH for GPGSSH_VERIFYTIME prereqTodd Zullinger, Jun 6, 2023

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.