Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 35634 - coreutils 5.0.91 - date behaves unexpectedly
Summary: coreutils 5.0.91 - date behaves unexpectedly
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Seemant Kulleen (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-11 18:37 UTC by Nicolai Lissner
Modified: 2004-02-21 16:23 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolai Lissner 2003-12-11 18:37:11 UTC
the "date" command from coreutils behaves different as expected:

date -d "date -d "1970-01-01 00:00: $timestamp CEST"
does not work anymore.

for example:
date -d "1970-01-01 00:00: 1071197001 UTC"
should return:
Fri Dec 12 02:43:21 UTC 2003
...and it does with coreutils 5.0

but with coreutils 5.0.91 it just returns
Do Jan  1 00:00:59 UTC 1970

and this output does not change for any timestamp > 59

Does anyone know if this is a bug?
Or is that an intentional change of the behaviour?
Maybe to achieve more POSIX compliance?
Who know more about this?
Comment 1 Seemant Kulleen (RETIRED) gentoo-dev 2003-12-11 18:49:36 UTC
I can not duplicate your error, it works with coreutils-5.0-r5, coreutils-5.0-r6 and coreutils-5.0.91-r2
Comment 2 Ciaran McCreesh 2003-12-11 19:52:44 UTC
Hmm, well I can duplicate it :)

ciaranm@snowdrop ciaranm 0 $ qpkg -v -I coreutils
sys-apps/coreutils-5.0-r5 *
ciaranm@snowdrop ciaranm 0 $ date -d "1970-01-01 00:00: 1071197001 UTC"
Fri Dec 12 01:43:21 GMT 2003
ciaranm@snowdrop ciaranm 0 $ accept sudo emerge coreutils
(yada yada)
ciaranm@snowdrop ciaranm 0 $ qpkg -v -I coreutils
sys-apps/coreutils-5.0.91-r2 *
ciaranm@snowdrop ciaranm 0 $ date -d "1970-01-01 00:00: 1071197001 UTC"
Thu Jan  1 01:00:59 BST 1970

Playing with gvimdiff doesn't show anything obviously changed between the
source files. Looks like anything > 59 for the timestamp is broken.

ciaranm@snowdrop ciaranm 0 $ date -d "1970-01-01 00:00: 59 UTC"
Thu Jan  1 01:00:59 BST 1970
ciaranm@snowdrop ciaranm 0 $ date -d "1970-01-01 00:00: 60 UTC"
Thu Jan  1 01:00:59 BST 1970

If no-one's figured it out by the time I get my hands on a monitor that can
do > 1024x768 (silly laptop, how am I supposed to use an editor on that?) I'll
start tinkering with the source files some more...
Comment 3 Josh Grebe (RETIRED) gentoo-dev 2003-12-12 10:55:21 UTC
Ok, tracked this down to around like 452 in src/date.c

when.tv_sec = get_date (datestr, NULL)

this knocks the seconds to a max of 59. get_date is in libs/date.c, which is made from libs/date.y, and requires more looking... Just an update...
Comment 4 Matt Taylor 2003-12-12 11:41:39 UTC
$ date -d "1970-01-01 00:00: 1071197001 UTC"
Thu Dec 11 21:43:21 EST 2003
$ qpkg -v -I coreutils
sys-apps/coreutils-5.0.91-r2 *
Comment 5 Josh Grebe (RETIRED) gentoo-dev 2003-12-18 14:29:45 UTC
This looks to be an intentional change. The way to achieve this same function is to use something like:
date -d "1970-01-01 00:00:00 + 1071760000seconds UTC"
Comment 6 Seemant Kulleen (RETIRED) gentoo-dev 2003-12-29 20:07:20 UTC
does coreutils-5.0.91-r3 (just checked into portage) exhibit this as well?
Comment 7 Josh Grebe (RETIRED) gentoo-dev 2003-12-30 20:54:36 UTC
It does on my system...
Comment 8 Nicolai Lissner 2004-01-01 16:08:14 UTC
Yes, it does here, too.
Although Josh Grebe's version of the commandline runs here fine, too 
(it should do on ANY version before)
Comment 9 Seemant Kulleen (RETIRED) gentoo-dev 2004-02-21 16:23:35 UTC
it's an intentional change upstream, probably for more POSIX compliance again (sigh).