[net.news.b] files left in /tmp & spool.

dan@ciprico.UUCP (12/05/84)

I'm having a little problem here...it's with news leaving lots of
"L<ddd@place.u" files in /tmp and also .in0procid files in /usr/spool/news.
I'm not sure, but the files seem to be related to rnews expecting "n" lines
and getting "n-1" lines.   Anyone have any information on this?
news 2.10.2 by the way.   -Dan A. Dickey

stein@fortune.UUCP (Mark Stein) (12/12/84)

> I'm having a little problem here...it's with news leaving lots of
> "L<ddd@place.u" files in /tmp and also .in0procid files in /usr/spool/news.

I noticed the same behavior in /usr/spool/news after I installed 2.10.2.
(We purge /tmp daily so that is not a problem here.) I didn't have the time
to track it down, so I wrote a quick program that runs as part of the daily
news cleanup script.  It was written for 4.1, but should compile easily on
other systems with libndir.

Has anybody found the bug?

			Mark Stein
			Fortune Systems
			{ihnp4,hpda,amdcad,nsc,sri-unix}!fortune!stein


/*
 *  read the news spool directory and get rid of any tmp files older than
 *	1 week old.
 *
 *  compile with -lndir library
 *
 *  Mark Stein [9/11/84]
 *  Fortune Systems Corp.
 */

#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <ndir.h>

#define SPOOL	"/usr/spool/news"		/* directory to open */
#define AGE	60*60*24*7			/* 7 days of seconds */

main(argc, argv)
int argc;
char *argv[];
{
	DIR *dirp;				/* directory ptr */
	struct direct *de;			/* directory entry */
	struct stat sbuf;			/* stat info */
	char path[100];				/* buf for pathname */
	long age = AGE;				/* aging time */
	long now, time();;			/* time right now */

	now = time(0);
	if ((dirp = opendir(SPOOL)) == NULL) {
		perror(SPOOL);
		exit(1);
	}
	if (argc > 1)
		age = atoi(argv[1]);
	while (de = readdir(dirp)) {
		if(   (de->d_namlen == 9 && (   !strncmp(de->d_name, ".ar", 3)
					     || !strncmp(de->d_name, ".in", 3)))
		   || (de->d_namlen == 8 &&     !strncmp(de->d_name, "tr",  2)))
		{
			sprintf(path, "%s/%s", SPOOL, de->d_name);
			if (stat(path, &sbuf) < 0) {
				perror(path);
				continue;
			}
			if (now - sbuf.st_mtime > age)
				unlink(path);
		}
	}
}

lepreau@utah-cs.UUCP (Jay Lepreau) (12/12/84)

I dunno about 2.10.2, but in more lowly versions inews doesn't ignore
SIGTSTP, leading to all sorts of orphan temp files around, as you
describe.  (User in readnews does a followup and then ^Z's to take a
breather from the strain of such literary effort.)  inews can eventually
die w/o psting the article, too.