bug-sh-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in sh-utils-2.0-13


From: Zvi Har'El
Subject: Bug in sh-utils-2.0-13
Date: Thu, 21 Jun 2001 00:05:50 +0300 (IDT)

Hi,

/bin/date as shipped in RedHat 7.1 (and not updated since) exhibits a bug in
date parsing:

~$ rpm -qf /bin/date
sh-utils-2.0-13

~$ TZ= /bin/date -u -d "1970-01-01 UTC  `/bin/date +%s \
    -d \"2001-6-20 00:00:00+0000\"` sec"
Wed Jun 20 00:00:00 UTC 2001

~$ TZ=America/New_York /bin/date -u -d "1970-01-01 UTC  `/bin/date +%s \
    -d \"2001-6-20 00:00:00+0000\"` sec"
Wed Jun 20 01:00:00 UTC 2001


Explanation:
    date +%s -d "2001-6-20 00:00:00+000"
finds the number of seconds since the epoch, 1970-0-01 UTC. Using this number
as an argument to another invocation of date as a displacement in seconds to
the epoch itself, should give back the original date, i.e. midnigt of June
20th. However, it gives one hour later.  The result should be independent of
the local time zone, but because of a bug in the date parser
sh-utils-2.0/lib/getdate.y, the day-light saving property of the local time
zone remains significant.

Solution:

Upgrade sh-util-2.0 to sh-utils-2.0j, available from
    ftp://alpha.gnu.org/gnu/fetish/sh-utils-2.0j.tar.gz

This has fixed the bug in the date parser, since sh-utils-2.0j/lib is now
identical to fileutils-4.1/lib (to convince yourself that the latter parser is
OK, note that
    touch -d "2000-6-20 00:00:00+0000" file_name
really puts the correct time stamp on the file, whatever TZ is!).

Best,

Zvi.

-- 
Dr. Zvi Har'El     mailto:address@hidden     Department of Mathematics
tel:+972-54-227607                   Technion - Israel Institute of Technology
fax:+972-4-8324654 http://www.math.technion.ac.il/~rl/     Haifa 32000, ISRAEL
"If you can't say somethin' nice, don't say nothin' at all." -- Thumper (1942)
                               Wednesday, 30 Sivan 5761, 20 June 2001, 11:30PM




reply via email to

[Prev in Thread] Current Thread [Next in Thread]