[leafnode-list] texpire failing to expire

Matthias Andree ma at dt.e-technik.uni-dortmund.de
Wed Sep 29 00:26:52 CEST 2004


"Cory C. Albrecht" <cory+leafnode at fenris.cjb.net> writes:

> I know that I would prefer the simple method of switching off threading in 
> texpire.

Please let me know if the patch below (for 20040920a or 20040915a, may
not apply to earlier versions) works for you to force article-based
expiry. The new -a option (expire articles, not threads) removed another
20% or so of my articles so it does something %-)

Note that the final word on the default isn't yet spoken, I might drop
the -a option and add a "expire threads" option instead.

Your views will be appreciated.

Index: texpire.8.in
===================================================================
RCS file: /var/CVS/leafnode-2/texpire.8.in,v
retrieving revision 1.9
diff -u -r1.9 texpire.8.in
--- texpire.8.in	12 Sep 2004 12:11:59 -0000	1.9
+++ texpire.8.in	28 Sep 2004 22:13:54 -0000
@@ -50,6 +50,9 @@
 Expire will look at the arrival time of the articles rather than at the
 access time. Expiry will still be thread-based.
 .TP
+.I -a
+Expire individual articles rather than threads.
+.TP
 .I -n
 Dry run mode. In this mode, texpire will not delete anything, it will
 just write what it would do without -n.
Index: texpire.c
===================================================================
RCS file: /var/CVS/leafnode-2/texpire.c,v
retrieving revision 1.52
diff -u -r1.52 texpire.c
--- texpire.c	16 Sep 2004 11:06:54 -0000	1.52
+++ texpire.c	28 Sep 2004 22:15:52 -0000
@@ -64,7 +64,8 @@
 
 static int dryrun = 0;		/* do not delete articles */
 static int use_atime = 1;	/* look for atime on articles to expire */
-static int repair_spool = 0;
+static int repair_spool = 0;	/* repair mode */
+static int expire_threads = 1;	/* if whole threads are blocked from expiry */
 
 static char gdir[LN_PATH_MAX];		/* name of current group directory */
 static unsigned long deleted, kept;
@@ -408,11 +409,16 @@
 		    && S_ISREG(st.st_mode)
 		    && ((use_atime ? st.st_atime : st.st_mtime)
 			> expire)) {
-		    /* a newer article was found, disconnect from
-		       threadlist.  we later free() from hashtab[] */
-		    t->subthread = NULL;
-		    break;
-		    /* no need to look further */
+		    if (expire_threads) {
+			/* a newer article was found, disconnect from
+			   threadlist.  we later free() from hashtab[] */
+			t->subthread = NULL;
+			/* no need to look further */
+			break;
+		    } else {
+			/* prevent this article from expiry */
+			r->artno = 0;
+		    }
 		}
 	    }
 	}
@@ -1015,7 +1021,7 @@
     if (!initvars(argv[0], 0))
 	init_failed(myname);
 
-    while ((option = getopt(argc, argv, GLOBALOPTS "frn")) != -1) {
+    while ((option = getopt(argc, argv, GLOBALOPTS "afnr")) != -1) {
 	if (parseopt(myname, option, optarg, &conffile))
 	    continue;
 	switch (option) {
@@ -1028,6 +1034,9 @@
 	case 'n':
 	    dryrun = 1;
 	    break;
+	case 'a':
+	    expire_threads = 0;
+	    break;
 	default:
 	    usage();
 	    exit(EXIT_FAILURE);


-- 
Matthias Andree

Encrypted mail welcome: my GnuPG key ID is 0x052E7D95 (PGP/MIME preferred)



More information about the leafnode-list mailing list