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

Re: [leafnode-list] leafnode doesn't unsubscribe unread groups



"Gerry Doris" <gerry@xxxxxxxxx> writes:

> I checked my setup (RH 7.3 and latest leafnode).  leafnode is still
> downloading news groups that I haven't accessed in months.  The messages
> are being expired correctly after being kept for two weeks.
>
> I am the only user so no one else is reading them.  leafnode downloads new
> messages in subscribed news groups every 6 hours.  It is not running in
> delaybody mode.

I believe I found the culprit.

Leafnode has run the "getmarked()" code independent of the delaybody
setting since 1.9.33, in previous versions, this code was only used when
delaybody was nonzero.

The change in 1.9.33 was made to support a smoother transition from
delaybody=1 to delaybody=0.

As far as I analyzed it, the bug exists in leafnode-1.9.18...1.9.32 with
delaybody=1 and leafnode-1.9.33...1.9.40 with any delaybody setting. I
haven't looked at versions before 1.9.18. So this is a really old one.

To make a long story short, please try this patch and let me know if
leafnode then leaves the ctimes of files in interesting.group alone
(ls -lc) for those files that correspond to groups that you're no longer
subscribed to.

Index: fetchnews.c
===================================================================
RCS file: /var/CVS/leafnode-1/fetchnews.c,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -r1.106 -r1.107
--- fetchnews.c	20 May 2003 19:26:20 -0000	1.106
+++ fetchnews.c	20 May 2003 20:47:26 -0000	1.107
@@ -443,9 +443,10 @@
     unsigned long id[BODY_DOWNLOAD_LIMIT]; /* RATS: ignore */
     char *t;
 
+    /* #1 read interesting.groups file */
     n = 0;
     mastr_vcat(filename, spooldir, "/interesting.groups/", group->name, NULL);
-    if (!(f = fopen(mastr_str(filename), "r+")))
+    if (!(f = fopen(mastr_str(filename), "r")))
 	syslog(LOG_ERR, "Cannot open %s for reading", mastr_str(filename));
     else {
 	struct stat st;
@@ -455,14 +456,13 @@
 		printf("%s: getting bodies of marked messages...\n",
 			group->name);
 	    while ((t = getaline(f)) && n < BODY_DOWNLOAD_LIMIT) {
-		if (sscanf(t, "%lu", &id[n]))
+		if (sscanf(t, "%lu", &id[n]) == 1)
 		    ++n;
 	    }
 	}
 	fclose(f);
-	if (n)
-	    truncate(mastr_str(filename), 0);
     }
+    /* #2 get bodies */
     if (delaybody || had_bodies) {
 	syslog(LOG_INFO, "%s: marked bodies %d", group->name, n);
 	if (verbose > 1)
@@ -472,14 +472,16 @@
 	if (getbody(group, id[i]))
 	    id[i] = 0;
 
-    /* write back ids of all articles which could not be retrieved */
-    if (!(f = fopen(mastr_str(filename), "w")))
-	syslog(LOG_ERR, "Cannot open %s for writing", mastr_str(filename));
-    else {
-	for (i = 0; i < n; ++i)
-	    if (id[i] != 0)
-		fprintf(f, "%lu\n", id[i]);
-	fclose(f);
+    /* #3 write back ids of all articles which could not be retrieved */
+    if (had_bodies) {
+	if (!(f = fopen(mastr_str(filename), "w")))
+	    syslog(LOG_ERR, "Cannot open %s for writing", mastr_str(filename));
+	else {
+	    for (i = 0; i < n; ++i)
+		if (id[i] != 0)
+		    fprintf(f, "%lu\n", id[i]);
+	    fclose(f);
+	}
     }
     if (delaybody || had_bodies) {
 	if (verbose)


-- 
Matthias Andree
leafnode-1 download: http://sourceforge.net/projects/leafnode/
leafnode-1 docs/new: http://mandree.home.pages.de/leafnode/
leafnode-2 homepage: http://mandree.home.pages.de/leafnode/beta/

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