git/list[1] front-page[2] threads[3] people[4] search[5] about
wed 2026-10-07 16:11 UTC

Re: [PATCH v2 2/2] rev-parse: use selected alternate terms too look up refs

From
JRJonas Rebmann <kernel@schlaraffenlan.de>
Date
Mar 24, 2026, 12:30 UTC
Message-ID
<888f8670-856a-4ce7-8177-da78ba4f0c8a@schlaraffenlan.de>
In-Reply-To
<d366fc82-efcc-46cb-9536-cd38b1fd18d4@gmail.com>
Hi Phillip,
Thank you for your feedback, it will be addressed in v3.
On 24/03/2026 11.49, Phillip Wood wrote:
> If we fail to read the terms because there is no bisect in progress
> then term_bad and term_good will be NULL and so the next line will
> segfault.

My understanding of read_bisect_terms() was that it never sets the terms to NULL, that if no bisect is in progress, .git/BISECT_TERMS does not exist, and the terms default to "good"/"bad" here in bisect.c:

	if (errno == ENOENT) {
		free(*read_bad);
		*read_bad = xstrdup("bad");
		free(*read_good);
		*read_good = xstrdup("good");
		return;
	} else {
		die_errno(_("could not read file '%s'"), filename);
	}
So is a NULL-check really needed on caller end?

Regards, Jonas

Previous: Phillip WoodNext: Junio C Hamano
Message 6 of 9 in “Avoid hardcoded "good"/"bad" bisect terms”
  1. 0/2 Avoid hardcoded "good"/"bad" bisect termsJonas Rebmann, Mar 23, 2026
  2. 1/2 bisect: use selected alternate terms in status outputJonas Rebmann, Mar 23, 2026
  3. 2/2 rev-parse: use selected alternate terms too look up refsJonas Rebmann, Mar 23, 2026
  4. Phillip WoodMar 24, 2026
  5. Phillip WoodMar 24, 2026
  6. Jonas RebmannMar 24, 2026
  7. Junio C HamanoMar 24, 2026
  8. Phillip WoodMar 24, 2026
  9. Junio C HamanoMar 24, 2026

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.