Skip Menu |

This queue is for tickets about the Net-FTPSSL CPAN distribution.

Report information
The Basics
Id: 124570
Status: resolved
Priority: 0/
Queue: Net-FTPSSL

People
Owner: Nobody in particular
Requestors: bitcardbmw [...] lsmod.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.39
Fixed in: 0.40



Subject: timegm should be called with 4-digit year
man Time::Local says Whenever possible, use an absolute four digit year instead. With a detailed explanation about ambiguity of 2-digit years above that. Please review/test/merge the attached patch
Subject: fix.patch
Index: Net-FTPSSL-0.39/FTPSSL.pm =================================================================== --- Net-FTPSSL-0.39.orig/FTPSSL.pm +++ Net-FTPSSL-0.39/FTPSSL.pm @@ -2701,10 +2701,10 @@ sub _mdtm { if ( $GMT_flag ) { # Use GMT Time [ timegm() vs timelocal() ] - $timestamp = timegm ( $sec, $min, $hr, $day, $mon - 1, $yr - 1900 ); + $timestamp = timegm ( $sec, $min, $hr, $day, $mon - 1, $yr ); } else { # Use Local Time [ timegm() vs timelocal() ] - $timestamp = timelocal ( $sec, $min, $hr, $day, $mon - 1, $yr - 1900 ); + $timestamp = timelocal ( $sec, $min, $hr, $day, $mon - 1, $yr ); } } } Index: Net-FTPSSL-0.39/t/10-complex.t =================================================================== --- Net-FTPSSL-0.39.orig/t/10-complex.t +++ Net-FTPSSL-0.39/t/10-complex.t @@ -861,8 +861,8 @@ sub test_mdtm_in_gmt { if ( defined $tm && $tm =~ m/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/ ) { my ($yr, $mon, $day, $hr, $min, $sec) = ($1, $2, $3, $4, $5, $6); - my $gm = timegm ( $sec, $min, $hr, $day, $mon - 1, $yr - 1900 ); - my $loc = timelocal ( $sec, $min, $hr, $day, $mon - 1, $yr - 1900 ); + my $gm = timegm ( $sec, $min, $hr, $day, $mon - 1, $yr ); + my $loc = timelocal ( $sec, $min, $hr, $day, $mon - 1, $yr ); if ( abs ($gm - $now) <= abs ($loc - $now) ) { $msg = "The FTP/S server correctly uses UTC/GMT time for MDTM.";
Thank you for using my module, but I'd like to verify what you are asking for. I'm assuming you are saying I'm misusing the Time::Local functions for your situation. My usage should be OK as long as timestamps on the file are between the years 2000 and 2899. So are you saying you wish to collect timestamps on files from 1999 and earlier from some servers? Curtis On Sun Feb 25 03:43:07 2018, bmwiedemann wrote: Show quoted text
> man Time::Local says > > Whenever possible, use an absolute four digit year instead. > > With a detailed explanation about ambiguity of 2-digit years above that. > > Please review/test/merge the attached patch
Subject: Re: [rt.cpan.org #124570] timegm should be called with 4-digit year
Date: Tue, 27 Feb 2018 15:29:11 +0000
To: bug-Net-FTPSSL [...] rt.cpan.org
From: "Bernhard M. Wiedemann" <bernhardout [...] lsmod.de>
On 2018-02-27 01:58, Curtis Leach via RT wrote: Show quoted text
> My usage should be OK as long as timestamps on the file are between > the years 2000 and 2899. So are you saying you wish to collect > timestamps on files from 1999 and earlier from some servers?
yes, indeed. I do have some such old files on my server and so might others. Also I like software that just keeps working (even in 2050 when year 99 will mean 2099 to Time::Local) and always does the right thing.
Your changes have been implemented and the upload to CPAN should be available in an hour or so. Curtis On Tue Feb 27 10:38:10 2018, bernhardout@lsmod.de wrote: Show quoted text
> > > On 2018-02-27 01:58, Curtis Leach via RT wrote:
> > My usage should be OK as long as timestamps on the file are between > > the years 2000 and 2899. So are you saying you wish to collect > > timestamps on files from 1999 and earlier from some servers?
> > yes, indeed. I do have some such old files on my server and so might > others. > > Also I like software that just keeps working (even in 2050 when year > 99 will mean 2099 to Time::Local) and always does the right thing.