Skip to content
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

inconsistency between PerlIO::get_layers and open/binmode #7896

Open
p5pRT opened this issue May 3, 2005 · 7 comments
Open

inconsistency between PerlIO::get_layers and open/binmode #7896

p5pRT opened this issue May 3, 2005 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented May 3, 2005

Migrated from rt.perl.org#35180 (status was 'open')

Searchable as RT35180$

@p5pRT
Copy link
Author

p5pRT commented May 3, 2005

From laurent.dami@justice.ge.ch

use PerlIO;

open F, "foo.pl";


# now try to open a temp file with same layers as F
my $tmp = undef;
my $F_layers = join "", map {":$_"} PerlIO::get_layers(F);
open $tmp, "+>$F_layers", undef;

my $tmp_layers = join "", map {":$_"} PerlIO::get_layers($tmp);

print "MISMATCH !! $F_layers / $tmp_layers\n" unless $F_layers eq
$tmp_layers;

# on Win32 : MISMATCH !! :unix:crlf / :unix:crlf:unix

__END__
Perl Info
Site configuration information for perl v5.8.6:

Configured by damil at Wed Dec 22 15:20:14 2004.

Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
Platform:
osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
uname=''
config_args='undef'
hint=recommended, useposix=true, d_sigaction=undef
usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cl', ccflags ='-nologo -Gf -W3 -MD -DNDEBUG -O1 -DWIN32 -D_CONSOLE
-DNO_STRICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DPERL_IMPLICIT_CONTEXT
-DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX',
optimize='-MD -DNDEBUG -O1',
cppflags='-DWIN32'
ccversion='', gccversion='', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64',
lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='link', ldflags ='-nologo -nodefaultlib -release
-libpath:"c:\Perl\lib\CORE" -machine:x86'
libpth=\lib
libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib
uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib
msvcrt.lib
perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib
uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib
msvcrt.lib
libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib
gnulibc_version='undef'
Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -release
-libpath:"c:\Perl\lib\CORE" -machine:x86'

Locally applied patches:
ACTIVEPERL_LOCAL_PATCHES_ENTRY
21540 Fix backward-compatibility issues in if.pm
23565 Wrong MANIFEST.SKIP

---
@INC for perl v5.8.6:
C:/Perl/lib
C:/Perl/site/lib
.

---
Environment for perl v5.8.6:
HOME=c:/dami
LANG (unset)
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=C:\Program Files\XEmacs\XEmacs-21.4.13\i586-pc-win32;c:\program
files\imagemagick-5.4.9-q16;C:\Perl\bin\;C:\orant\bin;C:\Program
Files\Microsoft.NET\FrameworkSDK\Bin\;C:\Program Files\Microsoft Visual
Studio
.NET\Common7\IDE\;C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\;C:\Program
Files\Microsoft Visual Studio
.NET\Vc7\bin\;C:\texmf\miktex\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\
System32\Wbem;C:\Program Files\Fichiers communs\Adaptec
Shared\System;C:\BASISclient\cs\bin;C:\BASISclient\www\bin;c:\Unix;c:\progra
m files\minGW\bin;C:\Program Files\j2sdk1.4.1_01\bin;C:\Program
Files\Support Tools\
PERL_BADLANG (unset)
SHELL (unset)




Laurent Dami
Conseiller en syst�mes d'information
Palais de Justice - Etat de Gen�ve
Case postale 3966
Place du Bourg-de-Four 3, 1211 Gen�ve 3
+41 (22) 327 20 64 (direct), +41 (22) 327 20 37 (service)
http://cui.unige.ch/~dami

@p5pRT
Copy link
Author

p5pRT commented Nov 17, 2005

From @rgs

I'm not sure that's really a bug, since open pushes some layers by
defaults depending on the platform. That's more a minor annoyance.

@p5pRT
Copy link
Author

p5pRT commented Nov 17, 2005

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Nov 18, 2005

From Peter.Dintelmann@dresdner-bank.com

":unix:crlf" seem to be the default layers on this platform. When $tmp is opened

open $tmp, "+>$F_layers", undef;

":unix:crlf" ($F_layers) are pushed on top of the default layers resulting in ":unix:crlf:unix:crlf" for $tmp. However ":crlf" is documented to be pushed only once

:crlf
A layer that implements DOS/Windows like CRLF line endings.
... ...
Note that this layer likes to be one of its kind: it silently
ignores attempts to be pushed into the layer stack more than once.
... ...

and the result is ":unix:crlf:unix" (the rightmost ":crlf" is silently ignored).

IMHO your code behaves exactly as documented.

@p5pRT
Copy link
Author

p5pRT commented Dec 31, 2005

From nick@ing-simmons.net

But the odd thing is if undef is replaced by a file name it works
as original poster expected.
So it seems the magic undef for temp file code is getting extra
set of layers.

@toddr
Copy link
Member

toddr commented Feb 13, 2020

On UNIX my output is currently this on 5.30

MISMATCH !!  / :unix:perlio

@Leont can you comment on this?

@Leont
Copy link
Contributor

Leont commented Feb 15, 2020

This is a known issue, though I'm not sure if it has a ticket.

Our tempfile implementation is buggy with regards to layers, it applies them twice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants