Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the DateTime CPAN distribution.

Report information
The Basics
Id: 3813
Status: resolved
Priority: 0/
Queue: DateTime

People
Owner: DROLSKY [...] cpan.org
Requestors: peterm [...] zeta.org.au
Cc:
AdminCc:

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



Subject: test 20infinite.t also failed in win32 (w2k) A/S 5.8.0 version 0.1702
t\20infinite............NOK 12# Failed test (t\20infinite.t at line 61) # got: '-2147483648' # expected: '2147483648' t\20infinite............NOK 13# Failed test (t\20infinite.t at line 61) # got: '-2147483646' # expected: '2147483648' t\20infinite............ok 39/39# Looks like you failed 2 tests of 39.
Subject: Re: test 20infinite.t also failed in win32 (w2k) A/S 5.8.0 version 0.1702
From: rrwo [...] cpan.org
[guest - Fri Sep 19 00:32:24 2003]: Show quoted text
> t\20infinite............NOK 12# Failed test (t\20infinite.t at
line 61) Show quoted text
> # got: '-2147483648' > # expected: '2147483648' > t\20infinite............NOK 13# Failed test (t\20infinite.t at
line 61) Show quoted text
> # got: '-2147483646' > # expected: '2147483648' > t\20infinite............ok 39/39# Looks like you failed 2 tests of 39.
If negative epoch times fail on some OSs (such as Win32) and tests are skipped, perhaps this test should be skipped as well? Otherwise the test still fails on some Win32 machines.
Date: Tue, 8 Mar 2005 16:49:56 -0600 (CST)
From: Dave Rolsky <autarch [...] urth.org>
To: Guest via RT <bug-DateTime [...] rt.cpan.org>
Subject: Re: [cpan #3813] Re: test 20infinite.t also failed in win32 (w2k) A/S 5.8.0 version 0.1702
RT-Send-Cc:
On Tue, 8 Mar 2005, Guest via RT wrote: Show quoted text
> Full context and any attached attachments can be found at: > <URL: https://rt.cpan.org/Ticket/Display.html?id=3813 > > > [guest - Fri Sep 19 00:32:24 2003]: >
>> t\20infinite............NOK 12# Failed test (t\20infinite.t at
> line 61)
>> # got: '-2147483648' >> # expected: '2147483648' >> t\20infinite............NOK 13# Failed test (t\20infinite.t at
> line 61)
>> # got: '-2147483646' >> # expected: '2147483648' >> t\20infinite............ok 39/39# Looks like you failed 2 tests of 39.
> > If negative epoch times fail on some OSs (such as Win32) and tests are > skipped, perhaps this test should be skipped as well? > > Otherwise the test still fails on some Win32 machines.
This is a different problem. The handling of infinite numbers on Win32 and some other platforms appears to be unpredictable. I've also seen failures on at least one Linux platform. You can certainly still use most of DateTime even without the DateTime::Infinite pieces working. -dave /*=================================================== VegGuide.Org www.BookIRead.com Your guide to all that's veg. My book blog ===================================================*/
From: johanl ÄR darserman.com
[autarch@urth.org - Tue Mar 8 17:50:06 2005]: Show quoted text
> This is a different problem. The handling of infinite numbers on > Win32 > and some other platforms appears to be unpredictable. I've also seen > failures on at least one Linux platform. You can certainly still use > most > of DateTime even without the DateTime::Infinite pieces working.
Not if the tests don't pass and the module isn't installed becasue of that. How many more people should have to see a failing module test and go here to find this ticket which is now more than two years old? Just asking... /J
Date: Mon, 21 Nov 2005 08:55:23 -0600 (CST)
From: Dave Rolsky <autarch [...] urth.org>
To: Guest via RT <bug-DateTime [...] rt.cpan.org>
Subject: Re: [cpan #3813] test 20infinite.t also failed in win32 (w2k) A/S 5.8.0 version 0.1702
RT-Send-Cc:
On Mon, 21 Nov 2005, Guest via RT wrote: Show quoted text
> > This message about DateTime was sent to you by guest <> via rt.cpan.org > > Full context and any attached attachments can be found at: > <URL: https://rt.cpan.org/Ticket/Display.html?id=3813 > > > [autarch@urth.org - Tue Mar 8 17:50:06 2005]:
>> This is a different problem. The handling of infinite numbers on >> Win32 >> and some other platforms appears to be unpredictable. I've also seen >> failures on at least one Linux platform. You can certainly still use >> most >> of DateTime even without the DateTime::Infinite pieces working.
> > Not if the tests don't pass and the module isn't installed becasue of that. > > How many more people should have to see a failing module test and go > here to find this ticket which is now more than two years old? Just > asking...
Patches welcome. Attitude like that probably will not get you far, however. -dave /*=================================================== VegGuide.Org www.BookIRead.com Your guide to all that's veg. My book blog ===================================================*/
From: johanl [...] cpan.org
[autarch@urth.org - Mon Nov 21 09:56:01 2005]: Show quoted text
> Patches welcome. Attitude like that probably will not get you far, > however.
Ok, sorry if I came off as whiny. I don't know if it's any excuse, but my recation came from the impression that you didn't care about the problem, which I thought was a shame since the module is too useful to be hindered by this. My bad. Anyway, I poked around a little and found two things, both related to the tests itself (I think): 1) I wonder if the magic in Test::More isn't playing tricks with the overloading, which makes it unsuitable to use is() to compare the numbers. If 20infinite.t, line 61 uses cmp_ok with '==' instead, it seems to work better. cmp_ok( $deltas{$_}, '==', $nan, "infinity - infinity = nan ($_)" ); 2) The second thing is the Windows specific fix mentioned on line 17 # for some reason, Windows only gets NaN if abs() is used I'm not sure which Perl version/OS version etc that came from, but using winxp and Perl "v5.8.6 built for MSWin32-x86-multi-thread", it works correctly if I _don't_ use the abs() (so that comment was very helpful!) my $nan = $posinf - $posinf; This second thing of course needs to be tested on a few more combinations before anything can be said for certain, but for the original poster it was broken with w2k + 5.8.0. So I guess the question is whether these two things actually work, like for real usage of the module outside of the test suite, or if the infinite stuff is still broken for real on win32. I don't feel competent enough to answer that question, not knowing the module well enough. There's a patch at the end. If it doesn't break anything else and you decide to apply it, that comment about Windows should perhaps be rephrased to mention the change, in case the previous approach worked for previous versions of something (OS/Perl). /J Index: t/20infinite.t =================================================================== --- t/20infinite.t (revision 1) +++ t/20infinite.t (working copy) @@ -15,7 +15,7 @@ my $posinf = 100 ** 100 ** 100; my $neginf = -1 * $posinf; # for some reason, Windows only gets NaN if abs() is used -my $nan = abs( $posinf - $posinf ); +my $nan = $posinf - $posinf; # infinite date math { @@ -58,7 +58,7 @@ my @compare = $is_win32 ? ( qw( days seconds ) ) : ( qw( days seconds nanoseconds ) ); foreach (@compare) { - is( $deltas{$_}, $nan, "infinity - infinity = nan ($_)" ); + cmp_ok( $deltas{$_}, '==', $nan, "infinity - infinity = nan ($_)" ); } my $new_pos = $pos->clone->add( days => 10 );
Date: Wed, 23 Nov 2005 12:08:40 -0600 (CST)
From: Dave Rolsky <autarch [...] urth.org>
To: Guest via RT <bug-DateTime [...] rt.cpan.org>
Subject: Re: [cpan #3813] test 20infinite.t also failed in win32 (w2k) A/S 5.8.0 version 0.1702
RT-Send-Cc:
On Wed, 23 Nov 2005, Guest via RT wrote: Show quoted text
> 1) I wonder if the magic in Test::More isn't playing tricks with the > overloading, which makes it unsuitable to use is() to compare the > numbers. If 20infinite.t, line 61 uses cmp_ok with '==' instead, it > seems to work better. > > cmp_ok( $deltas{$_}, '==', $nan, "infinity - infinity = nan ($_)" );
Ah, interesting. Someone reported that the tests used to pass for him and failed after upgrading Test::More, so that might be it. Show quoted text
> 2) The second thing is the Windows specific fix mentioned on line 17 > > # for some reason, Windows only gets NaN if abs() is used > > I'm not sure which Perl version/OS version etc that came from, but using > winxp and Perl "v5.8.6 built for MSWin32-x86-multi-thread", it works > correctly if I _don't_ use the abs() (so that comment was very helpful!) > > my $nan = $posinf - $posinf; > > This second thing of course needs to be tested on a few more > combinations before anything can be said for certain, but for the > original poster it was broken with w2k + 5.8.0.
I can certainly change it for the next release and see what happens. It's not likely to get _more_ broken. Show quoted text
> So I guess the question is whether these two things actually work, like > for real usage of the module outside of the test suite, or if the > infinite stuff is still broken for real on win32. I don't feel competent > enough to answer that question, not knowing the module well enough.
That's tough to say. Mostly it depends on this holding true: my $inf = 100 ** 100 ** 100; my $neg_inf = -1 * $inf; $inf == $inf; $neg_ing == $neg_inf; If those last two are true, then DateTime::Infinite should work. Show quoted text
> There's a patch at the end. If it doesn't break anything else and you > decide to apply it, that comment about Windows should perhaps be > rephrased to mention the change, in case the previous approach worked > for previous versions of something (OS/Perl).
Sounds like a good idea. I'll probably apply the patch since like I said, it's unlikely to get worse, maybe just broken on different platforms. Thanks, -dave /*=================================================== VegGuide.Org www.BookIRead.com Your guide to all that's veg. My book blog ===================================================*/