Bug 1124882

Summary: date fails to parse dates bigger than INT_MAX on 32bit arch
Product: Red Hat Enterprise Linux 7 Reporter: Aleš Mareček <amarecek>
Component: coreutilsAssignee: Kamil Dudka <kdudka>
Status: CLOSED WONTFIX QA Contact: qe-baseos-daemons
Severity: high Docs Contact:
Priority: medium    
Version: 7.2CC: hkario, kdudka, lmiksik, lpol, ovasik
Target Milestone: alpha   
Target Release: 7.4   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-12-15 07:31:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Aleš Mareček 2014-07-30 14:32:46 UTC
Description of problem:
date fails to parse dates bigger than INT_MAX (2147483647), 32-bit architecture.

Version-Release number of selected component (if applicable):
Always

How reproducible:
coreutils-8.4-31.el6.i686
date (GNU coreutils) 8.4

Steps to Reproduce:
1. date -d "2038-01-19 04:14:08" "+%s"

Actual results:
date: invalid date `2038-01-19 04:14:08'

Expected results:
2147483648

Additional info:
i:i386|m:i686 root@x86-64-v06 [~]# date -d "2038-01-19 04:14:07" "+%s"
2147483647
i:i386|m:i686 root@x86-64-v06 [~]# date -d "2038-01-19 04:14:08" "+%s"
date: invalid date `2038-01-19 04:14:08'

Comment 2 Pádraig Brady 2014-07-30 16:31:40 UTC
The limitation here stems from the glibc and kernel representation of time_t
which on 32 bit x86 at least is long, i.e. 31 bits.

Now theoretically we could work around this by defining time64_t, mktime64(), localtime64() in gnulib, and parse_datetime() etc. would use those.

Those functions in turn could call out to _time64() on windows,
or otherwise on signed 32 bit time_t systems, handle at least the 32 bit wrap,
thus handling dates until 2106.

We could split the problem by only implementing mktime64() in gnulib,
and thus supporting absolute times like in the above report without
needing to worry about the kernel interface required for relative times.

Though would it be worth doing that, when 64 bit supports this already?

What's the use case for this exactly?

Comment 4 Aleš Mareček 2014-07-31 09:19:19 UTC
Greetings,
thank you for your quick response at first.
We use this datetime functions in certificate testing what is broken on 32-bit archs. Timestamp is basic commonly used data type and shouldn't be faulty.
Thanks and Regards!

Comment 9 RHEL Program Management 2020-12-15 07:31:01 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.