New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reopening filehandles can clobber PerlIO layers #12249
Comments
From @dmcbrideCreated by @dmcbride(Originally found on AIX with 5.10.1, but can be reproduced in 5.16.0 The following code has two surprises. a) the layers for STDOUT are different for input vs output. (Thanks to #perl for pointing me to PerlIO and that the layers can --- #!/bin/env perl5.16.0 use strict; say "Testing on $^V:"; binmode STDOUT, ':utf8'; say "Layers before:"; open my $fh, '>&STDOUT' or die "can't dup"; open STDOUT, '>&', $fh or die "can't dup2"; say "Layers after:"; --- Output: $ perl5.16.0 ./x.pl Perl Info
|
From ambrus@math.bme.huOn 7/4/12, Darin McBride <perlbug-followup@perl.org> wrote:
I believe this might be the intended semantics. If you duplicate a filehandle with the "&" or "&=" open mode, that If you wanted two handles that share their internal state, you $ perl -we 'open F, ">&=", STDOUT or die; for (1..10) { print F "foo"; (Remark. I imagine there are cases when you may need to share a lower Btw, report [perl #34595] is somewhat similar to this, but I believe Ambrus |
The RT System itself - Status changed from 'new' to 'open' |
From @dmcbrideOn Wednesday July 4 2012 12:28:41 PM you wrote:
Here's the crux of the problem - there are many times where you can't simply Some modules do this somewhat hidden, others do it right (i.e., fork first - But I do think this is surprising. Especially since this is the example in |
From @LeontOn Wed Jul 04 07:59:23 2012, dmcbride@cpan.org wrote:
I found this lovely explanation in do_openn (doio.c:597): /* Eeek - FIXME !!! This has been there since 2001 (e99cca9) :-( Leon |
Migrated from rt.perl.org#113982 (status was 'open')
Searchable as RT113982$
The text was updated successfully, but these errors were encountered: