[net.news.b] rn bugs #20-22

lwall@sdcrdcf.UUCP (Larry Wall) (11/01/84)

#!/bin/sh
: make a subdirectory, cd to it, and run this through sh.
echo 'If this kit is complete, "End of kit" will echo at the end'
echo Extracting index
cat >index <<'!STUFFY!FUNK!'
bug1:	Subject: %i and %R use old Article-I.D. line
bug2:	Subject: rn may get confused about minimum article numbers
bug3:	Subject: rn on System V--circular dependency
bug4:	Subject: 2.10.2 disables checkexpired() optimization.
bug5:	Subject: Xref patch for 2.10.1 inews is wrong.
bug6:	Subject: articles saved to mailbox start with "From: " instead of "From ".
bug7:	Subject: core dump on portable rn
bug8:	Subject: <sys/ioctl> not found on V7
bug9:	Subject: int vs. long
bug10:	Subject: %d vs %ld
bug11:	Subject: R and F may not include article.
bug12:	Subject: missing free() on pdp11's
bug13:	Subject: switch bugs
bug14:	Subject: missing ; if DEBUGGING not defined
bug15:	Subject: (Mail) happens inappropriately.
bug16:	Subject: & substitution in fullname incorrect
bug17:	Subject: null junk files and checkgroups that want to remove everything
bug18:	Subject: rn does switches before looking up baud rate
bug19:	Subject: Pnews can say misleading things about distributions.
bug20:	Subject: KILL files blow up because '/' not considered a metacharacter
bug21:	Subject: filexp (the shell script) doesn't do ~/ or ~ right.
bug22:	Subject: unread article count can get off when articles expire
!STUFFY!FUNK!
echo Extracting bug20
cat >bug20 <<'!STUFFY!FUNK!'
System: rn version 4.1
Bug #: 20
Subject: KILL files blow up because '/' not considered a metacharacter
Index: artsrch.c
From: ber@yquem.UUCP

Description:
	When rn is processing subjects to turn them into search strings, it
	translates search meta-characters into '.'.  Unfortunately, '/',
	while not strictly a search meta-character, is the search string
	delimiter used by the 'K' command, and needs to be included in the
	list of special characters.  (Note that '?' does not need to be
	a special character since 'K' only uses '/'.)

Repeat-By:
	Find an article with a subject containing a slash.  Type 'K' to put
	the subject into the KILL file.  Type '-' to get back to the article
	and 'm' to mark it unread.  Exit the newsgroup and reenter it.
	Watch the fireworks as rn tries to interpret the end of the subject
	as a list of commands.

Fix:	Install either artsrch.c.20-c (diff -c) by hand or artsrch.c.20-e
	(diff -e) using ed.  The -e version must be applied only to a stock
	revision 4.1 artsrch.c.

	To repair a KILL file with this problem, edit the KILL file, find
	the offending '/', and either quote it with a backslash, or replace
	it with a '.'.


!STUFFY!FUNK!
echo Extracting artsrch.c.20-c
cat >artsrch.c.20-c <<'!STUFFY!FUNK!'
*** /tmp/,RCSt1012951	Wed Oct 31 09:57:39 1984
--- /tmp/,RCSt2012951	Wed Oct 31 09:57:44 1984
***************
*** 1,4
! /* $Header: artsrch.c,v 4.1 84/09/24 11:42:18 lwall Exp $
   *
   * $Log:	artsrch.c,v $
   * Revision 4.1  84/09/24  11:42:18  lwall

--- 1,4 -----
! /* $Header: artsrch.c,v 4.1.1.2 84/10/31 09:55:45 lwall Exp $
   *
   * $Log:	artsrch.c,v $
   * Revision 4.1.1.2  84/10/31  09:55:45  lwall
***************
*** 1,6
  /* $Header: artsrch.c,v 4.1 84/09/24 11:42:18 lwall Exp $
   *
   * $Log:	artsrch.c,v $
   * Revision 4.1  84/09/24  11:42:18  lwall
   * Real baseline.
   * 

--- 1,12 -----
  /* $Header: artsrch.c,v 4.1.1.2 84/10/31 09:55:45 lwall Exp $
   *
   * $Log:	artsrch.c,v $
+  * Revision 4.1.1.2  84/10/31  09:55:45  lwall
+  * Added / to list of search meta-characters.
+  * 
+  * Revision 4.1.1.1  84/09/25  13:20:11  lwall
+  * Branch for sdcrdcf changes.
+  * 
   * Revision 4.1  84/09/24  11:42:18  lwall
   * Real baseline.
   * 
***************
*** 150,156
  	    srchahead = -1;
  	h[24] = '\0';		/* compensate for notesfiles */
  	while (*h) {
! 	    if (index("\\[.^*$'\"",*h) != Nullch)
  		*h++ = '.';
  	    else
  		h++;

--- 156,162 -----
  	    srchahead = -1;
  	h[24] = '\0';		/* compensate for notesfiles */
  	while (*h) {
! 	    if (index("/\\[.^*$'\"",*h) != Nullch)
  		*h++ = '.';
  	    else
  		h++;
!STUFFY!FUNK!
echo Extracting artsrch.c.20-e
sed >artsrch.c.20-e <<'!STUFFY!FUNK!' -e 's/X//'
X153c
X	    if (index("/\\[.^*$'\"",*h) != Nullch)
X.
X3a
X * Revision 4.1.1.2  84/10/31  09:55:45  lwall
X * Added / to list of search meta-characters.
X * 
X * Revision 4.1.1.1  84/09/25  13:20:11  lwall
X * Branch for sdcrdcf changes.
X * 
X.
X1c
X/* $Header: artsrch.c,v 4.1.1.2 84/10/31 09:55:45 lwall Exp $
X.
!STUFFY!FUNK!
echo Extracting bug21
cat >bug21 <<'!STUFFY!FUNK!'
System: rn version 4.1
Bug #: 21
Subject: filexp (the shell script) doesn't do ~/ or ~ right.
Index: Configure
From: steven@mcvax.UUCP (Steven Pemberton)

Description:
	There is a little shell script spit out by Configure to do tilde (~)
	substitution on systems that don't have csh.  Unfortunately, it
	doesn't do ~ or ~/* correctly if your home directory name happens
	to contain a slash (heh heh).

Repeat-By:
	Say "filexp ~".

Fix:	You can change this either in Configure or in filexp itself as you
	see fit.
Change

  : expand filename
  case $1 in
  ~/*|~)
!     /bin/echo $1 | /bin/sed "s/~/${HOME-$LOGDIR}/"
      ;;
  ~*)
      if /bin/test -f /bin/csh; then

to

  : expand filename
  case $1 in
  ~/*|~)
!     /bin/echo $1 | /bin/sed "s|~|${HOME-$LOGDIR}|"
      ;;
  ~*)
      if /bin/test -f /bin/csh; then

unless your home directory happens to contain '|', which I doubt.
!STUFFY!FUNK!
echo Extracting bug22
cat >bug22 <<'!STUFFY!FUNK!'
System: rn version 4.1
Bug #: 22
Subject: unread article count can get off when articles expire
Index: bits.c
From: uddeborg@chalmers.UUCP (G|ran Uddeborg)

Description:
	Rn makes a faulty assumption about the read/unread status of
	certain expired articles when entering a newsgroup, with the
	result that the number of articles reported as remaining to be read
	will be low, and possibly even negative.  This doesn't hurt anything
	in particular, but it is somewhat disconcerting.

Repeat-By:
	Find a newsgroup in which the first existing article is followed
	by a range of expired articles.  If for instance, you have a newsgroup
	in which article 100 exists, as well as articles 200-300, edit your
	.newsrc to read:

	net.blurfl: 1-100,110-190,200-299

	If you then enter this newsgroup with rn, in trying to process
	expired articles 101-199 it will forget that you have read 110-190,
	and count them twice when it marks 101-199 as read.  In this example
	you would end up with rn saying there are about -80 unread articles.

Fix:	Install either bits.c.22-c (diff -c) by hand or bits.c.22-e (diff -e)
	using ed.  The -e version must be applied only to a stock revision
	4.1 bits.c.

!STUFFY!FUNK!
echo Extracting bits.c.22-c
cat >bits.c.22-c <<'!STUFFY!FUNK!'
*** /tmp/,RCSt1015166	Wed Oct 31 12:01:42 1984
--- /tmp/,RCSt2015166	Wed Oct 31 12:01:45 1984
***************
*** 1,4
! /* $Header: bits.c,v 4.1 84/09/24 11:43:17 lwall Exp $
   *
   * $Log:	bits.c,v $
   * Revision 4.1  84/09/24  11:43:17  lwall

--- 1,4 -----
! /* $Header: bits.c,v 4.1.1.2 84/10/31 11:58:50 lwall Exp $
   *
   * $Log:	bits.c,v $
   * Revision 4.1.1.2  84/10/31  11:58:50  lwall
***************
*** 1,6
  /* $Header: bits.c,v 4.1 84/09/24 11:43:17 lwall Exp $
   *
   * $Log:	bits.c,v $
   * Revision 4.1  84/09/24  11:43:17  lwall
   * Real baseline.
   * 

--- 1,14 -----
  /* $Header: bits.c,v 4.1.1.2 84/10/31 11:58:50 lwall Exp $
   *
   * $Log:	bits.c,v $
+  * Revision 4.1.1.2  84/10/31  11:58:50  lwall
+  * initctl() wrongly assumed that expired articles were unread when trying
+  * to adjust firstart, and misadjusted toread[ng].  toread[ng] is now
+  * recomputed from scratch.
+  * 
+  * Revision 4.1.1.1  84/09/25  13:20:31  lwall
+  * Branch for sdcrdcf changes.
+  * 
   * Revision 4.1  84/09/24  11:43:17  lwall
   * Real baseline.
   * 
***************
*** 370,375
      char *mybuf = buf;			/* place to decode rc line */
      register char *s, *c, *h;
      register long i;
      
  #ifdef DELAYMARK
      dmcount = 0;

--- 378,384 -----
      char *mybuf = buf;			/* place to decode rc line */
      register char *s, *c, *h;
      register long i;
+     register ART_NUM unread;
      
  #ifdef DELAYMARK
      dmcount = 0;
***************
*** 403,409
      else
  	firstart = 1;			/* all the bits are valid for now */
      if (absfirst > firstart) {		/* do we know already? */
- 	toread[ng] -= (ART_UNREAD)(absfirst - firstart);
  	firstart = absfirst;		/* no point calling getngmin again */
      }
      else if (artopen(firstart) == Nullfp) {

--- 412,417 -----
      else
  	firstart = 1;			/* all the bits are valid for now */
      if (absfirst > firstart) {		/* do we know already? */
  	firstart = absfirst;		/* no point calling getngmin again */
      }
      else if (artopen(firstart) == Nullfp) {
***************
*** 410,416
  					/* first unread article missing? */
  	i = getngmin(".",firstart);	/* see if expire has been busy */
  	if (i) {			/* avoid a bunch of extra opens */
- 	    toread[ng] -= (ART_UNREAD)(i - firstart);
  	    firstart = i;
  	}
      }

--- 418,423 -----
  					/* first unread article missing? */
  	i = getngmin(".",firstart);	/* see if expire has been busy */
  	if (i) {			/* avoid a bunch of extra opens */
  	    firstart = i;
  	}
      }
***************
*** 419,424
  	subj_to_get = firstart;
  #   endif
  #endif
      for (i=OFFSET(firstart)/BITSPERBYTE; i<ctlsize; i++)
  	ctlarea[i] = 0;			/* assume unread */
  #ifdef DEBUGGING

--- 426,432 -----
  	subj_to_get = firstart;
  #   endif
  #endif
+     unread = lastart - firstart + 1;	/* assume this range unread */
      for (i=OFFSET(firstart)/BITSPERBYTE; i<ctlsize; i++)
  	ctlarea[i] = 0;			/* assume unread */
  #ifdef DEBUGGING
***************
*** 442,447
  		min = firstart;
  	    if (max > lastart)
  		max = lastart;
  	    for (i=min; i<=max; i++)	/* for all articles in range */
  		/*NOSTRICT*/
  		ctl_set(i);		/* mark them read */

--- 450,457 -----
  		min = firstart;
  	    if (max > lastart)
  		max = lastart;
+ 	    if (min <= max)		/* non-null range? */
+ 		unread -= max - min + 1;/* adjust unread count */
  	    for (i=min; i<=max; i++)	/* for all articles in range */
  		/*NOSTRICT*/
  		ctl_set(i);		/* mark them read */
***************
*** 446,452
  		/*NOSTRICT*/
  		ctl_set(i);		/* mark them read */
  	}
! 	else if ((i = atol(s)) >= firstart && i <= lastart)
  					/* is single number reasonable? */
  	    /*NOSTRICT*/
  	    ctl_set(i);			/* mark it read */

--- 456,462 -----
  		/*NOSTRICT*/
  		ctl_set(i);		/* mark them read */
  	}
! 	else if ((i = atol(s)) >= firstart && i <= lastart) {
  					/* is single number reasonable? */
  	    /*NOSTRICT*/
  	    ctl_set(i);			/* mark it read */
***************
*** 450,455
  					/* is single number reasonable? */
  	    /*NOSTRICT*/
  	    ctl_set(i);			/* mark it read */
  #ifdef DEBUGGING
  	if (debug & DEB_CTLAREA_BITMAP) {
  	    printf("\n%s\n",s);

--- 460,467 -----
  					/* is single number reasonable? */
  	    /*NOSTRICT*/
  	    ctl_set(i);			/* mark it read */
+ 	    unread--;			/* decrement articles to read */
+ 	}
  #ifdef DEBUGGING
  	if (debug & DEB_CTLAREA_BITMAP) {
  	    printf("\n%s\n",s);
***************
*** 468,473
  #endif
      if (mybuf != buf)
  	free(mybuf);
      return 0;
  }
  

--- 480,486 -----
  #endif
      if (mybuf != buf)
  	free(mybuf);
+     toread[ng] = unread;
      return 0;
  }
  
!STUFFY!FUNK!
echo Extracting bits.c.22-e
sed >bits.c.22-e <<'!STUFFY!FUNK!' -e 's/X//'
X470a
X    toread[ng] = unread;
X.
X452a
X	    unread--;			/* decrement articles to read */
X	}
X.
X449c
X	else if ((i = atol(s)) >= firstart && i <= lastart) {
X.
X444a
X	    if (min <= max)		/* non-null range? */
X		unread -= max - min + 1;/* adjust unread count */
X.
X421a
X    unread = lastart - firstart + 1;	/* assume this range unread */
X.
X413d
X406d
X372a
X    register ART_NUM unread;
X.
X3a
X * Revision 4.1.1.2  84/10/31  11:58:50  lwall
X * initctl() wrongly assumed that expired articles were unread when trying
X * to adjust firstart, and misadjusted toread[ng].  toread[ng] is now
X * recomputed from scratch.
X * 
X * Revision 4.1.1.1  84/09/25  13:20:31  lwall
X * Branch for sdcrdcf changes.
X * 
X.
X1c
X/* $Header: bits.c,v 4.1.1.2 84/10/31 11:58:50 lwall Exp $
X.
!STUFFY!FUNK!
echo ""
echo "End of kit"
: I do not append .signature, but someone might mail this.
exit