You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by mm...@apache.org on 2011/08/19 17:08:59 UTC

svn commit: r1159659 - in /spamassassin/trunk: lib/Mail/SpamAssassin/PluginHandler.pm sa-learn.raw

Author: mmartinec
Date: Fri Aug 19 15:08:58 2011
New Revision: 1159659

URL: http://svn.apache.org/viewvc?rev=1159659&view=rev
Log:
PluginHandler.pm returned undef instead of 0 when some of the called plugins returned a 0 and the last one failed with undef - leading to sa-learn aborting scan of further messages with "ERROR: the Bayes learn function returned an error" on encountering the first already learned message

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/PluginHandler.pm
    spamassassin/trunk/sa-learn.raw

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/PluginHandler.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/PluginHandler.pm?rev=1159659&r1=1159658&r2=1159659&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/PluginHandler.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/PluginHandler.pm Fri Aug 19 15:08:58 2011
@@ -207,9 +207,10 @@ sub callback {
       warn "plugin: eval failed: $eval_stat\n";
     };
 
-    if ($ret) {
-      #dbg("plugin: ${plugin}->${methodref} => $ret");
-      $overallret = $ret;
+    if (defined $ret) {
+      # dbg("plugin: ${plugin}->${methodref} => $ret");
+      # we are interested in defined but false results too
+      $overallret = $ret  if $ret || !defined $overallret;
     }
 
     if ($plugin->{_inhibit_further_callbacks}) {
@@ -218,7 +219,6 @@ sub callback {
     }
   }
 
-  $overallret ||= $ret;
   return $overallret;
 }
 

Modified: spamassassin/trunk/sa-learn.raw
URL: http://svn.apache.org/viewvc/spamassassin/trunk/sa-learn.raw?rev=1159659&r1=1159658&r2=1159659&view=diff
==============================================================================
--- spamassassin/trunk/sa-learn.raw (original)
+++ spamassassin/trunk/sa-learn.raw Fri Aug 19 15:08:58 2011
@@ -469,7 +469,7 @@ eval {
 
   # if exit_status isn't already set to non-zero, set it to the reverse of the
   # run result (0 is bad, 1+ is good -- the opposite of exit status codes)
-  eval { $exit_status ||= ! $iter->run(@targets); };
+  my $run_ok = eval { $exit_status ||= ! $iter->run(@targets); 1 };
 
   print STDERR "\n" if ($opt{showdots});
   $progress->final() if ($opt{progress} && $progress);
@@ -483,7 +483,7 @@ eval {
     undef $tempfile;
   }
 
-  if ($@) { die $@ unless ( $@ =~ /HITLIMIT/ ); }
+  if (!$run_ok && $@ !~ /HITLIMIT/) { die $@ }
   1;
 } or do {
   my $eval_stat = $@ ne '' ? $@ : "errno=$!";  chomp $eval_stat;