ports/158530: [UPDATE] japanese/p5-Mail-SpamAssassin: Update 3.3.2
Takefu
takefu at airport.fm
Thu Jun 30 09:00:25 UTC 2011
>Number: 158530
>Category: ports
>Synopsis: [UPDATE] japanese/p5-Mail-SpamAssassin: Update 3.3.2
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Thu Jun 30 09:00:24 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator: Takefu
>Release: FreeBSD 8.2-RELEASE-p2 amd64
>Organization:
FOX Amateur Radio Club
>Environment:
>Description:
- Update to 3.3.2
Please close PR 157584
>How-To-Repeat:
>Fix:
--- ja-p5-Mail-SpamAssassin.patch begins here ---
diff -ruN /usr/ports/japanese/p5-Mail-SpamAssassin/Makefile japanese/p5-Mail-SpamAssassin/Makefile
--- /usr/ports/japanese/p5-Mail-SpamAssassin/Makefile 2011-04-28 16:12:24.000000000 +0900
+++ japanese/p5-Mail-SpamAssassin/Makefile 2011-06-30 14:20:09.000000000 +0900
@@ -6,8 +6,7 @@
#
PORTNAME= Mail-SpamAssassin
-PORTVERSION= 3.3.1
-PORTREVISION= 3
+PORTVERSION= 3.3.2
CATEGORIES= japanese mail perl5
MASTER_SITES= ${MASTER_SITE_APACHE:S/$/:apache/} ${MASTER_SITE_PERL_CPAN:S/$/:cpan/} \
${PATCH_SITES}
@@ -19,11 +18,10 @@
EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX}
PATCH_SITES= http://spamassassin.emaillab.jp/pub/ja-patch/sa${PORTVERSION:R}/:JA
-PATCHFILES= spamassassin-${PORTVERSION}-ja-${PATCHLEVEL}.patch:JA
+PATCHFILES= spamassassin-3.3.1-ja-${PATCHLEVEL}.patch:JA
PATCHLEVEL= 1
PATCH_DIST_STRIP= -p1
-RUN_DEPENDS+=
MAINTAINER= fmysh at iijmio-mail.jp
COMMENT= SpamAssassin with Japanese tokenizer
@@ -32,10 +30,14 @@
p5-HTML-Parser>=3.43:${PORTSDIR}/www/p5-HTML-Parser \
${SITE_PERL}/Bundle/LWP.pm:${PORTSDIR}/www/p5-libwww \
${SITE_PERL}/${PERL_ARCH}/Encode/Detect.pm:${PORTSDIR}/converters/p5-Encode-Detect \
+ ${SITE_PERL}/Mail/Internet.pm:${PORTSDIR}/mail/p5-Mail-Tools\
+ ja-p5-MeCab>=0.98:${PORTSDIR}/japanese/p5-MeCab
+BUILD_DEPENDS= p5-NetAddr-IP>=4.00.7:${PORTSDIR}/net-mgmt/p5-NetAddr-IP \
+ p5-Net-DNS>=0.63:${PORTSDIR}/dns/p5-Net-DNS \
+ p5-HTML-Parser>=3.43:${PORTSDIR}/www/p5-HTML-Parser \
+ ${SITE_PERL}/Bundle/LWP.pm:${PORTSDIR}/www/p5-libwww \
+ ${SITE_PERL}/${PERL_ARCH}/Encode/Detect.pm:${PORTSDIR}/converters/p5-Encode-Detect \
${SITE_PERL}/Mail/Internet.pm:${PORTSDIR}/mail/p5-Mail-Tools
-RUN_DEPENDS+= ja-p5-MeCab>=0.98:${PORTSDIR}/japanese/p5-MeCab
-
-BUILD_DEPENDS= ${RUN_DEPENDS}
CONFLICTS= p5-Mail-SpamAssassin-[0-9]*
@@ -46,6 +48,9 @@
CONTACT_ADDRESS="${CONTACT_ADDRESS}" \
LOCALSTATEDIR="/var/db/spamassassin"
+USERS= spamd
+GROUPS= spamd
+
# You can override it if you like
CONTACT_ADDRESS?= The administrator of that system
@@ -220,7 +225,7 @@
spamassassin-run.3
MAN1= spamd.1 spamassassin.1 spamc.1 sa-learn.1 sa-update.1 \
- spamassassin-run.1 sa-compile.1
+ spamassassin-run.1 sa-compile.1 sa-awl.1
DOCSDIR= ${PREFIX}/share/doc/${PKGNAMEPREFIX}${PORTNAME}
DATADIR= ${PREFIX}/share/spamassassin
@@ -239,7 +244,7 @@
SUB_LIST+= SQL_FLAG=""
.endif
.if !defined(WITH_AS_ROOT)
-SUB_LIST+= RUN_AS_USER="-u spamd -H /var/spool/spamd"
+SUB_LIST+= RUN_AS_USER="-u ${USERS} -H /var/spool/spamd"
.else
SUB_LIST+= RUN_AS_USER=""
.endif
@@ -289,7 +294,7 @@
.endif
pre-su-install:
- @${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
+ @USER=${USERS} GROUP=${GROUPS} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
@${INSTALL_PROGRAM} ${WRKSRC}/spamc/libspamc.so ${PREFIX}/lib/libspamc.so.0
@${LN} -sf libspamc.so.0 ${PREFIX}/lib/libspamc.so
.if !defined(WITHOUT_SSL)
@@ -314,7 +319,7 @@
@[ -f ${PREFIX}/etc/mail/spamassassin/v320.pre ] || \
${CP} ${PREFIX}/etc/mail/spamassassin/v320.pre.sample \
${PREFIX}/etc/mail/spamassassin/v320.pre
- @PKG_PREFIX=${PREFIX} BATCH=${BATCH} SU_CMD="${SU_CMD}" ${SH} ${PKGDIR}/pkg-install ${PKGNAME} POST-INSTALL
+ @PKG_PREFIX=${PREFIX} BATCH=${BATCH} SU_CMD="${SU_CMD}" USER=${USERS} GROUP=${GROUPS} ${SH} ${PKGDIR}/pkg-install ${PKGNAME} POST-INSTALL
@[ -f ${PREFIX}/etc/mail/spamassassin/v330.pre ] || \
${CP} ${PREFIX}/etc/mail/spamassassin/v330.pre.sample \
${PREFIX}/etc/mail/spamassassin/v330.pre
diff -ruN /usr/ports/japanese/p5-Mail-SpamAssassin/distinfo japanese/p5-Mail-SpamAssassin/distinfo
--- /usr/ports/japanese/p5-Mail-SpamAssassin/distinfo 2011-03-21 14:17:23.000000000 +0900
+++ japanese/p5-Mail-SpamAssassin/distinfo 2011-06-30 09:09:05.000000000 +0900
@@ -1,5 +1,5 @@
-SHA256 (ja-spamassassin/Mail-SpamAssassin-3.3.1.tar.gz) = a11ca187150d5a8fc2904c4a50f29d3ff739294fa714aaab127ba692d65410ad
-SIZE (ja-spamassassin/Mail-SpamAssassin-3.3.1.tar.gz) = 1196842
+SHA256 (ja-spamassassin/Mail-SpamAssassin-3.3.2.tar.gz) = 5323038939a0ef9fc97d5264defce3ae1d95e98b3a94c4c3b583341c927f32df
+SIZE (ja-spamassassin/Mail-SpamAssassin-3.3.2.tar.gz) = 1208182
SHA256 (ja-spamassassin/tokenizer.pre) = 9f8e30a8449fd13d571427ea30a252b4b275f153bde5345c50427a7aee3c90e0
SIZE (ja-spamassassin/tokenizer.pre) = 163
SHA256 (ja-spamassassin/spamassassin-3.3.1-ja-1.txt) = 8342ed8b783f0eae867df9749b8c2ef35d7d5bee00bc240624bab57cc5a03070
diff -ruN /usr/ports/japanese/p5-Mail-SpamAssassin/files/patch-DKIM.pm japanese/p5-Mail-SpamAssassin/files/patch-DKIM.pm
--- /usr/ports/japanese/p5-Mail-SpamAssassin/files/patch-DKIM.pm 2011-04-18 15:55:33.000000000 +0900
+++ japanese/p5-Mail-SpamAssassin/files/patch-DKIM.pm 1970-01-01 09:00:00.000000000 +0900
@@ -1,66 +0,0 @@
---- lib/Mail/SpamAssassin/Plugin/DKIM.pm (revision 925052)
-+++ lib/Mail/SpamAssassin/Plugin/DKIM.pm (working copy)
-@@ -213,6 +213,19 @@
- in the SpamAssassin distribution. The whitelist score is lower, because
- these are often targets for abuse of public mailers which sign their mail.
-
-+=item unwhitelist_from_dkim author at example.com
-+
-+Removes an email address from def_whitelist_from_dkim and whitelist_from_dkim
-+tables, if it exists. Useful for removing undesired default entries from a
-+distributed configuration file by a local.cf file or by a C<user_prefs>.
-+Note that a parameter is a single email address - currently that address
-+is removed regardless of a signing-domain which may have been specified in a
-+whitelisting entry.
-+
-+The specified email address has to match exactly the address previously
-+used in a whitelist_from_dkim or def_whitelist_from_dkim directive
-+(with an exception that its domain name part is matched case-insensitively).
-+
- =item adsp_override domain [signing-practices]
-
- Currently few domains publish their signing practices (RFC 5617 - ADSP),
-@@ -362,6 +375,7 @@
- }
- my $address = $1;
- my $sdid = defined $2 ? $2 : ''; # empty implies author domain signature
-+ $address =~ s/(\@[^@]*)\z/lc($1)/e; # lowercase the email address domain
- $self->{parser}->add_to_addrlist_rcvd('whitelist_from_dkim',
- $address, $sdid);
- }
-@@ -381,12 +395,32 @@
- }
- my $address = $1;
- my $sdid = defined $2 ? $2 : ''; # empty implies author domain signature
-+ $address =~ s/(\@[^@]*)\z/lc($1)/e; # lowercase the email address domain
- $self->{parser}->add_to_addrlist_rcvd('def_whitelist_from_dkim',
- $address, $sdid);
- }
- });
-
- push (@cmds, {
-+ setting => 'unwhitelist_from_dkim',
-+ type => $Mail::SpamAssassin::Conf::CONF_TYPE_ADDRLIST,
-+ code => sub {
-+ my ($self, $key, $value, $line) = @_;
-+ unless (defined $value && $value !~ /^$/) {
-+ return $Mail::SpamAssassin::Conf::MISSING_REQUIRED_VALUE;
-+ }
-+ unless ($value =~ /^\S+$/) {
-+ return $Mail::SpamAssassin::Conf::INVALID_VALUE;
-+ }
-+ $value =~ s/(\@[^@]*)\z/lc($1)/e; # lowercase the email address domain
-+ $self->{parser}->remove_from_addrlist_rcvd('whitelist_from_dkim',
-+ $value);
-+ $self->{parser}->remove_from_addrlist_rcvd('def_whitelist_from_dkim',
-+ $value);
-+ }
-+ });
-+
-+ push (@cmds, {
- setting => 'adsp_override',
- type => $Mail::SpamAssassin::Conf::CONF_TYPE_HASH_KEY_VALUE,
- code => sub {
-
-
-
diff -ruN /usr/ports/japanese/p5-Mail-SpamAssassin/files/patch-bug6392 japanese/p5-Mail-SpamAssassin/files/patch-bug6392
--- /usr/ports/japanese/p5-Mail-SpamAssassin/files/patch-bug6392 2011-04-18 15:55:33.000000000 +0900
+++ japanese/p5-Mail-SpamAssassin/files/patch-bug6392 1970-01-01 09:00:00.000000000 +0900
@@ -1,225 +0,0 @@
-Index: lib/Mail/SpamAssassin/HTML.pm
-===================================================================
---- lib/Mail/SpamAssassin/HTML.pm (revision 943932)
-+++ lib/Mail/SpamAssassin/HTML.pm (revision 943933)
-@@ -191,7 +191,7 @@
- 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) {
-Index: lib/Mail/SpamAssassin/Dns.pm
-===================================================================
---- lib/Mail/SpamAssassin/Dns.pm (revision 943932)
-+++ lib/Mail/SpamAssassin/Dns.pm (revision 943933)
-@@ -754,7 +754,7 @@
- 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) {
-Index: lib/Mail/SpamAssassin/Plugin/Check.pm
-===================================================================
---- lib/Mail/SpamAssassin/Plugin/Check.pm (revision 943932)
-+++ lib/Mail/SpamAssassin/Plugin/Check.pm (revision 943933)
-@@ -307,64 +307,51 @@
- 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,41 +360,52 @@
- 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};
-+ 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 {
-+ 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;
-+ }
- }
-
- sub begin_evalstr_chunk {
-Index: lib/Mail/SpamAssassin/Plugin/BodyEval.pm
-===================================================================
---- lib/Mail/SpamAssassin/Plugin/BodyEval.pm (revision 943932)
-+++ lib/Mail/SpamAssassin/Plugin/BodyEval.pm (revision 943933)
-@@ -119,7 +119,7 @@
- }
-
- # 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 -ruN /usr/ports/japanese/p5-Mail-SpamAssassin/files/patch-bug6396 japanese/p5-Mail-SpamAssassin/files/patch-bug6396
--- /usr/ports/japanese/p5-Mail-SpamAssassin/files/patch-bug6396 2011-04-18 15:55:33.000000000 +0900
+++ japanese/p5-Mail-SpamAssassin/files/patch-bug6396 1970-01-01 09:00:00.000000000 +0900
@@ -1,13 +0,0 @@
-Index: lib/Mail/SpamAssassin/Plugin/MIMEEval.pm
-===================================================================
---- lib/Mail/SpamAssassin/Plugin/MIMEEval.pm (revision 929342)
-+++ lib/Mail/SpamAssassin/Plugin/MIMEEval.pm (revision 929343)
-@@ -498,7 +498,7 @@
- # 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;
diff -ruN /usr/ports/japanese/p5-Mail-SpamAssassin/files/patch-bug6624 japanese/p5-Mail-SpamAssassin/files/patch-bug6624
--- /usr/ports/japanese/p5-Mail-SpamAssassin/files/patch-bug6624 1970-01-01 09:00:00.000000000 +0900
+++ japanese/p5-Mail-SpamAssassin/files/patch-bug6624 2011-06-30 09:04:45.000000000 +0900
@@ -0,0 +1,88 @@
+--- lib/Mail/SpamAssassin/BayesStore/MySQL.pm (revision 1138970)
++++ lib/Mail/SpamAssassin/BayesStore/MySQL.pm (working copy)
+@@ -840,14 +840,28 @@
+ return 0;
+ }
+
++ # With ON DUPLICATE KEY UPDATE, the affected-rows value per row is 1 if
++ # the row is inserted as a new row and 2 if an existing row is updated.
++ #
++ # Due to a MySQL server bug a value of 3 can be seen.
++ # See: http://bugs.mysql.com/bug.php?id=46675
++ # When executing the INSERT ... ON DUPLICATE KEY UPDATE statement
++ # and checking the rows return count:
++ # mysql_client_found_rows = 0: The second INSERT returns a row count
++ # of 2 in all MySQL versions.
++ # mysql_client_found_rows = 1: The second INSERT returns this row count:
++ # Before MySQL 5.1.20: 2
++ # MySQL 5.1.20: undef on Mac OS X, 139775481 on Linux (garbage?)
++ # MySQL 5.1.21 and up: 3
++ #
+ my $num_rows = $rc;
+
+ $sth->finish();
+
+- if ($num_rows == 1 || $num_rows == 2) {
++ if ($num_rows == 1 || $num_rows == 2 || $num_rows == 3) {
+ my $token_count_update = '';
+
+- $token_count_update = "token_count = token_count + 1," if ($num_rows == 1);
++ $token_count_update = "token_count = token_count + 1," if $num_rows == 1;
+ $sql = "UPDATE bayes_vars SET
+ $token_count_update
+ newest_token_age = GREATEST(newest_token_age, ?),
+@@ -872,7 +886,11 @@
+ }
+ else {
+ # $num_rows was not what we expected
+- dbg("bayes: _put_token: Updated an unexpected number of rows.");
++ my $token_displ = $token;
++ $token_displ =~ s/(.)/sprintf('%02x',ord($1))/egs;
++ dbg("bayes: _put_token: Updated an unexpected number of rows: %s, ".
++ "id: %s, token (hex): %s",
++ $num_rows, $self->{_userid}, $token_displ);
+ $self->{_dbh}->rollback();
+ return 0;
+ }
+@@ -987,8 +1005,24 @@
+ else {
+ my $num_rows = $rc;
+
+- $need_atime_update_p = 1 if ($num_rows == 1 || $num_rows == 2);
+- $new_tokens++ if ($num_rows == 1);
++ # With ON DUPLICATE KEY UPDATE, the affected-rows value per row is 1 if
++ # the row is inserted as a new row and 2 if an existing row is updated.
++ # But see MySQL bug (as above): http://bugs.mysql.com/bug.php?id=46675
++
++ if ($num_rows == 1) {
++ $new_tokens++;
++ $need_atime_update_p = 1;
++ } elsif ($num_rows == 2 || $num_rows == 3) {
++ $need_atime_update_p = 1;
++ } else {
++ # $num_rows was not what we expected
++ my $token_displ = $token;
++ $token_displ =~ s/(.)/sprintf('%02x',ord($1))/egs;
++ dbg("bayes: _put_tokens: Updated an unexpected number of rows: %s, ".
++ "id: %s, token (hex): %s",
++ $num_rows, $self->{_userid}, $token_displ);
++ $error_p = 1;
++ }
+ }
+ }
+
+@@ -1026,10 +1060,10 @@
+ }
+ }
+ else {
+- # $num_rows was not what we expected
+- dbg("bayes: _put_tokens: Updated an unexpected number of rows.");
+- $self->{_dbh}->rollback();
+- return 0;
++ info("bayes: _put_tokens: no atime updates needed? Num of tokens: %d",
++ scalar keys %{$tokens});
++# $self->{_dbh}->rollback();
++# return 0;
+ }
+ }
+
diff -ruN /usr/ports/japanese/p5-Mail-SpamAssassin/pkg-deinstall japanese/p5-Mail-SpamAssassin/pkg-deinstall
--- /usr/ports/japanese/p5-Mail-SpamAssassin/pkg-deinstall 2010-07-21 16:56:10.000000000 +0900
+++ japanese/p5-Mail-SpamAssassin/pkg-deinstall 2011-06-30 13:47:27.000000000 +0900
@@ -5,13 +5,13 @@
fi
if [ -d /var/db/spamassassin ]; then
- echo "To delete /var/db/spamassassin, use 'rm -rf /var/db/spamassassin'"
+ echo "To delete /var/db/spamassassin, use 'rm -rf /var/db/spamassassin'"
fi
USER=spamd
if pw usershow "${USER}" 2>/dev/null 1>&2; then
- echo "To delete ${USER} user permanently, use 'rmuser ${USER}'"
+ echo "To delete ${USER} user permanently, use 'rmuser ${USER}'"
fi
exit 0
diff -ruN /usr/ports/japanese/p5-Mail-SpamAssassin/pkg-install japanese/p5-Mail-SpamAssassin/pkg-install
--- /usr/ports/japanese/p5-Mail-SpamAssassin/pkg-install 2010-08-24 08:19:34.000000000 +0900
+++ japanese/p5-Mail-SpamAssassin/pkg-install 2011-06-30 13:44:56.000000000 +0900
@@ -1,88 +1,65 @@
#!/bin/sh
PKG_PREFIX=${PKG_PREFIX:-/usr/local}
-USER=spamd
-GROUP=${USER}
-UID=58
-GID=${UID}
+USER=${USER:-spamd}
+GROUP=${GROUP:-spamd}
HOME=/var/spool/${USER}
if [ "$2" = "POST-INSTALL" ];then
ask() {
- local question default answer
+ local question default answer
- question=$1
- default=$2
- if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
- read -t120 -p "${question} [${default}]? " answer
- fi
- echo ${answer:-${default}}
+ question=$1
+ default=$2
+ if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
+ read -t120 -p "${question} [${default}]? " answer
+ fi
+ echo ${answer:-${default}}
}
yesno() {
- local question default answer
+ local question default answer
- question=$1
- default=$2
- while :; do
- answer=$(ask "${question}" "${default}")
- case "${answer}" in
- [Yy]*) return 0;;
- [Nn]*) return 1;;
- esac
- echo "Please answer yes or no."
- done
+ question=$1
+ default=$2
+ while :; do
+ answer=$(ask "${question}" "${default}")
+ case "${answer}" in
+ [Yy]*) return 0;;
+ [Nn]*) return 1;;
+ esac
+ echo "Please answer yes or no."
+ done
}
- if ! pw groupshow "${GROUP}" 2>/dev/null 1>&2; then
- if pw groupadd ${GROUP} -g ${GID}; then
- echo "Added group \"${GROUP}\"."
- else
- echo "Adding group \"${GROUP}\" failed..."
- exit 1
- fi
- fi
-
- if ! pw usershow "${USER}" 2>/dev/null 1>&2; then
- if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \
- -s "/sbin/nologin" -d "${HOME}" \
- -c "SpamAssassin user"; \
- then
- echo "Added user \"${USER}\"."
- mkdir ${HOME} && chown ${USER}:${GROUP} ${HOME}
- else
- echo "Adding user \"${USER}\" failed..."
- exit 1
- fi
- fi
-
+
# Create pid directory
- mkdir /var/run/spamd 2> /dev/null && chown ${USER}:${GROUP} /var/run/spamd
+ install -d -o ${USER} -g ${GROUP} /var/run/spamd
/usr/bin/su root -c "${PKG_PREFIX}/bin/spamassassin -x -L --lint"
-
- if [ ${?} -eq 255 ];then
- echo "***********************************************"
- echo "*__ ___ ____ _ _ ___ _ _ ____ *"
- echo "*\ \ / / \ | _ \| \ | |_ _| \ | |/ ___|*"
- echo "* \ \ /\ / / _ \ | |_) | \| || || \| | | _ *"
- echo "* \ V V / ___ \| _ <| |\ || || |\ | |_| |*"
- echo "* \_/\_/_/ \_\_| \_\_| \_|___|_| \_|\____|*"
- echo "* *"
- echo "*You must install rules before starting spamd!*"
- echo "***********************************************"
- if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
- if yesno "Do you wish to run sa-update to fetch new rules" "N";then
- ${PKG_PREFIX}/bin/sa-update || true
- else
- echo ""
- fi
- /usr/bin/su root -c "${PKG_PREFIX}/bin/spamassassin -x -L --lint"
- if [ ${?} -eq 0 ] && grep '^load.*Rule2XSBody' ${PKG_PREFIX}/etc/mail/spamassassin/v320.pre > /dev/null ;then
- if yesno "Do you wish to compile rules with re2c (will take a long time)" "N";then
- ${PKG_PREFIX}/bin/sa-compile || true
- fi
- fi
- fi
+
+ if [ ${?} -eq 9 ];then
+ echo "***********************************************"
+ echo "*__ ___ ____ _ _ ___ _ _ ____ *"
+ echo "*\ \ / / \ | _ \| \ | |_ _| \ | |/ ___|*"
+ echo "* \ \ /\ / / _ \ | |_) | \| || || \| | | _ *"
+ echo "* \ V V / ___ \| _ <| |\ || || |\ | |_| |*"
+ echo "* \_/\_/_/ \_\_| \_\_| \_|___|_| \_|\____|*"
+ echo "* *"
+ echo "*You must install rules before starting spamd!*"
+ echo "***********************************************"
+ if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
+ if yesno "Do you wish to run sa-update to fetch new rules" "N";then
+ ${PKG_PREFIX}/bin/sa-update || true
+ else
+ echo ""
+ fi
+ /usr/bin/su root -c "${PKG_PREFIX}/bin/spamassassin -x -L --lint"
+ if [ ${?} -eq 0 ] && grep '^load.*Rule2XSBody' ${PKG_PREFIX}/etc/mail/spamassassin/v320.pre > /dev/null ;then
+ if yesno "Do you wish to compile rules with re2c (will take a long time)" "N";then
+ ${PKG_PREFIX}/bin/sa-compile || true
+ fi
+ fi
+ fi
fi
-
+
exit 0
fi # post-install
diff -ruN /usr/ports/japanese/p5-Mail-SpamAssassin/pkg-plist japanese/p5-Mail-SpamAssassin/pkg-plist
--- /usr/ports/japanese/p5-Mail-SpamAssassin/pkg-plist 2010-08-24 08:19:34.000000000 +0900
+++ japanese/p5-Mail-SpamAssassin/pkg-plist 2011-06-30 13:45:51.000000000 +0900
@@ -1,5 +1,4 @@
- at unexec %D/etc/rc.d/sa-spamd.sh stop > /dev/null 2>&1 || true
- at unexec %D/etc/rc.d/sa-spamd stop > /dev/null 2>&1 || true
+ at stopdaemon sa-spamd
bin/sa-awl
bin/sa-check_spamd
bin/sa-compile
@@ -159,4 +158,4 @@
@dirrmtry %%SITE_PERL%%/Mail
@dirrmtry etc/mail/spamassassin
@dirrmtry etc/mail
- at dirrmtry /var/run/spamd
+ at unexec rm -rf /var/run/spamd || true
--- ja-p5-Mail-SpamAssassin.patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list