Subject: Re: inn1.4u4 BUG (was Re: Expire pauses but never unpauses)
From: James Brister <[email-masked]>
Cc: [email-masked], [email-masked]
Date: 24 Sep 1996 17:27:11 -0700
Newsgroups: news.software.nntp

[email-masked] (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                                            [email-masked]
Internet Software Consortium                             [email-masked]
---------------------------------------------------------------------------
*** 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. */