Path: news.math.psu.edu!news.cse.psu.edu!rutgers!news.sgi.com!nntp-hub2.barrnet.net!news1.digital.com!data.ramona.vix.com!vixie!not-for-mail
From: James Brister <brister@vix.com>
Newsgroups: news.software.nntp
Subject: Re: inn1.4u4 BUG (was Re: Expire pauses but never unpauses)
Date: 24 Sep 1996 17:27:11 -0700
Organization: Vixie Enterprises
Lines: 107
Sender: brister@bb.home.vix.com
Message-ID: <yy3919z782o.fsf@bb.home.vix.com>
References: <5128ri$59s@queeg.apci.net> <514f0a$7uk@vertex.tor.hookup.net>
	<515mu9$dqj@queeg.apci.net> <515pcu$fee@queeg.apci.net>
NNTP-Posting-Host: bb.home.vix.com
Cc: brister@vix.com, sawyerk@apci.net
X-Newsreader: Gnus v5.3/Emacs 19.34


sawyerk@apci.net (Kevin Sawyer) writes:

> I'm back, and I looked through the source.  BUG!  Check out expire.c in the
> inn1.4unoff4 distribution.  You'll find this:
> 
>   HistoryText = _PATH_HISTORY;
>   HistoryPath = NULL;
> 
> I'm no rocket scientist, but I think it should be this:
> 
>   HistoryPath = _PATH_HISTORY;
>   HistoryText = NULL;
> 
> Anyway, I made that modification, recompiled, ran news.daily, and VIOLA! 
> Everything works just like it is supposed to!  (For now anyway...)
> 
> Please tell me if I just screwed myself.  ;-)

I think you did... The (poorly named) variable HistoryPath really means the
directory the history file is in, not the path of the history file itself,
whereas _PATH_HISTORY *is* the path of the history file. I'm surprised it
doesn't core dump, unless you're passing in a '-h' and a '-d'
flag. Appended here is a patch that *should* work against unoff4's
expire.c.

James
-- 
James Brister                                            brister@vix.com
Internet Software Consortium                             inn@isc.org
---------------------------------------------------------------------------
*** expire.c	1996/07/08 20:35:33	1.20
--- expire.c	1996/07/09 15:25:19	1.21
***************
*** 70,76 ****
  STATIC BOOL		EXPsizing;
  STATIC BOOL		EXPtracing;
  STATIC BOOL		EXPusepost;
- STATIC char		EXPnewslib[] = _PATH_NEWSLIB;
  STATIC char		ACTIVE[] = _PATH_ACTIVE;
  STATIC char		SPOOL[] = _PATH_SPOOL;
  STATIC int		nGroups;
--- 70,75 ----
***************
*** 894,899 ****
--- 893,899 ----
      char		*NHistory;
      char		*NHistorydir;
      char		*NHistorypag;
+     char		*EXPhistdir;
      char		buff[SMBUF];
      register FILE	*out;
      BOOL		Server;
***************
*** 915,920 ****
--- 915,927 ----
      UnlinkFile = FALSE;
      (void)umask(NEWSUMASK);
  
+     /* find the default history file directory */
+     EXPhistdir = COPY(_PATH_HISTORY);
+     p = strrchr(EXPhistdir, '/');
+     if (p != NULL) {
+ 	*p = '\0';
+     }
+ 
      /* Parse JCL. */
      while ((i = getopt(ac, av, "f:h:d:g:ilnpqr:stv:w:xz:")) != EOF)
  	switch (i) {
***************
*** 1037,1044 ****
  	out = NULL;
      else {
  	/* Open new history files, relative to news lib. */
! 	if (chdir(EXPnewslib) < 0) {
! 	    (void)fprintf(stderr, CANTCD, EXPnewslib, strerror(errno));
  	    exit(1);
  	}
  	out = EXPfopen(TRUE, NHistory, "w");
--- 1044,1051 ----
  	out = NULL;
      else {
  	/* Open new history files, relative to news lib. */
! 	if (chdir(EXPhistdir) < 0) {
! 	    (void)fprintf(stderr, CANTCD, EXPhistdir, strerror(errno));
  	    exit(1);
  	}
  	out = EXPfopen(TRUE, NHistory, "w");
***************
*** 1140,1147 ****
  		(void)printf("Expire tracing: history files not updated.\n");
  	}
  	if (!Bad && !EXPtracing) {
! 	    if (chdir(EXPnewslib) < 0) {
! 		(void)fprintf(stderr, CANTCD, EXPnewslib, strerror(errno));
  		CleanupAndExit(Server, Paused, 1);
  	    }
  	    /* If user used the -d flag, mark we're done and exit. */
--- 1147,1154 ----
  		(void)printf("Expire tracing: history files not updated.\n");
  	}
  	if (!Bad && !EXPtracing) {
! 	    if (chdir(EXPhistdir) < 0) {
! 		(void)fprintf(stderr, CANTCD, EXPhistdir, strerror(errno));
  		CleanupAndExit(Server, Paused, 1);
  	    }
  	    /* If user used the -d flag, mark we're done and exit. */
