]> git.pld-linux.org Git - packages/spamassassin.git/blame - spamassassin-perl_5_12.patch
- up to 3.3.2
[packages/spamassassin.git] / spamassassin-perl_5_12.patch
CommitLineData
87f30737 1--- /lib/Mail/SpamAssassin/HTML.pm (revision 930024)
2+++ /lib/Mail/SpamAssassin/HTML.pm (working copy)
3@@ -191,7 +191,7 @@
4 my $self = shift;
5 my %options = @_;
6
7- return join('', @{ $self->{text} }) unless keys %options;
8+ return join('', @{ $self->{text} }) unless %options;
9
10 my $mask;
11 while (my ($k, $v) = each %options) {
12--- /lib/Mail/SpamAssassin/Dns.pm (revision 930024)
13+++ /lib/Mail/SpamAssassin/Dns.pm (working copy)
14@@ -754,7 +754,7 @@
15 dbg("dns: entering helper-app run mode");
16 $self->{old_slash} = $/; # Razor pollutes this
17 %{$self->{old_env}} = ();
18- if ( defined %ENV ) {
19+ if ( %ENV ) {
20 # undefined values in %ENV can result due to autovivification elsewhere,
21 # this prevents later possible warnings when we restore %ENV
22 while (my ($key, $value) = each %ENV) {
23--- /lib/Mail/SpamAssassin/Plugin/Check.pm (revision 930024)
24+++ /lib/Mail/SpamAssassin/Plugin/Check.pm (working copy)
25@@ -307,64 +307,51 @@
26 my $package_name = __PACKAGE__;
27 my $methodname = $package_name."::_".$ruletype."_tests_".$clean_priority;
28
29- if (defined &{$methodname} && !$doing_user_rules) {
30-run_compiled_method:
31- # dbg("rules: run_generic_tests - calling %s", $methodname);
32- my $t = Mail::SpamAssassin::Timeout->new({ deadline => $master_deadline });
33- my $err = $t->run(sub {
34- no strict "refs";
35- $methodname->($pms, @{$opts{args}});
36- });
37- if ($t->timed_out() && $master_deadline && time > $master_deadline) {
38- info("check: exceeded time limit in $methodname, skipping further tests");
39- $pms->{deadline_exceeded} = 1;
40- }
41- return;
42- }
43+ if (!defined &{$methodname} || $doing_user_rules) {
44
45- # use %nopts for named parameter-passing; it's more friendly to future-proof
46- # subclassing, since new parameters can be added without breaking third-party
47- # subclassed implementations of this plugin.
48- my %nopts = (
49- ruletype => $ruletype,
50- doing_user_rules => $doing_user_rules,
51- priority => $priority,
52- clean_priority => $clean_priority
53- );
54+ # use %nopts for named parameter-passing; it's more friendly
55+ # to future-proof subclassing, since new parameters can be added without
56+ # breaking third-party subclassed implementations of this plugin.
57+ my %nopts = (
58+ ruletype => $ruletype,
59+ doing_user_rules => $doing_user_rules,
60+ priority => $priority,
61+ clean_priority => $clean_priority
62+ );
63
64- # build up the eval string...
65- $self->{evalstr_methodname} = $methodname;
66- $self->{evalstr_chunk_current_methodname} = undef;
67- $self->{evalstr_chunk_methodnames} = [];
68- $self->{evalstr_chunk_prefix} = []; # stack (array) of source code sections
69- $self->{evalstr} = ''; $self->{evalstr_l} = 0;
70- $self->{evalstr2} = '';
71- $self->begin_evalstr_chunk($pms);
72+ # build up the eval string...
73+ $self->{evalstr_methodname} = $methodname;
74+ $self->{evalstr_chunk_current_methodname} = undef;
75+ $self->{evalstr_chunk_methodnames} = [];
76+ $self->{evalstr_chunk_prefix} = []; # stack (array) of source code sections
77+ $self->{evalstr} = ''; $self->{evalstr_l} = 0;
78+ $self->{evalstr2} = '';
79+ $self->begin_evalstr_chunk($pms);
80
81- $self->push_evalstr_prefix($pms, '
82- # start_rules_plugin_code '.$ruletype.' '.$priority.'
83- my $scoresptr = $self->{conf}->{scores};
84- ');
85- if (defined $opts{pre_loop_body}) {
86- $opts{pre_loop_body}->($self, $pms, $conf, %nopts);
87- }
88- $self->add_evalstr($pms,
89- $self->start_rules_plugin_code($ruletype, $priority) );
90- while (my($rulename, $test) = each %{$opts{testhash}->{$priority}}) {
91- $opts{loop_body}->($self, $pms, $conf, $rulename, $test, %nopts);
92- }
93- if (defined $opts{post_loop_body}) {
94- $opts{post_loop_body}->($self, $pms, $conf, %nopts);
95- }
96+ $self->push_evalstr_prefix($pms, '
97+ # start_rules_plugin_code '.$ruletype.' '.$priority.'
98+ my $scoresptr = $self->{conf}->{scores};
99+ ');
100+ if (defined $opts{pre_loop_body}) {
101+ $opts{pre_loop_body}->($self, $pms, $conf, %nopts);
102+ }
103+ $self->add_evalstr($pms,
104+ $self->start_rules_plugin_code($ruletype, $priority) );
105+ while (my($rulename, $test) = each %{$opts{testhash}->{$priority}}) {
106+ $opts{loop_body}->($self, $pms, $conf, $rulename, $test, %nopts);
107+ }
108+ if (defined $opts{post_loop_body}) {
109+ $opts{post_loop_body}->($self, $pms, $conf, %nopts);
110+ }
111
112- $self->flush_evalstr($pms, 'run_generic_tests');
113- $self->free_ruleset_source($pms, $ruletype, $priority);
114+ $self->flush_evalstr($pms, 'run_generic_tests');
115+ $self->free_ruleset_source($pms, $ruletype, $priority);
116
117- # clear out a previous version of this method
118- undef &{$methodname};
119+ # clear out a previous version of this method
120+ undef &{$methodname};
121
122- # generate the loop that goes through each line...
123- my $evalstr = <<"EOT";
124+ # generate the loop that goes through each line...
125+ my $evalstr = <<"EOT";
126 {
127 package $package_name;
128
129@@ -373,41 +360,52 @@
130 sub $methodname {
131 EOT
132
133- for my $chunk_methodname (@{$self->{evalstr_chunk_methodnames}}) {
134- $evalstr .= " $chunk_methodname(\@_);\n";
135- }
136+ for my $chunk_methodname (@{$self->{evalstr_chunk_methodnames}}) {
137+ $evalstr .= " $chunk_methodname(\@_);\n";
138+ }
139
140- $evalstr .= <<"EOT";
141+ $evalstr .= <<"EOT";
142 }
143
144 1;
145 }
146 EOT
147
148- delete $self->{evalstr}; # free up some RAM before we eval()
149- delete $self->{evalstr2};
150- delete $self->{evalstr_methodname};
151- delete $self->{evalstr_chunk_current_methodname};
152- delete $self->{evalstr_chunk_methodnames};
153- delete $self->{evalstr_chunk_prefix};
154+ delete $self->{evalstr}; # free up some RAM before we eval()
155+ delete $self->{evalstr2};
156+ delete $self->{evalstr_methodname};
157+ delete $self->{evalstr_chunk_current_methodname};
158+ delete $self->{evalstr_chunk_methodnames};
159+ delete $self->{evalstr_chunk_prefix};
160
161- dbg("rules: run_generic_tests - compiling eval code: %s, priority %s",
162- $ruletype, $priority);
163-# dbg("rules: eval code to compile: $evalstr");
164- my $eval_result;
165- { my $timer = $self->{main}->time_method('compile_gen');
166- $eval_result = eval($evalstr);
167- }
168- if (!$eval_result) {
169- my $eval_stat = $@ ne '' ? $@ : "errno=$!"; chomp $eval_stat;
170- warn "rules: failed to compile $ruletype tests, skipping:\n".
171- "\t($eval_stat)\n";
172- $pms->{rule_errors}++;
173- }
174- else {
175+ dbg("rules: run_generic_tests - compiling eval code: %s, priority %s",
176+ $ruletype, $priority);
177+ # dbg("rules: eval code to compile: $evalstr");
178+ my $eval_result;
179+ { my $timer = $self->{main}->time_method('compile_gen');
180+ $eval_result = eval($evalstr);
181+ }
182+ if (!$eval_result) {
183+ my $eval_stat = $@ ne '' ? $@ : "errno=$!"; chomp $eval_stat;
184+ warn "rules: failed to compile $ruletype tests, skipping:\n".
185+ "\t($eval_stat)\n";
186+ $pms->{rule_errors}++;
187+ return;
188+ }
189 dbg("rules: compiled $ruletype tests");
190- goto run_compiled_method;
191 }
192+
193+#run_compiled_method:
194+# dbg("rules: run_generic_tests - calling %s", $methodname);
195+ my $t = Mail::SpamAssassin::Timeout->new({ deadline => $master_deadline });
196+ my $err = $t->run(sub {
197+ no strict "refs";
198+ $methodname->($pms, @{$opts{args}});
199+ });
200+ if ($t->timed_out() && $master_deadline && time > $master_deadline) {
201+ info("check: exceeded time limit in $methodname, skipping further tests");
202+ $pms->{deadline_exceeded} = 1;
203+ }
204 }
205
206 sub begin_evalstr_chunk {
207--- /lib/Mail/SpamAssassin/Plugin/BodyEval.pm (revision 930024)
208+++ /lib/Mail/SpamAssassin/Plugin/BodyEval.pm (working copy)
209@@ -119,7 +119,7 @@
210 }
211
212 # If there are no words, mark if there's at least 1 image ...
213- if (keys %html == 0 && exists $pms->{html}{inside}{img}) {
214+ if (!%html && exists $pms->{html}{inside}{img}) {
215 # Use "\n" as the mark since it can't ever occur normally
216 $html{"\n"}=1;
217 }
218--- /lib/Mail/SpamAssassin/Plugin/MIMEEval.pm 2010/01/26 12:13:41 903191
219+++ /lib/Mail/SpamAssassin/Plugin/MIMEEval.pm 2010/03/31 00:04:14 929343
220@@ -498,7 +498,7 @@ sub _check_base64_length {
221 # perhaps just limit to test, and image?
222 next if ($ctype eq 'application/ics');
223
224- my $cte = lc $p->get_header('content-transfer-encoding') || '';
225+ my $cte = lc($p->get_header('content-transfer-encoding') || '');
226 next if ($cte !~ /^base64$/);
227 foreach my $l ( @{$p->raw()} ) {
228 my $len = length $l;
This page took 0.049988 seconds and 4 git commands to generate.