[net.sources.bugs] new vn "%" listing bug

tallman@hc.UUCP (02/19/87)

The new feature in vn that allows one to go to a new newsgroup from the
"%" listing has a bug.  If the user mistypes the newsgroup number and
chooses a group that has no news in it the program aborts with "bad
temp file read".  The following patch should make it recover gracefully.

*** vn.c	Wed Feb 18 17:04:25 1987
--- vn.c.new	Wed Feb 18 17:07:37 1987
***************
*** 1188,1193 ****
--- 1188,1194 ----
  		printf("n - new group, other to return ... ");
  		c = getnoctl();
  	}
+ 	retry:
  	if (c == 'n')
  	{
  		printf("\n");
***************
*** 1197,1204 ****
  			i = 0;
  		if (i >= Ncount)
  			i = Ncount-1;
! 		find_page((Newsorder[i])->pnum);
! 		*rec = RECBIAS;
! 		*hirec = Page.h.artnum + RECBIAS;
  	}
  }
--- 1198,1213 ----
  			i = 0;
  		if (i >= Ncount)
  			i = Ncount-1;
! 		if ((Newsorder[i])->pages == 0) {
! 			printf("\nNo news was read for that group\n");
! 			printf("n - new group, other to return ... ");
! 			c = getnoctl();
! 			goto retry;
! 		}
! 		else {
! 			find_page((Newsorder[i])->pnum);
! 			*rec = RECBIAS;
! 			*hirec = Page.h.artnum + RECBIAS;
! 		}
  	}
  }
-- 
Dave Tallman - tallman@hc.arpa  or  ihnp4!lanl!hc!tallman
Los Alamos National Laboratory - E-10/Data Systems
Los Alamos, New Mexico  -  (505) 667-8495

bobm@rtech.UUCP (02/21/87)

OOPS.  Should have caught that.  Thanks.  Actually, I should have
done a visual pick on that list.  Using the internal newsgroup index
is a trifle crude, also.  It was a relatively quick way to add the
feature while I was doing other enhancements, however.

BTW, the posting of vn to mod.sources recently is pretty much exactly
what came out in net.sources.  It contains the much-discussed "continued
header line from BITNET" bug.  I sent mail with a correction to sources@mirror,
which I should have done before he had a chance to bring it out.  So, if
anyone pulls off that copy, at least go into reader.c and change the
line in gethead():

if (index(bufr,':') == NULL)

to

if (bufr[0] == '\n')

or maybe that was "buf".  I forget.  Of course, the rest of the fix (a
check for 0 where the calling routine divides by "artlin") ought to
be done, too, but this one-liner will prevent the cases that occurred.
-- 

Bob McQueer
{amdahl, sun, mtxinu, hoptoad, cpsc6a}!rtech!bobm