On Wed, 2010-04-21 at 12:03 -0400, Kevin A. McGrail wrote: > From my understanding of the code and the wiki > http://wiki.apache.org/spamassassin/RoundingIssues, the score for an > email that is 6.4500000000 to 6.4999999999 with a threshold of 6.5 as > SpamAssassin reports should be score=6.4, required=6.5. The old code > used to round to nearest 10th giving the message that X-Spam-Status: No, > score=6.5, required=6.5 was confusing so a special routine for rounding > when near the required score was implemented.
Ah, a gray area I didn't really know so far. :) OK, so in case it is NOT spam, but a rounded score would suggest this nonetheless, just don't round and floor instead -- less precise number, but no confusion because the result matches the visible numbers. > The PerMsgStatus.pm implements this special rounding so that it is > reported as score=6.4. So the message in question actually was NOT spam, and falsely reported to be by spamd. > However, SpamD/C uses rounding to the 10th for the output of the first > line but then utilizes PerMsgStatus.pm for the report, etc. Hmm, the patch is code duplication. And that in a case that caused confusion before. Would be nice if spamd could use PMS functions, rather than duplicating the code. No, I did not look closely at the surrounding code, just a quick look at the patch. :) And there's a bug in your patch, more precisely the comments, added to both PMS and spamd. The comment right before the final return *should* read, with the relevant "not" already added: + # if the email is NOT spam and $score = $rscore, return the $rscore - 0.1 + # effectively flooring the value to the closest tenth > Hence the lack of consistency with one part of the output saying > score=6.5 and another saying score=6.4. They should have both relayed > the score as 6.4 for clarity as decided previously. > > My patch implements logic with the same rounding in both places. -- char *t="\10pse\0r\0dtu...@ghno\x4e\xc8\x79\xf4\xab\x51\x8a\x10\xf4\xf4\xc4"; main(){ char h,m=h=*t++,*x=t+2*h,c,i,l=*x,s=0; for (i=0;i<l;i++){ i%8? c<<=1: (c=*++x); c&128 && (s+=h); if (!(h>>=1)||!t[s+h]){ putchar(t[s]);h=m;s=0; }}}