public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jonas Rebmann <kernel@schlaraffenlan•de>
To: phillip.wood@dunelm•org.uk,
	Jonas Rebmann <kernel@schlaraffenlan•de>,
	git@vger•kernel.org
Cc: Chris Down <chris@chrisdown•name>, Jeff King <peff@peff•net>
Subject: Re: [PATCH v2 2/2] rev-parse: use selected alternate terms too look up refs
Date: Tue, 24 Mar 2026 13:30:54 +0100	[thread overview]
Message-ID: <888f8670-856a-4ce7-8177-da78ba4f0c8a@schlaraffenlan.de> (raw)
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

  reply	other threads:[~2026-03-24 13:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23 22:48 [PATCH v2 0/2] Avoid hardcoded "good"/"bad" bisect terms Jonas Rebmann
2026-03-23 22:48 ` [PATCH v2 1/2] bisect: use selected alternate terms in status output Jonas Rebmann
2026-03-24 10:43   ` Phillip Wood
2026-03-24 17:33     ` Junio C Hamano
2026-03-23 22:49 ` [PATCH v2 2/2] rev-parse: use selected alternate terms too look up refs Jonas Rebmann
2026-03-24 10:49   ` Phillip Wood
2026-03-24 12:30     ` Jonas Rebmann [this message]
2026-03-24 14:11       ` Phillip Wood
2026-03-24 13:45   ` Junio C Hamano

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

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

  git send-email \
    --in-reply-to=888f8670-856a-4ce7-8177-da78ba4f0c8a@schlaraffenlan.de \
    --to=kernel@schlaraffenlan$(echo .)de \
    --cc=chris@chrisdown$(echo .)name \
    --cc=git@vger$(echo .)kernel.org \
    --cc=peff@peff$(echo .)net \
    --cc=phillip.wood@dunelm$(echo .)org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox