develooper Front page | perl.perl5.porters | Postings from September 2019

[perl #134458] PerlIO::get_layers() *always* reports :crlf onWindows

Thread Next
Hauke D
September 28, 2019 09:05
[perl #134458] PerlIO::get_layers() *always* reports :crlf onWindows
Message ID:
# New Ticket Created by  Hauke D 
# Please include the string:  [perl #134458]
# in the subject line of all future correspondence about this issue. 
# <URL: >

Hi all,

On Windows, doing `PerlIO::get_layers($filehandle)` will always report 
the :crlf layer, even when one has done `binmode $filehandle` and the 
:crlf layer isn't active. The attached script demonstrates this; note I 
also did a hexdump of the file to make sure that it indeed only contains 
an LF, not CRLF.

The PerlIO documentation does say that :crlf is part of the "default 
stack" on Windows, but I don't see an indication in the documentation of 
why PerlIO::get_layers() would *always* report that layer, even when 
it's not active.

I tested this on Strawberry Perl 5.8.9 through 5.28 on Windows 7. There 
is one minor difference: on Perls before 5.14, using the :raw 
pseudolayer directly in the `open` actually does cause the :crlf layer 
to no longer be reported by PerlIO::get_layers(). perl5140delta does 
mention several changes to PerlIO, but AFAICT nothing related to the 
aforementioned issue.

This definitely feels like a bug to me, but I don't know enough about 
the details of PerlIO on Windows to say more at the moment.

-- Hauke D

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About