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 2008/09/30 17:16:14 UTC
svn commit: r700496 - in /spamassassin/trunk/lib/Mail/SpamAssassin:
Plugin/Pyzor.pm Util.pm
Author: mmartinec
Date: Tue Sep 30 08:16:13 2008
New Revision: 700496
URL: http://svn.apache.org/viewvc?rev=700496&view=rev
Log:
refined error reporting in Pyzor plugin
Modified:
spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Pyzor.pm
spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Pyzor.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Pyzor.pm?rev=700496&r1=700495&r2=700496&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Pyzor.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Pyzor.pm Tue Sep 30 08:16:13 2008
@@ -283,8 +283,13 @@
$!==0 or die "error reading from pipe: $!";
my $errno = 0; close PYZOR or $errno = $!;
- proc_status_ok($?,$errno)
- or info("pyzor: [%s] finished: %s", $pid, exit_status_str($?,$errno));
+ if (proc_status_ok($?,$errno)) {
+ dbg("pyzor: [%s] finished successfully", $pid);
+ } elsif (proc_status_ok($?,$errno, 0,1)) { # sometimes it exits with 1
+ dbg("pyzor: [%s] finished: %s", $pid, exit_status_str($?,$errno));
+ } else {
+ info("pyzor: [%s] error: %s", $pid, exit_status_str($?,$errno));
+ }
if (!@response) {
# this exact string is needed below
@@ -294,8 +299,7 @@
dbg("pyzor: got response: " . join("\\n", @response));
if ($response[0] =~ /^Traceback/) {
- # this exact string is needed below
- die("internal error\n");
+ die("internal error, python traceback seen in response\n");
}
});
@@ -307,7 +311,7 @@
}
my $errno = 0; close PYZOR or $errno = $!;
proc_status_ok($?,$errno)
- or info("pyzor: [%s] terminated: %s", $pid, exit_status_str($?,$errno));
+ or info("pyzor: [%s] error: %s", $pid, exit_status_str($?,$errno));
}
$permsgstatus->leave_helper_run_mode();
@@ -409,8 +413,12 @@
# closing a pipe also waits for the process executing on the pipe to
# complete, no need to explicitly call waitpid
# my $child_stat = waitpid($pid,0) > 0 ? $? : undef;
- proc_status_ok($?,$errno)
- or die "pyzor: reporter error: ".exit_status_str($?,$errno)."\n";
+ if (proc_status_ok($?,$errno, 0)) {
+ dbg("pyzor: [%s] reporter finished successfully", $pid);
+ } else {
+ info("pyzor: [%s] reporter error: %s", $pid, exit_status_str($?,$errno));
+ }
+
});
$options->{report}->leave_helper_run_mode();
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm?rev=700496&r1=700495&r2=700496&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm Tue Sep 30 08:16:13 2008
@@ -325,8 +325,10 @@
$str = sprintf("stopped, signal %d", WSTOPSIG($stat));
} else {
my $sig = WTERMSIG($stat);
- $str = $sig == 2 ? 'INTERRUPTED' : $sig == 6 ? 'ABORTED'
- : sprintf("DIED on signal %d (%04x)", $sig,$stat);
+ $str = sprintf("%s, signal %d (%04x)",
+ $sig == 2 ? 'INTERRUPTED' : $sig == 6 ? 'ABORTED' :
+ $sig == 9 ? 'KILLED' : $sig == 15 ? 'TERMINATED' : 'DIED',
+ $sig, $stat);
}
if (defined $errno) { # deal with dual-valued and plain variables
$str .= ', '.$errno if (0+$errno) != 0 || ($errno ne '' && $errno ne '0');