Skip Menu |

This queue is for tickets about the IO-Compress-Zlib CPAN distribution.

Report information
The Basics
Id: 34560
Status: resolved
Priority: 0/
Queue: IO-Compress-Zlib

People
Owner: Nobody in particular
Requestors: robin-bitcard [...] robinbowes.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.008
Fixed in: (no value)



Subject: Test failure on Solaris
I'm trying to build IO::Compress::Zlib on Solaris (SXCE b83a i386): SunOS nas02 5.11 snv_83 i86pc i386 i86pc I'm using perl 5.8.8 from the Sun coolstack project. Installation failed through CPAN so I grabbed the tarball and tried installing manually. make test fails with the following errors: t/105oneshot-zip-only.............4/146 # Failed test (t/105oneshot-zip-only.t at line 81) # got: '603462246' # expected: '603460446' t/105oneshot-zip-only.............15/146 # Failed test (t/105oneshot-zip-only.t at line 91) # got: '603462247' # expected: '603460447' t/105oneshot-zip-only.............48/146 # Failed test (t/105oneshot-zip-only.t at line 121) # '603462250' # <= # '603460450' # Failed test (t/105oneshot-zip-only.t at line 133) # '603462250' # <= # '603460450' # Looks like you failed 4 tests of 146. t/105oneshot-zip-only............. Dubious, test returned 4 (wstat 1024, 0x400) Failed 4/146 subtests Looking at the tests that are failing, they all seem to be related to file times: 81: is $hdr->{Time}>>1, $mtime>>1, " Time is ok"; 91: is $hdr->{Time} >> 1, $mtime >> 1, " Time is ok"; 121: cmp_ok $hdr->{Time} >> 1, '<=', $after >> 1, " Time is ok"; 133: cmp_ok $hdr->{Time} >> 1, '<=', $after >> 1, " Time is ok"; The same thing works fine on Fedora 8.
From: pmqs [...] cpan.org
On Sun Mar 30 20:01:32 2008, robinbowes wrote: Show quoted text
> I'm trying to build IO::Compress::Zlib on Solaris (SXCE b83a i386): > > SunOS nas02 5.11 snv_83 i86pc i386 i86pc > > I'm using perl 5.8.8 from the Sun coolstack project. > > Installation failed through CPAN so I grabbed the tarball and tried > installing manually. > > make test fails with the following errors: > > t/105oneshot-zip-only.............4/146 > # Failed test (t/105oneshot-zip-only.t at line 81) > # got: '603462246' > # expected: '603460446' > t/105oneshot-zip-only.............15/146 > # Failed test (t/105oneshot-zip-only.t at line 91) > # got: '603462247' > # expected: '603460447' > t/105oneshot-zip-only.............48/146 > # Failed test (t/105oneshot-zip-only.t at line 121) > # '603462250' > # <= > # '603460450' > > # Failed test (t/105oneshot-zip-only.t at line 133) > # '603462250' > # <= > # '603460450' > # Looks like you failed 4 tests of 146. > t/105oneshot-zip-only............. Dubious, test returned 4 (wstat
1024, Show quoted text
> 0x400) > Failed 4/146 subtests > > > Looking at the tests that are failing, they all seem to be related to > file times: > > 81: is $hdr->{Time}>>1, $mtime>>1, " Time is ok"; > 91: is $hdr->{Time} >> 1, $mtime >> 1, " Time is ok"; > 121: cmp_ok $hdr->{Time} >> 1, '<=', $after >> 1, " Time is ok"; > 133: cmp_ok $hdr->{Time} >> 1, '<=', $after >> 1, " Time is ok"; > > The same thing works fine on Fedora 8.
And it works fine (for me) on Solaris 10 Sparc & x86. You are correct in your analysis - all the failing tests are related to the modification time field in a zip header. For some reason you seem to be having an out by exactly 200 seconds in each of those test. I've enclosed a small script that simulates what the code does. Can you run it and send me the results please? Paul
use strict; use warnings; sub _unixToDosTime # Archive::Zip::Member { my $time_t = shift; # TODO - add something to cope with unix time < 1980 my ( $sec, $min, $hour, $mday, $mon, $year ) = localtime($time_t); my $dt = 0; $dt += ( $sec >> 1 ); $dt += ( $min << 5 ); $dt += ( $hour << 11 ); $dt += ( $mday << 16 ); $dt += ( ( $mon + 1 ) << 21 ); $dt += ( ( $year - 80 ) << 25 ); return $dt; } sub _dosToUnixTime { #use Time::Local 'timelocal_nocheck'; use Time::Local 'timelocal'; my $dt = shift; my $year = ( ( $dt >> 25 ) & 0x7f ) + 80; my $mon = ( ( $dt >> 21 ) & 0x0f ) - 1; my $mday = ( ( $dt >> 16 ) & 0x1f ); my $hour = ( ( $dt >> 11 ) & 0x1f ); my $min = ( ( $dt >> 5 ) & 0x3f ); my $sec = ( ( $dt << 1 ) & 0x3e ); # catch errors my $time_t = eval { timelocal( $sec, $min, $hour, $mday, $mon, $year ); }; return 0 if $@; return $time_t; } my $now = time; my $dosTime = _unixToDosTime($now); my $unix = _dosToUnixTime($dosTime); my $delta = $now - $unix; my $packed = pack "V", $dosTime; my $unpacked = unpack "V", $packed; my $unix1 = _dosToUnixTime($unpacked); my $delta1 = $now - $unix1; print <<EOM; Now $now DOS $dosTime Unix $unix Delta $delta Packed Unix $unix1 Delta $delta1 EOM
From: robin-bitcard [...] robinbowes.com
On Mon Mar 31 06:51:36 2008, PMQS wrote: Show quoted text
> > I've enclosed a small script that simulates what the code does. Can you > run it and send me the results please?
Sure: # perl time.pl Now 1206994543 DOS 947890677 Unix 1206994542 Delta 1 Packed Unix 1206994542 Delta 1 Same script on Fedora 8: $ perl time.pl Now 1206994637 DOS 947890728 Unix 1206994636 Delta 1 Packed Unix 1206994636 Delta 1
On Mon Mar 31 16:17:53 2008, robinbowes wrote: Show quoted text
> On Mon Mar 31 06:51:36 2008, PMQS wrote:
> > > > I've enclosed a small script that simulates what the code does. Can you > > run it and send me the results please?
> > Sure: > > # perl time.pl > Now 1206994543 > DOS 947890677 > Unix 1206994542 > Delta 1 > > Packed > Unix 1206994542 > Delta 1 > > > Same script on Fedora 8: > > $ perl time.pl > Now 1206994637 > DOS 947890728 > Unix 1206994636 > Delta 1 > > Packed > Unix 1206994636 > Delta 1
Thanks, that worked perfectly. I've enclosed another variant. Can you try running it please? Paul
use strict; use warnings; sub _unixToDosTime # Archive::Zip::Member { my $time_t = shift; # TODO - add something to cope with unix time < 1980 my ( $sec, $min, $hour, $mday, $mon, $year ) = localtime($time_t); my $dt = 0; $dt += ( $sec >> 1 ); $dt += ( $min << 5 ); $dt += ( $hour << 11 ); $dt += ( $mday << 16 ); $dt += ( ( $mon + 1 ) << 21 ); $dt += ( ( $year - 80 ) << 25 ); return $dt; } sub _dosToUnixTime { #use Time::Local 'timelocal_nocheck'; use Time::Local 'timelocal'; my $dt = shift; my $year = ( ( $dt >> 25 ) & 0x7f ) + 80; my $mon = ( ( $dt >> 21 ) & 0x0f ) - 1; my $mday = ( ( $dt >> 16 ) & 0x1f ); my $hour = ( ( $dt >> 11 ) & 0x1f ); my $min = ( ( $dt >> 5 ) & 0x3f ); my $sec = ( ( $dt << 1 ) & 0x3e ); # catch errors my $time_t = eval { timelocal( $sec, $min, $hour, $mday, $mon, $year ); }; return 0 if $@; return $time_t; } sub writeFile { my($filename, @strings) = @_ ; 1 while unlink $filename ; open (F, ">$filename") or die "Cannot open $filename: $!\n" ; binmode F; foreach (@strings) { no warnings ; print F $_ ; } close F ; } sub readFile { my $f = shift ; open (F, "<$f") or die "Cannot open $f: $!\n" ; binmode F; local $/; my $string = <F> ; close F ; return $string ; } my $tempFile = "/tmp/paul123"; my $now = time; my $dosTime = _unixToDosTime($now); writeFile($tempFile, $dosTime); my $unix = readFile($tempFile); $unix = _dosToUnixTime($dosTime); my $delta = $now - $unix; my $packed = pack "V", $dosTime; writeFile($tempFile, $packed); my $got = readFile($tempFile); my $unpacked = unpack "V", $got; my $unix1 = _dosToUnixTime($unpacked); my $delta1 = $now - $unix1; print <<EOM; Now $now DOS $dosTime Unix $unix Delta $delta Packed Unix $unix1 Delta $delta1 EOM
From: robin-bitcard [...] robinbowes.com
On Mon Mar 31 16:54:03 2008, PMQS wrote: Show quoted text
> Thanks, that worked perfectly. I've enclosed another variant. Can you > try running it please?
Of course: # perl time2.pl Now 1207040093 DOS 947998426 Unix 1207040092 Delta 1 Packed Unix 1207040092 Delta 1 And on Fedora 8: $ perl time2.pl Now 1207040118 DOS 947998441 Unix 1207040118 Delta 0 Packed Unix 1207040118 Delta 0 R.
On Tue Apr 01 04:55:26 2008, robinbowes wrote: Show quoted text
> On Mon Mar 31 16:54:03 2008, PMQS wrote:
> > Thanks, that worked perfectly. I've enclosed another variant. Can you > > try running it please?
> > Of course: > > # perl time2.pl > Now 1207040093 > DOS 947998426 > Unix 1207040092 > Delta 1 > > Packed > Unix 1207040092 > Delta 1 > > And on Fedora 8: > > $ perl time2.pl > Now 1207040118 > DOS 947998441 > Unix 1207040118 > Delta 0 > > Packed > Unix 1207040118 > Delta 0
Thanks again, but that worked properly as well. So it doesn't help track down the problem. Did you run the script using the same account, with the same version of perl and on the same disk as when you tried building IO::Compress::Zlib? Paul
From: robin-bitcard [...] robinbowes.com
On Tue Apr 01 05:19:41 2008, PMQS wrote: Show quoted text
> Thanks again, but that worked properly as well. So it doesn't help track > down the problem. > > Did you run the script using the same account, with the same version of > perl and on the same disk as when you tried building IO::Compress::Zlib?
Yes, I did. Hmmm, not sure what's going on but I just tried again and the tests completed successfully. I have successfully installed via CPAN. Looks like something screwy with my system. Sorry to have bothered you. R.
On Tue Apr 01 08:55:37 2008, robinbowes wrote: Show quoted text
> On Tue Apr 01 05:19:41 2008, PMQS wrote:
> > Thanks again, but that worked properly as well. So it doesn't help track > > down the problem. > > > > Did you run the script using the same account, with the same version of > > perl and on the same disk as when you tried building IO::Compress::Zlib?
> > Yes, I did. > Hmmm, not sure what's going on but I just tried again and the tests > completed successfully. I have successfully installed via CPAN. > > Looks like something screwy with my system. > > Sorry to have bothered you.
No problem. I'll close this ticket then. Drop me a line if you trip over it again. Paul