GNU bug report logs -
#48085
date -d greater than 23 years ago gives error invalid date
Previous Next
Reported by: Mark Krenz <mark <at> slugbug.org>
Date: Wed, 28 Apr 2021 20:31:01 UTC
Severity: normal
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your bug report
#48085: date -d greater than 23 years ago gives error invalid date
which was filed against the coreutils package, has been closed.
The explanation is attached below, along with your original report.
If you require more details, please reply to 48085 <at> debbugs.gnu.org.
--
48085: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=48085
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
[Message part 3 (text/plain, inline)]
On 4/28/21 16:23, Mark Krenz wrote:
> So I'm not sure if this is a problem with coreutils or a change in the
> zoneinfo database. Any ideas?
This appears to be a problem in the GNU C library, when its mktime
deciphers the relatively unusual time zone history of Indiana.
I installed the attached patch into Gnulib and propagated it into
Coreutils, so the issue should be fixed in the next release of GNU
Coreutils. Eventually this patch should migrate from Gnulib to glibc so
that other apps get the fix. Thanks for reporting the issue.
[0001-mktime-improve-heuristic-for-ca-1986-Indiana-DST.patch (text/x-patch, attachment)]
[Message part 5 (message/rfc822, inline)]
I ran the following expecting it to provide me with the date 35 years
ago
date -d "now - 35 years"
Instead I received the error:
date: invalid date ‘now - 35 years’
Testing it further I found that the break point is at 24 years:
$ date --version
date (GNU coreutils) 8.32
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by David MacKenzie.
$ date -d "now - 23 years"
Tue Apr 28 03:20:37 PM EST 1998
$ date -d "now - 24 years"
date: invalid date ‘now - 24 years’
$
I compiled from the latest coreutils source and found it to have
the same issue:
$ cd coreutils/src/
$ ./date --version
date (GNU coreutils) 8.32.143-62a7c
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by David MacKenzie.
$ date "now - 23 years"
date: invalid date ‘now - 23 years’
$ date -d "now - 23 years"
Tue Apr 28 03:21:09 PM EST 1998
$ date -d "now - 24 years"
date: invalid date ‘now - 24 years’
$
I found that this did work on a system running coreutils 8.23 so
something seems to have broken since then. These are all Linux systems
that I've tried this on. The system I tested on was a fresh Ubuntu 21.04
VM.
Linux ubuntu2104 5.11.0-16-generic #17-Ubuntu SMP Wed Apr 14 20:12:43 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Thanks,
Mark
This bug report was last modified 187 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.