Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 948549 Details for
Bug 1149375
Time::Local patch for year 2038 on 64 bit breaks timelocal
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Upstream fix ported to Time-Local-1.11 and perl-5.8.8
perl-5.8.8-Do-not-attempt-to-extend-range-of-allowable-epoch-va.patch (text/plain), 4.88 KB, created by
Petr Pisar
on 2014-10-20 13:00:04 UTC
(
hide
)
Description:
Upstream fix ported to Time-Local-1.11 and perl-5.8.8
Filename:
MIME Type:
Creator:
Petr Pisar
Created:
2014-10-20 13:00:04 UTC
Size:
4.88 KB
patch
obsolete
>From e38a780e76b2aa3598fafda6874ec42f8e4fcf67 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> >Date: Wed, 8 Oct 2014 16:50:41 +0200 >Subject: [PATCH] Do not attempt to extend range of allowable epoch values >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This is a part of upstream commit > >commit 1c71e5bc5b789414e43c53776cc396aeeeda48fc >Author: Dave Rolsky <autarch@urth.org> >Date: Fri Mar 31 09:11:34 2006 +0000 > > revert lots of earlier changes about extending range around edges > merge warn with croak > doc tweaks to remove suggestion that nocheck versions should be used for doing datetime math > >ported to Time-Local-1.11 and perl-5.8.8. > >Time::Local patched to allow 64-bit time values on 64-bit platforms, see ><https://bugzilla.redhat.com/show_bug.cgi?id=1057047>, revealed a timelocal() >call produced warnings about undefined values: > >$ perl -Ilib -w -MTime::Local -e 'print timelocal(0,0,0,1,0,0), qq{\n};' >Use of uninitialized value in integer addition (+) at lib/Time/Local.pm line 81.[...] >946681200 > ><https://bugzilla.redhat.com/show_bug.cgi?id=1149375> > >Signed-off-by: Petr PÃsaÅ <ppisar@redhat.com> >--- > lib/Time/Local.pm | 37 ++++++++++--------------------------- > lib/Time/Local.t | 13 +------------ > 2 files changed, 11 insertions(+), 39 deletions(-) > >diff --git a/lib/Time/Local.pm b/lib/Time/Local.pm >index 199706f..30faa39 100644 >--- a/lib/Time/Local.pm >+++ b/lib/Time/Local.pm >@@ -24,27 +24,15 @@ my $Century = $NextCentury - 100; > my $SecOff = 0; > > my (%Options, %Cheat, %Min, %Max); >-my ($MinInt, $MaxInt); >+my ($MaxInt); > > if ($^O eq 'MacOS') { > # time_t is unsigned... > $MaxInt = (1 << (8 * $Config{ivsize})) - 1; >- $MinInt = 0; > } else { > $MaxInt = ((1 << (8 * $Config{ivsize} - 2))-1)*2 + 1; >- $MinInt = -$MaxInt - 1; >- >- # On Win32 (and others?) time_t appears to be signed, but negative >- # epochs still don't work. - XXX - this is experimental >- $MinInt = 0 >- unless defined ((localtime(-1))[0]); > } >- >-$Max{Day} = ($MaxInt >> 1) / 43200; >-$Min{Day} = $MinInt ? -($Max{Day} + 1) : 0; >- >-$Max{Sec} = $MaxInt - 86400 * $Max{Day}; >-$Min{Sec} = $MinInt - 86400 * $Min{Day}; >+my $MaxDay = int( ( $MaxInt - ( 86400 / 2 ) ) / 86400 ) - 1; > > # Determine the EPOC day for this machine > my $Epoc = 0; >@@ -124,16 +112,14 @@ sub timegm { > my $days = _daygm(undef, undef, undef, $mday, $month, $year); > my $xsec = $sec + $SecOff + 60*$min + 3600*$hour; > >- unless ($Options{no_range_check} >- or ($days > $Min{Day} or $days == $Min{Day} and $xsec >= $Min{Sec}) >- and ($days < $Max{Day} or $days == $Max{Day} and $xsec <= $Max{Sec})) >- { >- warn "Day too small - $days > $Min{Day}\n" if $days < $Min{Day}; >- warn "Day too big - $days > $Max{Day}\n" if $days > $Max{Day}; >- warn "Sec too small - $days < $Min{Sec}\n" if $days < $Min{Sec}; >- warn "Sec too big - $days > $Max{Sec}\n" if $days > $Max{Sec}; >- $year += 1900; >- croak "Cannot handle date ($sec, $min, $hour, $mday, $month, $year)"; >+ unless ($Options{no_range_check} or abs($days) < $MaxDay) { >+ my $msg = ''; >+ $msg .= "Day too big - $days > $MaxDay\n" if $days > $MaxDay; >+ >+ $year += 1900; >+ $msg .= "Cannot handle date ($sec, $min, $hour, $mday, $month, $year)"; >+ >+ croak $msg; > } > > no integer; >@@ -149,9 +135,6 @@ sub timegm_nocheck { > > > sub timelocal { >- # Adjust Max/Min allowed times to fit local time zone and call timegm >- local ($Max{Day}, $Max{Sec}) = _zoneadjust($Max{Day}, $Max{Sec}, $MaxInt); >- local ($Min{Day}, $Min{Sec}) = _zoneadjust($Min{Day}, $Min{Sec}, $MinInt); > my $ref_t = &timegm; > > # Calculate first guess with a one-day delta to avoid localtime overflow >diff --git a/lib/Time/Local.t b/lib/Time/Local.t >index 73c3655..d30c545 100755 >--- a/lib/Time/Local.t >+++ b/lib/Time/Local.t >@@ -69,7 +69,7 @@ my $epoch_is_64 = eval { $Config{ivsize} == 8 && ( gmtime 2**40 )[5] == 34912 }; > my $tests = (@time * 12); > $tests += @neg_time * 12; > $tests += @bad_time; >-$tests += 8; >+$tests += 6; > $tests += 2 if $ENV{PERL_CORE}; > $tests += 5 if $ENV{MAINTAINER}; > $tests += 3 if $epoch_is_64; >@@ -160,17 +160,6 @@ if ($neg_epoch_ok) { > skip(1, "skipping negative epoch.\n") for 1..2; > } > >-# round trip was broken for edge cases >-if ($^O eq "aix" && $Config{osvers} =~ m/^4\.3\./) { >- skip( 1, "No fix expected for edge case test for $_ on AIX 4.3") for qw( timegm timelocal ); >-} else { >- ok(sprintf('%x', timegm(gmtime(0x7fffffff))), sprintf('%x', 0x7fffffff), >- '0x7fffffff round trip through gmtime then timegm'); >- >- ok(sprintf('%x', timelocal(localtime(0x7fffffff))), sprintf('%x', 0x7fffffff), >- '0x7fffffff round trip through localtime then timelocal'); >-} >- > if ($epoch_is_64) { > ok( timegm( 8, 14, 3, 19, 0, ( 1900 + 138 ) ), 2**31, > 'can call timegm for 2**31 epoch seconds' ); >-- >1.9.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1149375
:
945048
| 948549