summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpettai <pettai@pkgsrc.org>2010-10-03 21:53:17 +0000
committerpettai <pettai@pkgsrc.org>2010-10-03 21:53:17 +0000
commit643fabc39989ee97bb3e46d533eb5b2f8e204951 (patch)
treedfbf53fb27501302d873b6befe7d9453755ea371
parentab1737ae42f5fef7a997d0f8eca22f1fa9609db8 (diff)
downloadpkgsrc-643fabc39989ee97bb3e46d533eb5b2f8e204951.tar.gz
Fixes for spamassassin running on perl 5.12.x
See: https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6392 https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6396 Oked by wiz@
-rw-r--r--mail/spamassassin/Makefile4
-rw-r--r--mail/spamassassin/distinfo7
-rw-r--r--mail/spamassassin/patches/patch-bf13
-rw-r--r--mail/spamassassin/patches/patch-bg13
-rw-r--r--mail/spamassassin/patches/patch-bh13
-rw-r--r--mail/spamassassin/patches/patch-bi187
-rw-r--r--mail/spamassassin/patches/patch-bj13
7 files changed, 247 insertions, 3 deletions
diff --git a/mail/spamassassin/Makefile b/mail/spamassassin/Makefile
index 9e0dfc858ad..73579c3509b 100644
--- a/mail/spamassassin/Makefile
+++ b/mail/spamassassin/Makefile
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.98 2010/08/21 16:35:10 seb Exp $
+# $NetBSD: Makefile,v 1.99 2010/10/03 21:53:17 pettai Exp $
DISTNAME= Mail-SpamAssassin-3.3.1
PKGNAME= spamassassin-3.3.1
-PKGREVISION= 1
+PKGREVISION= 2
SVR4_PKGNAME= sa
CATEGORIES= mail perl5
MASTER_SITES= ${MASTER_SITE_APACHE:=spamassassin/source/}
diff --git a/mail/spamassassin/distinfo b/mail/spamassassin/distinfo
index 623950699b7..e04ea0a8d3d 100644
--- a/mail/spamassassin/distinfo
+++ b/mail/spamassassin/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.52 2010/03/24 21:41:10 heinz Exp $
+$NetBSD: distinfo,v 1.53 2010/10/03 21:53:17 pettai Exp $
SHA1 (Mail-SpamAssassin-3.3.1.tar.gz) = 8b32a857cc89c8d057442400bc00f33fd703ce06
RMD160 (Mail-SpamAssassin-3.3.1.tar.gz) = 154fb16de88b3cc9fac41f721af21b181a2368f3
@@ -16,3 +16,8 @@ SHA1 (patch-ab) = 84ebc0f611365c00205a85cb84970772a0931ef8
SHA1 (patch-ae) = d46b1d8f56c8c61936c307f74b39a49da1b1f353
SHA1 (patch-aq) = 3a273c7742275647c2334382fed29c0ea33dfbd8
SHA1 (patch-ay) = ca8ea0b1e6d8fddd29d6ae960e1bf6e534d2f424
+SHA1 (patch-bf) = 16289fcab8f216bb8fe345d190046b17fc39b73b
+SHA1 (patch-bg) = c0756a98e2fd38ef06894abb14afba252a6276ea
+SHA1 (patch-bh) = 28cea16c76d7cfbeb78b8512b43453d5260be570
+SHA1 (patch-bi) = 0c9bf5d790968dbcb711fce3bc51877314c982f4
+SHA1 (patch-bj) = 11cd24cf7b88abbc52f520bd395e4c43d6443d22
diff --git a/mail/spamassassin/patches/patch-bf b/mail/spamassassin/patches/patch-bf
new file mode 100644
index 00000000000..707e9e2d9af
--- /dev/null
+++ b/mail/spamassassin/patches/patch-bf
@@ -0,0 +1,13 @@
+$NetBSD: patch-bf,v 1.1 2010/10/03 21:53:17 pettai Exp $
+
+--- ./lib/Mail/SpamAssassin/Dns.pm.orig 2010-10-01 20:52:41.000000000 +0000
++++ ./lib/Mail/SpamAssassin/Dns.pm
+@@ -754,7 +754,7 @@ sub enter_helper_run_mode {
+ dbg("dns: entering helper-app run mode");
+ $self->{old_slash} = $/; # Razor pollutes this
+ %{$self->{old_env}} = ();
+- if ( defined %ENV ) {
++ if ( %ENV ) {
+ # undefined values in %ENV can result due to autovivification elsewhere,
+ # this prevents later possible warnings when we restore %ENV
+ while (my ($key, $value) = each %ENV) {
diff --git a/mail/spamassassin/patches/patch-bg b/mail/spamassassin/patches/patch-bg
new file mode 100644
index 00000000000..d9c13acafcc
--- /dev/null
+++ b/mail/spamassassin/patches/patch-bg
@@ -0,0 +1,13 @@
+$NetBSD: patch-bg,v 1.1 2010/10/03 21:53:17 pettai Exp $
+
+--- ./lib/Mail/SpamAssassin/Plugin/BodyEval.pm.orig 2010-03-16 14:49:21.000000000 +0000
++++ ./lib/Mail/SpamAssassin/Plugin/BodyEval.pm
+@@ -119,7 +119,7 @@ sub _multipart_alternative_difference {
+ }
+
+ # If there are no words, mark if there's at least 1 image ...
+- if (keys %html == 0 && exists $pms->{html}{inside}{img}) {
++ if (!%html && exists $pms->{html}{inside}{img}) {
+ # Use "\n" as the mark since it can't ever occur normally
+ $html{"\n"}=1;
+ }
diff --git a/mail/spamassassin/patches/patch-bh b/mail/spamassassin/patches/patch-bh
new file mode 100644
index 00000000000..86e9851724c
--- /dev/null
+++ b/mail/spamassassin/patches/patch-bh
@@ -0,0 +1,13 @@
+$NetBSD: patch-bh,v 1.1 2010/10/03 21:53:17 pettai Exp $
+
+--- ./lib/Mail/SpamAssassin/HTML.pm.orig 2010-10-01 20:58:44.000000000 +0000
++++ ./lib/Mail/SpamAssassin/HTML.pm
+@@ -191,7 +191,7 @@ sub get_rendered_text {
+ my $self = shift;
+ my %options = @_;
+
+- return join('', @{ $self->{text} }) unless keys %options;
++ return join('', @{ $self->{text} }) unless %options;
+
+ my $mask;
+ while (my ($k, $v) = each %options) {
diff --git a/mail/spamassassin/patches/patch-bi b/mail/spamassassin/patches/patch-bi
new file mode 100644
index 00000000000..8220c9e521b
--- /dev/null
+++ b/mail/spamassassin/patches/patch-bi
@@ -0,0 +1,187 @@
+$NetBSD: patch-bi,v 1.1 2010/10/03 21:53:17 pettai Exp $
+
+--- ./lib/Mail/SpamAssassin/Plugin/Check.pm.orig 2010-03-16 14:49:21.000000000 +0000
++++ ./lib/Mail/SpamAssassin/Plugin/Check.pm
+@@ -307,64 +307,51 @@ sub run_generic_tests {
+ my $package_name = __PACKAGE__;
+ my $methodname = $package_name."::_".$ruletype."_tests_".$clean_priority;
+
+- if (defined &{$methodname} && !$doing_user_rules) {
+-run_compiled_method:
+- # dbg("rules: run_generic_tests - calling %s", $methodname);
+- my $t = Mail::SpamAssassin::Timeout->new({ deadline => $master_deadline });
+- my $err = $t->run(sub {
+- no strict "refs";
+- $methodname->($pms, @{$opts{args}});
+- });
+- if ($t->timed_out() && $master_deadline && time > $master_deadline) {
+- info("check: exceeded time limit in $methodname, skipping further tests");
+- $pms->{deadline_exceeded} = 1;
+- }
+- return;
+- }
++ if (!defined &{$methodname} || $doing_user_rules) {
+
+- # use %nopts for named parameter-passing; it's more friendly to future-proof
+- # subclassing, since new parameters can be added without breaking third-party
+- # subclassed implementations of this plugin.
+- my %nopts = (
+- ruletype => $ruletype,
+- doing_user_rules => $doing_user_rules,
+- priority => $priority,
+- clean_priority => $clean_priority
+- );
++ # use %nopts for named parameter-passing; it's more friendly
++ # to future-proof subclassing, since new parameters can be added without
++ # breaking third-party subclassed implementations of this plugin.
++ my %nopts = (
++ ruletype => $ruletype,
++ doing_user_rules => $doing_user_rules,
++ priority => $priority,
++ clean_priority => $clean_priority
++ );
++
++ # build up the eval string...
++ $self->{evalstr_methodname} = $methodname;
++ $self->{evalstr_chunk_current_methodname} = undef;
++ $self->{evalstr_chunk_methodnames} = [];
++ $self->{evalstr_chunk_prefix} = []; # stack (array) of source code sections
++ $self->{evalstr} = ''; $self->{evalstr_l} = 0;
++ $self->{evalstr2} = '';
++ $self->begin_evalstr_chunk($pms);
+
+- # build up the eval string...
+- $self->{evalstr_methodname} = $methodname;
+- $self->{evalstr_chunk_current_methodname} = undef;
+- $self->{evalstr_chunk_methodnames} = [];
+- $self->{evalstr_chunk_prefix} = []; # stack (array) of source code sections
+- $self->{evalstr} = ''; $self->{evalstr_l} = 0;
+- $self->{evalstr2} = '';
+- $self->begin_evalstr_chunk($pms);
+-
+- $self->push_evalstr_prefix($pms, '
+- # start_rules_plugin_code '.$ruletype.' '.$priority.'
+- my $scoresptr = $self->{conf}->{scores};
+- ');
+- if (defined $opts{pre_loop_body}) {
+- $opts{pre_loop_body}->($self, $pms, $conf, %nopts);
+- }
+- $self->add_evalstr($pms,
+- $self->start_rules_plugin_code($ruletype, $priority) );
+- while (my($rulename, $test) = each %{$opts{testhash}->{$priority}}) {
+- $opts{loop_body}->($self, $pms, $conf, $rulename, $test, %nopts);
+- }
+- if (defined $opts{post_loop_body}) {
+- $opts{post_loop_body}->($self, $pms, $conf, %nopts);
+- }
++ $self->push_evalstr_prefix($pms, '
++ # start_rules_plugin_code '.$ruletype.' '.$priority.'
++ my $scoresptr = $self->{conf}->{scores};
++ ');
++ if (defined $opts{pre_loop_body}) {
++ $opts{pre_loop_body}->($self, $pms, $conf, %nopts);
++ }
++ $self->add_evalstr($pms,
++ $self->start_rules_plugin_code($ruletype, $priority) );
++ while (my($rulename, $test) = each %{$opts{testhash}->{$priority}}) {
++ $opts{loop_body}->($self, $pms, $conf, $rulename, $test, %nopts);
++ }
++ if (defined $opts{post_loop_body}) {
++ $opts{post_loop_body}->($self, $pms, $conf, %nopts);
++ }
+
+- $self->flush_evalstr($pms, 'run_generic_tests');
+- $self->free_ruleset_source($pms, $ruletype, $priority);
++ $self->flush_evalstr($pms, 'run_generic_tests');
++ $self->free_ruleset_source($pms, $ruletype, $priority);
+
+- # clear out a previous version of this method
+- undef &{$methodname};
++ # clear out a previous version of this method
++ undef &{$methodname};
+
+- # generate the loop that goes through each line...
+- my $evalstr = <<"EOT";
++ # generate the loop that goes through each line...
++ my $evalstr = <<"EOT";
+ {
+ package $package_name;
+
+@@ -373,40 +360,51 @@ run_compiled_method:
+ sub $methodname {
+ EOT
+
+- for my $chunk_methodname (@{$self->{evalstr_chunk_methodnames}}) {
+- $evalstr .= " $chunk_methodname(\@_);\n";
+- }
++ for my $chunk_methodname (@{$self->{evalstr_chunk_methodnames}}) {
++ $evalstr .= " $chunk_methodname(\@_);\n";
++ }
+
+- $evalstr .= <<"EOT";
++ $evalstr .= <<"EOT";
+ }
+
+ 1;
+ }
+ EOT
+
+- delete $self->{evalstr}; # free up some RAM before we eval()
+- delete $self->{evalstr2};
+- delete $self->{evalstr_methodname};
+- delete $self->{evalstr_chunk_current_methodname};
+- delete $self->{evalstr_chunk_methodnames};
+- delete $self->{evalstr_chunk_prefix};
+-
+- dbg("rules: run_generic_tests - compiling eval code: %s, priority %s",
+- $ruletype, $priority);
+-# dbg("rules: eval code to compile: $evalstr");
+- my $eval_result;
+- { my $timer = $self->{main}->time_method('compile_gen');
+- $eval_result = eval($evalstr);
+- }
+- if (!$eval_result) {
+- my $eval_stat = $@ ne '' ? $@ : "errno=$!"; chomp $eval_stat;
+- warn "rules: failed to compile $ruletype tests, skipping:\n".
+- "\t($eval_stat)\n";
+- $pms->{rule_errors}++;
+- }
+- else {
++ delete $self->{evalstr}; # free up some RAM before we eval()
++ delete $self->{evalstr2};
++ delete $self->{evalstr_methodname};
++ delete $self->{evalstr_chunk_current_methodname};
++ delete $self->{evalstr_chunk_methodnames};
++ delete $self->{evalstr_chunk_prefix};
++
++ dbg("rules: run_generic_tests - compiling eval code: %s, priority %s",
++ $ruletype, $priority);
++ # dbg("rules: eval code to compile: $evalstr");
++ my $eval_result;
++ { my $timer = $self->{main}->time_method('compile_gen');
++ $eval_result = eval($evalstr);
++ }
++ if (!$eval_result) {
++ my $eval_stat = $@ ne '' ? $@ : "errno=$!"; chomp $eval_stat;
++ warn "rules: failed to compile $ruletype tests, skipping:\n".
++ "\t($eval_stat)\n";
++ $pms->{rule_errors}++;
++ return;
++ }
+ dbg("rules: compiled $ruletype tests");
+- goto run_compiled_method;
++ }
++
++#run_compiled_method:
++# dbg("rules: run_generic_tests - calling %s", $methodname);
++ my $t = Mail::SpamAssassin::Timeout->new({ deadline => $master_deadline });
++ my $err = $t->run(sub {
++ no strict "refs";
++ $methodname->($pms, @{$opts{args}});
++ });
++ if ($t->timed_out() && $master_deadline && time > $master_deadline) {
++ info("check: exceeded time limit in $methodname, skipping further tests");
++ $pms->{deadline_exceeded} = 1;
+ }
+ }
+
diff --git a/mail/spamassassin/patches/patch-bj b/mail/spamassassin/patches/patch-bj
new file mode 100644
index 00000000000..60daedca884
--- /dev/null
+++ b/mail/spamassassin/patches/patch-bj
@@ -0,0 +1,13 @@
+$NetBSD: patch-bj,v 1.1 2010/10/03 21:53:17 pettai Exp $
+
+--- lib/Mail/SpamAssassin/Plugin/MIMEEval.pm.orig 2010-03-16 14:49:21.000000000 +0000
++++ lib/Mail/SpamAssassin/Plugin/MIMEEval.pm
+@@ -498,7 +498,7 @@ sub _check_base64_length {
+ # perhaps just limit to test, and image?
+ next if ($ctype eq 'application/ics');
+
+- my $cte = lc $p->get_header('content-transfer-encoding') || '';
++ my $cte = lc($p->get_header('content-transfer-encoding') || '');
+ next if ($cte !~ /^base64$/);
+ foreach my $l ( @{$p->raw()} ) {
+ my $len = length $l;