You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2005/11/18 02:57:03 UTC

svn commit: r345401 - /spamassassin/trunk/masses/hit-frequencies

Author: jm
Date: Thu Nov 17 17:57:01 2005
New Revision: 345401

URL: http://svn.apache.org/viewcvs?rev=345401&view=rev
Log:
uh oh, another hit-freqs bug; deal correctly with lines that have no hits

Modified:
    spamassassin/trunk/masses/hit-frequencies

Modified: spamassassin/trunk/masses/hit-frequencies
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/masses/hit-frequencies?rev=345401&r1=345400&r2=345401&view=diff
==============================================================================
--- spamassassin/trunk/masses/hit-frequencies (original)
+++ spamassassin/trunk/masses/hit-frequencies Thu Nov 17 17:57:01 2005
@@ -513,6 +513,7 @@
 
     my $isspam = ($file eq $spam);
     my $caught;
+    my $restofline;
     my $rules;
     my $score;
 
@@ -535,9 +536,19 @@
 
     # note: doing the match with a regexp shaves off no less than
     # 7 opcodes. nice!
+
+    # the additional split() is for this case:
+    # ".  -20 /path  time=1112116980,scantime=0,format=f,reuse=no"
+    # in other words, no hits.  split(' ') cannot deal with this
+    # correctly, seeing (".", "-20", "/path", "time=...etc").  Work
+    # around this by using a literal / / regexp split to discard
+    # the csv stuff we don't want out of the rest of the line.
+
+
     $evalstr .= '
-        ($caught, $score, undef, $rules) = split(\' \', $_, 5);
-        next unless ($caught =~ /^[Y\.]$/ && $rules);
+        ($caught, $score, $restofline) = split(\' \', $_, 3);
+        next unless ($caught =~ /^[Y\.]$/ && $restofline);
+        (undef, $rules) = split(/ /, $restofline, 3);
     ';
 
     if ($opt_f) {
@@ -684,7 +695,7 @@
   my $str = shift;
 
   my @rules = sort split(' ', $str);
-  if ($rules{$rule}->{type} eq 'meta') {
+  if ($rules{$rule} && $rules{$rule}->{type} eq 'meta') {
     # ignore meta-subrules that match the rule they make up.
     # TODO: this is simplistic; it doesn't look to see if those subrules
     # are in turn meta rules with further subrules that should be ignored.