Bug 435766 - coreutils' date returns erroneous values on certain operations
coreutils' date returns erroneous values on certain operations
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: coreutils (Show other bugs)
4.6
x86_64 Linux
low Severity medium
: rc
: ---
Assigned To: Ondrej Vasik
:
: DAYLIGHT (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-03-03 14:07 EST by Kilian Cavalotti
Modified: 2010-10-22 18:58 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-05-18 16:07:42 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Kilian Cavalotti 2008-03-03 14:07:08 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.8 (like Gecko) (Debian)

Description of problem:
the coreutils' date utility can return wrong values on certain dates 
operations.

Version-Release number of selected component (if applicable):
coreutils-5.2.1-31.7

How reproducible:
Always


Steps to Reproduce:
$ date -d '2007/11/04 + 1 week' +%Y/%m/%d
or
$ date -d '2007/11/04 + 7 days' +%Y/%m/%d


Actual Results:
2007/11/10

Expected Results:
2007/11/11

Additional info:
$ date -d '2007/10/29 + 7 days' +%Y/%m/%d
2007/11/04
$ date -d '2007/10/28 + 7 days' +%Y/%m/%d
2007/11/04
Comment 1 Ondrej Vasik 2008-03-04 13:43:28 EST
It seems to be not a bug and to be related to the daylight saving time change.
Could you please specify your LC_TIME/LC_ALL/TZ setting? I think you can avoid
this issue easily by adding 1 or 2 hours to your commands or by using UTC time
as recommended by info pages / coreutils manual. 

See
http://www.gnu.org/software/coreutils/manual/html_node/Relative-items-in-date-strings.html
or info date (date input formats->Relative-items-in-date-strings).
Comment 2 Kilian Cavalotti 2008-03-04 14:23:57 EST
Indeed, this happens around the daylight savings date (PST/PDT):

$ ls -l /etc/localtime
lrwxrwxrwx  1 root root 30 Mar  4 
11:19 /etc/localtime -> /usr/share/zoneinfo/US/Pacific
$ date -d '2007/10/28 + 7 days' ; date -d '2007/10/29 + 7 days'
Sun Nov  4 00:00:00 PDT 2007
Sun Nov  4 23:00:00 PST 2007

But on Debian, running the same commands with the same settings, I got what I 
think is the right behavior:

debian$ dpkg -l coreutils
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: 
uppercase=bad)
||/ Name                                   Version                                
Description
+++-======================================-======================================-============================================================================================
ii  coreutils                              5.97-5.3                               
The GNU core utilities
debian$ ls -l /etc/localtime
lrwxrwxrwx 1 root root 30 2008-03-04 
11:19 /etc/localtime -> /usr/share/zoneinfo/US/Pacific
debian$ date -d '2007/10/28 + 7 days' ; date -d '2007/10/29 + 7 days'
Sun Nov  4 00:00:00 PDT 2007
Mon Nov  5 00:00:00 PST 2007

Comment 3 Ondrej Vasik 2008-03-04 15:04:32 EST
Thanks for quick response and clarification.
Issue was fixed by upstream between coreutils-5.2.1 (RHEL-4) and coreutils-5.97
(RHEL-5), so is fixed in RHEL-5 and Fedoras.

This is upstream commit with the fix of that issue. 
http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blobdiff;f=lib/getdate.y;h=cfa299f38a4f9b2c55efd1b9a8123db193ad2ad3;hp=dafc0eae476ac0a646dc3c1c10c0b4d3112f990d;hb=707f67871e2915afb4ae832a723429cca5203265;hpb=2498cb11a15474ebbe2e9595e14b8541dc15a4c9

Problem will get fixed in RHEL-4 in next maintainance release.
Comment 4 Kilian Cavalotti 2008-03-04 15:08:43 EST
Thank you!
Comment 5 Ondrej Vasik 2008-03-04 15:18:38 EST
Oops - I meant next maintainance release of RHEL-4 coreutils (definitely not
RHEL 4.7). So it will take some time - but you could use this upstream patch
meanwhile if you need the fix sooner.
Comment 6 Ondrej Vasik 2008-09-04 02:05:41 EDT
*** Bug 461084 has been marked as a duplicate of this bug. ***
Comment 7 RHEL Product and Program Management 2008-09-05 13:05:35 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 14 errata-xmlrpc 2009-05-18 16:07:42 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-0959.html

Note You need to log in before you can comment on or make changes to this bug.