[net.news.b] rn--first blood.

lwall@sdcrdcf.UUCP (Larry Wall) (09/26/84)

Well, I've broken the pattern.  I distributed rn last night, and I didn't find
a single bug.  Nope, someone else found them, and there were two of them.
Oh well, c'est la vie.  The first one is especially important because it
can mung the references line on posted articles.

I think nasty bugs must hide when they smell a distribution coming.  The only
way to exterminate them is to distribute and then start stomping.

Larry Wall
{allegra,burdvax,cbosgd,hplabs,ihnp4,sdcsvax}!sdcrdcf!lwall
----------------------------------------------------------------------------
rn bug #1:

Subject: %i and %R use old Article-I.D. line
Index: intrp.c

Description:
	Rn uses the old Article-I.D. line instead of the new Message-ID line
	when interpolating %i or %R.  I didn't notice this before because
	we just now recompiled inews without the OLD header lines.

Repeat-By:
	Just post a followup article on a system without OLD header lines.
	The references line will be missing the current message id, and
	the ATTRIBUTION line will start "In article <>..."

Fix:	Install either intrp.cpat (-c form) by hand or intrp.epat (-e form)
	using ed.  These files are in the shar script below.

--------------------------------------------------------------------------
rn bug #2:

Subject: rn may get confused about minimum article numbers
Index: rcstuff.c

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:	Install either rcstuff.cpat (-c form) by hand or rcstuff.epat (-e form)
	using ed.  These files are in the shar script below.

--------------------------------------------------------------------------
#! /bin/sh
echo Extracting intrp.cpat
cat >intrp.cpat <<'!STUFFY!FUNK!'
*** /tmp/,RCSt1014172	Tue Sep 25 14:12:06 1984
--- /tmp/,RCSt2014172	Tue Sep 25 14:12:16 1984
***************
*** 1,4
! /* $Header: intrp.c,v 4.1 84/09/24 11:57:13 lwall Exp $
   *
   * $Log:	intrp.c,v $
   * Revision 4.1  84/09/24  11:57:13  lwall

--- 1,4 -----
! /* $Header: intrp.c,v 4.1.1.2 84/09/25 14:02:08 lwall Exp $
   *
   * $Log:	intrp.c,v $
   * Revision 4.1.1.2  84/09/25  14:02:08  lwall
***************
*** 1,6
  /* $Header: intrp.c,v 4.1 84/09/24 11:57:13 lwall Exp $
   *
   * $Log:	intrp.c,v $
   * Revision 4.1  84/09/24  11:57:13  lwall
   * Real baseline.
   * 

--- 1,12 -----
  /* $Header: intrp.c,v 4.1.1.2 84/09/25 14:02:08 lwall Exp $
   *
   * $Log:	intrp.c,v $
+  * Revision 4.1.1.2  84/09/25  14:02:08  lwall
+  * %i used ARTID_LINE, should be MESSID_LINE.
+  * 
+  * Revision 4.1.1.1  84/09/25  13:22:59  lwall
+  * Branch for sdcrdcf changes.
+  * 
   * Revision 4.1  84/09/24  11:57:13  lwall
   * Real baseline.
   * 
***************
*** 489,495
  		    break;
  		case 'i':
  		    if (!(s=artid_buf))
! 			s = artid_buf = fetchlines(art,ARTID_LINE);
  		    if (*s != '<') {
  			sprintf(scrbuf,"<%s>",artid_buf);
  			s = scrbuf;

--- 495,501 -----
  		    break;
  		case 'i':
  		    if (!(s=artid_buf))
! 			s = artid_buf = fetchlines(art,MESSID_LINE);
  		    if (*s != '<') {
  			sprintf(scrbuf,"<%s>",artid_buf);
  			s = scrbuf;
***************
*** 566,572
  		    else
  			*scrbuf = '\0';
  		    if (!artid_buf)
! 			artid_buf = fetchlines(art,ARTID_LINE);
  		    if (artid_buf[0] == '<')
  			safecat(scrbuf,artid_buf,sizeof(scrbuf));
  		    else {

--- 572,578 -----
  		    else
  			*scrbuf = '\0';
  		    if (!artid_buf)
! 			artid_buf = fetchlines(art,MESSID_LINE);
  		    if (artid_buf[0] == '<')
  			safecat(scrbuf,artid_buf,sizeof(scrbuf));
  		    else {
!STUFFY!FUNK!
echo Extracting intrp.epat
sed >intrp.epat <<'!STUFFY!FUNK!' -e 's/X//'
X569c
X			artid_buf = fetchlines(art,MESSID_LINE);
X.
X492c
X			s = artid_buf = fetchlines(art,MESSID_LINE);
X.
X3a
X * Revision 4.1.1.2  84/09/25  14:02:08  lwall
X * %i used ARTID_LINE, should be MESSID_LINE.
X * 
X * Revision 4.1.1.1  84/09/25  13:22:59  lwall
X * Branch for sdcrdcf changes.
X * 
X.
X1c
X/* $Header: intrp.c,v 4.1.1.2 84/09/25 14:02:08 lwall Exp $
X.
!STUFFY!FUNK!
echo Extracting rcstuff.cpat
cat >rcstuff.cpat <<'!STUFFY!FUNK!'
*** /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)
!STUFFY!FUNK!
echo Extracting rcstuff.epat
sed >rcstuff.epat <<'!STUFFY!FUNK!' -e 's/X//'
X564a
X#endif
X#ifdef CACHEFIRST
X	abs1st[newng] = tmpabs1st;
X.
X556a
X#ifdef CACHEFIRST
X	    abs1st[i+1] = abs1st[i];
X#endif
X.
X547a
X#ifdef CACHEFIRST
X	tmpabs1st = abs1st[nextrcline-1];
X#endif
X.
X429a
X#ifdef CACHEFIRST
X	abs1st[nextrcline-1] = tmpabs1st;
X#endif
X.
X420a
X#ifdef CACHEFIRST
X	    abs1st[i-1] = abs1st[i];
X#endif
X.
X411a
X#ifdef CACHEFIRST
X	tmpabs1st = abs1st[ngx];
X#endif
X.
X391a
X#ifdef CACHEFIRST
X    ART_NUM tmpabs1st;
X#endif
X.
X3a
X * Revision 4.1.1.2  84/09/25  13:58:26  lwall
X * Oops, relocate_newsgroup() didn't relocate abs1st[].  One of these years
X * I'll make the newsgroup entry a struct...
X * 
X * Revision 4.1.1.1  84/09/25  13:25:43  lwall
X * Branch for sdcrdcf changes.
X * 
X.
X1c
X/* $Header: rcstuff.c,v 4.1.1.2 84/09/25 13:58:26 lwall Exp $
X.
!STUFFY!FUNK!
echo ""
echo "End of patches"
: I do not append .signature, but someone might mail this.
exit