Y2K patch for cnews-crg Why it's needed: ~~~~~~~~~~~~~~~~ As far as I can see, most of cnews is immune from date-related issues: all clever stuff is done with dates in time_t format (converted to number of seconds since 1 January 1970) as is to be expected in most Unix/C programs. Yes, that will give rise to problems in 2038, but that's not my concern at the moment. RFC1036 refers to RFC822 and makes two-digit years acceptable in Date: headers of articles. In practice software which still generates two-digit years is in a minority, but there are articles being posted even today with two-digit years. Inside cnews I have found two places where we need to attend to conversion of such dates: libc/getindate.c contains prsindate() which attempts to convert RFC822-acceptable Date: headers to struct_tm components. It initially assumed that a date of zero would be invalid and that a two-digit date implied 19nn. I have assumed that dates <70 are actually 20nn, in line with the method used elsewhere. Certain very odd and broken Date: headers might now be accepted as in the year 2000 if they don't contain a year component at all but this seems unlikely to be a real problem. The tryabsdate() routine in libc/getabsdate.c also needs to be given a little help in understanding that a two digit year could be 20nn. If you don't mind losing articles with two-digit dates then you could carry on using cnews in its unpatched state - assuming there's nothing else I've not spotted. How to apply this patch: ~~~~~~~~~~~~~~~~~~~~~~~~ 1. If you previously built and installed cnews and still have the source available change to the directory containing the sources and continue with step 3. 2. Download the source - available from: ftp://ftp.zoo.toronto.edu/pub/cnews.tar.Z Note that the archive doesn't create a directory automatically! Change to /usr/src (or your preference) and create a suitable directory. Change to the new directory and untar the sources. I recommend copying my quiz.defs file into conf/ and using that as the starting point. In any case follow the instructions to run the quiz. Before "make"... 3. Copy the Y2K patch to the cnews source directory and within that directory do: #patch -p1 < cnews-y2k.patch This should report patching libc/getindate.c and libc/getabsdate.c. Now you can: #make Which should (re)build the binaries. The cautious should save copies of the existing installation before proceeding with things like "make install" and the rest. Testing: ~~~~~~~~ Not a lot can be done just yet, except that manually feeding an article with a year of 00 should result in it being rejected as in the future rather than as "unparsable date" in the logs. A locally posted article with a two digit date should get the correct century added by the time it appears in the in.coming spool directory. Everything else should work as before. Disclaimer: ~~~~~~~~~~~ The patch works for me in practice and I believe the theory to be sound. If it doesn't work for you I would like to know why not, but I accept no liability. Dan Glover 12 December 1999