git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Piotr Krukowiecki <piotr.krukowiecki@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff King <peff@peff.net>, Johannes Sixt <j.sixt@viscovery.net>,
	Git Mailing List <git@vger.kernel.org>,
	Christian Couder <chriscool@tuxfamily.org>
Subject: [PATCH 1/2] git bisect run: exit code 126 and 127 abort the run
Date: Sat, 19 Mar 2011 16:18:56 +0100	[thread overview]
Message-ID: <4D84C960.3010401@gmail.com> (raw)
In-Reply-To: <7vei654omv.fsf@alter.siamese.dyndns.org>

Those codes are reserved by POSIX to indicate
"command not executable" and "command not found":
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_08_02

Bisect used to treat them as codes returned by user
to mark a "bad" code.

With that approach it was not possible to differentiate
between codes returned by the user and codes returned by
shell (which is likely a sign of a poorly written test
script).

Another minor problem was lack of consistency in exit codes.
A "bad" code was marked by any value in range 1-124,126-127
and the gap in the middle looked weird.

Change the meaning of exit codes 126 and 127 to
"abort the bisect process" to fixes the above problems.

Signed-off-by: Piotr Krukowiecki <piotr.krukowiecki@gmail.com>
---
 git-bisect.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

W dniu 17.03.2011 18:56, Junio C Hamano pisze:
> Jeff King <peff@peff.net> writes:
> 
>>   2. If we do detect such a mishap, I'm not sure that "indeterminate
>>      result" is necessarily the best result, as that will just keep
>>      trying more and more commits without success. It is more likely a
>>      sign of a poorly written test script, and the best thing we could
>>      do is die and say "your test script looks buggy".
> 
> Exactly. I agree "Aborting the bisect as run-script is a crap" is the
> right thing to do here.

Here's a patch. Next one changes git-bisect.txt

There's also Documentation/git-bisect-lk2009.txt which talks about exit
codes and should be changed somehow. As I understand it's a quote from an
email so I don't know if it should be edited in place, or should a note
be added at beginning?


(And again my patch has commit message longer than the changes...
 Now I understand why in-code documentation is lacking - after writing
 lengthy commit message documenting the code is just too much ;) )

diff --git a/git-bisect.sh b/git-bisect.sh
index c21e33c..9ca4852 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -376,9 +376,9 @@ bisect_run () {
       res=$?
 
       # Check for really bad run error.
-      if [ $res -lt 0 -o $res -ge 128 ]; then
+      if [ $res -lt 0 -o $res -ge 126 ]; then
 	  echo >&2 "bisect run failed:"
-	  echo >&2 "exit code $res from '$@' is < 0 or >= 128"
+	  echo >&2 "exit code $res from '$@' is < 0 or >= 126"
 	  exit $res
       fi
 
-- 
1.7.1

-- 
Piotr Krukowiecki

  reply	other threads:[~2011-03-19 15:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-16 20:44 git bisect code 125 - "WFT?" Piotr Krukowiecki
2011-03-16 21:36 ` Junio C Hamano
2011-03-16 22:06   ` Piotr Krukowiecki
2011-03-17  6:55     ` Johannes Sixt
2011-03-17  7:27       ` Jeff King
2011-03-17 17:56         ` Junio C Hamano
2011-03-19 15:18           ` Piotr Krukowiecki [this message]
2011-03-19 15:20           ` [PATCH 2/2] bisect documentation: exit codes 126,127 abort bisect Piotr Krukowiecki

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=4D84C960.3010401@gmail.com \
    --to=piotr.krukowiecki@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j.sixt@viscovery.net \
    --cc=peff@peff.net \
    /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).