2.10.3 unbatch bug and fix

Carl S. Gutekunst csg at pyramid.UUCP
Thu Mar 20 10:59:09 AEST 1986


In article <243 at micropro.UUCP> mojo writes:
>Yikes!  I lost two days of news.  Hasn't anyone *used* the 2.10.3
>unbatcher?  It doesn't work.
>
>53,54c53,54
>< 		while (strncmp(buf, "#! rnews ", 9) 
>< 			|| strncmp(buf, "! rnews ", 8)) { /* kludge for bug */
>---
>> 		while (!strncmp(buf, "#! rnews ", 9) 
>> 			&& !strncmp(buf, "! rnews ", 8)) { /* kludge for bug */

Which version of 2.10.3? We have 6/6/85, which is missing the second test.
I'll bet a nickel that yours is later, and somebody was trying to fix the
"article eater" bug without working out their boolean algebra first....

But your fix isn't correct either. Try this:

		while (strncmp(buf, "#! rnews ", 9) 
			&& strncmp(buf, "! rnews ", 8)) { /* kludge for bug */

That is, the body of the loop is executed only when both strncmp functions
return non-zero, meaning that the line was neither "#! rnews" nor "! rnews".
What your patch will do is execute the body of the loop only when the buffer
is simultaneously equal to both strings! 

All of which is moot, since I'm painfully familiar with at least one article
eater, and this kludge will not catch it reliably. (The real "bug repellant"
fix requires a complete rewrite of unbatch's inner loop; it's not difficult,
so I suppose I really should go back and work it into the code. Being as none
of our adjacent sites have the bug, I've gotten lazy. :-))

>(I don't know how to make a context diff, or don't
>have the utility.  Is it PD?)

You get a context diff with the "-c" option on the BSD diff utility. USG
sites get to lose, unfortunately....
--
Carl S. Gutekunst   {allegra,cmcl2,decwrl,hplabs,topaz,ut-sally}!pyramid!csg
Pyramid Technology Corp, Mountain View, CA  +1 415 965 7200



More information about the Net.bugs mailing list