[net.news.b] bug fix to a posted bug fix

chuqui@nsc.UUCP (Chuq Von Rospach) (04/08/84)

I just tracked down a bug in a routine posted a while back by
utcsstat!geoff in the routine findngsize() in rfuncs. The article-id is
<1610@utcsstat.UUCP> posted 1/5/84.

He rewrote the routine and posted a much faster and intelligent version. 
Unfortunately, he reversed a comparison, and the thing severely breaks the
'-' command in both readnews and vnews. The main symptom is that when you
'-' back across a newsgroup boundary the largest message in the group
becomes the largest message in the first group in your active file. This,
in our case, is general, and it is very disconcerting to see a message like
'Unix Wizards, message 1519 of 30'. 

The problem is that in one of his comparisons he uses strcmp() instead of
!strcmp(), which causes it to succeed on the first try instead of when the
two strings match. This causes it to return the wrong value. The corrected
line should look like: 

if (sscanf(buf, "%s "ld",n,&s) == 2 && !strcmp(n,ng))
				       ^
				       ^
				       |
				       | missing character!

chuq

-- 
From under the bar at Callahan's:		Chuq Von Rospach
{amd70,fortune,hplabs,menlo70}!nsc!chuqui	(408) 733-2600 x242

A toast! To absent friends... {clink}

geoff@utcsstat.UUCP (Geoffrey Collyer) (04/10/84)

Well, Chuq, I had a look for my original article containing my new
findngsize() and can't find it.  I'm pretty sure that I posted the
code by copying it out of my production source with an editor and
the following is the line in question taken directly from my production
rfuncs.c, which hasn't changed since I posted my article:

		if (sscanf(buf, "%s %ld", n, &s) == 2 && strcmp(n, ng) == 0) {

I have not seen the symptoms you describe and I didn't retype my changes,
I took them directly from the source.  Is it possible that you mistyped
my corrections?  I'm a pretty careful coder and the evidence at my end
is that I *did* test for equality of n and ng.

If you would mail me your copy of my original article, I'd appreciate it.
Perhaps we should pursue this privately.  I am a little concerned that
people will have the mistaken impression that I posted an untested and
incorrect fix.

Geoff Collyer, U. of Toronto

chuqui@nsc.UUCP (Chuq Von Rospach) (04/10/84)

It is open mouth, insert foot time for chuqui again, folks. I want to 
apologize to geoff for accusing him of posting a buggy bug fix. What really
happened was that when I printed a copy of his bug fix for my use, the 
printer ate the right side of the message, so that his final check, which
was 'strcmp(n,ng) ==0' and which works fine became 'strcmp(n,ng)' which
doesn't work. When I went to check my on-line version of the message, which
I should have done before I opened my mouth (my fingers?) I found the 
discrepancy. I have kicked the line printer for getting me into this, and I
think I'm going to go crawl back into my cave for a couple of days. I just
don't think it has been my week. 

Sorry, geoff!

chuq (*blush* *sigh*)

-- 
From under the bar at Callahan's:		Chuq Von Rospach
{amd70,fortune,hplabs,menlo70}!nsc!chuqui	(408) 733-2600 x242

A toast! To absent friends... {clink}