From: utzoo!decvax!harpo!uwvax!solomon Newsgroups: net.news.b Title: Bug in 2.6 expire Article-I.D.: uwvax.407 Posted: Fri Jun 4 09:22:52 1982 Received: Sat Jun 5 01:41:41 1982 I just discovered that "expire" hasn't been removing old news items on our machine since I installed version 2.6 news (about April 26). On investigating more fully, I found what appears to be a glaring bug in expire. If the article itself has no explicit expiration date, expire treats it as if its expiration date was expincr (default: 14 days) from NOW. Thus, of course, it never thinks the article is ready to expire. This bug is so obvious and sure to fail that I feel like I must be overlooking something obvious. Otherwise lots of other people would have been complaining by now. (Specifying -i or -I doesn't help). Anyhow, a simple fix made my expire work, and I just cleaned up over 2800 articles! I have ended this note with the fix. It is, however, just a kludge. (Note, for example, that the variable "newtime" is now unused.) Somebody who understands this software better should do it right. *** orig/expire.c Fri Jun 4 07:53:20 1982 --- expire.c Fri Jun 4 09:15:06 1982 *************** *** 1,3 /* * expire - expire daemon runs around and nails all articles that * have expired. --- 1,4 ----- + #define UWVAX 1 /* * expire - expire daemon runs around and nails all articles that * have expired. *************** *** 4,9 */ static char *SccsId = "@(#) expire.c 2.8 4/20/82"; #include "params.h" --- 5,18 ----- */ static char *SccsId = "@(#) expire.c 2.8 4/20/82"; + #ifdef UWVAX + /* WARNING: local mods have been added, so line numbers may not + * match the standard distributed version + * + * Fixed by solomon, 6/4/82, to deal correctly with articles missing an + * "Expires:" field. + */ + #endif #include "params.h" *************** *** 133,138 continue; } h.exptime = cgtdate(h.expdate); if (!h.expdate[0] || ignorexp==2 || (ignorexp==1 && newtime < h.exptime)) h.exptime = newtime; --- 142,155 ----- continue; } h.exptime = cgtdate(h.expdate); + #ifdef UWVAX + if (!h.recdate[0]) { + if (verbose) + printf("No expiration or reception date on %s.\n", + filename); + fclose(fp); + continue; + } if (!h.expdate[0] || ignorexp==2 || (ignorexp==1 && newtime < h.exptime)) { h.rectime = cgtdate(h.recdate); *************** *** 134,139 } h.exptime = cgtdate(h.expdate); if (!h.expdate[0] || ignorexp==2 || (ignorexp==1 && newtime < h.exptime)) h.exptime = newtime; if (now >= h.exptime) { --- 151,162 ----- continue; } if (!h.expdate[0] || ignorexp==2 || + (ignorexp==1 && newtime < h.exptime)) { + h.rectime = cgtdate(h.recdate); + h.exptime = h.rectime+expincr; + } + #else UWVAX + if (!h.expdate[0] || ignorexp==2 || (ignorexp==1 && newtime < h.exptime)) h.exptime = newtime; #endif UWVAX *************** *** 136,141 if (!h.expdate[0] || ignorexp==2 || (ignorexp==1 && newtime < h.exptime)) h.exptime = newtime; if (now >= h.exptime) { #ifdef DEBUG printf("cancel %s\n", filename); --- 159,165 ----- if (!h.expdate[0] || ignorexp==2 || (ignorexp==1 && newtime < h.exptime)) h.exptime = newtime; + #endif UWVAX if (now >= h.exptime) { #ifdef DEBUG printf("cancel %s\n", filename); Marvin Solomon (...!harpo!uwvax!solomon or solomon@uwisc)