Skip Menu |

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

Report information
The Basics
Id: 101232
Status: open
Priority: 0/
Queue: Date-Calc

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc: contyk [...] cpan.org
dam [...] cpan.org
gregoa [...] cpan.org
AdminCc:

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



Subject: Test suite started to fail since 2015-01-01
See http://matrix.cpantesters.org/?dist=Date-Calc;reports=1#sl=7,1 for a time-sorted overview of test reports. All reports in the new year 2015 are fail reports.
On Thu Jan 01 05:25:18 2015, SREZIC wrote: Show quoted text
> See http://matrix.cpantesters.org/?dist=Date-Calc;reports=1#sl=7,1 for > a time-sorted overview of test reports. All reports in the new year > 2015 are fail reports.
Makes ‘Happy New Year!’ rather ironic. :-) Oh, and Happy New Year, BTW!
For the record: Date-Calc-XS is also affected
From: jeppe [...] ioslo.net
It looks like the tests that fail refer to the PP version. The test scripts which fail start with BEGIN { $Date::Calc::XS_DISABLE = $Date::Calc::XS_DISABLE = 1; } .. and they refer to Decode_Date_EU2, Decode_Date_US2, Decode_Date_EU and Decode_Date_US. I've taken some time to rewrite one of the test files using a proper test harness, and easily find that the tests fail since we're now closer to 2064 than we are to 1964.
Subject: f016.t
#!perl -w BEGIN { eval { require bytes; }; } use Test::Most; BEGIN { $Date::Calc::XS_DISABLE = $Date::Calc::XS_DISABLE = 1; } use Date::Calc qw( Decode_Date_EU Decode_Date_US ); use strict; # ====================================================================== # ($year,$mm,$dd) = Decode_Date_EU($buffer); # ($year,$mm,$dd) = Decode_Date_US($buffer); # ====================================================================== plan tests => 25; # format: [[parameters], [expected output]] my $eu_tests = [ [ ["3.1.64"], [ 1964, 1, 3 ] ], [ ["3 1 64"], [ 1964, 1, 3 ] ], [ ["03.01.64"], [ 1964, 1, 3 ] ], [ ["03/01/64"], [ 1964, 1, 3 ] ], [ [ "3. Ene 1964", 4 ], [ 1964, 1, 3 ] ], [ [ "Geburtstag: 3. Januar '64 in Backnang/Württemberg", 3 ], [ 1964, 1, 3 ] ], [ ["03-Jan-64"], [ 1964, 1, 3 ] ], [ [ "3.Jan1964", 6 ], [ 1964, 1, 3 ] ], [ [ "3Jan64", 0 ], [ 1964, 1, 3 ] ], [ ["030164"], [ 1964, 1, 3 ] ], [ [ "3ja64", ], [ 1964, 1, 3 ] ], [ [ "3164", ], [ 1964, 1, 3 ] ], [ ["28.2.1995"], [ 1995, 2, 28 ] ], [ ["29.2.1995"], [] ], ]; foreach my $testcase (@$eu_tests) { my @arr = Decode_Date_EU( @{ $testcase->[0] } ); is_deeply( \@arr, $testcase->[1], "parse " . join( ',', @{ $testcase->[0] } ) . " ok" ); } my $us_tests = [ [ ["1 3 64"], [ 1964, 1, 3 ] ], [ ["01/03/64"], [ 1964, 1, 3 ] ], [ ["Jan 3 '64"], [ 1964, 1, 3 ] ], [ ["Jan 3 1964"], [ 1964, 1, 3 ] ], [ ["===> January 3rd 1964 (birthday)"], [ 1964, 1, 3 ] ], [ ["Jan31964"], [ 1964, 1, 3 ] ], [ ["Jan364"], [ 1964, 1, 3 ] ], [ ["ja364"], [ 1964, 1, 3 ] ], [ ["1364"], [ 1964, 1, 3 ] ], [ ["2.28.1995"], [ 1996, 2, 28 ] ], [ ["2.29.1995"], [] ] ]; foreach my $testcase (@$us_tests) { my @arr = Decode_Date_US( @{ $testcase->[0] } ); is_deeply( \@arr, $testcase->[1], "parse " . join( ',', @{ $testcase->[0] } ) . " ok" ); } __END__
I think all cases with a two-digit year in the date are affected, both PP and XS as the logic is the same in both. I think just checking if the result is 2064 now is sufficient (and correct). A better option would be computing the correct year in the test itself so this wouldn't break in 2115 again but... well... The attached patch works with Date::Pcalc, too.
Subject: Date-Calc-6.3-century.patch

Message body is not shown because it is too large.

For the record: Same for Date::Palc.
This should read Date::Pcalc ...
Here's an alternative patch which calculates the year. - Not sure which approach is preferrable ...
Subject: moving_window.patch

Message body is not shown because it is too large.

Here's yet another patch which tries to keep what I guess is the original idea of the tests -- see if a two-digit year from 50 years ago (64) maps to the correct full year (1964).
Subject: century.patch

Message body is not shown because it is too large.

Do I understand correctly that only the test suite is broken, not Date::Calc itself? Thank you for clarifying, Lutz
Subject: Re: [rt.cpan.org #101232] Test suite started to fail since 2015-01-01
Date: Wed, 4 Feb 2015 21:49:31 +0100
To: Lutz Gehlen via RT <bug-Date-Calc [...] rt.cpan.org>
From: gregor herrmann <gregoa [...] debian.org>
On Wed, 04 Feb 2015 09:16:11 -0500, Lutz Gehlen via RT wrote: Show quoted text
> Do I understand correctly that only the test suite is broken, not Date::Calc itself? > Thank you for clarifying,
That's my understanding. The tests use the 2-digit-year '64' and check that it expands to 1964; which worked until 2014-12-31, since 2015-01-01 it expands to 2064. And this behaviour is consistent with the module documentation. Cheers, gregor -- .''`. Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06 : :' : Debian GNU/Linux user, admin, and developer - https://www.debian.org/ `. `' Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe `- NP: Fleetwood Mac: Little Lies
Download signature.asc
application/pgp-signature 949b

Message body not shown because it is not plain text.

Here's the final patch from Damyan we uploaded to Debian right now. (Applies to -XS and Date::PCalc as well with an offset). Cheers, gregor
Subject: century-tests.patch

Message body is not shown because it is too large.

I've emailed the author of this module asking for co-maint. I'm not an XS programmer, but I can fix a few things.
I'm discussing the patches in private emails with Steffen. Hold your breath.....
On Wed Mar 04 19:00:10 2015, RSAVAGE wrote: Show quoted text
> I'm discussing the patches in private emails with Steffen. Hold your > breath.....
I am indeed currently working on a new release. If all goes well it should find its way onto CPAN this weekend. BTW, thanks a lot for all the patches you guys (and gals?) sent in! Unfortunately using Moving_Window() is no option because it makes the tests tautological (ad absurdum), because the Decode_Date_X() functions use it internally. Testing against 2064 is just as bad an idea as it was to test against 1964 in the first place, so I'll adopt a more general approach, in order for this bug not to bite us again next century (when I will no longer be around to fix it! ;-) ). Just in case this module will somehow live that long... ;-)
On Fri Mar 06 17:54:53 2015, STBEY wrote: Show quoted text
> On Wed Mar 04 19:00:10 2015, RSAVAGE wrote:
> > I'm discussing the patches in private emails with Steffen. Hold your > > breath.....
> > I am indeed currently working on a new release. > If all goes well it should find its way onto CPAN this weekend. > > BTW, thanks a lot for all the patches you guys (and gals?) sent in! > > Unfortunately using Moving_Window() is no option because it makes the > tests tautological (ad absurdum), > because the Decode_Date_X() functions use it internally. > > Testing against 2064 is just as bad an idea as it was to test against > 1964 in the first place, > so I'll adopt a more general approach, in order for this bug not to > bite us again next century (when I will no longer be around to fix it! > ;-) ). > > Just in case this module will somehow live that long... ;-)
Please test the following release candidates and let me know if they test alright: Date::Calc 6.4 Sat 07-Mar-2015 01:00:08 CET 2505ac448904945613237ec636695f4e 172879 Date-Calc-6.4.tar.gz 2012 Date-Calc-6.4.README http://guest.engelschall.com/~sb/download/pkg/Date-Calc-6.4.tar.gz Date::Calc::XS 6.4 Sat 07-Mar-2015 01:04:59 CET db42e9ea3b14adcc6d95c2b5913a172c 85842 Date-Calc-XS-6.4.tar.gz 2018 Date-Calc-XS-6.4.README http://guest.engelschall.com/~sb/download/pkg/Date-Calc-XS-6.4.tar.gz
On 2015-03-06 19:14:56, STBEY wrote: Show quoted text
> On Fri Mar 06 17:54:53 2015, STBEY wrote:
> > On Wed Mar 04 19:00:10 2015, RSAVAGE wrote:
> > > I'm discussing the patches in private emails with Steffen. Hold > > > your > > > breath.....
> > > > I am indeed currently working on a new release. > > If all goes well it should find its way onto CPAN this weekend. > > > > BTW, thanks a lot for all the patches you guys (and gals?) sent in! > > > > Unfortunately using Moving_Window() is no option because it makes the > > tests tautological (ad absurdum), > > because the Decode_Date_X() functions use it internally. > > > > Testing against 2064 is just as bad an idea as it was to test against > > 1964 in the first place, > > so I'll adopt a more general approach, in order for this bug not to > > bite us again next century (when I will no longer be around to fix > > it! > > ;-) ). > > > > Just in case this module will somehow live that long... ;-)
> > > Please test the following release candidates and let me know if they > test alright: > Date::Calc 6.4 Sat 07-Mar-2015 01:00:08 CET > 2505ac448904945613237ec636695f4e 172879 Date-Calc-6.4.tar.gz 2012 > Date-Calc-6.4.README > http://guest.engelschall.com/~sb/download/pkg/Date-Calc-6.4.tar.gz > Date::Calc::XS 6.4 Sat 07-Mar-2015 01:04:59 CET > db42e9ea3b14adcc6d95c2b5913a172c 85842 Date-Calc-XS-6.4.tar.gz 2018 > Date-Calc-XS-6.4.README > http://guest.engelschall.com/~sb/download/pkg/Date-Calc-XS-6.4.tar.gz
Tested with perl 5.20.2 on a debian/wheezy machine: Date-Calc-6.4 passes all tests, Date-Calc-XS-6.4 also passes all tests if Date::Calc 6.4 is found in the @INC path.
On Sat Mar 07 14:38:32 2015, SREZIC wrote: Show quoted text
> On 2015-03-06 19:14:56, STBEY wrote:
> > On Fri Mar 06 17:54:53 2015, STBEY wrote:
> > > On Wed Mar 04 19:00:10 2015, RSAVAGE wrote:
> > > > I'm discussing the patches in private emails with Steffen. Hold > > > > your > > > > breath.....
> > > > > > I am indeed currently working on a new release. > > > If all goes well it should find its way onto CPAN this weekend. > > > > > > BTW, thanks a lot for all the patches you guys (and gals?) sent in! > > > > > > Unfortunately using Moving_Window() is no option because it makes > > > the > > > tests tautological (ad absurdum), > > > because the Decode_Date_X() functions use it internally. > > > > > > Testing against 2064 is just as bad an idea as it was to test > > > against > > > 1964 in the first place, > > > so I'll adopt a more general approach, in order for this bug not to > > > bite us again next century (when I will no longer be around to fix > > > it! > > > ;-) ). > > > > > > Just in case this module will somehow live that long... ;-)
> > > > > > Please test the following release candidates and let me know if they > > test alright: > > Date::Calc 6.4 Sat 07-Mar-2015 01:00:08 CET > > 2505ac448904945613237ec636695f4e 172879 Date-Calc-6.4.tar.gz 2012 > > Date-Calc-6.4.README > > http://guest.engelschall.com/~sb/download/pkg/Date-Calc-6.4.tar.gz > > Date::Calc::XS 6.4 Sat 07-Mar-2015 01:04:59 CET > > db42e9ea3b14adcc6d95c2b5913a172c 85842 Date-Calc-XS-6.4.tar.gz 2018 > > Date-Calc-XS-6.4.README > > http://guest.engelschall.com/~sb/download/pkg/Date-Calc-XS-6.4.tar.gz
> > Tested with perl 5.20.2 on a debian/wheezy machine: Date-Calc-6.4 > passes all tests, Date-Calc-XS-6.4 also passes all tests if Date::Calc > 6.4 is found in the @INC path.
Thanks a lot!! The latter is indeed a prerequisite.