git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
	Elijah Newren <newren@gmail.com>
Subject: Re: [PATCH] t7518: fix flaky grep invocation
Date: Fri, 16 Oct 2020 17:02:07 -0700	[thread overview]
Message-ID: <xmqqr1px90u8.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <pull.884.git.git.1602891594738.gitgitgadget@gmail.com> (Elijah Newren via GitGitGadget's message of "Fri, 16 Oct 2020 23:39:54 +0000")

"Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:

> output, but on one automatic CI run I observed the following output:
>
> fatal: empty ident name (for <runner@fv-az128-670.gcliasfzo2nullsdbrimjtbyhg.cx.internal.cloudapp.net>) not allowed
>
> Note that 'null' appears as a substring of the domain name, found
> within 'gcliasfzo2nullsdbrimjtbyhg'.  Tighten the test by searching for
> "(null)" rather than "null".

Why do we even need grep again?  If we were to segfault, wouldn't
test_must_fail catch it for us?

... ahh, OK, your libc may allow NULL left in email and that is what
we are trying to catch?

Honestly, I am not sure if it even makes sense to test it like this.
The code that the test tries to protect against future breakages
roughly look like this these days.

	if (!email) {
		... one way to assign non-NULL to email ...
	}
	if (!email) {
		... do other things to assign non-NULL to email or die ...
	}

	if (want_name) {
		... here we require email to be set because we show
		... it in an error message
	}

The original problem was that the code had "if (want_name)" part
first before email==NULL condition has been dealt with, and used
email==NULL in one of the error messages.  The fix was to move the
part that deals with email==NULL up, as it does not need any of the
effects that happen in "if (want_name)" block.

Now, what is this particular test protecting against?  We may again
move the "if (want_name)" block up and trigger the error message in
it that uses e-mail while having NULL in email again?  If so, would
it make more sense to do something along this line, lose the "grep"
and keep "test_must_fail"?  We expect and require at this point in
the code (the patch is inside that "if (want_name)" block) email
must have been set up already, so it would be a BUG() otherwise.

Hmm?

 ident.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git i/ident.c w/ident.c
index 6aba4b5cb6..9b71563d95 100644
--- i/ident.c
+++ w/ident.c
@@ -430,6 +430,8 @@ const char *fmt_ident(const char *name, const char *email,
 			if (strict) {
 				if (using_default)
 					ident_env_hint(whose_ident);
+				if (!email)
+					BUG("NULL email when we need to complain???");
 				die(_("empty ident name (for <%s>) not allowed"), email);
 			}
 			pw = xgetpwuid_self(NULL);

  reply	other threads:[~2020-10-17  5:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-16 23:39 [PATCH] t7518: fix flaky grep invocation Elijah Newren via GitGitGadget
2020-10-17  0:02 ` Junio C Hamano [this message]
2020-10-17 23:35   ` Elijah Newren
2020-10-17  0:08 ` Taylor Blau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqr1px90u8.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).