in reply to [Win32] PerlIO-Layers fails 4 tests on perl-5.10 only

What is your goal?

I couldnt pass the PIO Layers 0.005's test suite on AP 5.10.0 and 0.005 has a PPM release. I think I know why,
ok 9 # skip filehandles may not be open when automated testing ok 10 # skip filehandles may not be open when automated testing ok 11 # skip filehandles may not be open when automated testing
http://ppm4.activestate.com/MSWin32-x86/5.10/1000/L/LE/LEONT/PerlIO-Layers-0.005.d/log-20100909T021003.txt
C:\Documents and Settings\Owner\Desktop\cpan libs\PerlIO-Layers-0.005> +build test t\00-load.........# Testing PerlIO::Layers 0.005, Perl 5.010000, C:\Pe +rl\bin\per l.exe t\00-load.........ok t\10-basics.......ok 1/15 t\10-basics.......NOK 9/15# Failed test 'stdin is open' # at t\10-basics.t line 27. # got: '0' # expected: '1' # Failed test 'stdout is open' t\10-basics.......NOK 10/15# at t\10-basics.t line 28. # got: '0' # expected: '1' # Failed test 'stderr is open' t\10-basics.......NOK 11/15# at t\10-basics.t line 29. # got: '0' # expected: '1' # Looks like you failed 3 tests of 15. t\10-basics.......dubious Test returned status 3 (wstat 768, 0x300) DIED. FAILED tests 9-11 Failed 3/15 tests, 80.00% okay t\pod-coverage....skipped all skipped: Test::Pod::Coverage 1.08 required for testing POD + coverage t\pod.............skipped all skipped: Test::Pod 1.22 required for testing POD Failed Test Stat Wstat Total Fail List of Failed ---------------------------------------------------------------------- +--------- t\10-basics.t 3 768 15 3 9-11 2 tests skipped. Failed 1/4 test scripts. 3/16 subtests failed. Files=4, Tests=16, 0 wallclock secs ( 0.00 cusr + 0.00 csys = 0.00 +CPU) Failed 1/4 test programs. 3/16 subtests failed. C:\Documents and Settings\Owner\Desktop\cpan libs\PerlIO-Layers-0.005> +perl -V Summary of my perl5 (revision 5 version 10 subversion 0) configuration +: Platform: osname=MSWin32, osvers=5.00, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=und +ef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D +_CONSOLE - DNO_STRICT -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE -DPRIVLIB_LAST_IN_INC + -DPERL_IM PLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX' +, optimize='-MD -Zi -DNDEBUG -O1', cppflags='-DWIN32' ccversion='13.10.6030', 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 +', lseeksi ze=8 alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -l +ibpath:"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 uui +d.lib ws2_ 32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.l +ib perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool +.lib comd lg32.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 msvc +rt.lib libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl510.lib gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt: +ref,icf - libpath:"C:\Perl\lib\CORE" -machine:x86' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PL_OP_SLAB_ALLOC USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_SITECUSTOMIZE Locally applied patches: ActivePerl Build 1003 [285500] 33741 avoids segfaults invoking S_raise_signal() (on Linux) 33763 Win32 process ids can have more than 16 bits 32809 Load 'loadable object' with non-default file extension 32728 64-bit fix for Time::Local Built under MSWin32 Compiled at May 13 2008 16:52:49 %ENV: PERL_JSON_BACKEND="JSON::XS" PERL_YAML_BACKEND="YAML" @INC: C:/Perl/site/lib C:/Perl/lib . C:\Documents and Settings\Owner\Desktop\cpan libs\PerlIO-Layers-0.005>
On VC Perl 5.12, I failed other tests.
C:\Documents and Settings\Owner\Desktop\cpan libs\PerlIO-Layers-0.005> +build test t\00-load.t ....... # Testing PerlIO::Layers 0.005, Perl 5.012002, C:\ +perl512\bi n\perl.exe t\00-load.t ....... ok t\10-basics.t ..... 1/15 # Failed test 'stdin is binary' # at t\10-basics.t line 40. # got: '0' # expected: '1' # $VAR1 = [ # "unix", # undef, # [ # "OPEN", # "CANREAD", # "CRLF" # ] # ]; # $VAR2 = [ # "crlf", # undef, # [ # "UTF8", # "LINEBUF", # "CANREAD", # "FASTGETS" # ] # ]; # Looks like you failed 1 test of 15. t\10-basics.t ..... Dubious, test returned 1 (wstat 256, 0x100) Failed 1/15 subtests (less 3 skipped subtests: 11 okay) t\pod-coverage.t .. skipped: Test::Pod::Coverage 1.08 required for tes +ting POD c overage t\pod.t ........... skipped: Test::Pod 1.22 required for testing POD Test Summary Report ------------------- t\10-basics.t (Wstat: 256 Tests: 15 Failed: 1) Failed test: 15 Non-zero exit status: 1 Files=4, Tests=16, 0 wallclock secs ( 0.11 usr + 0.00 sys = 0.11 CP +U) Result: FAIL Failed 1/4 test programs. 1/16 subtests failed. C:\Documents and Settings\Owner\Desktop\cpan libs\PerlIO-Layers-0.005> +perl -V Summary of my perl5 (revision 5 version 12 subversion 2) configuration +: Platform: osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=und +ef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -GF -W3 -Od -MD -Zi -DDEBUGGING -DWIN32 + -D_CONSOL E -DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLIC +IT_SYS -DU SE_PERLIO', optimize='-Od -MD -Zi -DDEBUGGING', cppflags='-DWIN32' ccversion='13.10.3077', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64 +', lseeksi ze=8 alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -debug -libpath:"c:\pe +rl512\lib\ CORE" -machine:x86' libpth="c:\Program Files\Microsoft Visual Studio .NET 2003\VC7\lib +" libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib + comdlg32 .lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uui +d.lib ws2_ 32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib comctl32 +.lib msvcr t.lib perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool +.lib comd lg32.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 comc +tl32.lib m svcrt.lib libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl512.lib gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -lib +path:"c:\p erl512\lib\CORE" -machine:x86' Characteristics of this binary (from libperl): Compile-time options: DEBUGGING MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PERL_TRACK_MEMPOOL PL_OP_SLAB +_ALLOC USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF Built under MSWin32 Compiled at Mar 23 2011 08:10:43 %ENV: PERL_JSON_BACKEND="JSON::XS" PERL_YAML_BACKEND="YAML" @INC: C:/perl512/site/lib C:/perl512/lib . C:\Documents and Settings\Owner\Desktop\cpan libs\PerlIO-Layers-0.005>

Replies are listed 'Best First'.
Re^2: [Win32] PerlIO-Layers fails 4 tests on perl-5.10 only
by syphilis (Archbishop) on Apr 09, 2012 at 08:21 UTC
    What is your goal?

    It'd be nice if PerlIO-Layers could be fixed so that it passes all tests on perl-5.10.0. (It's a dependency for File::Map which, in turn will be a dependency for the next stable release of PDL.)
    The author of the module is stumped, and I don't have much of an idea (and not much time at the moment, either).

    I don't know much about the performance of the earlier versions of PerlIO-Layers on windows (I think they might have issues), but 0.009 and 0.010 are fine for me on a wide range of perl versions from 5.8.9 to 5.15.9, and using a variety of compilers including gcc-4.5.2 (32-bit), gcc-4.7.0 (64-bit), MSVC++ 7.0 (32-bit), and MS Platform SDK for Windows Server 2003 R2 (64-bit).

    It seems odd that there should be failures for only 5.10.0 - and I thought someone here might have some ideas as to why that happens.
    But it's not mission-critical - more a request to anyone that's interested, rather than an urgent plea for help.

    Cheers,
    Rob
      I modified Layers.pm to dump the flags.
      sub _has_flags { my $check_flag = _names_to_flags(@_); return sub { my ($fh, $layer) = @_; my $iterator = natatime(3, PerlIO::get_layers($fh, details => +1)); while (my ($name, $arguments, $flags) = $iterator->()) { next if defined $layer and $name ne $layer; print('FL='.unpack('H8',pack('N',$flags)).','.unpack('B32' +,pack('N',$flags))."\n"); print('CK='.unpack('H8',pack('N',$check_flag)).','.unpack( +'B32',pack('N',$check_flag))."\n"); my $entry = $flags & $check_flag; return 1 if $entry; } return 0; } }
      And the problem is, 5.10 has different flags than 5.12. I dont know yet if 5.10 has different C consts, or just different api design, and if the 16XXX/0x4000 flag is plain wrong. I havent looked if 0x4000 is hard coded in Layers the module or not.

      On 5.10.
      $VAR1 = { "\$mode" => "<:encoding(utf8)", "\$fh" => \*{"main::\$fh"}, "\$test_type" => "crlf", "\$result_for{\$test_type}" => 1 }; FL=00408400,00000000010000001000010000000000 CK=00004000,00000000000000000100000000000000 FL=00408400,00000000010000001000010000000000 CK=00004000,00000000000000000100000000000000 FL=00408400,00000000010000001000010000000000 CK=00004000,00000000000000000100000000000000 not ok 51 - File opened with <:encoding(utf8) should return 1 on test +crlf # Failed test 'File opened with <:encoding(utf8) should return 1 on +test crlf' # at 10-basics.t line 77. # got: '0' # expected: '1' # $VAR1 = [ # "unix", # undef, # [ # "UTF8", # "CANREAD", # "FASTGETS" # ] # ]; # $VAR2 = [ # "crlf", # undef, # [ # "UTF8", # "CANREAD", # "FASTGETS" # ] # ]; # $VAR3 = [ # "encoding", # "utf8", # [ # "UTF8", # "CANREAD", # "FASTGETS" # ] # ];
      On 5.12
      $VAR1 = { "\$fh" => \*{"main::\$fh"}, "\$mode" => "<:encoding(utf8)", "\$result_for{\$test_type}" => 1, "\$test_type" => "crlf" }; FL=00200400,00000000001000000000010000000000 CK=00004000,00000000000000000100000000000000 FL=00404400,00000000010000000100010000000000 CK=00004000,00000000000000000100000000000000
      I will keep looking.

      I made this. Dont know what to think about it. http://pastebin.com/SSDrPpDD

      update, the flags come from XS in Layers.xs not hard coded consts in the PM, the flags of the layers come from http://perl5.git.perl.org/perl.git/blob/HEAD:/universal.c#l960 I dont have a C debugging enabled 5.10 so I cant give you any more advice. Search perlio.c in perl.git for changes between 5.10 and 5.12 or dont do the PIO::Layers test on 5.10. Its a design issue with 5.10, not a Layers.pm issue.
        Search perlio.c in perl.git for changes between 5.10 and 5.12

        Many thanks for "loosening the ground" so vigorously for me - that makes further digging so much easier.

        Cheers,
        Rob