git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 1/2] perl: redirect stderr to /dev/null instead of closing

From
Petr Baudis <pasky@ucw.cz>
Date
Apr 5, 2013, 14:48 UTC
Message-ID
<20130405144828.GX6137@machine.or.cz>
In-Reply-To
<801ebb2a75d7cddfeee70eb86e8854c78d22eb3e.1365107899.git.trast@inf.ethz.ch>
  Hi!
On Thu, Apr 04, 2013 at 10:41:41PM +0200, Thomas Rast wrote:
Show 19 quoted lines
> 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
Previous: Eric WongNext: Junio C Hamano
Message 5 of 11 in “perl: redirect stderr to /dev/null instead of closing”
  1. perl: redirect stderr to /dev/null instead of closingThomas Rast, Apr 3, 2013
  2. Eric WongApr 4, 2013
  3. 1/2 perl: redirect stderr to /dev/null instead of closingThomas Rast, Apr 4, 2013
  4. Eric WongApr 4, 2013
  5. Petr BaudisApr 5, 2013
  6. Junio C HamanoApr 5, 2013
  7. Petr BaudisApr 5, 2013
  8. Thomas RastApr 6, 2013
  9. Petr BaudisApr 6, 2013
  10. 2/2 t9700: do not close STDERRThomas Rast, Apr 4, 2013
  11. Jonathan NiederApr 4, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.