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

Re: [leafnode-list] The Energizer Bunny, and entries in SERVERNAME

"Michael O'Quinn" <michael@xxxxxxxxxxx> writes:

> I tend to manage /var/spool/news/interesting.groups fairly closely, since
> I have a relatively small news spool and it fills up too quickly if I
> don't.  In most cases, the entries that disappear are the ones I've
> removed from interesting.groups for this particular run.
> This may be intended as a feature, but for me it's certainly a bug.

Indeed, it has bad side effects, like fetching a group all from scratch.

Hum. Indeed, removing them is a pain if you mark the news group
interesting again before everything has expired.

For now, the easiest workaround seems to be to set something like

        initialfetch = 100

in the config file. In that case, leafnode will not fetch more than 100
articles if you kill the group subscription (say, with
rm interesting.group/too.much.traffic) and then read the group.

> This is probably a separate issue from the occasional lines disappearing
> from SERVERNAME, except that after I terminated this Energizer Bunny run,
> the SERVERNAME file existed but it was completely empty - filesize was
> zero, zip, nada, nix, nein.  The fact that the news spool filled up may
> have had an effect on this.

It has had. The SERVERNAME~ file has unconditionally been renamed to
SERVERNAME, and write errors were never checked for.

> So, to summarize, (1) I've had some lines disappear from the SERVERNAME
> file when they are removed from interesting.groups, (2) when my news spool
> filled up, the ENTIRE SERVERNAME file went to the bit-bucket, and (3)
> fetchnews doesn't stop when the spool is full.
> I'll install rc9 and I'll try to test it this weekend for the "Files not 
> Fetched" issue.

I fixed (2) now. In case there is a write error (disk full or
something), the old file will remain in place.

I believe I'm not fixing (1) in 1.9.x. Maybe I can backport a fix from
2.0b once one is there, if any. I'll also leave (3) as it is now, unless
someone has a good idea how to do that in a robust way without breaking
too many places. Try initialfetch=100 or something for now.

As to (2), here's a patch against 1.9.20.rc9:

Index: fetchnews.c
RCS file: /home/emma/mycvsroot/leafnode-1/fetchnews.c,v
retrieving revision 1.21
diff -u -r1.21 fetchnews.c
--- fetchnews.c	2002/03/23 14:33:56	1.21
+++ fetchnews.c	2002/03/23 21:47:44
@@ -1476,8 +1476,8 @@
 	ngs = NULL;
 	debug = 0;
 	if (verbose > 1)
-	    printf("Read server info from %s\n", s);
-	syslog(LOG_INFO, "Read server info from %s", s);
+	    printf("Reading server info from %s\n", s);
+	syslog(LOG_INFO, "Reading server info from %s", s);
 	while (((l = getaline(f)) != NULL) && (strlen(l))) {
 	    a = (struct stringlist *)critmalloc(sizeof(struct stringlist)
 						+ strlen(l),
@@ -1527,8 +1527,9 @@
 		if (delaybody && (headerbody != 1))
-		if (f != NULL)
+		if (f != NULL) {
 		    fprintf(f, "%s %ld\n", g->name, newserver);
+		}
 	    } else {
 		printf("%s not found in groupinfo file\n", de->d_name);
 		syslog(LOG_INFO, "%s not found in groupinfo file", de->d_name);
@@ -1537,9 +1538,25 @@
     if (f != NULL) {
-	fclose(f);
+	int ren = 1;
 	xsnprintf(s, SIZE_s, "%s/leaf.node/%s~", spooldir, server);
-	rename(s, oldfile);
+	if (ferror(f)) ren = 0;
+	if (fflush(f)) ren = 0;
+	if (fclose(f)) ren = 0;
+	if (ren) {
+	    if (rename(s, oldfile)) {
+		int e = errno;
+	        syslog(LOG_ERR, "cannot rename %s to %s: %s", s,
+		       oldfile, strerror(e));
+	        fprintf(stderr, "cannot rename %s to %s: %s\n", s,
+		       oldfile, strerror(e));
+            }
+	} else {
+	    syslog(LOG_ERR, "write error on %s, old version of %s kept",
+		   s, oldfile);
+	    fprintf(stderr, "write error on %s, old version of %s kept\n",
+		   s, oldfile);
+	}

Matthias Andree

leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list