See response below; Tolga Cengiz wrote: > Email: 8490 Autolearn: 1623 AvgScore: -16.40 AvgScanTime: 4.07 > sec > Spam: 1355 Autolearn: 22 AvgScore: 7.29 AvgScanTime: 3.30 > sec > Ham: 7135 Autolearn: 1601 AvgScore: -20.90 AvgScanTime: 4.22 > sec > ----- Original Message ----- > From: Tom Manliclic > To: qmailtoaster-list@qmailtoaster.com > Sent: Wednesday, May 07, 2008 2:55 PM > Subject: Re: [qmailtoaster] Illegal division by zero in sa-stats > > > I think the same sa-stats command was executed when I got the error the > only difference > now is that I have atleast one spam. So you're right the first time when > you said a script bug. ...
Defiantly a script bug. I wrote a quick patch by adding if's to check for 0's. This is my first attempt at creating a patch. SOMEONE PLEASE CHECK MY WORK. --- /usr/sbin/sa-stats 2008-05-07 08:50:28.000000000 -0500 +++ /usr/sbin/sa-stats.new 2008-05-07 09:22:42.000000000 -0500 @@ -287,9 +287,24 @@ &hr; foreach my $key (sort { $HAM_RULES{$b} <=> $HAM_RULES{$a} } keys %HAM_RULES) { #my $perc1=sprintf("%.2f",($HAM_RULES{$key}/$NUM_EMAIL)*100); - my $perc1=sprintf("%.2f",(($SPAM_RULES{$key}+$HAM_RULES{$key})/$NUM_EMAIL)*100); - my $perc2=sprintf("%.2f",($SPAM_RULES{$key}/$NUM_SPAM)*100); + if ($NUM_EMAIL > 0) { + my $perc1=sprintf("%.2f",(($SPAM_RULES{$key}+$HAM_RULES{$key})/$NUM_EMAIL)*100); + } + else { + my $perc1=sprintf("%.2f",0); + } + if ($NUM_SPAM > 0) { + my $perc2=sprintf("%.2f",($SPAM_RULES{$key}/$NUM_SPAM)*100); + } + else { + my $perc2=sprintf("%.2f",0); + } + if ($NUM_HAM > 0) { my $perc3=sprintf("%.2f",($HAM_RULES{$key}/$NUM_HAM)*100); + } + else { + my $perc3=sprintf("%.2f",0); + } printf("%4d\t%-24s\t%5s\t%6.2f\t%6.2f\t%6.2f\n",$count+1,$key,$HAM_RULES{$key},$perc1,$perc2,$perc3); $count++; if ($count >= $TOPRULES && $TOPRULES > 0) { Kent Busbee Director of Technology Northlake Christian School
sa-stats.patch
Description: Binary data
--------------------------------------------------------------------- QmailToaster hosted by: VR Hosted <http://www.vr.org> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]