develooper Front page | perl.perl5.porters | Postings from May 2015

[perl #125115] Dup to closed filehandle creates file named GLOB(0x...)

From:
Tony Cook via RT
Date:
May 26, 2015 06:05
Subject:
[perl #125115] Dup to closed filehandle creates file named GLOB(0x...)
Message ID:
rt-4.0.18-26808-1432620294-1223.125115-15-0@perl.org
On Thu May 07 09:02:04 2015, knut.arne.bjorndal@easyconnect.no wrote:
> On 07/05/15 04:14, Tony Cook via RT wrote:
> > On Wed May 06 04:03:02 2015, knut.arne.bjorndal@easyconnect.no wrote:
> >> close STDOUT;
> >> open( my $foo, ">&", \*STDOUT) or die $!;
> >>
> >> Expected result: die 'Bad file descriptor'
> >>
> >> What happened: A file named GLOB(0xe52b90) is created, and any output
> >> written to $foo goes there.
> >>
> >> This has also been tested with 5.20.2 and 5.21.11 built with perlbrew.
> > 
> > Try the attached patch.
> 
> Seems to work fine. I've tested both some isolated examples of this
> problem as well as a codebase that does a fair amount of IO redirection.
> 

Thanks, I've attached a version with a test, which will go in once 5.22 is released.

Tony



---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=125115



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About