[PATCH 1/2] git bisect run: exit code 126 and 127 abort the run

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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@xxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]