Skip Menu |
 

This queue is for tickets about the Perl4-CoreLibs CPAN distribution.

Report information
The Basics
Id: 131341
Status: open
Priority: 0/
Queue: Perl4-CoreLibs

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

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



From: gregoa [...] cpan.org
Subject: [PATCH] turn the y2k20 into a y2k40 problem, or fix test failures starting in 2020
Download (untitled) / with headers
text/plain 890b
In Debian we are currently applying the following patch to Perl4-CoreLibs. We thought you might be interested in it too. Description: turn the y2k20 into a y2k40 problem, or fix test failures starting in 2020 t/timelocal.t fails with not ok 31 - timelocal year for 1970 1 2 0 0 0 # Failed test 'timelocal year for 1970 1 2 0 0 0' # at t/timelocal.t line 36. # got: '170' # expected: '70' not ok 37 - timegm year for 1970 1 2 0 0 0 # Failed test 'timegm year for 1970 1 2 0 0 0' # at t/timelocal.t line 49. # got: '170' # expected: '70' Origin: vendor Author: gregor herrmann <gregoa@debian.org> Last-Update: 2020-01-03 The patch is tracked in our Git repository at https://salsa.debian.org/perl-team/modules/packages/libperl4-corelibs-perl/raw/master/debian/patches/y2k20.patch Thanks for considering, gregor herrmann, Debian Perl Group
Here is the current version of the patch.
Download y2k20.patch
text/x-diff 1.1k

Message body is not shown because sender requested not to inline it.

On Thu Jan 02 23:04:11 2020, GREGOA wrote:
Show quoted text
> In Debian we are currently applying the following patch to
> Perl4-CoreLibs.
> We thought you might be interested in it too.
>
> Description: turn the y2k20 into a y2k40 problem, or fix test failures
> starting in 2020
> t/timelocal.t fails with
> not ok 31 - timelocal year for 1970 1 2 0 0 0
> # Failed test 'timelocal year for 1970 1 2 0 0 0'
> # at t/timelocal.t line 36.
> # got: '170'
> # expected: '70'
> not ok 37 - timegm year for 1970 1 2 0 0 0
> # Failed test 'timegm year for 1970 1 2 0 0 0'
> # at t/timelocal.t line 49.
> # got: '170'
> # expected: '70'
> Origin: vendor
> Author: gregor herrmann <gregoa@debian.org>
> Last-Update: 2020-01-03
>
>
> The patch is tracked in our Git repository at
> https://salsa.debian.org/perl-team/modules/packages/libperl4-corelibs-
> perl/raw/master/debian/patches/y2k20.patch
>
> Thanks for considering,
> gregor herrmann,
> Debian Perl Group

As much as I hope not to be using Perl4 CoreLibs in 2040, I'd rather not have this test fail at that point, see attached patch that used the +-50 "rolling" century calculation to adjust year_in

Subject: patch-t_timelocal__t
Download patch-t_timelocal__t
application/octet-stream 1.7k

Message body not shown because it is not plain text.

On Wed Sep 16 01:16:04 2020, JWRIGHT wrote:
Show quoted text
> On Thu Jan 02 23:04:11 2020, GREGOA wrote:
> > In Debian we are currently applying the following patch to
> > Perl4-CoreLibs.
> > We thought you might be interested in it too.
> >
> > Description: turn the y2k20 into a y2k40 problem, or fix test
> > failures
> > starting in 2020
> > t/timelocal.t fails with
> > not ok 31 - timelocal year for 1970 1 2 0 0 0
> > # Failed test 'timelocal year for 1970 1 2 0 0 0'
> > # at t/timelocal.t line 36.
> > # got: '170'
> > # expected: '70'
> > not ok 37 - timegm year for 1970 1 2 0 0 0
> > # Failed test 'timegm year for 1970 1 2 0 0 0'
> > # at t/timelocal.t line 49.
> > # got: '170'
> > # expected: '70'
> > Origin: vendor
> > Author: gregor herrmann <gregoa@debian.org>
> > Last-Update: 2020-01-03
> >
> >
> > The patch is tracked in our Git repository at
> > https://salsa.debian.org/perl-team/modules/packages/libperl4-
> > corelibs-
> > perl/raw/master/debian/patches/y2k20.patch
> >
> > Thanks for considering,
> > gregor herrmann,
> > Debian Perl Group
>
> As much as I hope not to be using Perl4 CoreLibs in 2040, I'd rather
> not have
> this test fail at that point, see attached patch that used the +-50
> "rolling"
> century calculation to adjust year_in


Subject: t_timelocal__t.patch
--- t/timelocal.t.orig 2017-07-30 02:42:17.000000000 -0400 +++ t/timelocal.t 2020-09-16 01:09:04.438584335 -0400 @@ -2,7 +2,7 @@ use warnings; use strict; use Config; -use Test::More tests => 135; +use Test::More tests => 183; require_ok "timelocal.pl"; @@ -11,6 +11,7 @@ foreach( [1950, 4, 12, 9, 30, 31], [1969, 12, 31, 16, 59, 59], [1970, 1, 2, 00, 00, 00], + [1971, 1, 2, 00, 00, 00], [1980, 2, 28, 12, 00, 00], [1980, 2, 29, 12, 00, 00], [1999, 12, 31, 23, 59, 59], @@ -18,6 +19,9 @@ foreach( [2010, 10, 12, 14, 13, 12], [2020, 2, 29, 12, 59, 59], [2030, 7, 4, 17, 07, 06], + [2069, 7, 4, 17, 07, 06], + [2070, 7, 4, 17, 07, 06], + [2071, 7, 4, 17, 07, 06], ) { my($year, $mon, $mday, $hour, $min, $sec) = @$_; $year -= 1900; @@ -25,7 +29,10 @@ foreach( # Test timelocal() { - my $year_in = $year < 70 ? $year + 1900 : $year; + # need current year to calculate "rolling" current century + my $current_year = (localtime)[5]; + # is year $year in the current "rolling" century? + my $year_in = abs( $current_year - $year ) >= 50 ? $year + 1900 : $year; my $time = &timelocal($sec,$min,$hour,$mday,$mon,$year_in); my($s,$m,$h,$D,$M,$Y) = localtime($time); is $s, $sec, "timelocal second for @$_"; @@ -38,7 +45,10 @@ foreach( # Test timegm() { - my $year_in = $year < 70 ? $year + 1900 : $year; + # need current year to calculate "rolling" current century + my $current_year = (gmtime)[5]; + # is year $year in the current "rolling" century? + my $year_in = abs( $current_year - $year ) >= 50 ? $year + 1900 : $year; my $time = &timegm($sec,$min,$hour,$mday,$mon,$year_in); my($s,$m,$h,$D,$M,$Y) = gmtime($time); is $s, $sec, "timegm second for @$_";


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.