From: Jeff King <peff@peff.net>
To: Johannes Sixt <j.sixt@viscovery.net>
Cc: Piotr Krukowiecki <piotr.krukowiecki@gmail.com>,
Junio C Hamano <gitster@pobox.com>,
Git Mailing List <git@vger.kernel.org>,
Christian Couder <chriscool@tuxfamily.org>
Subject: Re: git bisect code 125 - "WFT?"
Date: Thu, 17 Mar 2011 03:27:23 -0400 [thread overview]
Message-ID: <20110317072723.GH11931@sigill.intra.peff.net> (raw)
In-Reply-To: <4D81B04A.1010802@viscovery.net>
On Thu, Mar 17, 2011 at 07:55:06AM +0100, Johannes Sixt wrote:
> Am 3/16/2011 23:06, schrieb Piotr Krukowiecki:
> > On Wed, Mar 16, 2011 at 10:36 PM, Junio C Hamano <gitster@pobox.com> wrote:
> >> Piotr Krukowiecki <piotr.krukowiecki@gmail.com> writes:
> >>
> >>> Opinions? Would it be possible to change the meaning of the codes now
> >>> (in 1.8.0)?
> >>
> >> How about just documenting why it is a bad idea to use 126 or 127 as you
> >> found out somewhere, and stopping there, iow, without changing the code to
> >> use 126/127 that we consider it is a bad idea to use and avoided using so
> >> far?
> >
> > Documenting it won't help. If you get 126 code, you won't know if user
> > returned it to mark the code as bad, or if bash returned it to say
> > that it can't
> > execute a command.
>
> Huh? Why should the user's script return 126 or 127, particularly if the
> documentation says "don't do that"? Moreover, any decent (shell)
> programmer will know that these two values are reserved by POSIX for
> particular purposes (they are _not_ specific to bash):
>
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_01_01
I think the argument is not that the user would want to return those
codes, but that we can protect a poorly written test script from itself
by including those exit codes in the list of "indeterminate result"
codes.
IOW, currently this:
git bisect run 'make && ./test-pogram'
will happily generate a bogus bisection. And obviously that's a trivial
example, but one can imagine a much larger script with a missing command
in it.
There are two problems with that argument that I see, though:
1. It only protects some very specific cases, and they're not even
interesting cases. Say your bisection runs a test script that looks
like this:
cmd1
missing-cmd
cmd2
we _still_ won't see it as an indeterminate result, because the
missing cmd's exit code is lost. So you would have to write:
cmd1 &&
missing-cmd &&
cmd2
but that doesn't really help much. If you are going to be that
careful, what you really want is something like:
cmd1 || exit 125
missing-cmd || exit 125
cmd2 || exit 125
some-final-command-to-check-the-state
So it can help, but I don't think it really helps in real-world
cases.
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".
-Peff
next prev parent reply other threads:[~2011-03-17 7:27 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 [this message]
2011-03-17 17:56 ` Junio C Hamano
2011-03-19 15:18 ` [PATCH 1/2] git bisect run: exit code 126 and 127 abort the run Piotr Krukowiecki
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=20110317072723.GH11931@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=chriscool@tuxfamily.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j.sixt@viscovery.net \
--cc=piotr.krukowiecki@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.
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).