View | Details | Raw Unified | Return to bug 158267
Collapse All | Expand All

(-)./Makefile (-6 / +10 lines)
Lines 6-13 Link Here
6
#
6
#
7
7
8
PORTNAME=	Mail-SpamAssassin
8
PORTNAME=	Mail-SpamAssassin
9
PORTVERSION=	3.3.1
9
PORTVERSION=	3.3.2
10
PORTREVISION=	4
11
CATEGORIES=	mail perl5
10
CATEGORIES=	mail perl5
12
MASTER_SITES=	${MASTER_SITE_APACHE:S/$/:apache/} ${MASTER_SITE_PERL_CPAN:S/$/:cpan/}
11
MASTER_SITES=	${MASTER_SITE_APACHE:S/$/:apache/} ${MASTER_SITE_PERL_CPAN:S/$/:cpan/}
13
MASTER_SITE_SUBDIR=	spamassassin/source/:apache Mail/:cpan
12
MASTER_SITE_SUBDIR=	spamassassin/source/:apache Mail/:cpan
Lines 23-29 Link Here
23
		${SITE_PERL}/Bundle/LWP.pm:${PORTSDIR}/www/p5-libwww \
22
		${SITE_PERL}/Bundle/LWP.pm:${PORTSDIR}/www/p5-libwww \
24
		${SITE_PERL}/${PERL_ARCH}/Encode/Detect.pm:${PORTSDIR}/converters/p5-Encode-Detect \
23
		${SITE_PERL}/${PERL_ARCH}/Encode/Detect.pm:${PORTSDIR}/converters/p5-Encode-Detect \
25
		${SITE_PERL}/Mail/Internet.pm:${PORTSDIR}/mail/p5-Mail-Tools
24
		${SITE_PERL}/Mail/Internet.pm:${PORTSDIR}/mail/p5-Mail-Tools
26
BUILD_DEPENDS=	${RUN_DEPENDS}
25
BUILD_DEPENDS=	p5-NetAddr-IP>=4.00.7:${PORTSDIR}/net-mgmt/p5-NetAddr-IP \
26
		p5-Net-DNS>=0.63:${PORTSDIR}/dns/p5-Net-DNS \
27
		p5-HTML-Parser>=3.43:${PORTSDIR}/www/p5-HTML-Parser \
28
		${SITE_PERL}/Bundle/LWP.pm:${PORTSDIR}/www/p5-libwww \
29
		${SITE_PERL}/${PERL_ARCH}/Encode/Detect.pm:${PORTSDIR}/converters/p5-Encode-Detect \
30
		${SITE_PERL}/Mail/Internet.pm:${PORTSDIR}/mail/p5-Mail-Tools
27
31
28
CONFLICTS=	ja-p5-Mail-SpamAssassin-[0-9]*
32
CONFLICTS=	ja-p5-Mail-SpamAssassin-[0-9]*
29
33
Lines 224-230 Link Here
224
SUB_LIST+=	SQL_FLAG=""
228
SUB_LIST+=	SQL_FLAG=""
225
.endif
229
.endif
226
.if !defined(WITH_AS_ROOT)
230
.if !defined(WITH_AS_ROOT)
227
SUB_LIST+=	RUN_AS_USER="-u spamd -H /var/spool/spamd"
231
SUB_LIST+=	RUN_AS_USER="-u ${USERS} -H /var/spool/spamd"
228
.else
232
.else
229
SUB_LIST+=	RUN_AS_USER=""
233
SUB_LIST+=	RUN_AS_USER=""
230
.endif
234
.endif
Lines 274-280 Link Here
274
.endif
278
.endif
275
279
276
pre-su-install:
280
pre-su-install:
277
	@${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
281
	@${SH} USER=${USERS} GROUP=${GROUPS} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
278
	@${INSTALL_PROGRAM} ${WRKSRC}/spamc/libspamc.so ${PREFIX}/lib/libspamc.so.0
282
	@${INSTALL_PROGRAM} ${WRKSRC}/spamc/libspamc.so ${PREFIX}/lib/libspamc.so.0
279
	@${LN} -sf libspamc.so.0 ${PREFIX}/lib/libspamc.so
283
	@${LN} -sf libspamc.so.0 ${PREFIX}/lib/libspamc.so
280
.if !defined(WITHOUT_SSL)
284
.if !defined(WITHOUT_SSL)
Lines 299-305 Link Here
299
	@[ -f ${PREFIX}/etc/mail/spamassassin/v320.pre ] || \
303
	@[ -f ${PREFIX}/etc/mail/spamassassin/v320.pre ] || \
300
		${CP} ${PREFIX}/etc/mail/spamassassin/v320.pre.sample \
304
		${CP} ${PREFIX}/etc/mail/spamassassin/v320.pre.sample \
301
			${PREFIX}/etc/mail/spamassassin/v320.pre
305
			${PREFIX}/etc/mail/spamassassin/v320.pre
302
	@PKG_PREFIX=${PREFIX} BATCH=${BATCH} SU_CMD="${SU_CMD}" ${SH} ${PKGDIR}/pkg-install ${PKGNAME} POST-INSTALL
306
	@PKG_PREFIX=${PREFIX} BATCH=${BATCH} SU_CMD="${SU_CMD}" USER=${USERS} GROUP=${GROUPS} ${SH} ${PKGDIR}/pkg-install ${PKGNAME} POST-INSTALL
303
	@[ -f ${PREFIX}/etc/mail/spamassassin/v330.pre ] || \
307
	@[ -f ${PREFIX}/etc/mail/spamassassin/v330.pre ] || \
304
		${CP} ${PREFIX}/etc/mail/spamassassin/v330.pre.sample \
308
		${CP} ${PREFIX}/etc/mail/spamassassin/v330.pre.sample \
305
			${PREFIX}/etc/mail/spamassassin/v330.pre
309
			${PREFIX}/etc/mail/spamassassin/v330.pre
(-)./distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (Mail-SpamAssassin-3.3.1.tar.gz) = a11ca187150d5a8fc2904c4a50f29d3ff739294fa714aaab127ba692d65410ad
1
SHA256 (Mail-SpamAssassin-3.3.2.tar.gz) = 5323038939a0ef9fc97d5264defce3ae1d95e98b3a94c4c3b583341c927f32df
2
SIZE (Mail-SpamAssassin-3.3.1.tar.gz) = 1196842
2
SIZE (Mail-SpamAssassin-3.3.2.tar.gz) = 1208182
(-)./files/patch-DKIM.pm (-66 lines)
Lines 1-66 Link Here
1
--- lib/Mail/SpamAssassin/Plugin/DKIM.pm	(revision 925052)
2
+++ lib/Mail/SpamAssassin/Plugin/DKIM.pm	(working copy)
3
@@ -213,6 +213,19 @@
4
 in the SpamAssassin distribution.  The whitelist score is lower, because
5
 these are often targets for abuse of public mailers which sign their mail.
6
 
7
+=item unwhitelist_from_dkim author@example.com
8
+
9
+Removes an email address from def_whitelist_from_dkim and whitelist_from_dkim
10
+tables, if it exists. Useful for removing undesired default entries from a
11
+distributed configuration file by a local.cf file or by a C<user_prefs>.
12
+Note that a parameter is a single email address - currently that address
13
+is removed regardless of a signing-domain which may have been specified in a
14
+whitelisting entry.
15
+
16
+The specified email address has to match exactly the address previously
17
+used in a whitelist_from_dkim or def_whitelist_from_dkim directive
18
+(with an exception that its domain name part is matched case-insensitively).
19
+
20
 =item adsp_override domain [signing-practices]
21
 
22
 Currently few domains publish their signing practices (RFC 5617 - ADSP),
23
@@ -362,6 +375,7 @@
24
       }
25
       my $address = $1;
26
       my $sdid = defined $2 ? $2 : '';  # empty implies author domain signature
27
+      $address =~ s/(\@[^@]*)\z/lc($1)/e; # lowercase the email address domain
28
       $self->{parser}->add_to_addrlist_rcvd('whitelist_from_dkim',
29
                                             $address, $sdid);
30
     }
31
@@ -381,12 +395,32 @@
32
       }
33
       my $address = $1;
34
       my $sdid = defined $2 ? $2 : '';  # empty implies author domain signature
35
+      $address =~ s/(\@[^@]*)\z/lc($1)/e; # lowercase the email address domain
36
       $self->{parser}->add_to_addrlist_rcvd('def_whitelist_from_dkim',
37
                                             $address, $sdid);
38
     }
39
   });
40
 
41
   push (@cmds, {
42
+    setting => 'unwhitelist_from_dkim',
43
+    type => $Mail::SpamAssassin::Conf::CONF_TYPE_ADDRLIST,
44
+    code => sub {
45
+      my ($self, $key, $value, $line) = @_;
46
+      unless (defined $value && $value !~ /^$/) {
47
+        return $Mail::SpamAssassin::Conf::MISSING_REQUIRED_VALUE;
48
+      }
49
+      unless ($value =~ /^\S+$/) {
50
+        return $Mail::SpamAssassin::Conf::INVALID_VALUE;
51
+      }
52
+      $value =~ s/(\@[^@]*)\z/lc($1)/e;  # lowercase the email address domain
53
+      $self->{parser}->remove_from_addrlist_rcvd('whitelist_from_dkim',
54
+                                                 $value);
55
+      $self->{parser}->remove_from_addrlist_rcvd('def_whitelist_from_dkim',
56
+                                                 $value);
57
+    }
58
+  });
59
+
60
+  push (@cmds, {
61
     setting => 'adsp_override',
62
     type => $Mail::SpamAssassin::Conf::CONF_TYPE_HASH_KEY_VALUE,
63
     code => sub {
64
65
66
(-)./files/patch-bug6392 (-225 lines)
Lines 1-225 Link Here
1
Index: lib/Mail/SpamAssassin/HTML.pm
2
===================================================================
3
--- lib/Mail/SpamAssassin/HTML.pm	(revision 943932)
4
+++ lib/Mail/SpamAssassin/HTML.pm	(revision 943933)
5
@@ -191,7 +191,7 @@
6
   my $self = shift;
7
   my %options = @_;
8
 
9
-  return join('', @{ $self->{text} }) unless keys %options;
10
+  return join('', @{ $self->{text} }) unless %options;
11
 
12
   my $mask;
13
   while (my ($k, $v) = each %options) {
14
Index: lib/Mail/SpamAssassin/Dns.pm
15
===================================================================
16
--- lib/Mail/SpamAssassin/Dns.pm	(revision 943932)
17
+++ lib/Mail/SpamAssassin/Dns.pm	(revision 943933)
18
@@ -754,7 +754,7 @@
19
   dbg("dns: entering helper-app run mode");
20
   $self->{old_slash} = $/;              # Razor pollutes this
21
   %{$self->{old_env}} = ();
22
-  if ( defined %ENV ) {
23
+  if ( %ENV ) {
24
     # undefined values in %ENV can result due to autovivification elsewhere,
25
     # this prevents later possible warnings when we restore %ENV
26
     while (my ($key, $value) = each %ENV) {
27
Index: lib/Mail/SpamAssassin/Plugin/Check.pm
28
===================================================================
29
--- lib/Mail/SpamAssassin/Plugin/Check.pm	(revision 943932)
30
+++ lib/Mail/SpamAssassin/Plugin/Check.pm	(revision 943933)
31
@@ -307,64 +307,51 @@
32
   my $package_name = __PACKAGE__;
33
   my $methodname = $package_name."::_".$ruletype."_tests_".$clean_priority;
34
 
35
-  if (defined &{$methodname} && !$doing_user_rules) {
36
-run_compiled_method:
37
-  # dbg("rules: run_generic_tests - calling %s", $methodname);
38
-    my $t = Mail::SpamAssassin::Timeout->new({ deadline => $master_deadline });
39
-    my $err = $t->run(sub {
40
-      no strict "refs";
41
-      $methodname->($pms, @{$opts{args}});
42
-    });
43
-    if ($t->timed_out() && $master_deadline && time > $master_deadline) {
44
-      info("check: exceeded time limit in $methodname, skipping further tests");
45
-      $pms->{deadline_exceeded} = 1;
46
-    }
47
-    return;
48
-  }
49
+  if (!defined &{$methodname} || $doing_user_rules) {
50
 
51
-  # use %nopts for named parameter-passing; it's more friendly to future-proof
52
-  # subclassing, since new parameters can be added without breaking third-party
53
-  # subclassed implementations of this plugin.
54
-  my %nopts = (
55
-    ruletype => $ruletype,
56
-    doing_user_rules => $doing_user_rules,
57
-    priority => $priority,
58
-    clean_priority => $clean_priority
59
-  );
60
+    # use %nopts for named parameter-passing; it's more friendly
61
+    # to future-proof subclassing, since new parameters can be added without
62
+    # breaking third-party subclassed implementations of this plugin.
63
+    my %nopts = (
64
+      ruletype => $ruletype,
65
+      doing_user_rules => $doing_user_rules,
66
+      priority => $priority,
67
+      clean_priority => $clean_priority
68
+    );
69
 
70
-  # build up the eval string...
71
-  $self->{evalstr_methodname} = $methodname;
72
-  $self->{evalstr_chunk_current_methodname} = undef;
73
-  $self->{evalstr_chunk_methodnames} = [];
74
-  $self->{evalstr_chunk_prefix} = [];  # stack (array) of source code sections
75
-  $self->{evalstr} = ''; $self->{evalstr_l} = 0;
76
-  $self->{evalstr2} = '';
77
-  $self->begin_evalstr_chunk($pms);
78
+    # build up the eval string...
79
+    $self->{evalstr_methodname} = $methodname;
80
+    $self->{evalstr_chunk_current_methodname} = undef;
81
+    $self->{evalstr_chunk_methodnames} = [];
82
+    $self->{evalstr_chunk_prefix} = []; # stack (array) of source code sections
83
+    $self->{evalstr} = ''; $self->{evalstr_l} = 0;
84
+    $self->{evalstr2} = '';
85
+    $self->begin_evalstr_chunk($pms);
86
 
87
-  $self->push_evalstr_prefix($pms, '
88
-      # start_rules_plugin_code '.$ruletype.' '.$priority.'
89
-      my $scoresptr = $self->{conf}->{scores};
90
-  ');
91
-  if (defined $opts{pre_loop_body}) {
92
-    $opts{pre_loop_body}->($self, $pms, $conf, %nopts);
93
-  }
94
-  $self->add_evalstr($pms,
95
-                     $self->start_rules_plugin_code($ruletype, $priority) );
96
-  while (my($rulename, $test) = each %{$opts{testhash}->{$priority}}) {
97
-    $opts{loop_body}->($self, $pms, $conf, $rulename, $test, %nopts);
98
-  }
99
-  if (defined $opts{post_loop_body}) {
100
-    $opts{post_loop_body}->($self, $pms, $conf, %nopts);
101
-  }
102
+    $self->push_evalstr_prefix($pms, '
103
+        # start_rules_plugin_code '.$ruletype.' '.$priority.'
104
+        my $scoresptr = $self->{conf}->{scores};
105
+    ');
106
+    if (defined $opts{pre_loop_body}) {
107
+      $opts{pre_loop_body}->($self, $pms, $conf, %nopts);
108
+    }
109
+    $self->add_evalstr($pms,
110
+                       $self->start_rules_plugin_code($ruletype, $priority) );
111
+    while (my($rulename, $test) = each %{$opts{testhash}->{$priority}}) {
112
+      $opts{loop_body}->($self, $pms, $conf, $rulename, $test, %nopts);
113
+    }
114
+    if (defined $opts{post_loop_body}) {
115
+      $opts{post_loop_body}->($self, $pms, $conf, %nopts);
116
+    }
117
 
118
-  $self->flush_evalstr($pms, 'run_generic_tests');
119
-  $self->free_ruleset_source($pms, $ruletype, $priority);
120
+    $self->flush_evalstr($pms, 'run_generic_tests');
121
+    $self->free_ruleset_source($pms, $ruletype, $priority);
122
 
123
-  # clear out a previous version of this method
124
-  undef &{$methodname};
125
+    # clear out a previous version of this method
126
+    undef &{$methodname};
127
 
128
-  # generate the loop that goes through each line...
129
-  my $evalstr = <<"EOT";
130
+    # generate the loop that goes through each line...
131
+    my $evalstr = <<"EOT";
132
   {
133
     package $package_name;
134
 
135
@@ -373,41 +360,52 @@
136
     sub $methodname {
137
 EOT
138
 
139
-  for my $chunk_methodname (@{$self->{evalstr_chunk_methodnames}}) {
140
-    $evalstr .= "      $chunk_methodname(\@_);\n";
141
-  }
142
+    for my $chunk_methodname (@{$self->{evalstr_chunk_methodnames}}) {
143
+      $evalstr .= "      $chunk_methodname(\@_);\n";
144
+    }
145
 
146
-  $evalstr .= <<"EOT";
147
+    $evalstr .= <<"EOT";
148
     }
149
 
150
     1;
151
   }
152
 EOT
153
 
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
+    delete $self->{evalstr};   # free up some RAM before we eval()
161
+    delete $self->{evalstr2};
162
+    delete $self->{evalstr_methodname};
163
+    delete $self->{evalstr_chunk_current_methodname};
164
+    delete $self->{evalstr_chunk_methodnames};
165
+    delete $self->{evalstr_chunk_prefix};
166
 
167
-  dbg("rules: run_generic_tests - compiling eval code: %s, priority %s",
168
-      $ruletype, $priority);
169
-# dbg("rules: eval code to compile: $evalstr");
170
-  my $eval_result;
171
-  { my $timer = $self->{main}->time_method('compile_gen');
172
-    $eval_result = eval($evalstr);
173
-  }
174
-  if (!$eval_result) {
175
-    my $eval_stat = $@ ne '' ? $@ : "errno=$!";  chomp $eval_stat;
176
-    warn "rules: failed to compile $ruletype tests, skipping:\n".
177
-         "\t($eval_stat)\n";
178
-    $pms->{rule_errors}++;
179
-  }
180
-  else {
181
+    dbg("rules: run_generic_tests - compiling eval code: %s, priority %s",
182
+        $ruletype, $priority);
183
+  # dbg("rules: eval code to compile: $evalstr");
184
+    my $eval_result;
185
+    { my $timer = $self->{main}->time_method('compile_gen');
186
+      $eval_result = eval($evalstr);
187
+    }
188
+    if (!$eval_result) {
189
+      my $eval_stat = $@ ne '' ? $@ : "errno=$!";  chomp $eval_stat;
190
+      warn "rules: failed to compile $ruletype tests, skipping:\n".
191
+           "\t($eval_stat)\n";
192
+      $pms->{rule_errors}++;
193
+      return;
194
+    }
195
     dbg("rules: compiled $ruletype tests");
196
-    goto run_compiled_method;
197
   }
198
+
199
+#run_compiled_method:
200
+# dbg("rules: run_generic_tests - calling %s", $methodname);
201
+  my $t = Mail::SpamAssassin::Timeout->new({ deadline => $master_deadline });
202
+  my $err = $t->run(sub {
203
+    no strict "refs";
204
+    $methodname->($pms, @{$opts{args}});
205
+  });
206
+  if ($t->timed_out() && $master_deadline && time > $master_deadline) {
207
+    info("check: exceeded time limit in $methodname, skipping further tests");
208
+    $pms->{deadline_exceeded} = 1;
209
+  }
210
 }
211
 
212
 sub begin_evalstr_chunk {
213
Index: lib/Mail/SpamAssassin/Plugin/BodyEval.pm
214
===================================================================
215
--- lib/Mail/SpamAssassin/Plugin/BodyEval.pm	(revision 943932)
216
+++ lib/Mail/SpamAssassin/Plugin/BodyEval.pm	(revision 943933)
217
@@ -119,7 +119,7 @@
218
         }
219
 
220
 	# If there are no words, mark if there's at least 1 image ...
221
-	if (keys %html == 0 && exists $pms->{html}{inside}{img}) {
222
+	if (!%html && exists $pms->{html}{inside}{img}) {
223
 	  # Use "\n" as the mark since it can't ever occur normally
224
 	  $html{"\n"}=1;
225
 	}
(-)./files/patch-bug6396 (-13 lines)
Lines 1-13 Link Here
1
Index: lib/Mail/SpamAssassin/Plugin/MIMEEval.pm
2
===================================================================
3
--- lib/Mail/SpamAssassin/Plugin/MIMEEval.pm	(revision 929342)
4
+++ lib/Mail/SpamAssassin/Plugin/MIMEEval.pm	(revision 929343)
5
@@ -498,7 +498,7 @@
6
     # perhaps just limit to test, and image?
7
     next if ($ctype eq 'application/ics');
8
 
9
-    my $cte = lc $p->get_header('content-transfer-encoding') || '';
10
+    my $cte = lc($p->get_header('content-transfer-encoding') || '');
11
     next if ($cte !~ /^base64$/);
12
     foreach my $l ( @{$p->raw()} ) {
13
       my $len = length $l;
(-)./files/patch-bug6488 (-18 lines)
Lines 1-18 Link Here
1
BUG 6488 - Lint errors with Perl 5.12.1 in AntiVirus.pm
2
3
Index: lib/Mail/SpamAssassin/Plugin/AntiVirus.pm
4
=========================================================================
5
--- lib/Mail/SpamAssassin/Plugin/AntiVirus.pm	(revision 574664)
6
+++ lib/Mail/SpamAssassin/Plugin/AntiVirus.pm	(revision 1028149)
7
@@ -98,9 +98,9 @@
8
     my ($ctype, $boundary, $charset, $name) =
9
       Mail::SpamAssassin::Util::parse_content_type($p->get_header('content-type'));
10
 
11
-    $name = lc $name || '';
12
+    $name = lc($name || '');
13
 
14
-    my $cte = lc $p->get_header('content-transfer-encoding') || '';
15
+    my $cte = lc($p->get_header('content-transfer-encoding') || '');
16
     $ctype = lc $ctype;
17
 
18
     if ($name && $name =~ /\.(?:ade|adp|asx|bas|bat|chm|cmd|com|cpl|crt|dll|exe|hlp|hta|inf|ins|isp|js|jse|lnk|mda|mdb|mde|mdt|mdw|mdz|msc|msi|msp|mst|nws|ops|pcd|pif|prf|reg|scf|scr\??|sct|shb|shs|shm|swf|url|vb|vbe|vbs|vbx|vxd|wsc|wsf|wsh)$/)
(-)./files/patch-bug6624 (+88 lines)
Line 0 Link Here
1
--- lib/Mail/SpamAssassin/BayesStore/MySQL.pm	(revision 1138970)
2
+++ lib/Mail/SpamAssassin/BayesStore/MySQL.pm	(working copy)
3
@@ -840,14 +840,28 @@
4
       return 0;
5
     }
6
 
7
+    # With ON DUPLICATE KEY UPDATE, the affected-rows value per row is 1 if
8
+    # the row is inserted as a new row and 2 if an existing row is updated.
9
+    #
10
+    # Due to a MySQL server bug a value of 3 can be seen.
11
+    # See: http://bugs.mysql.com/bug.php?id=46675
12
+    #   When executing the INSERT ... ON DUPLICATE KEY UPDATE statement
13
+    #   and checking the rows return count:
14
+    #   mysql_client_found_rows = 0: The second INSERT returns a row count
15
+    #                                of 2 in all MySQL versions.
16
+    #   mysql_client_found_rows = 1: The second INSERT returns this row count:
17
+    #     Before MySQL 5.1.20: 2
18
+    #     MySQL 5.1.20: undef on Mac OS X, 139775481 on Linux (garbage?)
19
+    #     MySQL 5.1.21 and up: 3
20
+    #
21
     my $num_rows = $rc;
22
 
23
     $sth->finish();
24
 
25
-    if ($num_rows == 1 || $num_rows == 2) {
26
+    if ($num_rows == 1 || $num_rows == 2 || $num_rows == 3) {
27
       my $token_count_update = '';
28
       
29
-      $token_count_update = "token_count = token_count + 1," if ($num_rows == 1);
30
+      $token_count_update = "token_count = token_count + 1," if $num_rows == 1;
31
       $sql = "UPDATE bayes_vars SET
32
                      $token_count_update
33
                      newest_token_age = GREATEST(newest_token_age, ?),
34
@@ -872,7 +886,11 @@
35
     }
36
     else {
37
       # $num_rows was not what we expected
38
-      dbg("bayes: _put_token: Updated an unexpected number of rows.");
39
+      my $token_displ = $token;
40
+      $token_displ =~ s/(.)/sprintf('%02x',ord($1))/egs;
41
+      dbg("bayes: _put_token: Updated an unexpected number of rows: %s, ".
42
+          "id: %s, token (hex): %s",
43
+          $num_rows, $self->{_userid}, $token_displ);
44
       $self->{_dbh}->rollback();
45
       return 0;
46
     }
47
@@ -987,8 +1005,24 @@
48
       else {
49
 	my $num_rows = $rc;
50
 
51
-	$need_atime_update_p = 1 if ($num_rows == 1 || $num_rows == 2);
52
-	$new_tokens++ if ($num_rows == 1);
53
+        # With ON DUPLICATE KEY UPDATE, the affected-rows value per row is 1 if
54
+        # the row is inserted as a new row and 2 if an existing row is updated.
55
+        # But see MySQL bug (as above): http://bugs.mysql.com/bug.php?id=46675
56
+
57
+        if ($num_rows == 1) {
58
+          $new_tokens++;
59
+          $need_atime_update_p = 1;
60
+        } elsif ($num_rows == 2 || $num_rows == 3) {
61
+          $need_atime_update_p = 1;
62
+        } else {
63
+          # $num_rows was not what we expected
64
+          my $token_displ = $token;
65
+          $token_displ =~ s/(.)/sprintf('%02x',ord($1))/egs;
66
+          dbg("bayes: _put_tokens: Updated an unexpected number of rows: %s, ".
67
+              "id: %s, token (hex): %s",
68
+              $num_rows, $self->{_userid}, $token_displ);
69
+          $error_p = 1;
70
+        }
71
       }
72
     }
73
 
74
@@ -1026,10 +1060,10 @@
75
       }
76
     }
77
     else {
78
-      # $num_rows was not what we expected
79
-      dbg("bayes: _put_tokens: Updated an unexpected number of rows.");
80
-      $self->{_dbh}->rollback();
81
-      return 0;
82
+      info("bayes: _put_tokens: no atime updates needed?  Num of tokens: %d",
83
+           scalar keys %{$tokens});
84
+#     $self->{_dbh}->rollback();
85
+#     return 0;
86
     }
87
   }
88
 
(-)./pkg-install (-6 / +4 lines)
Lines 1-9 Link Here
1
#!/bin/sh
1
#!/bin/sh
2
PKG_PREFIX=${PKG_PREFIX:-/usr/local}
2
PKG_PREFIX=${PKG_PREFIX:-/usr/local}
3
USER=spamd
3
USER=${USER:-spamd}
4
GROUP=${USER}
4
GROUP=${GROUP:-spamd}
5
UID=58
6
GID=${UID}
7
HOME=/var/spool/${USER}
5
HOME=/var/spool/${USER}
8
6
9
if [ "$2" = "POST-INSTALL" ];then
7
if [ "$2" = "POST-INSTALL" ];then
Lines 34-43 Link Here
34
}
32
}
35
33
36
    # Create pid directory
34
    # Create pid directory
37
    install -d -g ${USER} -g ${GROUP} /var/run/spamd
35
    install -d -o ${USER} -g ${GROUP} /var/run/spamd
38
    /usr/bin/su root -c "${PKG_PREFIX}/bin/spamassassin -x -L --lint"
36
    /usr/bin/su root -c "${PKG_PREFIX}/bin/spamassassin -x -L --lint"
39
37
40
    if [ ${?} -eq 255 ];then
38
    if [ ${?} -eq 9 ];then
41
        echo "***********************************************"
39
        echo "***********************************************"
42
        echo "*__        ___    ____  _   _ ___ _   _  ____ *"
40
        echo "*__        ___    ____  _   _ ___ _   _  ____ *"
43
        echo "*\ \      / / \  |  _ \| \ | |_ _| \ | |/ ___|*"
41
        echo "*\ \      / / \  |  _ \| \ | |_ _| \ | |/ ___|*"
(-)./pkg-plist (-4 / +3 lines)
Lines 1-5 Link Here
1
@unexec %D/etc/rc.d/sa-spamd.sh stop > /dev/null 2>&1 || true
1
@stopdaemon sa-spamd
2
@unexec %D/etc/rc.d/sa-spamd stop > /dev/null 2>&1 || true
3
bin/sa-awl
2
bin/sa-awl
4
bin/sa-check_spamd
3
bin/sa-check_spamd
5
bin/sa-compile
4
bin/sa-compile
Lines 134-140 Link Here
134
@unexec rm -rf /var/lib/spamassassin/2* || true
133
@unexec rm -rf /var/lib/spamassassin/2* || true
135
@unexec rmdir /var/lib/spamassassin 2>/dev/null  || true
134
@unexec rmdir /var/lib/spamassassin 2>/dev/null  || true
136
@unexec rmdir /var/lib 2>/dev/null || true
135
@unexec rmdir /var/lib 2>/dev/null || true
137
@unexec rmdir /var/db/spamassassin || true
136
@unexec rmdir /var/db/spamassassin 2>/dev/null || true
138
@dirrm %%DATADIR%%
137
@dirrm %%DATADIR%%
139
@dirrm %%SITE_PERL%%/%%PERL_ARCH%%/auto/Mail/SpamAssassin
138
@dirrm %%SITE_PERL%%/%%PERL_ARCH%%/auto/Mail/SpamAssassin
140
@dirrmtry %%SITE_PERL%%/%%PERL_ARCH%%/auto/Mail
139
@dirrmtry %%SITE_PERL%%/%%PERL_ARCH%%/auto/Mail
Lines 151-154 Link Here
151
@dirrmtry %%SITE_PERL%%/Mail
150
@dirrmtry %%SITE_PERL%%/Mail
152
@dirrmtry etc/mail/spamassassin
151
@dirrmtry etc/mail/spamassassin
153
@dirrmtry etc/mail
152
@dirrmtry etc/mail
154
@dirrmtry /var/run/spamd
153
@unexec rm -rf /var/run/spamd || true

Return to bug 158267