head 1.3; access; symbols pkgsrc-2013Q2:1.3.0.6 pkgsrc-2013Q2-base:1.3 pkgsrc-2012Q4:1.3.0.4 pkgsrc-2012Q4-base:1.3 pkgsrc-2011Q4:1.3.0.2 pkgsrc-2011Q4-base:1.3 pkgsrc-2011Q2:1.2.0.8 pkgsrc-2011Q2-base:1.2 pkgsrc-2011Q1:1.2.0.6 pkgsrc-2011Q1-base:1.2 pkgsrc-2010Q4:1.2.0.4 pkgsrc-2010Q4-base:1.2 pkgsrc-2010Q3:1.2.0.2 pkgsrc-2010Q3-base:1.2; locks; strict; comment @# @; 1.3 date 2011.08.07.07.47.20; author tron; state dead; branches; next 1.2; 1.2 date 2010.10.04.22.12.06; author pettai; state Exp; branches; next 1.1; 1.1 date 2010.10.03.21.53.17; author pettai; state Exp; branches; next ; desc @@ 1.3 log @Update "spamassassin" package to version 3.3.2. Changes since version 3.3.1: This is a minor release, primarily to support perl-5.12 and later. Additionally several other minor bugs are fixed. @ text @$NetBSD: patch-bi,v 1.2 2010/10/04 22:12:06 pettai Exp $ fixes spamassassin bug #6392 (running spamassassin 3.3.1 on perl 5.12.x) https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6392 --- ./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; } } @ 1.2 log @Added comments to the new patches, requested by wiz@@ @ text @d1 1 a1 1 $NetBSD: patch-bi,v 1.1 2010/10/03 21:53:17 pettai Exp $ @ 1.1 log @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@@ @ text @d1 4 a4 1 $NetBSD$ @