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

[perl #7515] perlio bug ?

Thread Previous
From:
James E Keenan via RT
Date:
May 1, 2012 17:59
Subject:
[perl #7515] perlio bug ?
Message ID:
rt-3.6.HEAD-4610-1335920358-1908.7515-15-0@perl.org
On Sat Aug 11 12:29:40 2001, me-01@ton.iguana.be wrote:
> 
> -----------------------------------------------------------------
> [Please enter your report here]
> 
> Run this from the commandline:
> 
> perl -wle 'print $]; sub foo { local (*A, *B); pipe(A,B); return
>    fileno(A)}; sub bar { local *BOE; print open(BOE, "<&=" . foo) ?
>    "bad" : "good"}; bar; close STDIN; bar'
> 
> Tested on two systems this gives:
> 5.007001
> good
> bad
> 
> 5.006
> good
> good
> 
> 
> Written formatted, the code is:
> 
> print $];
> 
> sub foo {
>     local (*A, *B);
>     pipe(A,B);
>     return fileno(A)
> };
> 
> sub bar {
>     local *BOE;
>     print open(BOE, "<&=" . foo) ? "bad" : "good"
> };
> 
> bar;
> close STDIN;
> bar
> 
> the filehandles created in foo should be closed when foo is left,
> so bar's attempt to fdopen on the filedescriptor should fail.
> 
> It however succeeds from perl 5.7 on for filedescriptors 0, 1 and 2
> because the closes are in fact not done.
> 

Persists in Perl 5.14.2:

$ perl -wle 'print $]; sub foo { local (*A, *B); pipe(A,B); return
fileno(A)}; sub bar { local *BOE; print open(BOE, "<&=" . foo) ? "bad" :
"good"}; bar; close STDIN; bar'
5.014002
good
bad

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

Thread Previous


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