Skip Menu |

This queue is for tickets about the Date-Manip CPAN distribution.

Report information
The Basics
Id: 126052
Status: resolved
Priority: 0/
Queue: Date-Manip

People
Owner: Nobody in particular
Requestors: pgajdos [...] suse.cz
Cc:
AdminCc:

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



Subject: interger overflow on 32-bit architectures
Date: Mon, 13 Aug 2018 13:19:37 +0200
To: bug-Date-Manip [...] rt.cpan.org
From: pgajdos <pgajdos [...] suse.cz>
Hello, thanks for Date-Manip. I stumbled over several failing tests for me running the testsuite on i586. I think at least one issue, if not only, lies in days_since_1BC(), as demonstrated below. $ cat test.pl #!/bin/perl require 5.010000; use strict; use warnings; use integer; sub days_since_1BC { my($arg) = @_; if (ref($arg)) { my($y,$m,$d) = @$arg; $m = ($m + 9) % 12; $y = $y - $m/10; return 365*$y + $y/4 - $y/100 + $y/400 + ($m*306 + 5)/10 + ($d - 1) - 305; } else { my $g = $arg + 305; print "g = $g\n"; my $y = (10000*$g + 14780)/3652425; my $res = 10000*$g; print "10000*$g = $res\n"; print "y = $y\n"; my $ddd = $g - (365*$y + $y/4 - $y/100 + $y/400); if ($ddd < 0) { $y = $y - 1; $ddd = $g - (365*$y + $y/4 - $y/100 + $y/400); } my $mi = (100*$ddd + 52)/3060; my $mm = ($mi + 2) % 12 + 1; $y = $y + ($mi + 2)/12; my $dd = $ddd - ($mi*306 + 5)/10 + 1; return [$y, $mm, $dd]; } } my $y = 2009; my $m = 8; my $d = 15; print "YMD: $y $m $d\n"; my $d1bc = days_since_1BC([$y,$m,$d]); print "D1BC: $d1bc\n"; my $ymd = days_since_1BC($d1bc); print "YMD: @$ymd\n"; $ x86_64 $ perl test.pl YMD: 2009 8 15 D1BC: 733634 g = 733939 10000*733939 = 7339390000 y = 2009 YMD: 2009 8 15 $ i586 $ perl test.pl YMD: 2009 8 15 D1BC: 733634 g = 733939 10000*733939 = -1250544592 y = -342 YMD: 1997 2 2 $
Thanks for your report. This was just pointed out to me a couple weeks ago, and I believe that I have it fully resolved. The next release is due out in a couple weeks, so I'll continue to do some testing. In the meantime, you can get a pre-release version at: https://sullybeck.com/Date-Manip-6.73.tgz If you have a moment to see if it passes all the checks on your machine, that would be great. Thanks
Subject: Re: [rt.cpan.org #126052] interger overflow on 32-bit architectures
Date: Mon, 13 Aug 2018 14:57:39 +0200
To: Sullivan Beck via RT <bug-Date-Manip [...] rt.cpan.org>
From: pgajdos <pgajdos [...] suse.cz>
Thanks for the link. The situation is much better now. I get only four tests failing with the pre-release, identical for both i586 and x86_64: [ 64s] Test Summary Report [ 64s] ------------------- [ 64s] t/delta.convert.t (Wstat: 0 Tests: 61 Failed: 2) [ 64s] Failed tests: 48, 58 [ 64s] t/delta.parse.fract.t (Wstat: 0 Tests: 3 Failed: 1) [ 64s] Failed test: 3 [ 64s] t/delta.set.3.t (Wstat: 0 Tests: 70 Failed: 1) [ 64s] Failed test: 66 [ 64s] Files=203, Tests=3685, 26 wallclock secs ( 0.82 usr 0.22 sys + 22.50 cusr 2.32 csys = 25.86 CPU) [ 64s] Result: FAIL [ 64s] Failed 3/203 test programs. 4/3685 subtests failed. [ 64s] make: *** [Makefile:8090: test_dynamic] Error 255 [ 64s] error: Bad exit status from /var/tmp/rpm-tmp.5liTb2 (%check) Should I try to debug more? I am sorry I had opened two identical bugs, I do not know how I did it. I hope I will not open third one by replying to the mail. Thanks!
They are failing on my end too (I thought I had all of them passing... I probably forgot to run all tests after the most recent changes). I'll get a new pre-release ready as soon as I've resolved the problems.
Subject: Re: [rt.cpan.org #126052] interger overflow on 32-bit architectures
Date: Mon, 13 Aug 2018 15:30:45 +0200
To: Sullivan Beck via RT <bug-Date-Manip [...] rt.cpan.org>
From: pgajdos <pgajdos [...] suse.cz>
Thanks!
Okay, a new pre-release is available (same URL). This should fix the last (known) problem due to the integer math.
Subject: Re: [rt.cpan.org #126052] interger overflow on 32-bit architectures
Date: Mon, 13 Aug 2018 16:33:53 +0200
To: Sullivan Beck via RT <bug-Date-Manip [...] rt.cpan.org>
From: pgajdos <pgajdos [...] suse.cz>
Perfect, now testsuite passes on both i586 and x86_64.
Great. Thanks for your assistance. The new release will include all of these changes.