[net.sources.bugs] Rn bug patch #2

jonab@sdcrdcf.UUCP (Jonathan Biggar) (11/17/84)

System: rn version 4.1
Bug #: 2
Priority: MEDIUM
Subject: rn may get confused about minimum article numbers
Index: rcstuff.c
Prereq: 4.1

Description:
	The relocate_newsgroup() routine did not correctly adjust the
	abs1st array, which stores minimum article numbers.  This can
	manifest itself in several ways, such as spurious "Corrupt Xref"
	messages, and newsgroups that seem to be missing their articles.
	The problem does not show up unless you have CACHEFIRST defined,
	and newsgroups are added or moved to or from the beginning of the
	.newsrc.

Repeat-By:
	Move or add some newsgroups to the front of your .newsrc, and then
	read news for a while.  Sooner or later, it'll get you.

Fix:	From rn, say "| patch -d DIR", where DIR is your rn source directory.
	Outside of rn, say "cd DIR; patch <thisarticle".  If you don't have
	the patch program, apply the following by hand, or get patch.

*** /tmp/,RCSt1014132	Tue Sep 25 14:10:40 1984
--- /tmp/,RCSt2014132	Tue Sep 25 14:11:02 1984
***************
*** 1,4
! /* $Header: rcstuff.c,v 4.1 84/09/24 12:05:08 lwall Exp $
   *
   * $Log:	rcstuff.c,v $
   * Revision 4.1  84/09/24  12:05:08  lwall

--- 1,4 -----
! /* $Header: rcstuff.c,v 4.1.1.2 84/09/25 13:58:26 lwall Exp $
   *
   * $Log:	rcstuff.c,v $
   * Revision 4.1.1.2  84/09/25  13:58:26  lwall
***************
*** 1,6
  /* $Header: rcstuff.c,v 4.1 84/09/24 12:05:08 lwall Exp $
   *
   * $Log:	rcstuff.c,v $
   * Revision 4.1  84/09/24  12:05:08  lwall
   * Real baseline.
   * 

--- 1,13 -----
  /* $Header: rcstuff.c,v 4.1.1.2 84/09/25 13:58:26 lwall Exp $
   *
   * $Log:	rcstuff.c,v $
+  * Revision 4.1.1.2  84/09/25  13:58:26  lwall
+  * Oops, relocate_newsgroup() didn't relocate abs1st[].  One of these years
+  * I'll make the newsgroup entry a struct...
+  * 
+  * Revision 4.1.1.1  84/09/25  13:25:43  lwall
+  * Branch for sdcrdcf changes.
+  * 
   * Revision 4.1  84/09/24  12:05:08  lwall
   * Real baseline.
   * 
***************
*** 389,394
  #ifdef DEBUGGING
      ART_NUM tmpngmax;
  #endif
      
      starthere = 0;                      /* Disable this optimization */
      writesoft = TRUE;			/* Update soft pointer file */

--- 396,404 -----
  #ifdef DEBUGGING
      ART_NUM tmpngmax;
  #endif
+ #ifdef CACHEFIRST
+     ART_NUM tmpabs1st;
+ #endif
      
      starthere = 0;                      /* Disable this optimization */
      writesoft = TRUE;			/* Update soft pointer file */
***************
*** 409,414
  #ifdef DEBUGGING
  	tmpngmax = ngmax[ngx];
  #endif
  	for (i=ngx+1; i<nextrcline; i++) {
  	    rcline[i-1] = rcline[i];
  	    toread[i-1] = toread[i];

--- 419,427 -----
  #ifdef DEBUGGING
  	tmpngmax = ngmax[ngx];
  #endif
+ #ifdef CACHEFIRST
+ 	tmpabs1st = abs1st[ngx];
+ #endif
  	for (i=ngx+1; i<nextrcline; i++) {
  	    rcline[i-1] = rcline[i];
  	    toread[i-1] = toread[i];
***************
*** 418,423
  #ifdef DEBUGGING
  	    ngmax[i-1] = ngmax[i];
  #endif
  	}
  	rcline[nextrcline-1] = tmprcline;
  	toread[nextrcline-1] = tmptoread;

--- 431,439 -----
  #ifdef DEBUGGING
  	    ngmax[i-1] = ngmax[i];
  #endif
+ #ifdef CACHEFIRST
+ 	    abs1st[i-1] = abs1st[i];
+ #endif
  	}
  	rcline[nextrcline-1] = tmprcline;
  	toread[nextrcline-1] = tmptoread;
***************
*** 427,432
  #ifdef DEBUGGING
  	ngmax[nextrcline-1] = tmpngmax;
  #endif
      }
      if (current_ng > ngx)
  	current_ng--;

--- 443,451 -----
  #ifdef DEBUGGING
  	ngmax[nextrcline-1] = tmpngmax;
  #endif
+ #ifdef CACHEFIRST
+ 	abs1st[nextrcline-1] = tmpabs1st;
+ #endif
      }
      if (current_ng > ngx)
  	current_ng--;
***************
*** 545,550
  #ifdef DEBUGGING
  	tmpngmax = ngmax[nextrcline-1];
  #endif
  	for (i=nextrcline-2; i>=newng; i--) {
  	    rcline[i+1] = rcline[i];
  	    toread[i+1] = toread[i];

--- 564,572 -----
  #ifdef DEBUGGING
  	tmpngmax = ngmax[nextrcline-1];
  #endif
+ #ifdef CACHEFIRST
+ 	tmpabs1st = abs1st[nextrcline-1];
+ #endif
  	for (i=nextrcline-2; i>=newng; i--) {
  	    rcline[i+1] = rcline[i];
  	    toread[i+1] = toread[i];
***************
*** 554,559
  #ifdef DEBUGGING
  	    ngmax[i+1] = ngmax[i];
  #endif
  	}
  	rcline[newng] = tmprcline;
  	toread[newng] = tmptoread;

--- 576,584 -----
  #ifdef DEBUGGING
  	    ngmax[i+1] = ngmax[i];
  #endif
+ #ifdef CACHEFIRST
+ 	    abs1st[i+1] = abs1st[i];
+ #endif
  	}
  	rcline[newng] = tmprcline;
  	toread[newng] = tmptoread;
***************
*** 562,567
  	softptr[newng] = tmpsoftptr;
  #ifdef DEBUGGING
  	ngmax[newng] = tmpngmax;
  #endif
      }
      if (current_ng >= newng)

--- 587,595 -----
  	softptr[newng] = tmpsoftptr;
  #ifdef DEBUGGING
  	ngmax[newng] = tmpngmax;
+ #endif
+ #ifdef CACHEFIRST
+ 	abs1st[newng] = tmpabs1st;
  #endif
      }
      if (current_ng >= newng)