git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Martin Ågren" <martin.agren@gmail.com>
To: Yasushi SHOJI <yasushi.shoji@gmail.com>
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	git@vger.kernel.org, "Christian Couder" <chriscool@tuxfamily.org>,
	"Junio C Hamano" <gitster@pobox.com>
Subject: Re: [BUG] v2.16.0-rc0 seg faults when git bisect skip
Date: Sat,  6 Jan 2018 09:21:16 +0100	[thread overview]
Message-ID: <20180106082116.11057-1-martin.agren@gmail.com> (raw)
In-Reply-To: <CAELBRWLyZ5s2Wvk2U5Ks2adx23Z+51dbEs3QbAq+5nGLe21srQ@mail.gmail.com>

> On Fri, Jan 5, 2018 at 11:45 AM, Yasushi SHOJI <yasushi.shoji@gmail.com> wrote:
>> When does the list allowed to contain NULLs?

Short answer: there are no commits left to test.

The list is built in the for-loop in `find_bisection()`. So the
technical answer is: if all commits in the initial list `commit_list`
are UNINTERESTING (including if `commit_list` is empty to begin with).

It's also helpful to study where we should end up from there. We should
take the `if (!revs.commits)` branch in `bisect_next_all()`. That is, we
should print either "There are only 'skip'ped commits left to test. The
first bad commit could be any of:" or "<commit> was both good and bad".

>> Since nobody noticed it since 7c117184d7, it must be a rare case, right?

Right, you marked a commit both good and bad. That's probably not very
common. But it obviously happens. :-)

On 5 January 2018 at 06:28, Yasushi SHOJI <yasushi.shoji@gmail.com> wrote:
> OK, here is the step to reproduce on git.git

Thank you for providing a script for reproducing this. It helped me come
up with the attached patch. The patch is based on ma/bisect-leakfix,
which includes Ævar's patch.

I think this patch could be useful, either as a final "let's test
something previously non-tested; this would have caught the segfault",
or simply squashed into Ævar's patch as a "let's add a test that would
have caught this, and which also tests a previously non-tested code
path."

Thanks for digging and finding a reproduction recipe.

Martin

-- >8 --
Subject: [PATCH] bisect: add test for marking commit both good and bad

Since 670f5fe34f ([PATCH] Fix bisection terminating condition,
2005-08-30), we have noticed and complained when a commit was marked
both good and bad. But we had no tests for this behavior.

Test the behavior when we mark a commit first bad, then good, but also
when we are already in the bad state, where `git bisect skip` should
notice it.

This test would have caught the segfault which was recently fixed in
2e9fdc795c (bisect: fix a regression causing a segfault, 2018-01-03).

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
---
 t/t6030-bisect-porcelain.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
index 8c2c6eaef8..190f0ce0ab 100755
--- a/t/t6030-bisect-porcelain.sh
+++ b/t/t6030-bisect-porcelain.sh
@@ -894,4 +894,13 @@ test_expect_success 'bisect start takes options and revs in any order' '
 	test_cmp expected actual
 '
 
+test_expect_success 'marking commit both good and bad gets reported' '
+	git bisect reset &&
+	git bisect start HEAD &&
+	test_must_fail git bisect good HEAD >out &&
+	test_i18ngrep "both good and bad" out &&
+	test_must_fail git bisect skip >out &&
+	test_i18ngrep "both good and bad" out
+'
+
 test_done
-- 
2.16.0.rc1


  reply	other threads:[~2018-01-06  8:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-03 12:36 [BUG] v2.16.0-rc0 seg faults when git bisect skip Yasushi SHOJI
2018-01-03 14:21 ` Ævar Arnfjörð Bjarmason
2018-01-03 18:26   ` Martin Ågren
2018-01-03 18:48     ` [PATCH] bisect: fix a regression causing a segfault Ævar Arnfjörð Bjarmason
2018-01-05  2:45     ` [BUG] v2.16.0-rc0 seg faults when git bisect skip Yasushi SHOJI
2018-01-05  5:28       ` Yasushi SHOJI
2018-01-06  8:21         ` Martin Ågren [this message]
2018-01-06 14:27           ` Yasushi SHOJI
2018-01-06 15:02             ` Martin Ågren
2018-01-06 15:05             ` Christian Couder
2018-01-08 14:45               ` Yasushi SHOJI
2018-01-08 15:09                 ` Christian Couder
2018-01-09 11:09                   ` Yasushi SHOJI
2018-01-05 22:20       ` 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

  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=20180106082116.11057-1-martin.agren@gmail.com \
    --to=martin.agren@gmail.com \
    --cc=avarab@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=yasushi.shoji@gmail.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.
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).