git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Couder <chriscool@tuxfamily.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: [RFC/PATCH] Bisect: implement "git bisect run <cmd>..." to automatically bisect.
Date: Thu, 22 Mar 2007 22:59:48 +0100	[thread overview]
Message-ID: <200703222259.49089.chriscool@tuxfamily.org> (raw)
In-Reply-To: <7vejnhwy0y.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano a écrit :

[...]

> > +      # Check for really bad run error.
> > +      if [ $res -lt 0 -o $res -ge 128 ]; then
> > +	  echo >&2 "bisect run failed:"
> > +	  echo >&2 "exit code $res from '$@' is < 0 or >= 128"
> > +	  exit $res
> > +      fi
>
> I am not sure if this flexibility/leniency is desirable.  It
> certainly allows a sloppily written shell script that exits with
> any random small-positive values to report a badness, which may
> be handy, but allowing sloppiness might lead to wasted time
> after all.  I dunno.  A more strict convention that says the run
> script should exit 1 to signal "bad, please continue", 0 for
> "good, please continue" and other values for "no good, abort"
> might be less error prone.

Perhaps, but when running "git bisect run make" to automatically find the 
commit that broke the build, it would fail because make will usually return 
2 in case of error. 

It seems that there are few standards for exit code, so whatever convention 
we choose will not work in all cases.

> In any case, the exit status convention needs documentation.

Yes, I will work on it.

[...]

> > +      # Use "git-bisect good" or "git-bisect bad"
> > +      # depending on run success or failure.
> > +      # We cannot use bisect_good or bisect_bad functions
> > +      # because they can exit.
> > +      if [ $res -gt 0 ]; then
> > +	  next_bisect='git-bisect bad'
> > +      else
> > +	  next_bisect='git-bisect good'
> > +      fi
> > +
> > +      $next_bisect > "$GIT_DIR/BISECT_RUN"
>
> If their exiting, and possibly variable assignments, are the
> only problem, you can run that in subshell, can't you?  Like:
>
> 	( $next_bisect >"$GIT_DIR/BISECT_RUN" )

You are right. I will submit an updated patch with this change and some 
documentation.

Thanks,
Christian.

      reply	other threads:[~2007-03-22 21:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-22  6:08 [RFC/PATCH] Bisect: implement "git bisect run <cmd>..." to automatically bisect Christian Couder
2007-03-22  7:14 ` Junio C Hamano
2007-03-22 21:59   ` Christian Couder [this message]

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=200703222259.49089.chriscool@tuxfamily.org \
    --to=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.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).