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

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
  • Comment on Re^2: [Win32] PerlIO-Layers fails 4 tests on perl-5.10 only

Replies are listed 'Best First'.
Re^3: [Win32] PerlIO-Layers fails 4 tests on perl-5.10 only
by bulk88 (Priest) on Apr 09, 2012 at 13:13 UTC
    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