git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git List <git@vger.kernel.org>,
	Ramkumar Ramachandra <r@artagnon.com>,
	Christian Couder <christian.couder@gmail.com>,
	"Miriam R." <mirucam@gmail.com>
Subject: Re: [PATCH v2 4/4] bisect--helper: double-check run command on exit code 126 and 127
Date: Thu, 03 Feb 2022 16:42:33 -0800	[thread overview]
Message-ID: <xmqqa6f7pime.fsf@gitster.g> (raw)
In-Reply-To: <20987dc6-e0c7-6ca2-19fd-2b323b3f6d9f@web.de> ("René Scharfe"'s message of "Tue, 18 Jan 2022 13:46:32 +0100")

René Scharfe <l.s.r@web.de> writes:

> When a run command cannot be executed or found, shells return exit code
> 126 or 127, respectively.  Valid run commands are allowed to return
> these codes as well to indicate bad revisions, though, for historical
> reasons.  This means typos can cause bogus bisect runs that go over the
> full distance and end up reporting invalid results.
>
> The best solution would be to reserve exit codes 126 and 127, like
> 71b0251cdd (Bisect run: "skip" current commit if script exit code is
> 125., 2007-10-26) did for 125, and abort bisect run when we get them.
> That might be inconvenient for those who relied on the documentation
> stating that 126 and 127 can be used for bad revisions, though.

I think the basic idea is sound and useful.  How happy are we who
was involved in the discussion with this result?

> +static int get_first_good(const char *refname, const struct object_id *oid,
> +			  int flag, void *cb_data)
> +{
> +	oidcpy(cb_data, oid);
> +	return 1;
> +}

OK, this iterates and stops at the first one.

> +static int verify_good(const struct bisect_terms *terms,
> +		       const char **quoted_argv)
> +{
> +	int rc;
> +	enum bisect_error res;
> +	struct object_id good_rev;
> +	struct object_id current_rev;
> +	char *good_glob = xstrfmt("%s-*", terms->term_good);
> +	int no_checkout = ref_exists("BISECT_HEAD");
> +
> +	for_each_glob_ref_in(get_first_good, good_glob, "refs/bisect/",
> +			     &good_rev);
> +	free(good_glob);
> +
> +	if (read_ref(no_checkout ? "BISECT_HEAD" : "HEAD", &current_rev))
> +		return -1;

 * Could the current_rev already be marked as "good", in which case
   we can avoid cost of rewriting working tree files to a
   potentially distant revision?  I often do manual tests to mark
   "bisect good" or "bisect bad" before using "bisect run".

 * Can we have *no* rev that is marked as "good"?  I think we made
   it possible to say "my time is more valuable than machine cycles,
   so I'll only tell you that this revision is broken and give you
   no limit on the bottom side of the history.  still assume that
   there was only one good-to-bad transition in the history and find
   it" by supplying only one "bad" and no "good" when starting to
   bisect.  And in such a case, ...

> +	res = bisect_checkout(&good_rev, no_checkout);

... this would feed an uninitialized object_id to bisect_checkout.

Thanks.

  parent reply	other threads:[~2022-02-04  0:42 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-09 19:29 git bisect bad @ Ramkumar Ramachandra
2022-01-09 19:54 ` Junio C Hamano
2022-01-09 20:48   ` Ramkumar Ramachandra
2022-01-10  9:01     ` [PATCH] bisect: report actual bisect_state() argument on error René Scharfe
2022-01-10 10:04       ` Ramkumar Ramachandra
2022-01-10 17:06     ` git bisect bad @ Junio C Hamano
2022-01-10 21:04       ` Ramkumar Ramachandra
2022-01-12  9:04         ` René Scharfe
2022-01-12 17:50           ` Junio C Hamano
2022-01-12 18:34             ` René Scharfe
2022-01-13  5:10               ` René Scharfe
2022-01-13  9:32                 ` Ramkumar Ramachandra
2022-01-13 12:28                   ` Christian Couder
2022-01-13 13:55                     ` René Scharfe
2022-01-13 15:16                       ` Ramkumar Ramachandra
2022-01-14  7:47                         ` René Scharfe
2022-01-14  8:04                           ` Ramkumar Ramachandra
2022-01-18 12:45                             ` René Scharfe
2022-01-14 18:42                           ` Junio C Hamano
2022-01-13 18:40                       ` Junio C Hamano
2022-01-18 12:45     ` [PATCH v2 1/4] bisect--helper: report actual bisect_state() argument on error René Scharfe
2022-01-18 12:46     ` [PATCH v2 2/4] bisect--helper: release strbuf and strvec on run error René Scharfe
2022-01-18 12:46     ` [PATCH v2 3/4] bisect: document run behavior with exit codes 126 and 127 René Scharfe
2022-01-18 12:46     ` [PATCH v2 4/4] bisect--helper: double-check run command on exit code " René Scharfe
2022-01-19  2:36       ` Junio C Hamano
2022-01-19  7:52         ` René Scharfe
2022-02-04  0:42       ` Junio C Hamano [this message]
2022-02-04 17:16         ` René Scharfe
2022-02-04 18:16         ` Ramkumar Ramachandra
2022-02-04 19:32           ` Junio C Hamano
2022-02-04 18:09       ` Ramkumar Ramachandra

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=xmqqa6f7pime.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=l.s.r@web.de \
    --cc=mirucam@gmail.com \
    --cc=r@artagnon.com \
    /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.
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 NNTP newsgroup(s).