[PATCH 1/2] git bisect run: exit code 126 and 127 abort the run
- From
Piotr Krukowiecki <piotr.krukowiecki@gmail.com>
- Date
- Mar 19, 2011, 15:18 UTC
- Message-ID
- <4D84C960.3010401@gmail.com>
- 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:
Show 10 quoted lines
> 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