File Altering-hash-requires-restarting-loop.patch of Package spamassassin.19374
diff -urp Mail-SpamAssassin-3.4.0-orig/lib/Mail/SpamAssassin/AsyncLoop.pm Mail-SpamAssassin-3.4.0/lib/Mail/SpamAssassin/AsyncLoop.pm
--- Mail-SpamAssassin-3.4.0-orig/lib/Mail/SpamAssassin/AsyncLoop.pm 2014-02-07 09:36:28.000000000 +0100
+++ Mail-SpamAssassin-3.4.0/lib/Mail/SpamAssassin/AsyncLoop.pm 2014-02-13 17:21:40.915266502 +0100
@@ -428,7 +428,14 @@ sub complete_lookups {
my $r = $self->{total_queries_completed} / $self->{total_queries_started};
my $r2 = $r * $r; # 0..1
my $max_deadline;
- while (my($key,$ent) = each %$pending) {
+ # A callback routine may generate another DNS query, which may insert
+ # an entry into the %$pending hash thus invalidating the each() context.
+ # So, make sure that callbacks are not called while the each() context
+ # is open, or avoid using each(). [Bug 6937]
+ #
+ # while (my($key,$ent) = each %$pending) {
+ foreach my $key (keys %$pending) {
+ my $ent = $pending->{$key};
my $t_init = $ent->{timeout_initial};
my $dt = $t_init - ($t_init - $ent->{timeout_min}) * $r2;
my $deadline = $ent->{start_time} + $dt;
@@ -543,7 +550,8 @@ sub abort_remaining_lookups {
my $foundcnt = 0;
my $now = time;
- while (my($key,$ent) = each %$pending) {
+ foreach my $key (keys %$pending) {
+ my $ent = $pending->{$key};
dbg("async: aborting after %.3f s, %s: %s",
$now - $ent->{start_time},
(defined $ent->{timeout_initial} &&
diff -urp Mail-SpamAssassin-3.4.0-orig/lib/Mail/SpamAssassin/Message.pm Mail-SpamAssassin-3.4.0/lib/Mail/SpamAssassin/Message.pm
--- Mail-SpamAssassin-3.4.0-orig/lib/Mail/SpamAssassin/Message.pm 2014-02-07 09:36:28.000000000 +0100
+++ Mail-SpamAssassin-3.4.0/lib/Mail/SpamAssassin/Message.pm 2014-02-13 17:21:51.731346856 +0100
@@ -611,7 +611,7 @@ sub finish {
while (my $part = shift @toclean) {
# bug 5557: windows requires tmp file be closed before it can be rm'd
if (ref $part->{'raw'} eq 'GLOB') {
- close($part->{'raw'}) or die "error closing input file: $!";
+ close($part->{'raw'}) or warn "error closing input file: $!";
}
# bug 5858: avoid memory leak with deep MIME structure