Item10359: Foswiki::Time is affected by "year 2038 problem"
Priority: Normal
Current State: No Action Required
Released In: (select future release)
Target Release: patch
A
bug with Time::Local Perl module affects Foswiki::Time with the
Year 2038 problem.
There is a
new Perl module (Time::y2038) to solve this issue. Maybe Foswiki::Time could use it instead of Time::Local. I have made some local tests against Foswiki trunk and Time::y2038 worked for me. Follow below the file diff with my changes in Foswiki code to do it.
*
Foswiki-Time.pm.diff: Foswiki-Time.pm.diff
I didn't do any tests yet... follow complete trace of the error:
computing page for TesteDataTooBig.WebHome
Day too big - 24884 > 24853
Cannot handle date (0, 0, 0, 17, 1, 2038) at /home/joenio/src/foswiki.git/core/lib/Foswiki/Time.pm line 144
at /usr/share/perl/5.10/Time/Local.pm line 125
Time::Local::timegm(0, 0, 0, 17, 1, 138) called at /home/joenio/src/foswiki.git/core/lib/Foswiki/Time.pm line 144
Foswiki::Time::parseTime('17 Feb 2038') called at /home/joenio/src/foswiki.git/core/lib/Foswiki/Plugins/DBCachePlugin/Core.pm line 1190
Foswiki::Plugins::DBCachePlugin::Core::formatTime('17 Feb 2038', 'Feb') called at /home/joenio/src/foswiki.git/core/lib/Foswiki/Plugins/DBCachePlugin/Core.pm line 310
Foswiki::Plugins::DBCachePlugin::Core::handleDBQUERY('Foswiki=HASH(0x87ce7b0)', 'Foswiki::Attrs=HASH(0x9095a08)', 'WebHome', 'TesteDataTooBig', 'Foswiki::Meta=HASH(0x8b39780)') called at /home/joenio/src/foswiki.git/core/lib/Foswiki/Plugins/DBCachePlugin.pm line 182
Foswiki::Plugins::DBCachePlugin::DBQUERY('Foswiki=HASH(0x87ce7b0)', 'Foswiki::Attrs=HASH(0x9095a08)', 'WebHome', 'TesteDataTooBig', 'Foswiki::Meta=HASH(0x8b39780)') called at /home/joenio/src/foswiki.git/core/lib/Foswiki/Func.pm line 570
Foswiki::Func::__ANON__('Foswiki=HASH(0x87ce7b0)', 'Foswiki::Attrs=HASH(0x9095a08)', 'Foswiki::Meta=HASH(0x8b39780)') called at /home/joenio/src/foswiki.git/core/lib/Foswiki.pm line 3031
Foswiki::_expandMacroOnTopicRendering('Foswiki=HASH(0x87ce7b0)', 'DBQUERY', '"form = \'TesteForm\'" format=" * $topic $formatTime(Nascim...', 'Foswiki::Meta=HASH(0x8b39780)') called at /home/joenio/src/foswiki.git/core/lib/Foswiki.pm line 2912
Foswiki::_processMacros('Foswiki=HASH(0x87ce7b0)', '---+!! %MAKETEXT{"Welcome to the [_1] web" args="<nop>%WEB%"}...', 'CODE(0x8767dd0)', 'Foswiki::Meta=HASH(0x8b39780)', 16) called at /home/joenio/src/foswiki.git/core/lib/Foswiki.pm line 2709
Foswiki::innerExpandMacros('Foswiki=HASH(0x87ce7b0)', 'SCALAR(0x8772900)', 'Foswiki::Meta=HASH(0x8b39780)') called at /home/joenio/src/foswiki.git/core/lib/Foswiki.pm line 3208
Foswiki::expandMacros('Foswiki=HASH(0x87ce7b0)', '---+!! %MAKETEXT{"Welcome to the [_1] web" args="<nop>%WEB%"}...', 'Foswiki::Meta=HASH(0x8b39780)') called at /home/joenio/src/foswiki.git/core/lib/Foswiki/Meta.pm line 3138
Foswiki::Meta::expandMacros('Foswiki::Meta=HASH(0x8b39780)', '---+!! %MAKETEXT{"Welcome to the [_1] web" args="<nop>%WEB%"}...') called at /home/joenio/src/foswiki.git/core/lib/Foswiki/UI/View.pm line 406
Foswiki::UI::View::_prepare('---+!! %MAKETEXT{"Welcome to the [_1] web" args="<nop>%WEB%"}...', 'Foswiki::Meta=HASH(0x8b39780)', 0) called at /home/joenio/src/foswiki.git/core/lib/Foswiki/UI/View.pm line 386
Foswiki::UI::View::view('Foswiki=HASH(0x87ce7b0)') called at /home/joenio/src/foswiki.git/core/lib/Foswiki/UI.pm line 316
Foswiki::UI::__ANON__() called at /usr/share/perl5/Error.pm line 416
eval {...} called at /usr/share/perl5/Error.pm line 408
Error::subs::try('CODE(0x824e978)', 'HASH(0x87d1848)') called at /home/joenio/src/foswiki.git/core/lib/Foswiki/UI.pm line 435
Foswiki::UI::_execute('Foswiki::Request=HASH(0x87a9578)', 'CODE(0x8788410)', 'view', 1) called at /home/joenio/src/foswiki.git/core/lib/Foswiki/UI.pm line 277
Foswiki::UI::handleRequest('Foswiki::Request=HASH(0x87a9578)') called at /home/joenio/src/foswiki.git/core/lib/Foswiki/Engine/CGI.pm line 37
Foswiki::Engine::CGI::run('Foswiki::Engine::CGI=HASH(0x84a3880)') called at /home/joenio/src/foswiki.git/core/bin/view line 29.
Time::Local upstream
said:
At some point, this module should probably be deprecated.
--
JoenioCosta - 16 Feb 2011
OK, that all looks kosher. The patch should be applied.
--
CrawfordCurrie - 15 Mar 2011
I do not have a y2038 CPAN module in my installation. So it is not a standard CPAN lib.
We will need to provide it in the Foswiki CPAN lib if we want to use this solution.
--
KennethLavrsen - 31 Aug 2011
How about test if Time::y2038 is available, and fall back to Time::Local if it isn't available. This lets a site improve time processing without requiring us to add another dependency.
--
GeorgeClark - 09 Jan 2015
Setting this to No Action. From
CPAN:Time::Local
"As of version 5.12.0, perl has stopped using the underlying time library of the operating system it's running on and has its own implementation of those routines with a safe range of at least +/ 2**52 (about 142 million years)."
--
GeorgeClark - 06 May 2017