⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 svn-commit.2

📁 The BuildBot is a system to automate the compile/test cycle required by most software projects. CVS
💻 2
📖 第 1 页 / 共 3 页
字号:
-    }-  };--  # clear the alarm before doing lots of time-consuming hard work-  my $err = $@;-  if (defined $oldalarm) { -    alarm $oldalarm; $oldalarm = undef;-  }+  });    if (defined(fileno(*PYZOR))) {  # still open     if ($pid) {@@ -299,11 +281,14 @@   }   $permsgstatus->leave_helper_run_mode(); +  if ($timer->timed_out()) {+    dbg("pyzor: check timed out after $timeout seconds");+    return 0;+  }+   if ($err) {     chomp $err;-    if ($err eq "__alarm__ignore__") {-      dbg("pyzor: check timed out after $timeout seconds");-    } elsif ($err eq "__brokenpipe__ignore__") {+    if ($err eq "__brokenpipe__ignore__") {       dbg("pyzor: check failed: broken pipe");     } elsif ($err eq "no response") {       dbg("pyzor: check failed: no response");@@ -364,23 +349,19 @@  sub pyzor_report {   my ($self, $options, $tmpf) = @_;++  # note: not really tainted, this came from system configuration file+  my $path = Mail::SpamAssassin::Util::untaint_file_path($options->{report}->{conf}->{pyzor_path});++  my $opts = $options->{report}->{conf}->{pyzor_options} || '';   my $timeout = $self->{main}->{conf}->{pyzor_timeout};    $options->{report}->enter_helper_run_mode(); -  my $oldalarm = 0;+  my $timer = Mail::SpamAssassin::Timeout->new({ secs => $timeout });+  my $err = $timer->run_and_catch(sub { -  eval {-    local $SIG{ALRM} = sub { die "__alarm__ignore__\n" };     local $SIG{PIPE} = sub { die "__brokenpipe__ignore__\n" };-    local $SIG{__DIE__};   # bug 4631--    $oldalarm = alarm $timeout;--    # note: not really tainted, this came from system configuration file-    my $path = Mail::SpamAssassin::Util::untaint_file_path($options->{report}->{conf}->{pyzor_path});--    my $opts = $options->{report}->{conf}->{pyzor_options} || '';      dbg("pyzor: opening pipe: " . join(' ', $path, $opts, "report", "< $tmpf")); @@ -391,23 +372,19 @@     my @ignored = <PYZOR>;     $options->{report}->close_pipe_fh(\*PYZOR); -    if (defined $oldalarm) { -      alarm $oldalarm; $oldalarm = undef;-    }     waitpid ($pid, 0);-  };+  }); -  my $err = $@;-  if (defined $oldalarm) { -    alarm $oldalarm; $oldalarm = undef;-  }   $options->{report}->leave_helper_run_mode(); +  if ($timer->timed_out()) {+    dbg("reporter: pyzor report timed out after $timeout seconds");+    return 0;+  }+   if ($err) {     chomp $err;-    if ($err eq '__alarm__ignore__') {-      dbg("reporter: pyzor report timed out after $timeout seconds");-    } elsif ($err eq '__brokenpipe__ignore__') {+    if ($err eq '__brokenpipe__ignore__') {       dbg("reporter: pyzor report failed: broken pipe");     } else {       warn("reporter: pyzor report failed: $err\n");Modified: spamassassin/branches/3.1/lib/Mail/SpamAssassin/Plugin/Razor2.pmURL: http://svn.apache.org/viewcvs/spamassassin/branches/3.1/lib/Mail/SpamAssassin/Plugin/Razor2.pm?rev=384590&r1=384589&r2=384590&view=diff==============================================================================--- spamassassin/branches/3.1/lib/Mail/SpamAssassin/Plugin/Razor2.pm (original)+++ spamassassin/branches/3.1/lib/Mail/SpamAssassin/Plugin/Razor2.pm Thu Mar  9 11:51:59 2006@@ -143,14 +143,11 @@   }    Mail::SpamAssassin::PerMsgStatus::enter_helper_run_mode($self);-  my $oldalarm = 0; -  eval {-    local ($^W) = 0;    # argh, warnings in Razor+  my $timer = Mail::SpamAssassin::Timeout->new({ secs => $timeout });+  my $err = $timer->run_and_catch(sub { -    local $SIG{ALRM} = sub { die "__alarm__ignore__\n" };-    local $SIG{__DIE__};   # bug 4631-    $oldalarm = alarm $timeout;+    local ($^W) = 0;    # argh, warnings in Razor      # everything's in the module!     my $rc = Razor2::Client::Agent->new("razor-$type");@@ -184,7 +181,7 @@       # let's reset the alarm since get_server_info() calls       # nextserver() which calls discover() which very likely will       # reset the alarm for us ... how polite.  :(-      alarm $timeout;+      $timer->reset();        # no facility prefix on this die       my $sigs = $rc->compute_sigs($objects)@@ -219,100 +216,96 @@ 	  my $error = $rc->errprefix("$debug: spamassassin") || "$debug: razor2 had unknown error during disconnect"; 	  die $error; 	}+      } -	# if we got here, we're done doing remote stuff, abort the alert-        if (defined $oldalarm) {-          alarm $oldalarm; $oldalarm = undef;-        }--	# Razor 2.14 says that if we get here, we did ok.-	$return = 1;+      # Razor 2.14 says that if we get here, we did ok.+      $return = 1; -	# figure out if we have a log file we need to close...-	if (ref($rc->{logref}) && exists $rc->{logref}->{fd}) {-	  # the fd can be stdout or stderr, so we need to find out if it is-	  # so we don't close them by accident.  Note: we can't just-	  # undef the fd here (like the IO::Handle manpage says we can)-	  # because it won't actually close, unfortunately. :(-	  my $untie = 1;-	  foreach my $log (*STDOUT{IO}, *STDERR{IO}) {-	    if ($log == $rc->{logref}->{fd}) {-	      $untie = 0;-	      last;-	    }-	  }-	  close $rc->{logref}->{fd} if ($untie);-	}--	if ($type eq 'check') {-	  # so $objects->[0] is the first (only) message, and ->{spam} is a general yes/no-	  push(@results, { result => $objects->[0]->{spam} });+      # figure out if we have a log file we need to close...+      if (ref($rc->{logref}) && exists $rc->{logref}->{fd}) {+        # the fd can be stdout or stderr, so we need to find out if it is+        # so we don't close them by accident.  Note: we can't just+        # undef the fd here (like the IO::Handle manpage says we can)+        # because it won't actually close, unfortunately. :(+        my $untie = 1;+        foreach my $log (*STDOUT{IO}, *STDERR{IO}) {+          if ($log == $rc->{logref}->{fd}) {+            $untie = 0;+            last;+          }+        }+        close $rc->{logref}->{fd} if ($untie);+      } -	  # great for debugging, but leave this off!-	  #use Data::Dumper;-	  #print Dumper($objects),"\n";--	  # ->{p} is for each part of the message-	  # so go through each part, taking the highest cf we find-	  # of any part that isn't contested (ct).  This helps avoid false-	  # positives.  equals logic_method 4.-	  #-	  # razor-agents < 2.14 have a different object format, so we now support both.-	  # $objects->[0]->{resp} vs $objects->[0]->{p}->[part #]->{resp}-	  my $part = 0;-	  my $arrayref = $objects->[0]->{p} || $objects;-	  if (defined $arrayref) {-	    foreach my $cf (@{$arrayref}) {-	      if (exists $cf->{resp}) {-		for (my $response=0; $response<@{$cf->{resp}}; $response++) {-		  my $tmp = $cf->{resp}->[$response];-		  my $tmpcf = $tmp->{cf}; # Part confidence-		  my $tmpct = $tmp->{ct}; # Part contested?-		  my $engine = $cf->{sent}->[$response]->{e};--		  # These should always be set, but just in case ...-		  $tmpcf = 0 unless defined $tmpcf;-		  $tmpct = 0 unless defined $tmpct;-		  $engine = 0 unless defined $engine;--		  push(@results,-		       { part => $part, engine => $engine, contested => $tmpct, confidence => $tmpcf });-		}-	      }-	      else {-		push(@results, { part => $part, noresponse => 1 });-	      }-	      $part++;-	    }-	  }-	  else {-	    # If we have some new $objects format that isn't close to-	    # the current razor-agents 2.x version, we won't FP but we-	    # should alert in debug.-	    dbg("$debug: it looks like the internal Razor object has changed format!");-	  }-	}+      if ($type eq 'check') {+        # so $objects->[0] is the first (only) message, and ->{spam} is a general yes/no+        push(@results, { result => $objects->[0]->{spam} });++        # great for debugging, but leave this off!+        #use Data::Dumper;+        #print Dumper($objects),"\n";++        # ->{p} is for each part of the message+        # so go through each part, taking the highest cf we find+        # of any part that isn't contested (ct).  This helps avoid false+        # positives.  equals logic_method 4.+        #+        # razor-agents < 2.14 have a different object format, so we now support both.+        # $objects->[0]->{resp} vs $objects->[0]->{p}->[part #]->{resp}+        my $part = 0;+        my $arrayref = $objects->[0]->{p} || $objects;+        if (defined $arrayref) {+          foreach my $cf (@{$arrayref}) {+            if (exists $cf->{resp}) {+              for (my $response=0; $response<@{$cf->{resp}}; $response++) {+                my $tmp = $cf->{resp}->[$response];+                my $tmpcf = $tmp->{cf}; # Part confidence+                my $tmpct = $tmp->{ct}; # Part contested?+                my $engine = $cf->{sent}->[$response]->{e};++                # These should always be set, but just in case ...+                $tmpcf = 0 unless defined $tmpcf;+                $tmpct = 0 unless defined $tmpct;+                $engine = 0 unless defined $engine;++                push(@results,+                      { part => $part, engine => $engine, contested => $tmpct, confidence => $tmpcf });+              }+            }+            else {+              push(@results, { part => $part, noresponse => 1 });+            }+            $part++;+          }+        }+        else {+          # If we have some new $objects format that isn't close to+          # the current razor-agents 2.x version, we won't FP but we+          # should alert in debug.+          dbg("$debug: it looks like the internal Razor object has changed format!");+        }       }     }     else {       warn "$debug: undefined Razor2::Client::Agent\n";     }   -    if (defined $oldalarm) {-      alarm $oldalarm; $oldalarm = undef;-    }-  };+  });++  # OK, that's enough Razor stuff. now, reset all that global+  # state it futzes with :(+  # work around serious brain damage in Razor2 (constant seed)+  srand; -  my $err = $@;-  if (defined $oldalarm) {-    alarm $oldalarm; $oldalarm = undef;+  Mail::SpamAssassin::PerMsgStatus::leave_helper_run_mode($self);++  if ($timer->timed_out()) {+    dbg("$debug: razor2 $type timed out after $timeout seconds");   }    if ($err) {     chomp $err;-    if ($err eq "__alarm__ignore__") {-      dbg("$debug: razor2 $type timed out after $timeout seconds");-    } elsif ($err =~ /(?:could not connect|network is unreachable)/) {+    if ($err =~ /(?:could not connect|network is unreachable)/) {       # make this a dbg(); SpamAssassin will still continue,       # but without Razor checking.  otherwise there may be       # DSNs and errors in syslog etc., yuck@@ -323,11 +316,6 @@       warn("$debug: razor2 $type failed: $! $err");     }   }--  # work around serious brain damage in Razor2 (constant seed)-  srand;--  Mail::SpamAssassin::PerMsgStatus::leave_helper_run_mode($self);    # razor also debugs to stdout. argh. fix it to stderr...   if (would_log('dbg', $debug)) {Modified: spamassassin/branches/3.1/lib/Mail/SpamAssassin/Plugin/SPF.pmURL: http://svn.apache.org/viewcvs/spamassassin/branches/3.1/lib/Mail/SpamAssassin/Plugin/SPF.pm?rev=384590&r1=384589&r2=384590&view=diff==============================================================================--- spamassassin/branches/3.1/lib/Mail/SpamAssassin/Plugin/SPF.pm (original)+++ spamassassin/branches/3.1/lib/Mail/SpamAssassin/Plugin/SPF.pm Thu Mar  9 11:51:59 2006@@ -34,6 +34,7 @@  use Mail::SpamAssassin::Plugin; use Mail::SpamAssassin::Logger;+use Mail::SpamAssassin::Timeout; use strict; use warnings; use bytes;@@ -300,30 +301,17 @@    my ($result, $comment);   my $timeout = $scanner->{conf}->{spf_timeout};-  my $oldalarm = 0; -  eval {-    local $SIG{ALRM} = sub { die "__alarm__ignore__\n" };-    local $SIG{__DIE__};   # bug 4631-    $oldalarm = alarm($timeout);+  my $timer = Mail::SpamAssassin::Timeout->new({ secs => $timeout });+  my $err = $timer->run_and_catch(sub {+     ($result, $comment) = $query->result();-    if (defined $oldalarm) {-      alarm $oldalarm; $oldalarm = undef;-    }-  }; -  my $err = $@;-  if (defined $oldalarm) {-    alarm $oldalarm; $oldalarm = undef;-  }+  });    if ($err) {     chomp $err;-    if ($err eq "__alarm__ignore__") {-      dbg("spf: lookup timed out after $timeout seconds");-    } else {-      warn("spf: lookup failed: $err\n");-    }+    warn("spf: lookup failed: $err\n");     return 0;   } Modified: spamassassin/branches/3.1/lib/Mail/SpamAssassin/SpamdForkScaling.pmURL: http://svn.apache.org/viewcvs/spamassassin/branches/3.1/lib/Mail/SpamAssassin/SpamdForkScaling.pm?rev=384590&r1=384589&r2=384590&view=diff==============================================================================--- spamassassin/branches/3.1/lib/Mail/SpamAssassin/SpamdForkScaling.pm (original)+++ spamassassin/branches/3.1/lib/Mail/SpamAssassin/SpamdForkScaling.pm Thu Mar  9 11:51:59 2006@@ -25,6 +25,7 @@  use Mail::SpamAssassin::Util; use Mail::SpamAssassin::Logger;+use Mail::SpamAssassin::Timeout;  use vars qw {   @PFSTATE_VARS %EXPORT_TAGS @EXPORT_OK@@ -109,6 +110,9 @@    delete $self->{kids}->{$pid}; +  # note this for the select()-caller's benefit+  $self->{child_just_exited} = 1;+   # remove the child from the backchannel list, too   $self->{backchannel}->delete_socket_for_child($pid); @@ -188,24 +192,63 @@     vec($rin, $self->{server_fileno}, 1) = 0;   } -  my ($rout, $eout, $nfound, $timeleft);+  my ($rout, $eout, $nfound, $timeleft, $selerr);++  # use alarm to back up select()'s built-in alarm, to debug Theo's bug.+  # not that I can remember what Theo's bug was, but hey ;)    A good+  # 60 seconds extra on the alarm() should make that quite rare...++  my $timer = Mail::SpamAssassin::Timeout->new({ secs => ($tout*2) + 60 }); -  # use alarm to back up select()'s built-in alarm, to debug theo's bug-  eval {-    Mail::SpamAssassin::Util::trap_sigalrm_fully(sub { die "tcp timeout"; });-    alarm ($tout*2) if ($tout);+  $timer->run(sub {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -