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 2006/11/15 18:29:49 UTC

svn commit: r475313 - in /spamassassin/trunk/lib/Mail/SpamAssassin: Conf.pm Plugin/Check.pm

Author: jm
Date: Wed Nov 15 09:29:47 2006
New Revision: 475313

URL: http://svn.apache.org/viewvc?view=rev&rev=475313
Log:
fix t/spamd_allow_user_rules.t test failure; turns out the optimisation of header rules in the non-tflags-multiple case was buggy, causing rule misses, since a m//g modifier was being used when it shouldn't have been.  Also, don't delete the source_file hash etc. if we are using allow_user_rules; that stuff is used to recompile the ruleset

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Check.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm?view=diff&rev=475313&r1=475312&r2=475313
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm Wed Nov 15 09:29:47 2006
@@ -3050,7 +3050,9 @@
 sub free_uncompiled_rule_source {
   my ($self) = @_;
 
-  if (!$self->{main}->{keep_config_parsing_metadata}) {
+  if (!$self->{main}->{keep_config_parsing_metadata} &&
+        !$self->{allow_user_rules})
+  {
     delete $self->{if_stack};
     delete $self->{source_file};
     delete $self->{meta_dependencies};

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Check.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Check.pm?view=diff&rev=475313&r1=475312&r2=475313
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Check.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Check.pm Wed Nov 15 09:29:47 2006
@@ -436,7 +436,7 @@
     }
     else {
       # store for use below
-      $testcode{$rulename} = $testtype.'~ '.$pat.'g';
+      $testcode{$rulename} = $testtype.'~ '.$pat;
     }
   }
 
@@ -459,18 +459,20 @@
         my $posline = '';
         my $ifwhile = 'if';
         my $hitdone = '';
+        my $matchg = '';
         if (($tflags->{$rulename}||'') =~ /\bmultiple\b/)
         {
           $posline = 'pos $hval = 0;';
           $ifwhile = 'while';
           $hitdone = 'last';
+          $matchg = 'g';
         }
 
         $evalstr .= '
           if ($scoresptr->{q#'.$rulename.'#}) {
             '.$posline.'
             '.$self->hash_line_for_rule($pms, $rulename).'
-            '.$ifwhile.' ($hval '.$testcode.') {
+            '.$ifwhile.' ($hval '.$testcode.$matchg.') {
               $self->got_hit(q#'.$rulename.'#, "", ruletype => "header");
               '.$self->hit_rule_plugin_code($pms, $rulename, "header", $hitdone).'
             }