View difference between Paste ID: YQwhuy5i and Ep3aJxRk
SHOW: | | - or go back to the newest paste.
1
$FreeBSD$
2
3
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6937
4
5
6
--- Mail/SpamAssassin/AsyncLoop.pm	2011-06-07 01:59:17.000000000 +0200
7
+++ Mail/SpamAssassin/AsyncLoop.pm	2013-05-29 01:37:58.000000000 +0200
8
@@ -361,5 +361,12 @@
9
     $now = time;  # capture new timestamp, after possible sleep in 'select'
10
 
11
-    while (my($key,$ent) = each %$pending) {
12
+    # A callback routine may generate another DNS query, which may insert
13
+    # an entry into the %$pending hash thus invalidating the each() context.
14
+    # So, make sure that callbacks are not called while the each() context
15
+    # is open, or avoid using each().  [Bug 6937]
16
+    #
17
+  # while (my($key,$ent) = each %$pending) {
18
+    foreach my $key (keys %$pending) {
19
+      my $ent = $pending->{$key};
20
       my $id = $ent->{id};
21
       if (defined $ent->{poll_callback}) {  # call a "poll_callback" if exists
22
@@ -449,5 +456,6 @@
23
   my $foundcnt = 0;
24
   my $now = time;
25
-  while (my($key,$ent) = each %$pending) {
26
+  foreach my $key (keys %$pending) {
27
+    my $ent = $pending->{$key};
28
     dbg("async: aborting after %.3f s, %s: %s",
29
         $now - $ent->{start_time},
30
--- Mail/SpamAssassin/Conf/Parser.pm	2011-06-07 01:59:17.000000000 +0200
31
+++ Mail/SpamAssassin/Conf/Parser.pm	2013-05-29 01:32:06.000000000 +0200
32
@@ -1249,5 +1249,5 @@
33
   my $mods = '';
34
   local ($1,$2);
35
-  if ($re =~ s/^m{//) {
36
+  if ($re =~ s/^m\{//) {
37
     $re =~ s/}([a-z]*)$//; $mods = $1;
38
   }
39-
--- Mail/SpamAssassin/DnsResolver.pm~	2011-06-07 01:59:17.000000000 +0200
39+
--- Mail/SpamAssassin/DnsResolver.pm	2011-06-07 01:59:17.000000000 +0200
40
+++ Mail/SpamAssassin/DnsResolver.pm	2013-05-29 01:32:06.000000000 +0200
41
@@ -441,8 +441,14 @@
42
       if (!defined($timeout) || $timeout > 0)
43
         { $timer = $self->{main}->time_method("poll_dns_idle") }
44
+      $! = 0;
45
       ($nfound, $timeleft) = select($rout=$rin, undef, undef, $timeout);
46
     }
47
     if (!defined $nfound || $nfound < 0) {
48
-      warn "dns: select failed: $!";
49
+      if ($!) { warn "dns: select failed: $!\n" }
50
+      else    { info("dns: select interrupted") }
51
+      return;
52
+    } elsif (!$nfound) {
53
+      if (!defined $timeout) { warn("dns: select returned empty-handed\n") }
54
+      elsif ($timeout > 0) { dbg("dns: select timed out %.3f s", $timeout) }
55
       return;
56
     }
57
--- Mail/SpamAssassin/Message.pm	2011-06-07 01:59:17.000000000 +0200
58
+++ Mail/SpamAssassin/Message.pm	2013-05-29 01:32:06.000000000 +0200
59
@@ -567,5 +567,5 @@
60
     # bug 5557: windows requires tmp file be closed before it can be rm'd
61
     if (ref $part->{'raw'} eq 'GLOB') {
62
-      close($part->{'raw'})  or die "error closing input file: $!";
63
+      close($part->{'raw'})  or warn "error closing input file: $!";
64
     }
65
 
66
--- Mail/SpamAssassin/PerMsgStatus.pm	2011-06-07 01:59:17.000000000 +0200
67
+++ Mail/SpamAssassin/PerMsgStatus.pm	2013-05-29 01:32:06.000000000 +0200
68
@@ -421,6 +421,6 @@
69
     }
70
 
71
-    # ignore tests with 0 score in this scoreset
72
-    next if ($scores->{$test} == 0);
73
+    # ignore tests with 0 score (or undefined) in this scoreset
74
+    next if !$scores->{$test};
75
 
76
     # Go ahead and add points to the proper locations
77
@@ -1253,11 +1253,10 @@
78
               my $line = '';
79
               foreach my $test (sort @{$self->{test_names_hit}}) {
80
-                if (!$line) {
81
-                  $line .= $test . "=" . $self->{conf}->{scores}->{$test};
82
-                } else {
83
-                  $line .= $arg . $test . "=" . $self->{conf}->{scores}->{$test};
84
-                }
85
+                my $score = $self->{conf}->{scores}->{$test};
86
+                $score = '0'  if !defined $score;
87
+                $line .= $arg  if $line ne '';
88
+                $line .= $test . "=" . $score;
89
               }
90
-              $line ? $line : 'none';
91
+              $line ne '' ? $line : 'none';
92
             },
93
 
94
--- Mail/SpamAssassin/Util.pm	2013-05-29 01:29:59.000000000 +0200
95
+++ Mail/SpamAssassin/Util.pm	2013-05-29 01:33:16.000000000 +0200
96
@@ -1588,5 +1588,5 @@
97
     return undef;   # invalid
98
   }
99
-  elsif ($re =~ s/^m{//) {              # m{foo/bar}
100
+  elsif ($re =~ s/^m\{//) {             # m{foo/bar}
101
     $delim = '}';
102
   }