FW: Bug in zic.c?
Olson, Arthur David (NIH/NCI) [E]
olsona at dc37a.nci.nih.gov
Wed Sep 29 12:48:38 UTC 2010
I'm forwarding this message from Lei Liu, who is not on the time zone mailing list.
Those of you who are on the list, please direct replies appropriately.
--ado
-----Original Message-----
From: Liu, Lei [mailto:lei.liu2 at windriver.com]
Sent: Wednesday, September 29, 2010 4:17
To: tz at lecserver.nci.nih.gov
Subject: Bug in zic.c?
Hi,
I have a question about the code in zic.c.
In function stringrule I get:
week = 1 + rp->r_dayofmonth / DAYSPERWEEK;
if ((week - 1) * DAYSPERWEEK + 1 != rp->r_dayofmonth)
return -1;
//...
week = 1 + rp->r_dayofmonth / DAYSPERWEEK;
if (week * DAYSPERWEEK - 1 != rp->r_dayofmonth)
return -1;
What do these two if check here? The first one passes only when
rp->r_dayofmonth mod 7 equals to 1. And the second one passes
only when rp->r_dayofmonth mode 7 equals to 6. But IMO
rp->r_dayofmonth can be arbitrary valid day number of the month.
This question came up with a problem of compiling following input
file:
#RULE NAME FROM TO TYPE IN ON
AT SAVE LTRS
Rule localtime minimum maximum - Mar Sun<=14
2:00 1:0 PDT
Rule localtime minimum maximum - Nov Sun<=7
2:00 0:0 UTC
# ZONE NAME GMTOFF RULES/SAVE FORMAT
Zone localtime 0:0 localtime %s
zic prints out:
"fault.txt", line 6: too many transitions?! (rule from "fault.txt", line 2)
After I removed the two if check, this file can be successfully
processed.
Is this problem caused by a bug in zic.c or the invalid input data.
Thanks.
Lei
More information about the tz
mailing list