From: Petr Baudis <pasky@ucw.cz>
To: Thomas Rast <trast@inf.ethz.ch>
Cc: git@vger.kernel.org, Eric Wong <normalperson@yhbt.net>,
Marcin Owsiany <marcin@owsiany.pl>
Subject: Re: [PATCH v2 1/2] perl: redirect stderr to /dev/null instead of closing
Date: Fri, 5 Apr 2013 16:48:28 +0200 [thread overview]
Message-ID: <20130405144828.GX6137@machine.or.cz> (raw)
In-Reply-To: <801ebb2a75d7cddfeee70eb86e8854c78d22eb3e.1365107899.git.trast@inf.ethz.ch>
Hi!
On Thu, Apr 04, 2013 at 10:41:41PM +0200, Thomas Rast wrote:
> As pointed out by Eric Wong (thanks), the initial close needs to go:
> die() would again write nowhere if we close STDERR beforehand.
>
> > Perhaps we should also do the following:
> >
> > --- a/perl/Git.pm
> > +++ b/perl/Git.pm
> > @@ -1489,9 +1489,6 @@ sub _command_common_pipe {
> > if (not defined $pid) {
> > throw Error::Simple("open failed: $!");
> > } elsif ($pid == 0) {
> > - if (defined $opts{STDERR}) {
> > - close STDERR;
> > - }
> > if ($opts{STDERR}) {
> > open (STDERR, '>&', $opts{STDERR})
> > or die "dup failed: $!";
>
> Indeed. Thanks for pointing that out.
I'm sorry, I don't follow. Doesn't this just break the STDERR option
altogether as we will try to dup2() over an already open file
descriptor? We do need to close STDERR if we are going to reopen it,
I think.
Kind regards,
Petr "Pasky" Baudis
next prev parent reply other threads:[~2013-04-06 16:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-03 22:26 [PATCH] perl: redirect stderr to /dev/null instead of closing Thomas Rast
2013-04-04 1:16 ` Eric Wong
2013-04-04 20:41 ` [PATCH v2 1/2] " Thomas Rast
2013-04-04 21:14 ` Eric Wong
2013-04-05 14:48 ` Petr Baudis [this message]
2013-04-05 18:57 ` Junio C Hamano
2013-04-05 23:34 ` Petr Baudis
2013-04-06 8:07 ` Thomas Rast
2013-04-06 10:34 ` Petr Baudis
2013-04-04 20:41 ` [PATCH v2 2/2] t9700: do not close STDERR Thomas Rast
2013-04-04 21:11 ` Jonathan Nieder
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=20130405144828.GX6137@machine.or.cz \
--to=pasky@ucw.cz \
--cc=git@vger.kernel.org \
--cc=marcin@owsiany.pl \
--cc=normalperson@yhbt.net \
--cc=trast@inf.ethz.ch \
/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).