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

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

Thread Next
From:
Hauke D
Date:
September 28, 2019 09:05
Subject:
[perl #134458] PerlIO::get_layers() *always* reports :crlf onWindows
Message ID:
rt-4.0.24-9265-1569661541-1737.134458-75-0@perl.org
# New Ticket Created by  Hauke D 
# Please include the string:  [perl #134458]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=134458 >


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.

Thanks,
-- Hauke D

Thread Next


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