Subject: | On Windows 8.1, IO-stringy-2.111 fails all tests in t\IO_InnerFile.t due to missing binmode |
As I understand it, IO::InnerFile does not do CRLF translation.
In t\IO_InnerFile.t, t\dummy-test-file file is written without a binmode OUT, therefore, by default, perl does CRLF translation on the content written to the file as you can see below:
C:\...\IO-stringy-2.111> xxd t\dummy-test-file
00000000: 4865 7265 2069 7320 736f 6d65 2064 756d Here is some dum
00000010: 6d79 2063 6f6e 7465 6e74 2e0a 4865 7265 my content..Here
00000020: 2069 7320 736f 6d65 206d 6f72 6520 6475 is some more du
00000030: 6d6d 7920 636f 6e74 656e 740a 4865 7265 mmy content.Here
00000040: 2069 7320 7965 7420 6d6f 7265 2064 756d is yet more dum
00000050: 6d79 2063 6f6e 7465 6e74 2e0a 416e 6420 my content..And
00000060: 6669 6e61 6c6c 7920 616e 6f74 6865 7220 finally another
00000070: 6c69 6e65 2e0a line..
As a consequence, the offsets specified in IO::InnerFile constructors are wrong.
Adding binmode OUT between open and print enables tests to pass:
# Create a test file
open(OUT, '>t/dummy-test-file') || die("Cannot write t/dummy-test-file: $!");
binmode OUT;
print OUT <<'EOF';
Obviously, this doesn't fix any underlying issues. Maybe the standard cautions about fseek on text streams should be included somewhere in the documentation.
HTH,
-- Sinan
For reference:
Summary of my perl5 (revision 5 version 20 subversion 2) configuration:
Platform:
osname=MSWin32, osvers=6.3, archname=MSWin32-x64-multi-thread
uname=''
config_args='undef'
hint=recommended, useposix=true, d_sigaction=undef
useithreads=define, usemultiplicity=define
use64bitint=define, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cl', ccflags ='-nologo -GF -W3 -O1 -Os -favor:INTEL64 -MD -Zi -DNDEBUG -GL -fp:precise -DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64 -DCONSERVATIVE -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DUSE_64_BIT_ALL -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO',
optimize='-O1 -Os -favor:INTEL64 -MD -Zi -DNDEBUG -GL -fp:precise',
cppflags='-DWIN32'
ccversion='18.00.31101', gccversion='', gccosandvers=''
intsize=4, longsize=4, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8
ivtype='__int64', ivsize=8, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -ltcg -libpath:"c:\opt\perl-5.20.2\lib\CORE" -machine:AMD64 "/manifestdependency:type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'"'
libpth="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\amd64"
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 comctl32.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 comctl32.lib msvcrt.lib
libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl520.lib
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -ltcg -libpath:"c:\opt\perl-5.20.2\lib\CORE" -machine:AMD64 "/manifestdependency:type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'"'
Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES HAVE_INTERP_INTERN MULTIPLICITY
PERLIO_LAYERS PERL_DONT_CREATE_GVSV
PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS
PERL_MALLOC_WRAP PERL_NEW_COPY_ON_WRITE
PERL_PRESERVE_IVUV USE_64_BIT_ALL USE_64_BIT_INT
USE_ITHREADS USE_LARGE_FILES USE_LOCALE
USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
USE_SITECUSTOMIZE
Built under MSWin32
Compiled at Feb 16 2015 08:44:56
%ENV:
PERLDOC_PAGER="c:\opt\cygwin64\bin\less.exe -+C -E -F -g -i"
@INC:
c:/opt/perl-5.20.2/site/lib/MSWin32-x64-multi-thread
c:/opt/perl-5.20.2/site/lib
c:/opt/perl-5.20.2/lib
.