PerlAlien / File-Listing

Module to parse directoy listings
1 stars 3 forks source link

timelocal should be called with 4-digit year [rt.cpan.org #124528] #5

Closed plicease closed 4 years ago

plicease commented 4 years ago

https://rt.cpan.org/Ticket/Display.html?id=124528

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 (not tested)

Index: File-Listing-6.04/lib/File/Listing.pm
===================================================================
--- File-Listing-6.04.orig/lib/File/Listing.pm
+++ File-Listing-6.04/lib/File/Listing.pm
@@ -332 +332 @@ sub line {
-       my $filetime = Time::Local::timelocal(0,$M,$H,$d,$m-1,_guess_year($y)-1900);
+       my $filetime = Time::Local::timelocal(0,$M,$H,$d,$m-1,_guess_year($y));
plicease commented 4 years ago

This should be addressed. Time::Local's year argument depends on the current year. This will require some tests though, which do not currently exists.

plicease commented 4 years ago

So playing around with apache in a docker container (see #14) seems as though apache always provides a four digit year so I am not sure why we are even ding _guess_year. There is also a new and old format and I think probably only will recognize one of those.

plicease commented 4 years ago

This should be fixed in 6.08_01