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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 48085 in the body.
You can then email your comments to 48085 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#48085
; Package
coreutils
.
(Wed, 28 Apr 2021 20:31:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Mark Krenz <mark <at> slugbug.org>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Wed, 28 Apr 2021 20:31:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#48085
; Package
coreutils
.
(Wed, 28 Apr 2021 21:15:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 48085 <at> debbugs.gnu.org (full text, mbox):
Further investigating this problem it appears that at least today it
doesn't like going back past September 26th, 1997. But only when the
time delta is specified in years months or days. You can go back
further if it's specified in total amounts of hours minutes or seconds.
$ date -d "now - 283 months"
Sun 28 Sep 1997 03:42:05 PM EST
$ date -d "now - 284 months"
date: invalid date ‘now - 284 months’
$ date -d "now - 283 months - 2 days"
Fri 26 Sep 1997 03:42:31 PM EST
$ date -d "now - 283 months - 3 days"
date: invalid date ‘now - 283 months - 3 days’
$ date -d "now - 8615 days"
Fri Sep 26 03:52:30 PM EST 1997
$ date -d "now - 8616 days"
date: invalid date ‘now - 8616 days’
$ date -d "now - 206804 hours"
Wed Sep 24 07:54:15 PM EST 1997
$ date -d "now - 12408240 minutes"
Wed Sep 24 08:03:50 PM EST 1997
$ date -d "now - 744590000 seconds"
Tue Sep 23 05:20:23 PM EST 1997
I don't see anything special about Sept 25th, 1997 in terms of it's
numeric value:
$ date -d "1997-09-25" +%s
875163600
Or the delta from now to then.
8615*86400 = 744336000
Very weird. I'll be curious to see what turns out to be the problem. I
also found a system I'm running that has coreutils 8.30 and it did not
have the problem, so that narrows the gap a bit.
Mark
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#48085
; Package
coreutils
.
(Wed, 28 Apr 2021 23:24:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 48085 <at> debbugs.gnu.org (full text, mbox):
Well it seems that this might actually be related to timezone database
files. My timezone is America/Indianapolis but I noticed when I set the
timezone to America/New_York or UTC that this problem doesn't happen
$ TZ=America/Indianapolis date -d "now - 9001 days"
date: invalid date ‘now - 9001 days’
$ TZ=America/New_York date -d "now - 9001 days"
Thu 05 Sep 1996 07:05:55 PM EDT
$ TZ=UTC date -d "now - 9001 days"
Thu 05 Sep 1996 11:05:59 PM UTC
$ TZ=America/Metlakatla date -d "now - 9001 days"
date: invalid date ‘now - 9001 days’
$
I found that last one after trying a for loop in /usr/share/zoneinfo/America
So I'm not sure if this is a problem with coreutils or a change in the
zoneinfo database. Any ideas?
Mark
Reply sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
You have taken responsibility.
(Sat, 19 Feb 2022 23:58:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Mark Krenz <mark <at> slugbug.org>
:
bug acknowledged by developer.
(Sat, 19 Feb 2022 23:58:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 48085-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (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)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 20 Mar 2022 11:24:07 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Paul Eggert <eggert <at> cs.ucla.edu>
to
control <at> debbugs.gnu.org
.
(Mon, 06 Jan 2025 04:50:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#48085
; Package
coreutils
.
(Mon, 06 Jan 2025 04:51:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 48085 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 2025-01-05 07:07, Pádraig Brady wrote:
> I notice coreutils CI is now failing in a gnulib test with:
>
> test-parse-datetime.c:419: assertion 'result.tv_sec == 515107490 - 60 *
> 60 + (has_leap_seconds ? 13 : 0)' failed
>
> Adding some extra debug I see that
> result.tv_sec is 1 hour too late (i.e. 515107490).
>
> This test is related to https://bugs.gnu.org/48085
Yes, it looks like that test is too picky, since Bug#48085 is about
parse_datetime failing rather than about a particular value. Although I
could not reproduce the test failure on either Fedora 41 or Ubuntu 24.10
I installed the attached patch, which I hope fixes things for the
coreutils CI (for which I don't know the build+run environment).
[0001-parse-datetime-tests-port-to-Gnulib-mktime.patch (text/x-patch, attachment)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#48085
; Package
coreutils
.
(Mon, 06 Jan 2025 07:38:01 GMT)
Full text and
rfc822 format available.
Message #26 received at 48085 <at> debbugs.gnu.org (full text, mbox):
Paul Eggert wrote:
> Although I
> could not reproduce the test failure on either Fedora 41 or Ubuntu 24.10
> I installed the attached patch, which I hope fixes things for the
> coreutils CI (for which I don't know the build+run environment).
The test failure occurred also (before your patch) in the gnulib CI, on
- Ubuntu 22.04
- CentOS 7
- macOS 13,14,15
- Solaris 11
Bruno
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 03 Feb 2025 12:24:16 GMT)
Full text and
rfc822 format available.
This bug report was last modified 38 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.