Subject:
|
Re: Y2K problem with lugnet! (was Re: Help! My newsreader's downloading everything on lugnet!)
|
Newsgroups:
|
lugnet.admin.general
|
Date:
|
Sun, 2 Jan 2000 02:58:29 GMT
|
Viewed:
|
1144 times
|
| |
| |
In lugnet.admin.general, lehman@javanet.com (Todd Lehman) writes:
> Update: Well, that fixes the NEWGROUPS command all right, but the NEWNEWS
> command is doing something more insidious afterwards with date strings.
OK, the other thing the NEWNEWS command was doing was comparing 12-character
date strings (for example, "991231235959" is the last second of 1999) as
generated by a function ltod() which called sprintf with values obtained via
gmtime(), which is OK, but the sprintf used %02d's, resulting in the first
second of 2000 coming out as "1000101000000" (i.e., the year is 100 instead
of 2000 or 00). The string comparison is left-justified, so they compared
like this:
"991231235959" (1999 Dec 31 23:59:59)
"1000101000000" (2000 Jan 01 00:00:00)
I changed a block of code inside of ltod() of date.c from:
(void) sprintf(timebuf, "%02d%02d%02d%02d%02d%02d",
tp->tm_year,
tp->tm_mon + 1, /* 0 to 11??? How silly. */
tp->tm_mday,
tp->tm_hour,
tp->tm_min,
tp->tm_sec);
to:
(void) sprintf(timebuf, "%04d%02d%02d%02d%02d%02d",
^^^^
tp->tm_year + 1900, /* Y2K bug workaround */
^^^^^^
tp->tm_mon + 1, /* 0 to 11??? How silly. */
tp->tm_mday,
tp->tm_hour,
tp->tm_min,
tp->tm_sec);
Now ltod() returns:
"19991231235959" (1999 Dec 31 23:59:59)
"20000101000000" (2000 Jan 01 00:00:00)
and the comparisons work.
The rilly goofy thing is that the NEWNEWS command takes epoch-time values,
converts them to strings with ltod(), and then has a custom string
comparison function to compare those. It's really goofy. At least it's in
C and it's still extremely fast, even if it's stupid. Probably the reason
it doesn't compare the integer epoch times directly is because the code was
originally written for the B-News history file format, which went like this:
"12/31/99 23:59" (1999 Dec 31 23:59)
and a custom comparison routine wouldn't be odd for that, if that was the
native representation at some broken point in time long ago.
Anyway, I recompiled, unit tested, and then put a new nntpd up on port 1119
(just that port, not the others yet).
Gonna do some more regression testing via
news://lugnet.com:1119/lugnet.loc.uk
and some other ways I can think of, then I'll make new fixed versions for
the other ports and put those up too.
This'll fix the problem Tony Priestman discovered, but there still may be
other problems lurking around. I'm pretty surprised actually that even
CNews had a Y2K bug. I guess CNews is just *so* old (it goes back to the
1980's, I think), and the NNTP protocol itself is broken, as MattM pointed
out.
--Todd
|
|
Message has 3 Replies:
Message is in Reply To:
40 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|