[net.news.b] rn bug #17--important for usenet admin types

lwall@sdcrdcf.UUCP (Larry Wall) (10/19/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
!STUFFY!FUNK!
echo Extracting bug17
cat >bug17 <<'!STUFFY!FUNK!'
System: rn version 4.1
Bug #: 17
Subject: null junk files and checkgroups that want to remove everything
Index: inews.c (version 2.10.2)

Description:
	Due to differences between 2.10.1 and 2.10.2, the DOXREFS patch
	sent out with the rn kit for inews 2.10.2 can cause inews to do
	certain strange things.  All your files in the junk newsgroup will
	end up empty, and the checkgroups control message will ask you to
	remove all non-local newsgroups.

Repeat-By:
	If you installed inews.c.2.pat, you've got the problem, and are
	already repeating it.

Fix:	Install inews.c.17-c on a 2.10.2 inews that already has the DOXREFS
	patch.  This new patch merely changes some LINKART's into DOXREFS's
	(the code was already there, I just short-circuited), and moves the
	call to control() to after the article file is copied.  Someone
	suggested changing the code in control() regarding checkgroups, but
	changing inews.c is more general, and besides, I'm lazy and don't
	want to patch two files when I could patch one.
!STUFFY!FUNK!
echo Extracting inews.c.17-c
cat >inews.c.17-c <<'!STUFFY!FUNK!'
*** inews.c.2.oldpat	Thu Oct 18 09:39:54 1984
--- inews.c.2	Thu Oct 18 09:36:44 1984
***************
*** 576,582
  		logerr("No valid newsgroups found, moved to junk");
  		if (localize("junk"))
  			savehist(histline);
! #ifndef LINKART
  		xxit(1);
  #endif
  	}

--- 576,582 -----
  		logerr("No valid newsgroups found, moved to junk");
  		if (localize("junk"))
  			savehist(histline);
! #ifndef DOXREFS
  		xxit(1);
  #endif
  	}
***************
*** 580,586
  		xxit(1);
  #endif
  	}
! #ifdef LINKART
  	else
  #endif
  	if (time((time_t)0) > (cgtdate(header.subdate) + DFLTEXP) ){

--- 580,586 -----
  		xxit(1);
  #endif
  	}
! #ifdef DOXREFS
  	else
  #endif
  	if (time((time_t)0) > (cgtdate(header.subdate) + DFLTEXP) ){
***************
*** 587,593
  		logerr("Article too old, moved to junk");
  		if (localize("junk"))
  			savehist(histline);
! #ifndef LINKART
  		xxit(1);
  #endif
  	}

--- 587,593 -----
  		logerr("Article too old, moved to junk");
  		if (localize("junk"))
  			savehist(histline);
! #ifndef DOXREFS
  		xxit(1);
  #endif
  	}
***************
*** 591,597
  		xxit(1);
  #endif
  	}
! #ifdef LINKART
  	else
  #endif
  	if (is_ctl) {

--- 591,597 -----
  		xxit(1);
  #endif
  	}
! #ifdef DOXREFS
  	else
  #endif
  	if (is_ctl) {
***************
*** 595,600
  	else
  #endif
  	if (is_ctl) {
  		control(&header);
  		localize("control");
  	} else {

--- 595,601 -----
  	else
  #endif
  	if (is_ctl) {
+ #ifndef DOXREFS
  		control(&header);
  #endif
  		localize("control");
***************
*** 596,601
  #endif
  	if (is_ctl) {
  		control(&header);
  		localize("control");
  	} else {
  		if (s_find(&srec, FULLSYSNAME) == FALSE)

--- 597,603 -----
  	if (is_ctl) {
  #ifndef DOXREFS
  		control(&header);
+ #endif
  		localize("control");
  	} else {
  		if (s_find(&srec, FULLSYSNAME) == FALSE)
***************
*** 656,661
  	fclose(tfp);
  	fclose(infp);
  #endif LINKART || DOXREFS
  
  	broadcast();
  	savehist(histline);

--- 658,668 -----
  	fclose(tfp);
  	fclose(infp);
  #endif LINKART || DOXREFS
+ 
+ #ifdef DOXREFS
+ 	if (is_ctl)	/* moved here cuz checkgroups uses ARTICLE! */
+ 		control(&header);
+ #endif
  
  	broadcast();
  	savehist(histline);
!STUFFY!FUNK!
echo ""
echo "End of kit"
: I do not append .signature, but someone might mail this.
exit

uddeborg@chalmers.UUCP (G|ran Uddeborg) (10/25/84)

What about a shell script that takes a bug fix message from Larry, unpacks
it, installs the patches using rcs, archives the fixes and cleans up? :-)

G|ran Uddeborg
...!mcvax!enea!chalmers!uddeborg

bllklly@uwmacc.UUCP (Bill Kelly) (10/25/84)

>What about a shell script that takes a bug fix message from Larry, unpacks
>it, installs the patches using rcs, archives the fixes and cleans up? :-)

Maybe it's a little silly, but I already wrote a script to unpack sharred source
and bug fixes from the net.  It's far from perfect in recognizing the
beginning of the script, but it works on 80% or more of the stuff we get,
including Larry's postings.  You need to change the setting of LIB to tell
where you stored the unshar.awk file.  There are some other minor
annoyances, (the worst is that if the article contains a shell script that
isn't sharred, it will run the shell script itself, so there is a potential
danger) but I find it helpful.  (P.S.  It peels off everything before
the actual script and adds it to file COMMENTS in case you're interested in
what the poster had to say about it.)  No claims for portability -- it uses
csh because I'm more familiar with it than sh.

: This is a shar archieve.  Extract with sh, not csh.
: The rest of this file will extract:
: unshar unshar.awk
echo extracting - unshar
sed 's/^X//' > unshar << '/*EOF'
X#!/bin/csh
Xset LIB=~bllklly/util
Xif (! $#argv) then
X	echo -n "File to un-shar? "
X	set fname=$<
Xelse
X	set fname=$1
Xendif
Xset numfiles=$#fname
Xforeach f ($fname)
X    echo "echo awk did not succeed." > /tmp/UNSH$$
X    awk -f $LIB/unshar.awk $f > /tmp/UNSH$$
X    if ( -z /tmp/UNSH$$ ) then
X    	echo awk did not succeed.
X    else
X    	echo "OK, made the shell input, now run ${f}:"
X    	sh /tmp/UNSH$$
X    endif
X    if ( $status && $status != 9876 ) then
X	echo "Errors running /tmp/UNSH$$, will leave it for your perusal"
X    else
X        echo "Done with unshar."
X        rm /tmp/UNSH$$
X        rm -i $f
X    endif
X    @ numfiles = $numfiles - 1
X    if ($numfiles > 0) then
X        echo -n "Hit return to continue. "
X        set junk=$<
X    endif
Xend
/*EOF
echo extracting - unshar.awk
sed 's/^X//' > unshar.awk << '/*EOF'
X# When comments or shell is true, print everything.
X# Until comments or shell is true, print just interesting stuff
X# from the mail header, like From and Subject.
X# "cut" tells whether it looks like a CUT HERE type of file
X# "shell" tells whether a recognizable shar start was found
XBEGIN {shell=0; comments=0; cut=0; print "cat >> COMMENTS << EOF"}
X/^[a-zA-Z].*<</  {if (!shell) print "EOF"
X		shell=1
X}
X/^: .*sh/  {if (!shell) print "EOF"
X		shell=1
X}
X/^echo /  {if (!shell) print "EOF"
X		shell=1
X}
X/^#[ !]/  {if (!shell) print "EOF"
X		shell=1
X}
X/^$/  {if (!shell) {
X		if (!comments) {
X			comments=1
X			print
X			next
X		}
X	}
X}
X/\<cut\>/ {cut=1}
X/\<CUT\>/ {cut=1}
X/Subject/ {print; next}
X/From/ {print; next}
X/Organization/ {print; next}
X{if (shell || comments) print; else next}
XEND {if (!shell) {
X	if (comments) {
X		print "EOF"
X		print "rm MORECOMMENTS"
X	}
X	print "echo This was not a shar type script!"
X	if (cut) print "echo Looked like it said CUT HERE tho"
X	print "exit 9876"
X     }
X}
/*EOF
-- 

Bill Kelly
{allegra, ihnp4, seismo}!uwvax!uwmacc!bllklly
1210 West Dayton St/U Wisconsin Madison/Mad WI 53706

"Life's like a jigsaw...you get the straight bits, but there's plenty
 missing in the middle." -- Xtc