git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-bisect annoyances

From
Christian Couder <chriscool@tuxfamily.org>
Date
Apr 11, 2008, 05:41 UTC
Message-ID
<200804110741.40732.chriscool@tuxfamily.org>
In-Reply-To
<20080410114739.GA15229@elte.hu>
Le jeudi 10 avril 2008, Ingo Molnar a écrit :
> Ok, just in case i dont bore people with "stupid user" experiences and
> logs of sessions of confusion, here's another session i just had with
> Git.
Thanks, this is very much appreciated.
Show 44 quoted lines
> This time it's with our good friend git-bisect - which i thought to
> master pretty well and which i already used successfully to bisect
> kernel bugs up to a hundred times already (at least).
>
> The 'v' repository is a vanilla clone of Linus's upstream linux-2.6.git
> kernel tree with no other modifications done to it.
>
>  dione:~> git-clone v linux-tmp4
>  Initialized empty Git repository in /home/mingo/linux-tmp4/.git/
>  0 blocks
>  Checking out files: 100% (23809/23809), done.
>  dione:~> cd linux-tmp4/
>  dione:~/linux-tmp4> ls
>  COPYING        MAINTAINERS     arch     fs       kernel  samples   usr
>  CREDITS        Makefile        block    include  lib     scripts   virt
>  Documentation  README          crypto   init     mm      security
>  Kbuild         REPORTING-BUGS  drivers  ipc      net     sound
>
>  #
>  # ok, so far so good. done this a thousand times before.
>  #
>  # Now lets check out v2.6.24 and check whether the bug i'm interested
>  # in triggers on v2.6.24. I dont create an extra branch for it, because
>  # this is pure temporary work, i use a plain git-checkout as a
>  # throwaway temporary branch:
>  #
>
>  dione:~/linux-tmp4> git-checkout v2.6.24
>  Note: moving to "v2.6.24" which isn't a local branch
>  If you want to create a new branch from this checkout, you may do so
>  (now or later) by using -b with the checkout command again. Example:
>    git checkout -b <new_branch_name>
>  HEAD is now at 4991408... Linux 2.6.24
>
>  #
>  # i build that kernel and boot it - the bug doesnt trigger - good.
>  # We've got all prerequisites for a bisection session - a 'good' kernel
>  # [v2.6.24] and a 'bad' kernel [HEAD].
>  #
>  #
>
>  dione:~/linux-tmp4> git-bisect start
>  fatal: ref HEAD is not a symbolic ref
>  won't bisect on seeked tree

Yeah, it seems that this is a left over from cogito. There has been some work on it lately but it seems not enough. See:

http://git.kernel.org/?p=git/git.git;a=commitdiff;h=0f497e75f05cdf0c0c1278eaba898cda6f118d71
Show 28 quoted lines
>  #
>  # Hm. It's not a symbolic ref, and git-bisect just wont do it. Ok but
>  # then what, and what can the user do to progress? It should be rather
>  # clear to Git what i'm intending to do here. I'm not interested in
>  # HEAD at all, i want to start bisection and i'll feed the good/bad
>  # points to git-bisect - once it lets me do that.
>  #
>  # Ok, lets see where we are:
>  #
>
>  dione:~/linux-tmp4> git-branch -a
>  * (no branch)
>    master
>    origin/HEAD
>    origin/master
>    origin/new_branch
>
>  #
>  # So perhaps this new, unnamed branch is what is causing the trouble?
>  # Lets try a specific branch then:
>  #
>
>  dione:~/linux-tmp4> git-checkout master
>  Previous HEAD position was 4991408... Linux 2.6.24
>  Switched to branch "master"
>
>  dione:~/linux-tmp4> git-bisect start
>  won't bisect on seeked tree
This seems to work for me with git 1.5.5 on the git tree:

$ git checkout master Switched to branch "master" Your branch is ahead of the tracked remote branch 'origin/master' by 4 commits. $ git bisect start $

What git version do you have ?
Show 22 quoted lines
>  #
>  # Hm, still no go. Lets see what git-bisect has to offer:
>  #
>
>  dione:~/linux-tmp4> git-bisect
>  Usage: /usr/bin/git-bisect
>  [start|bad|good|skip|next|reset|visualize|replay|log|run]
>
>  #
>  # Ah, it has a reset thing, lets try it:
>  #
>
>  dione:~/linux-tmp4> git-bisect reset
>  Note: moving to "49914084e797530d9baaf51df9eda77babc98fa8" which isn't a
>  local branch
>  If you want to create a new branch from this checkout, you may do so
>  (now or later) by using -b with the checkout command again. Example:
>    git checkout -b <new_branch_name>
>  HEAD is now at 4991408... Linux 2.6.24
>
>  dione:~/linux-tmp4> git-bisect start
>  fatal: ref HEAD is not a symbolic ref
This probably come from previous failures.
Show 15 quoted lines
>  #
>  # hm, still no go. I'm not interested in a new branch at all, but i
>  # want to bisect, so lets try what was suggested then and name the
>  # branch:
>  #
>
>  dione:~/linux-tmp4> git-checkout -b tmp
>  Switched to a new branch "tmp"
>
>  #
>  # Looks good so far - can i bisect?
>  #
>
>  dione:~/linux-tmp4> git-bisect start
>  won't bisect on seeked tree
This too.
Show 22 quoted lines
>  #
>  # Hm, still no go. Ok, lets forget this whole temporary branch thing
>  # that looked good and try a more pristine state:
>  #
>
>  dione:~/linux-tmp4> git-checkout -b tmp2 master
>  Previous HEAD position was 4991408... Linux 2.6.24
>  Switched to a new branch "tmp2"
>
>  dione:~/linux-tmp4> git-bisect start
>
>  #
>  # Halleluya! While i have typed much more than i wanted, and ended up
>  # with two extra branches that i have to throw away, it seems to be
>  # working! Although the command printing nothing is not really
>  # reassuring - did it really do something?
>  #
>  # Ok, lets get the bisection going now:
>  #
>
>  dione:~/linux-tmp4> git-bisect good v2.6.24 bad HEAD
>  dione:~/linux-tmp4>

This is really bad, because, as you can see from the man page or "git bisect -h" (see also the patch I just sent), "git bisect good" can take many known good revisions:

git bisect good [<rev>...]
        mark <rev>... known-good revisions.
So you marked also "bad" and HEAD as "good".
This is really strange, because here I get for example:

$ git-bisect good bad HEAD Bad rev input: bad HEAD

So you must have something tagged as "bad" or have a "bad" branch, and that's why the command works for you but does the wrong thing.

If you wanted to do it all in one command you could have done:
$ git bisect start HEAD v2.6.24
That would have marked HEAD as "bad" and v2.6.24 as "good":
git bisect start [<bad> [<good>...]] [--] [<pathspec>...]
        reset bisect state and start bisection.
>  #
>  # Hm, no indication about what happened, and no "middle" bisection
>  # point offered. No way to figure out what's wrong.

Right, we probably need to have at look at this more closely, maybe warn if a "bad" or a "good" tag or branch exists or something like that.

Show 12 quoted lines
>  # Ok, backtrack one more step - something's wrong here. Lets start
>  # again with a completely new tree:
>  #
>
>  dione:~> git-clone v linux-tmp5
>  Initialized empty Git repository in /home/mingo/linux-tmp5/.git/
>  0 blocks
>  Checking out files: 100% (23809/23809), done.
>  dione:~> cd linux-tmp5/
>  dione:~/linux-tmp5> git-checkout -b tmp master
>  Switched to a new branch "tmp"
>  dione:~/linux-tmp5> git-bisect start good v2.6.24
This marked "good" as "bad" and "v2.6.24" as "good".

Again this should "work" only if you have a "good" tag or branch in your repo.

>  dione:~/linux-tmp5> cd
>  dione:~> cd linux-tmp5/
>  dione:~/linux-tmp5> git-bisect start good v2.6.24 bad master
This marked "good" as "bad", and "v2.6.24", "bad" and "master" as "good".
Show 11 quoted lines
>  dione:~/linux-tmp5>
>
>  #
>  # Hm, nothing. Ho hum. Do i suck this much? One more tree than i wanted
>  # and three more branches that i wanted and still no bisection?
>  #
>  # Ah, i must have switched the arguments?
>  #
>
>  dione:~/linux-tmp5> git-bisect start v2.6.24 good master bad
>  won't bisect on seeked tree

This marked "v2.6.24" as "bad", and "good", "master" and "bad" as "good". So it's wrong too.

Show 11 quoted lines
>  #
>  # Nope.
>  #
>
>  dione:~/linux-tmp5> git-bisect visualize
>  You need to give me at least one good and one bad revisions.
>  (You can use "git bisect bad" and "git bisect good" for that.)
>  dione:~/linux-tmp5> git bisect bad HEAD
>  dione:~/linux-tmp5> git bisect good v2.6.24
>  Bisecting: -1 revisions left to test after this
>  [eb36f4fc019835cecf0788907f6cab774508087b] fix oops on rmmod capidrv

That's much better but you didn't "reset" or "start" again before giving it correctly the good and bad revs, so there are still some wrong left over from your previous start above.

>  #
>  # -1 revisions left to test? Ouch ...
>  #
>  # But why did "git bisect" make a difference to "git-bisect" ?
It should not have made any difference.
Show 43 quoted lines
>  # Lets see whether it's all from the same package:
>  #
>
>  dione:~> type git
>  git is hashed (/usr/bin/git)
>  dione:~> type git-bisect
>  git-bisect is hashed (/usr/bin/git-bisect)
>  dione:~> rpm -qf /usr/bin/git-bisect
>  git-core-1.5.4.3-2.fc8
>  dione:~> rpm -qf /usr/bin/git
>  git-core-1.5.4.3-2.fc8
>
>  #
>  # Yup, it is. 20 minutes spent on this already and no bisection.
>  # I really suck today :-)
>  #
>
>  #
>  # So i started suspecting my kernel and my hardware. Are timestamps
>  # maybe messed up and confusing Git? Since the commands dont return
>  # success nor failure i was unsure what Git thought about my attempts.
>  #
>  # So i rebooted the box and created a new tree. No go.
>  #
>
>  #
>  # Just to be sure i also waited through a full git-fsck, only 10
>  # minutes runtime:
>  #
>
>  dione:~/linux-tmp4> git-fsck --full --strict
>  dangling commit f4be31ec9690cfe6e94fcbed6ae60a6a38b3c3ed
>  dione:~/linux-tmp4>
>
>  #
>  # [ Sidenote #1: git-fsck is such a heavy operation that it should
>  #   really return some indication by default that it's all appears OK.
>  #   A user typically only runs git-fsck if in deep doubt about some
>  #   git detail - so while silence is often good for a comment, it's
>  #   counter-intuitive here. Especially since the "breakage" of
>  #   git-bisect is "silence" too, so the user is unable to trust these
>  #   different modal forms of silence and gets frustrated ... ]
>  #

I cannot comment on "git fsck" but I think it has nothing to do with bisect "breakages".

Show 37 quoted lines
>  #
>  # [ Sidenote #2: git-fsck --full --strict is slow and we always knew
>  #   this - it's a last-ditch thing for the truly hopeless. But this is
>  #   a 3.2 GHz quad box that is only 25% utilized during git-fsck but
>  #   takes 10 minutes to finish. Presumably git-fsck could run multiple
>  #   threads/tasks to be sped up? Making the slowest possible operation
>  #   of a tool significantly faster is a good way to reduce user
>  #   frustration IMO. A user is already frustrated enough when he tries
>  #   --full --strict. And i _bet_ a parallel version of git-fsck would
>  #   also be an fantastic bad-RAM checker ;-) ]
>  #
>
>  #
>  # Then, many other silly attempts later and at linux-tmp8, by chance -
>  # 30 minutes down the line - i got it going:
>  #
>  # I updated my Linus tree on the (rather pathetic) theory that maybe a
>  # specific layout of the repo breaks bisection - and that seems to have
>  # made a difference:
>  #
>
>  dione:~/linux-tmp8> git-checkout -b tmp2 master
>  Switched to a new branch "tmp2"
>  dione:~/linux-tmp8> git-bisect start
>  won't bisect on seeked tree
>  dione:~/linux-tmp8> git-bisect reset
>  Switched to branch "master"
>  dione:~/linux-tmp8> git-bisect bad master
>  You need to start by "git bisect start"
>  Do you want me to do it for you [Y/n]? Y
>  dione:~/linux-tmp8> git-bisect good v2.6.24
>  Bisecting: 6270 revisions left to test after this
>  [4814bdbd590e835ecec2d5e505165ec1c19796b2] [NETNS]: Lookup in FIB
>  semantic hashes taking into account the namespace.
>
>  #
>  # But i dont understand why.
I hope you understand better now.
Show 46 quoted lines
>  # Before updating Linus's tree i saved away 
>  # the commit ID that showed the breakage, just in case it matters:
>  #
>
>  commit 7180c4c9e09888db0a188f729c96c6d7bd61fa83
>  Merge: 4c3b01f... 869ab51...
>  Author: Linus Torvalds <torvalds@linux-foundation.org>
>  Date:   Mon Apr 7 19:15:35 2008 -0700
>
>  #
>  # .. but couldnt reproduce this weirdness with specifically checking
>  # out 7180c4c9e09888db0a188f729c96c6d7bd61fa83. But i still have the
>  # linux-tmp4 repository that shows this behavior reliably. It's all
>  # quite weird. Either this repo is corrupted in some special way, or my
>  # hardware has some really strange runtime failure, or i'm missing
>  # something very obvious ;-)
>  #
>
>  #
>  # One more minor sidenote. Git-bisect creates its own branch:
>  #
>
>  dione:~/linux-tmp12> git-branch -a
>  * bisect
>    master
>    tmp
>    tmp2
>    origin/HEAD
>    origin/master
>    origin/new_branch
>
>  #
>  # So i assumed that i could get rid of that 'bisect' branch by doing
>  # the obvious: "git-bisect stop", but no go:
>  #
>
>   dione:~/linux-tmp12> git-bisect stop
>   Usage: /usr/bin/git-bisect
> [start|bad|good|skip|next|reset|visualize|replay|log|run]
>
>  #
>  # After some experimentation "git-bisect reset" did the trick - but
>  # it's a bit counter-intuitive IMO, because the logical extension of
>  # 'start' is 'stop', and i often use 'git-bisect reset' to just restart
>  # bisection anew. (it chimes in on 'restart')
>  #

"git bisect start" also does a "restart" if a bisect is already started. But yes, we could add "stop" as a synonym for "reset" and "restart" as a synonym for "start".

Thanks, Christian.

Show 9 quoted lines
>  #
>  # Ok, that's all for today. :-)
>  #
>
> 	Ingo
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous: Ingo MolnarNext: Ingo Molnar
Message 62 of 86 in “git annoyances”
  1. Ingo MolnarApr 9, 2008
  2. Björn SteinbrinkApr 9, 2008
  3. Jeff KingApr 9, 2008
  4. git-remote: show all remotes with "git remote show"Jeff King, Apr 9, 2008
  5. Johannes SchindelinApr 9, 2008
  6. Junio C HamanoApr 10, 2008
  7. Ingo MolnarApr 9, 2008
  8. Ingo MolnarApr 10, 2008
  9. Avery PennarunApr 9, 2008
  10. Karl HasselströmApr 10, 2008
  11. Avery PennarunApr 10, 2008
  12. Karl HasselströmApr 11, 2008
  13. Friendly refspecs (Was: Re: git annoyances)Teemu Likonen, Apr 9, 2008
  14. Avery PennarunApr 9, 2008
  15. Jeff KingApr 9, 2008
  16. Teemu LikonenApr 9, 2008
  17. Jeff KingApr 9, 2008
  18. Jeff KingApr 10, 2008
  19. Jeff KingApr 10, 2008
  20. Junio C HamanoApr 10, 2008
  21. Jeff KingApr 10, 2008
  22. Teemu LikonenApr 13, 2008
  23. Add examples section to 'git fetch' manualTeemu Likonen, Apr 13, 2008
  24. Junio C HamanoApr 13, 2008
  25. Matt GrahamApr 13, 2008
  26. Teemu LikonenApr 13, 2008
  27. Junio C HamanoApr 14, 2008
  28. Jeff KingApr 16, 2008
  29. Jeff KingApr 16, 2008
  30. Junio C HamanoApr 16, 2008
  31. Jeff KingApr 16, 2008
  32. Daniel BarkalowApr 16, 2008
  33. Junio C HamanoApr 16, 2008
  34. Jeff KingApr 22, 2008
  35. Junio C HamanoApr 22, 2008
  36. Daniel BarkalowApr 22, 2008
  37. Jeff KingApr 22, 2008
  38. Jeff KingApr 22, 2008
  39. Junio C HamanoApr 22, 2008
  40. Jeff KingApr 22, 2008
  41. Teemu LikonenApr 23, 2008
  42. Junio C HamanoApr 23, 2008
  43. Andreas EricssonApr 23, 2008
  44. Jeff KingApr 23, 2008
  45. Jeff KingApr 23, 2008
  46. Teemu LikonenApr 23, 2008
  47. Junio C HamanoApr 9, 2008
  48. Teemu LikonenApr 10, 2008
  49. Santiago GalaApr 12, 2008
  50. Daniel BarkalowApr 9, 2008
  51. Ingo MolnarApr 9, 2008
  52. Daniel BarkalowApr 10, 2008
  53. Junio C HamanoApr 9, 2008
  54. Jon LoeligerApr 9, 2008
  55. Nicolas PitreApr 9, 2008
  56. Jeff KingApr 9, 2008
  57. André Goddard RosaApr 9, 2008
  58. Govind SalinasApr 10, 2008
  59. Jean-Christian de RivazApr 10, 2008
  60. Sverre RabbelierApr 10, 2008
  61. git-bisect annoyancesIngo Molnar, Apr 10, 2008
  62. Christian CouderApr 11, 2008
  63. Ingo MolnarApr 11, 2008
  64. Christian CouderApr 12, 2008
  65. Junio C HamanoApr 11, 2008
  66. When a remote is added but not fetched, tell the user.Gabriel, Apr 10, 2008
  67. Johannes SchindelinApr 11, 2008
  68. GabrielApr 11, 2008
  69. Default to fetching a remote after adding it.Gabriel, Apr 11, 2008
  70. Stephen SinclairApr 11, 2008
  71. Johannes SchindelinApr 12, 2008
  72. GabrielApr 12, 2008
  73. Johannes SchindelinApr 12, 2008
  74. Teemu LikonenApr 11, 2008
  75. Junio C HamanoApr 11, 2008
  76. Sverre RabbelierApr 11, 2008
  77. Junio C HamanoApr 11, 2008
  78. Sverre RabbelierApr 11, 2008
  79. Miles BaderApr 15, 2008
  80. Default to fetching a remote after adding it.Gabriel, Apr 11, 2008
  81. Wincent ColaiutaApr 11, 2008
  82. GabrielApr 11, 2008
  83. Luciano RochaApr 11, 2008
  84. Wincent ColaiutaApr 11, 2008
  85. Jeff KingApr 10, 2008
  86. Sverre RabbelierApr 10, 2008

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.