From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 2/2] run-command: mark path lookup errors with ENOENT
Date: Wed, 24 Oct 2018 11:25:56 +0200 (DST) [thread overview]
Message-ID: <nycvar.QRO.7.76.6.1810241125360.4546@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <20181024091617.GA25118@sigill.intra.peff.net>
Hi Peff,
On Wed, 24 Oct 2018, Jeff King wrote:
> On Wed, Oct 24, 2018 at 11:01:54AM +0200, Johannes Schindelin wrote:
>
> > > @@ -910,6 +921,7 @@ int start_command(struct child_process *cmd)
> > > }
> > > #endif
> > >
> > > +end_of_spawn:
> >
> > Sadly, this fails to build on Windows:
> >
> > run-command.c: In function 'start_command':
> > run-command.c:924:1: error: label 'end_of_spawn' defined but not used [-Werror=unused-label]
> > end_of_spawn:
> > ^~~~~~~~~~~~
>
> Doh. I didn't think of that.
>
> > How about squashing in this diff:
> >
> > -- snip --
> > diff --git a/run-command.c b/run-command.c
> > index 639ea5ac3366..3f03795a5995 100644
> > --- a/run-command.c
> > +++ b/run-command.c
> > @@ -918,6 +918,8 @@ int start_command(struct child_process *cmd)
> > close(fhout);
> > if (fherr != 2)
> > close(fherr);
> > +
> > + goto end_of_spawn;
> > }
> > #endif
> >
> > -- snap --
> >
> > I can confirm that the result compiles and passes t0061.
>
> That leaves the Windows side of the #else with a funny, useless goto
> (and without even a matching useless one on the Unix side). Let's put
> it instead inside the half of the #if that actually uses it. Like so
> (actually courtesy of Jonathan Nieder):
>
> diff --git a/run-command.c b/run-command.c
> index 639ea5ac33..d679cc267c 100644
> --- a/run-command.c
> +++ b/run-command.c
> @@ -868,6 +868,8 @@ int start_command(struct child_process *cmd)
> argv_array_clear(&argv);
> free(childenv);
> }
> +end_of_spawn:
> +
> #else
> {
> int fhin = 0, fhout = 1, fherr = 2;
> @@ -921,7 +923,6 @@ int start_command(struct child_process *cmd)
> }
> #endif
>
> -end_of_spawn:
> if (cmd->pid < 0) {
> if (need_in)
> close_pair(fdin);
That works for me, too.
> Thanks for your review!
You're welcome!
Thanks,
Dscho
>
> -Peff
>
prev parent reply other threads:[~2018-10-24 9:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-24 7:36 [PATCH 0/2] run-command: fix Unix PATH lookup Jeff King
2018-10-24 7:37 ` [PATCH 1/2] t5410: use longer path for sample script Jeff King
2018-10-24 8:53 ` Johannes Schindelin
2018-10-25 1:15 ` Junio C Hamano
2018-10-24 7:38 ` [PATCH 2/2] run-command: mark path lookup errors with ENOENT Jeff King
2018-10-24 9:01 ` Johannes Schindelin
2018-10-24 9:16 ` Jeff King
2018-10-24 9:25 ` Johannes Schindelin [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=nycvar.QRO.7.76.6.1810241125360.4546@tvgsbejvaqbjf.bet \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--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).