You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by qu...@apache.org on 2005/04/21 23:33:03 UTC

svn commit: r164126 - in /spamassassin/trunk: ./ lib/Mail/SpamAssassin/ lib/Mail/SpamAssassin/BayesStore/ lib/Mail/SpamAssassin/Logger/ lib/Mail/SpamAssassin/Plugin/ lib/Mail/SpamAssassin/Util/ spamd/ t/

Author: quinlan
Date: Thu Apr 21 14:33:01 2005
New Revision: 164126

URL: http://svn.apache.org/viewcvs?rev=164126&view=rev
Log:
cleaning up various error messages

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/ArchiveIterator.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/DBM.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/SQL.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/DnsResolver.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/Logger.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/Logger/Syslog.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/AWL.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/MIMEHeader.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/SpamdForkScaling.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/Util/DependencyInfo.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/Util/Progress.pm
    spamassassin/trunk/spamassassin.raw
    spamassassin/trunk/spamd/spamd.raw
    spamassassin/trunk/t/debug.t

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/ArchiveIterator.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/ArchiveIterator.pm?rev=164126&r1=164125&r2=164126&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/ArchiveIterator.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/ArchiveIterator.pm Thu Apr 21 14:33:01 2005
@@ -408,7 +408,7 @@
 	{
 	  $needs_restart = 0;
 
-	  #warn "debug: Needs restart, $MESSAGES total, $total_count done.\n";
+	  #warn "debug: needs restart, $MESSAGES total, $total_count done\n";
 	  $self->reap_children($self->{opt_j}, \@child, \@pid);
 	  @child=();
 	  @pid=();

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/DBM.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/DBM.pm?rev=164126&r1=164125&r2=164126&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/DBM.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/DBM.pm Thu Apr 21 14:33:01 2005
@@ -1450,14 +1450,14 @@
       untie %in;
     ';
     if ($@) {
-      print "$dbm: $dbm module not installed, nothing copied.\n";
+      print "$dbm: $dbm module not installed, nothing copied\n";
       dbg("bayes: error was: $@");
     }
     elsif ($count == 0) {
-      print "$dbm: no database of that kind found, nothing copied.\n";
+      print "$dbm: no database of that kind found, nothing copied\n";
     }
     else {
-      print "$dbm: copied $count entries.\n";
+      print "$dbm: copied $count entries\n";
       return 1;
     }
   }

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/SQL.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/SQL.pm?rev=164126&r1=164125&r2=164126&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/SQL.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/SQL.pm Thu Apr 21 14:33:01 2005
@@ -1532,13 +1532,13 @@
     }
 
     if ($token_error_count >= 20) {
-      warn "Encountered too many errors (20) while parsing token line, reverting to empty database and exiting.\n";
+      warn "bayes: encountered too many errors (20) while parsing token line, reverting to empty database and exiting\n";
       $self->clear_database();
       return 0;
     }
 
     if ($seen_error_count >= 20) {
-      warn "Encountered too many errors (20) while parsing seen lines, reverting to empty database and exiting.\n";
+      warn "bayes: encountered too many errors (20) while parsing seen lines, reverting to empty database and exiting\n";
       $self->clear_database();
       return 0;
     }

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/DnsResolver.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/DnsResolver.pm?rev=164126&r1=164125&r2=164126&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/DnsResolver.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/DnsResolver.pm Thu Apr 21 14:33:01 2005
@@ -214,7 +214,7 @@
   if ($@) {
     # this can happen if Net::DNS isn't available -- but in this
     # case this function should never be called!
-    warn "cannot create Net::DNS::Packet, but new_dns_packet() was called: $@ $!";
+    warn "dns: cannot create Net::DNS::Packet, but new_dns_packet() was called: $@ $!";
   }
   return $packet;
 }
@@ -250,7 +250,7 @@
   my $data = $pkt->data;
   my $dest = $self->{dest};
   if (!$self->{sock}->send ($pkt->data, 0, $self->{dest})) {
-    warn "sendto() failed: $@";
+    warn "dns: sendto() failed: $@";
     return;
   }
 
@@ -369,7 +369,7 @@
   my $rin = '';
   foreach my $sock (@fhlist) {
     my $fno = fileno($sock);
-    warn "oops! fileno now undef for $sock" unless defined($fno);
+    warn "dns: oops! fileno now undef for $sock" unless defined($fno);
     vec ($rin, $fno, 1) = 1;
   }
   return $rin;

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Logger.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/Logger.pm?rev=164126&r1=164125&r2=164126&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Logger.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Logger.pm Thu Apr 21 14:33:01 2005
@@ -51,6 +51,7 @@
 use constant INFO => 2;
 use constant DBG => 3;
 
+# global shared object
 our %LOG_SA;
 
 # defaults
@@ -91,6 +92,13 @@
 
 sub log_message {
   my ($level, @message) = @_;
+
+  # too many die and warn messages out there, don't log the
+  # ones that we don't own
+  if ($level eq "error" or $level eq "warn") {
+    return unless $message[0] =~ /^\S+:/;
+  }
+
   my $message = join(" ", @message);
   $message =~ s/[\r\n]+$//;		# remove any trailing newlines
   $message =~ s/[\x00-\x1f]/_/g;	# replace control characters with "_"

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Logger/Syslog.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/Logger/Syslog.pm?rev=164126&r1=164125&r2=164126&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Logger/Syslog.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Logger/Syslog.pm Thu Apr 21 14:33:01 2005
@@ -194,7 +194,7 @@
 
   $self->{consecutive_failures}++;
   if ($self->{consecutive_failures}++ > $self->{failure_threshold}) {
-    warn("syslog() failed " . $self->{consecutive_failures} .
+    warn("logger: syslog() failed " . $self->{consecutive_failures} .
 	 " times in a row, disabled\n");
     $self->{disabled} = 1;
     return 1;

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/AWL.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/AWL.pm?rev=164126&r1=164125&r2=164126&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/AWL.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/AWL.pm Thu Apr 21 14:33:01 2005
@@ -405,7 +405,7 @@
   return 0 unless ($self->{main}->{conf}->{use_auto_whitelist});
 
   unless ($args->{address}) {
-    print "SpamAssassin auto-whitelist: Failed to add address to blacklist.\n";
+    print "SpamAssassin auto-whitelist: failed to add address to blacklist\n";
     return;
   }
   
@@ -416,7 +416,7 @@
     $whitelist = Mail::SpamAssassin::AutoWhitelist->new($self->{main});
 
     if ($whitelist->add_known_bad_address($args->{address})) {
-      print "SpamAssassin auto-whitelist: adding address to blacklist: " . $args->{address} . ".\n";
+      print "SpamAssassin auto-whitelist: adding address to blacklist: " . $args->{address} . "\n";
       $status = 0;
     }
     else {
@@ -441,7 +441,7 @@
   return 0 unless ($self->{main}->{conf}->{use_auto_whitelist});
 
   unless ($args->{address}) {
-    print "SpamAssassin auto-whitelist: Failed to add address to whitelist.\n";
+    print "SpamAssassin auto-whitelist: failed to add address to whitelist\n";
     return 0;
   }
 
@@ -452,7 +452,7 @@
     $whitelist = Mail::SpamAssassin::AutoWhitelist->new($self->{main});
 
     if ($whitelist->add_known_good_address($args->{address})) {
-      print "SpamAssassin auto-whitelist: adding address to whitelist: " . $args->{address} . ".\n";
+      print "SpamAssassin auto-whitelist: adding address to whitelist: " . $args->{address} . "\n";
       $status = 1;
     }
     else {
@@ -478,7 +478,7 @@
   return 0 unless ($self->{main}->{conf}->{use_auto_whitelist});
 
   unless ($args->{address}) {
-    print "SpamAssassin auto-whitelist: Failed to remove address.\n";
+    print "SpamAssassin auto-whitelist: failed to remove address\n";
     return 0;
   }
 
@@ -489,11 +489,11 @@
     $whitelist = Mail::SpamAssassin::AutoWhitelist->new($self->{main});
 
     if ($whitelist->remove_address($args->{address})) {
-      print "SpamAssassin auto-whitelist: removing address: " . $args->{address} . ".\n";
+      print "SpamAssassin auto-whitelist: removing address: " . $args->{address} . "\n";
       $status = 1;
     }
     else {
-      print "SpamAssassin auto-whitelist: error removing address.\n";
+      print "SpamAssassin auto-whitelist: error removing address\n";
       $status = 0;
     }
   

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/MIMEHeader.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/MIMEHeader.pm?rev=164126&r1=164125&r2=164126&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/MIMEHeader.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/MIMEHeader.pm Thu Apr 21 14:33:01 2005
@@ -133,7 +133,7 @@
 
       eval $evalcode;
       if ($@) {
-        warn "plugin error: $@";
+        warn "mimeheader: plugin error: $@";
         return $Mail::SpamAssassin::Conf::INVALID_VALUE;
       }
 

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/SpamdForkScaling.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/SpamdForkScaling.pm?rev=164126&r1=164125&r2=164126&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/SpamdForkScaling.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/SpamdForkScaling.pm Thu Apr 21 14:33:01 2005
@@ -226,7 +226,7 @@
     return PFSTATE_BUSY;
   }
   else {
-    die "unknown message from child: '$line'";
+    die "prefork: unknown message from child: '$line'";
     return PFSTATE_ERROR;
   }
 }
@@ -327,14 +327,14 @@
   while (1) {
     my $line = $sock->getline();
     if (!defined($line)) {
-      die "empty order from parent";
+      die "prefork: empty order from parent";
     }
     chomp $line;
     if (index ($line, "A") == 0) {  # string starts with "A" = accept
       return PFORDER_ACCEPT;
     }
     else {
-      die "unknown order from parent: '$line'";
+      die "prefork: unknown order from parent: '$line'";
     }
   }
 }
@@ -421,7 +421,7 @@
 
   if (!defined $pid) {
     # this should be impossible. assert it
-    die "oops! no idle kids in need_to_del_server?";
+    die "prefork: oops! no idle kids in need_to_del_server?";
   }
 
   # warning: race condition if these two lines are the other way around.

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm?rev=164126&r1=164125&r2=164126&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm Thu Apr 21 14:33:01 2005
@@ -1186,14 +1186,14 @@
   if ($f != 0) {
     POSIX::close(0);
   }
-  open STDIN, "<$stdinfile" or die "cannot open $stdinfile: $!";
+  open STDIN, "<$stdinfile" or die "util: cannot open $stdinfile: $!";
 
   # this should be impossible; if we just closed fd 0, UNIX
   # fd behaviour dictates that the next fd opened (the new STDIN)
   # will be the lowest unused fd number, which should be 0.
   # so die with a useful error if this somehow isn't the case.
   if (fileno(STDIN) != 0) {
-    die "setuid: oops: fileno(STDIN) [".fileno(STDIN)."] != 0";
+    die "util: setuid: oops: fileno(STDIN) [".fileno(STDIN)."] != 0";
   }
 
   # ensure STDOUT is open.  since we just created a pipe to ensure this, it has
@@ -1214,11 +1214,11 @@
     if ($f != 2) {
       POSIX::close(2);
     }
-    open STDERR, ">&STDOUT" or die "dup STDOUT failed: $!";
+    open STDERR, ">&STDOUT" or die "util: dup STDOUT failed: $!";
 
     # STDERR must be fd 2 to be useful to subprocesses! (bug 3649)
     if (fileno(STDERR) != 2) {
-      die "setuid: oops: fileno(STDERR) [".fileno(STDERR)."] != 2";
+      die "util: setuid: oops: fileno(STDERR) [".fileno(STDERR)."] != 2";
     }
   }
 
@@ -1286,7 +1286,7 @@
   if ($@) {
     # this can happen if Net::DNS isn't available -- but in this 
     # case this function should never be called!
-    warn "cannot create Net::DNS::Packet, but new_dns_packet() was called: $@ $!";
+    warn "util: cannot create Net::DNS::Packet, but new_dns_packet() was called: $@ $!";
   }
   return $packet;
 }

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Util/DependencyInfo.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/Util/DependencyInfo.pm?rev=164126&r1=164125&r2=164126&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Util/DependencyInfo.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Util/DependencyInfo.pm Thu Apr 21 14:33:01 2005
@@ -208,8 +208,8 @@
 
   print $summary;
   if ($EXIT_STATUS || $WARNINGS) {
-    print "\nWarning: some functionality may not be available.\n".
-            "Please read the above report before continuing!\n\n";
+    print "\nwarning: some functionality may not be available,\n".
+            "please read the above report before continuing!\n\n";
   }
   return $EXIT_STATUS;
 }

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Util/Progress.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/Util/Progress.pm?rev=164126&r1=164125&r2=164126&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Util/Progress.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Util/Progress.pm Thu Apr 21 14:33:01 2005
@@ -87,7 +87,7 @@
   $class = ref($class) || $class;
 
   if (!exists($args->{total}) || $args->{total} < 1) {
-    warn "Must provide a total value > 1";
+    warn "progress: must provide a total value > 1";
     return undef;
   }
 

Modified: spamassassin/trunk/spamassassin.raw
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/spamassassin.raw?rev=164126&r1=164125&r2=164126&view=diff
==============================================================================
--- spamassassin/trunk/spamassassin.raw (original)
+++ spamassassin/trunk/spamassassin.raw Thu Apr 21 14:33:01 2005
@@ -139,7 +139,7 @@
 # Check to make sure the script version and the module version matches.
 # If not, die here!  Also, deal with unchanged VERSION macro.
 if ($Mail::SpamAssassin::VERSION ne '@@VERSION@@' && '@@VERSION@@' ne "\@\@VERSION\@\@") {
-  die 'ERROR! spamassassin script is v@@VERSION@@, but using modules v'.$Mail::SpamAssassin::VERSION."!\n";
+  die 'spamassassin: spamassassin script is v@@VERSION@@, but using modules v'.$Mail::SpamAssassin::VERSION."\n";
 }
 
 # by default:
@@ -264,7 +264,7 @@
     $spamtest->add_address_to_blacklist( $opt{'add-addr-to-blacklist'} );
   }
   else {
-    die "oops! unhandled whitelist operation";
+    die "spamassassin: oops! unhandled whitelist operation";
   }
 
   exit(0);
@@ -389,7 +389,7 @@
       $spamtest->add_all_addresses_to_blacklist($mail);
     }
     else {
-      warn "oops! unhandled whitelist operation";
+      warn "spamassassin: oops! unhandled whitelist operation";
     }
 
     $mail->finish();
@@ -436,8 +436,8 @@
     }
 
     if ($failed) {
-      warn "Warning, unable to $failed message\n";
-      warn "For more information, re-run with -D option to see debug output.\n";
+      warn "spamassassin: warning, unable to $failed message\n";
+      warn "spamassassin: for more information, re-run with -D option to see debug output\n";
     }
 
     $new_mail->finish();

Modified: spamassassin/trunk/spamd/spamd.raw
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/spamd/spamd.raw?rev=164126&r1=164125&r2=164126&view=diff
==============================================================================
--- spamassassin/trunk/spamd/spamd.raw (original)
+++ spamassassin/trunk/spamd/spamd.raw Thu Apr 21 14:33:01 2005
@@ -56,7 +56,7 @@
 # Check to make sure the script version and the module version matches.
 # If not, die here!  Also, deal with unchanged VERSION macro.
 if ($Mail::SpamAssassin::VERSION ne '@@VERSION@@' && '@@VERSION@@' ne "\@\@VERSION\@\@") {
-  die 'ERROR!  spamassassin script is v@@VERSION@@, but using modules v'.$Mail::SpamAssassin::VERSION."!\n";
+  die 'spamd: spamd script is v@@VERSION@@, but using modules v'.$Mail::SpamAssassin::VERSION."\n";
 }
 
 # Load Time::HiRes if it's available
@@ -214,11 +214,11 @@
   #
   
   # last in 2.3
-  'F:i'                   => sub { warn "The -F option has been removed from spamd, please remove from your commandline and re-run.\n"; exit 2; },
-  'add-from!'             => sub { warn "The --add-from option has been removed from spamd, please remove from your commandline and re-run.\n"; exit 2; },
+  'F:i'                   => sub { warn "spamd: the -F option has been removed from spamd, please remove from your commandline and re-run\n"; exit 2; },
+  'add-from!'             => sub { warn "spamd: the --add-from option has been removed from spamd, please remove from your commandline and re-run\n"; exit 2; },
 
   # last in 2.4
-  'stop-at-threshold|S' => sub { warn "The -S option has been deprecated and is no longer supported, ignoring.\n" },
+  'stop-at-threshold|S' => sub { warn "spamd: the -S option has been deprecated and is no longer supported, ignoring\n" },
 
 ) or print_usage_and_exit();
 
@@ -237,6 +237,8 @@
 if (defined $opt{'debug'}) {
   $opt{'debug'} ||= 'all';
 }
+# always turn on at least info-level debugging for spamd
+$opt{'debug'} ||= 'info';
 # turn on debugging facilities as soon as possible
 Mail::SpamAssassin::Logger::add_facilities($opt{'debug'});
 
@@ -298,7 +300,7 @@
 # ident-based spamc user authentication
 if ( $opt{'auth-ident'} ) {
   eval { require Net::Ident };
-  die "fatal: ident-based authentication requested, but Net::Ident is unavailable\n" if ($@);
+  die "spamd: ident-based authentication requested, but Net::Ident is unavailable\n" if ($@);
 
   $opt{'ident-timeout'} = undef if $opt{'ident-timeout'} <= 0.0;
   import Net::Ident qw(ident_lookup);
@@ -309,14 +311,14 @@
 $opt{'server-cert'} ||= "$LOCAL_RULES_DIR/certs/server-cert.pem";
 if ( $opt{'ssl'} ) {
   eval { require IO::Socket::SSL };
-  die "fatal: SSL encryption requested, but IO::Socket::SSL is unavailable\n"
+  die "spamd: SSL encryption requested, but IO::Socket::SSL is unavailable\n"
     if ($@);
 
   if ( !-e $opt{'server-key'} ) {
-    die "The server key file $opt{'server-key'} does not exist\n";
+    die "spamd: server key file $opt{'server-key'} does not exist\n";
   }
   if ( !-e $opt{'server-cert'} ) {
-    die "The server certificate file $opt{'server-cert'} does not exist\n";
+    die "spamd: server certificate file $opt{'server-cert'} does not exist\n";
   }
 }
 
@@ -483,8 +485,8 @@
       $ENV{'HOME'} = $nh;
     }
     else {
-      die "Can't determine home directory for user '"
-        . $opt{'username'} . "'!\n";
+      die "spamd: unable to determine home directory for user '"
+        . $opt{'username'} . "'\n";
     }
   }
 
@@ -507,7 +509,7 @@
   if (defined $addr) {
     if ($addr ne '') {
       $addr = ( gethostbyname($addr) )[4];
-      die "invalid address: $opt{'listen-ip'}\n" unless $addr;
+      die "spamd: invalid address: $opt{'listen-ip'}\n" unless $addr;
       $addr = inet_ntoa($addr);
     }
     else {
@@ -521,7 +523,7 @@
   $port = $opt{'port'} || 783;
   if ($port !~ /^(\d+)$/ ) {
     $port = ( getservbyname($port, 'tcp') )[2];
-    die "invalid port: $opt{'port'}\n" unless $port;
+    die "spamd: invalid port: $opt{'port'}\n" unless $port;
   }
 
   $listeninfo = "port $port/tcp";
@@ -563,7 +565,7 @@
 
   if ( -e $path ) {
     unless ( -S $path ) {
-      die "file $path exists but is no socket, exiting\n";
+      die "spamd: file $path exists but is no socket, exiting\n";
     }
   
     if ( new IO::Socket::UNIX( Peer => $path, Type => SOCK_STREAM ) ) {
@@ -571,7 +573,7 @@
 
       undef $opt{'socketpath'};    # so exit handlers won't unlink it!
 
-      die "spamd already running on $path, exiting\n";
+      die "spamd: already running on $path, exiting\n";
     }
     else {
       dbg("spamd: removing stale socket file $path");
@@ -586,11 +588,11 @@
   );
   dbg("spamd: creating UNIX socket:\n" . join("\n", map { "\t$_: " . (defined $socket{$_} ? $socket{$_} : "(undef)") } sort keys %socket));
   $server = new IO::Socket::UNIX(%socket)
-         || die "Could not create UNIX socket on $path: $! ($@)\n";
+         || die "spamd: could not create UNIX socket on $path: $! ($@)\n";
 
   # sanity check!
   if (!-S $path) {
-    die "Could not find newly-created UNIX socket on $path: $! ($@)\n";
+    die "spamd: could not find newly-created UNIX socket on $path: $! ($@)\n";
   }
 
   my $mode = $opt{socketmode};
@@ -607,21 +609,21 @@
     my $gid = -1;
     if ($owner) {
       my ($login,$pass,$puid,$pgid) = getpwnam($owner)
-                            or die "$owner not in passwd database\n";
+                            or die "spamd: $owner not in passwd database\n";
       $uid = $puid;
     }
     if ($group) {
       my ($name,$pass,$ggid,$members) = getgrnam($group)
-                            or die "$group not in group database\n";
+                            or die "spamd: $group not in group database\n";
       $gid = $ggid;
     }
     if (!chown $uid, $gid, $path) {
-      die "Could not chown $path to $uid/$gid: $! ($@)";
+      die "spamd: could not chown $path to $uid/$gid: $! ($@)";
     }
   }
 
   if (!chmod $mode, $path) {    # make sure everybody can talk to it
-    die "Could not chmod $path to $mode: $! ($@)";
+    die "spamd: could not chmod $path to $mode: $! ($@)";
   }
 }
 elsif ( $opt{'ssl'} ) {
@@ -638,7 +640,7 @@
   );
   dbg("spamd: creating SSL socket:\n" . join("\n", map { "\t$_:  " . (defined $socket{$_} ? $socket{$_} : "(undef)") } sort keys %socket));
   $server = new IO::Socket::SSL(%socket)
-         || die "Could not create SSL socket on $addr:$port: $! ($@)\n";
+         || die "spamd: could not create SSL socket on $addr:$port: $! ($@)\n";
 }
 else {
   my %socket = (
@@ -651,7 +653,7 @@
   );
   dbg("spamd: creating INET socket:\n" . join("\n", map { "\t$_: " . (defined $socket{$_} ? $socket{$_} : "(undef)") } sort keys %socket));
   $server = new IO::Socket::INET(%socket)
-         || die "Could not create INET socket on $addr:$port: $! ($@)\n";
+         || die "spamd: could not create INET socket on $addr:$port: $! ($@)\n";
 }
 
 if ( defined $opt{'pidfile'} ) {
@@ -687,7 +689,7 @@
 }
 
 # If we need Storable, and it's not installed, alert now before we daemonize.
-die "Required module Storable not found!\n"
+die "spamd: required module Storable not found\n"
   if ($copy_config_p && !$spamtest->_is_storable_available());
 
 ## DAEMONIZE! ##
@@ -713,7 +715,7 @@
   }
 
   $spamtest->copy_config(undef, \%conf_backup) ||
-    die "error returned from copy_config, no Storable module?\n";
+    die "spamd: error returned from copy_config, no Storable module?\n";
 }
 
 # setup signal handlers before the kids since we may have to kill them...
@@ -746,7 +748,7 @@
     close PIDF;
   }
   else {
-    warn "Can't write to PID file: $!\n";
+    warn "spamd: cannot write to PID file: $!\n";
   }
 }
 
@@ -771,7 +773,7 @@
 
   if ( defined $got_sighup ) {
     if (defined($opt{'pidfile'})) {
-      unlink($opt{'pidfile'}) || warn "Can't unlink $opt{'pidfile'}: $!\n";
+      unlink($opt{'pidfile'}) || warn "spamd: cannot unlink $opt{'pidfile'}: $!\n";
     }
 
     # leave Client fds active, and do not kill children; they can still
@@ -779,11 +781,11 @@
     # And close the logfile, so the new instance can reopen it.
     Mail::SpamAssassin::Logger::close_log();
     chdir($ORIG_CWD)
-      || die "spamd restart failed: chdir failed: ${ORIG_CWD}: $!\n";
+      || die "spamd: restart failed: chdir failed: ${ORIG_CWD}: $!\n";
     exec( $ORIG_ARG0, @ORIG_ARGV );
 
     # should not get past that...
-    die "spamd restart failed: exec failed: "
+    die "spamd: restart failed: exec failed: "
       . join ( ' ', $ORIG_ARG0, @ORIG_ARGV )
       . ": $!\n";
   }
@@ -802,10 +804,10 @@
   # block signal for fork
   my $sigset = POSIX::SigSet->new( POSIX::SIGINT(), POSIX::SIGCHLD() );
   sigprocmask( POSIX::SIG_BLOCK(), $sigset )
-    or die "Can't block SIGINT/SIGCHLD for fork: $!\n";
+    or die "spamd: cannot block SIGINT/SIGCHLD for fork: $!\n";
 
   $pid = fork();
-  die "fork: $!" unless defined $pid;
+  die "spamd: fork: $!" unless defined $pid;
 
   if ($pid) {
     ## PARENT
@@ -817,7 +819,7 @@
       $scaling->add_child($pid);
     }
     sigprocmask( POSIX::SIG_UNBLOCK(), $sigset )
-      or die "Can't unblock SIGINT/SIGCHLD for fork: $!\n";
+      or die "spamd: cannot unblock SIGINT/SIGCHLD for fork: $!\n";
     return;
   }
   else {
@@ -827,7 +829,7 @@
     if ( $opt{'username'} ) {
       my ( $uuid, $ugid ) = ( getpwnam( $opt{'username'} ) )[ 2, 3 ];
       if ( !defined $uuid || $uuid == 0 ) {
-        die "fatal: cannot run as nonexistent user or root with -u option\n";
+        die "spamd: cannot run as nonexistent user or root with -u option\n";
       }
 
       $uuid =~ /^(\d+)$/ and $uuid = $1;    # de-taint
@@ -841,7 +843,7 @@
       $> = $uuid;            # effective uid
       $< = $uuid;            # real uid. we now cannot setuid anymore
       if ( $> != $uuid and $> != ( $uuid - 2**32 ) ) {
-        die "fatal: setuid to uid $uuid failed\n";
+        die "spamd: setuid to uid $uuid failed\n";
       }
     }
 
@@ -850,7 +852,7 @@
 
     # unblock signals
     sigprocmask( POSIX::SIG_UNBLOCK(), $sigset )
-      or die "Can't unblock SIGINT/SIGCHLD for fork: $!\n";
+      or die "spamd: cannot unblock SIGINT/SIGCHLD for fork: $!\n";
 
     # set process name where supported
     # this will help make it clear via process listing which is child/parent
@@ -883,7 +885,7 @@
       }
       elsif ($evalret == -1) {
         # serious error; used for accept() failure
-        die("fatal error; respawning server");
+        die("spamd: respawning server");
       }
 
       # if we changed UID during processing, change back!
@@ -891,8 +893,8 @@
         $) = "$( $(";    # change eGID
         $> = $<;         # change eUID
         if ( $> != $< and $> != ( $< - 2**32 ) ) {
-          warn("spamd: fatal: return setuid failed");
-          die;           # make it fatal to avoid security breaches
+           # make it fatal to avoid security breaches
+	   die("spamd: return setuid failed");
         }
       }
 
@@ -1012,7 +1014,7 @@
     if ($@ =~ /tcp timeout/) {
       service_timeout("($timeout_tcp second socket timeout reading input from client)");
     } else {
-      warn $@;
+      warn "spamd: $@";
     }
     $client->close;
     return 0;
@@ -1054,7 +1056,7 @@
       if ($@ =~ /child processing timeout/) {
         service_timeout("($timeout_child second timeout while trying to $method)");
       } else {
-        warn $@;
+	warn "spamd: $@";
       }
       $client->close();
       return 0;
@@ -1077,7 +1079,7 @@
       if ($@ =~ /child processing timeout/) {
         service_timeout("($timeout_child second timeout while trying to $method)");
       } else {
-        warn $@;
+	warn "spamd: $@";
       }
       $client->close();
       return 0;
@@ -1114,7 +1116,7 @@
   $) = "$gid $gid";                   # eGID
   $> = $uid;                          # eUID
   if (!defined($uid) || ($> != $uid and $> != ($uid - 2**32))) {
-    die("spamd: fatal error: setuid to nobody failed");
+    die("spamd: setuid to nobody failed");
   }
 }
 
@@ -1279,7 +1281,7 @@
         $msg_resp .= "\r\n" if ( $version < 1.3 );
       }
       else {
-        die "unknown method $method";
+        die "spamd: unknown method $method";
       }
 
       if ( $version >= 1.3 )    # Spamc protocol > 1.2 means multi hdrs are OK
@@ -1581,8 +1583,8 @@
   my $dn = $ident_username || 'NONE';    # display name
   dbg("ident: ident_username = $dn, spamc_username = $username\n");
   if ( !defined($ident_username) || $username ne $ident_username ) {
-    info("spamd: fatal: ident username ($dn) does not match "
-        . "spamc username ($username)" );
+    info("spamd: ident username ($dn) does not match "
+	 . "spamc username ($username)" );
     return 0;
   }
   return 1;
@@ -1643,7 +1645,7 @@
   #
   if ( $opt{'vpopmail'} ) {
     if ( !$opt{'username'} ) {
-      warn "cannot use vpopmail without -u\n";
+      warn "spamd: cannot use vpopmail without -u\n";
     }
     create_default_cf_if_needed( $cf_file, $username, $dir );
     $spamtest->read_scoreonly_config($cf_file);
@@ -1870,12 +1872,12 @@
   $server->close;
 
   if (defined($opt{'pidfile'})) {
-    unlink($opt{'pidfile'}) || warn "Can't unlink $opt{'pidfile'}: $!\n";
+    unlink($opt{'pidfile'}) || warn "spamd: cannot unlink $opt{'pidfile'}: $!\n";
   }
 
   # the UNIX domain socket
   if (defined($opt{'socketpath'})) {
-    unlink($opt{'socketpath'}) || warn "Can't unlink $opt{'socketpath'}: $!\n";
+    unlink($opt{'socketpath'}) || warn "spamd: cannot unlink $opt{'socketpath'}: $!\n";
   }
 
   $SIG{CHLD} = 'DEFAULT';    # we're going to kill our children
@@ -1934,7 +1936,7 @@
 
     # the UNIX domain socket
     if (defined($opt{'socketpath'})) {
-      unlink($opt{'socketpath'}) || warn "Can't unlink $opt{'socketpath'}: $!\n";
+      unlink($opt{'socketpath'}) || warn "spamd: cannot unlink $opt{'socketpath'}: $!\n";
     }
 
     info("spamd: server socket closed");
@@ -1948,29 +1950,29 @@
 
   # be a nice daemon and chdir to the root so we don't block any
   # unmount attempts
-  chdir '/' or die "Can't chdir to /: $!\n";
+  chdir '/' or die "spamd: cannot chdir to /: $!\n";
 
   # Redirect in and out to the bit bucket
-  open STDIN,  "</dev/null" or die "Can't read from /dev/null: $!\n";
-  open STDOUT, ">/dev/null" or die "Can't write to /dev/null: $!\n";
+  open STDIN,  "</dev/null" or die "spamd: cannot read from /dev/null: $!\n";
+  open STDOUT, ">/dev/null" or die "spamd: cannot write to /dev/null: $!\n";
 
   # Remove the stderr logger
   Mail::SpamAssassin::Logger::remove('stderr');
 
   # Here we go...
-  defined( my $pid = fork ) or die "Can't fork: $!\n";
+  defined( my $pid = fork ) or die "spamd: cannot fork: $!\n";
   exit if $pid;
-  setsid or die "Can't start new session: $!\n";
+  setsid or die "spamd: cannot start new session: $!\n";
 
   # Now we can redirect the errors, too.
-  open STDERR, '>&STDOUT' or die "Can't duplicate stdout: $!\n";
+  open STDERR, '>&STDOUT' or die "spamd: cannot duplicate stdout: $!\n";
 
   dbg("spamd: successfully daemonized");
 }
 
 sub set_allowed_ip {
   foreach (@_) {
-    $allowed_nets->add_cidr($_) or die "Aborting.\n";
+    $allowed_nets->add_cidr($_) or die "spamd: aborting due to add_cidr error\n";
   }
 }
 
@@ -1984,7 +1986,7 @@
   # File::Spec->tmpdir uses TMPDIR, TMP, TEMP, C:/temp, /tmp etc.
   my $tmpdir = File::Spec->tmpdir();
   if ( !$tmpdir ) {
-    die "cannot find writable tmp dir! set TMP or TMPDIR in env";
+    die "spamd: cannot find writable tmp dir, set TMP or TMPDIR in environment";
   }
 
   # If TMPDIR isn't set, File::Spec->tmpdir() will set it to undefined.
@@ -1998,8 +2000,8 @@
 
   dbg("spamd: Preloading modules with HOME=$tmphome");
 
-  mkdir( $tmphome,  0700 ) or die "fatal: Can't create $tmphome: $!";
-  mkdir( $tmpsadir, 0700 ) or die "fatal: Can't create $tmpsadir: $!";
+  mkdir( $tmphome,  0700 ) or die "spamd: cannot create $tmphome: $!";
+  mkdir( $tmpsadir, 0700 ) or die "spamd: cannot create $tmpsadir: $!";
   $ENV{HOME} = $tmphome;
 
   $spamtest->compile_now(0,1);  # ensure all modules etc. are loaded
@@ -2028,7 +2030,7 @@
   # If the dir still exists, log a warning.
   if ( -d $tmphome ) {
     $err ||= "do something: $!";
-    warn "Failed to remove $tmphome: Could not $err\n";
+    warn "spamd: failed to remove $tmphome: could not $err\n";
   }
 }
 

Modified: spamassassin/trunk/t/debug.t
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/t/debug.t?rev=164126&r1=164125&r2=164126&view=diff
==============================================================================
--- spamassassin/trunk/t/debug.t (original)
+++ spamassassin/trunk/t/debug.t Thu Apr 21 14:33:01 2005
@@ -26,9 +26,9 @@
 my %facility = map {; $_ => 1 }
   qw( accessdb auto-whitelist bayes check config daemon dcc dns eval
       generic facility hashcash ident ignore info ldap learn locker log
-      logger markup message metadata plugin prefork pyzor razor2
-      received-header replacetags reporter rules spamd spf textcat uri
-      uridnsbl util ),
+      logger markup message metadata mimeheader plugin prefork progress
+      pyzor razor2 received-header replacetags reporter rules spamd spf
+      textcat uri uridnsbl util ),
 ;
 
 my $fh = IO::File->new_tmpfile();