diff options
author | Andrej Zverev <az@FreeBSD.org> | 2013-09-02 19:00:24 +0000 |
---|---|---|
committer | Andrej Zverev <az@FreeBSD.org> | 2013-09-02 19:00:24 +0000 |
commit | 2a21732666350729906b9fabc8fcd754e43eec90 (patch) | |
tree | 71fc0d8368ba7ef138a43018aae61e2ae6231fbe /mail/p5-Mail-SpamAssassin | |
parent | e8c8c11b2ed574a3a560fced871cfb78f0610342 (diff) | |
download | ports-2a21732666350729906b9fabc8fcd754e43eec90.tar.gz ports-2a21732666350729906b9fabc8fcd754e43eec90.zip |
- Fix issue when spamd crashes because of memory problems in Logger.pm
For more details see Bug 6745
- Do not bump portrevision since issue not global
While I'm here:
- convert to the new perl5 framework
PR: ports/181242
Submitted by: Igor Roshchin <spamd-pr@str.komkon.org>
Tested by: Igor Roshchin <spamd-pr@str.komkon.org> (two weeks)
Approved by: maintainer (timeout)
Notes
Notes:
svn path=/head/; revision=326056
Diffstat (limited to 'mail/p5-Mail-SpamAssassin')
-rw-r--r-- | mail/p5-Mail-SpamAssassin/Makefile | 3 | ||||
-rw-r--r-- | mail/p5-Mail-SpamAssassin/files/patch-bug6745 | 106 |
2 files changed, 108 insertions, 1 deletions
diff --git a/mail/p5-Mail-SpamAssassin/Makefile b/mail/p5-Mail-SpamAssassin/Makefile index 9d6bbb311b0a..68a7d7cece73 100644 --- a/mail/p5-Mail-SpamAssassin/Makefile +++ b/mail/p5-Mail-SpamAssassin/Makefile @@ -25,7 +25,8 @@ RUN_DEPENDS:= ${BUILD_DEPENDS} CONFLICTS?= ja-p5-Mail-SpamAssassin-[0-9]* p5-Mail-SpamAssassin-devel-[0-9]* p5-Mail-SpamAssassin-Alt-[0-9]* -PERL_CONFIGURE= 5.12+ +USES= perl5 +USE_PERL5= configure USE_LDCONFIG= yes DBDIR?= /var/db ETCDIR?= ${PREFIX}/etc/mail/spamassassin diff --git a/mail/p5-Mail-SpamAssassin/files/patch-bug6745 b/mail/p5-Mail-SpamAssassin/files/patch-bug6745 new file mode 100644 index 000000000000..346e45037296 --- /dev/null +++ b/mail/p5-Mail-SpamAssassin/files/patch-bug6745 @@ -0,0 +1,106 @@ +--- lib/Mail/SpamAssassin/Logger/Syslog.pm 2012/05/14 16:28:23 1338277 ++++ lib/Mail/SpamAssassin/Logger/Syslog.pm 2012/05/14 16:31:09 1338278 +@@ -167,17 +167,21 @@ + } + $msg = $timestamp . ' ' . $msg if $timestamp ne ''; + +- # important: do not call syslog() from the SIGCHLD handler +- # child_handler(). otherwise we can get into a loop if syslog() +- # forks a process -- as it does in syslog-ng apparently! (bug 3625) +- $Mail::SpamAssassin::Logger::LOG_SA{INHIBIT_LOGGING_IN_SIGCHLD_HANDLER} = 1; ++# no longer needed since a patch to bug 6745: ++# # important: do not call syslog() from the SIGCHLD handler ++# # child_handler(). otherwise we can get into a loop if syslog() ++# # forks a process -- as it does in syslog-ng apparently! (bug 3625) ++# $Mail::SpamAssassin::Logger::LOG_SA{INHIBIT_LOGGING_IN_SIGCHLD_HANDLER} = 1; ++ + my $eval_stat; + eval { + syslog($level, "%s", $msg); 1; + } or do { + $eval_stat = $@ ne '' ? $@ : "errno=$!"; chomp $eval_stat; + }; +- $Mail::SpamAssassin::Logger::LOG_SA{INHIBIT_LOGGING_IN_SIGCHLD_HANDLER} = 0; ++ ++# no longer needed since a patch to bug 6745: ++# $Mail::SpamAssassin::Logger::LOG_SA{INHIBIT_LOGGING_IN_SIGCHLD_HANDLER} = 0; + + if (defined $eval_stat) { + if ($self->check_syslog_sigpipe($msg)) { +--- spamd/spamd.raw 2012/05/14 16:28:23 1338277 ++++ spamd/spamd.raw 2012/05/14 16:31:09 1338278 +@@ -589,6 +589,7 @@ + my $timeout_child; # processing timeout (headers->finish), 0=no timeout + my $clients_per_child; # number of clients each child should process + my %children; # current children ++my @children_exited; + + if ( defined $opt{'max-children'} ) { + $childlimit = $opt{'max-children'}; +@@ -1033,6 +1034,8 @@ + # child_handler() if !$scaling || am_running_on_windows(); + child_handler(); # it doesn't hurt to call child_handler unconditionally + ++ child_cleaner(); ++ + do_sighup_restart() if defined $got_sighup; + + for (my $i = keys %children; $i < $childlimit; $i++) { +@@ -2523,7 +2526,8 @@ + my ($sig) = @_; + + # do NOT call syslog here unless the child's pid is in our list of known +- # children. This is due to syslog-ng brokenness -- bugs 3625, 4237. ++ # children. This is due to syslog-ng brokenness -- bugs 3625, 4237; ++ # see also bug 6745. + + # clean up any children which have exited + for (;;) { +@@ -2534,12 +2538,23 @@ + # + my $pid = waitpid(-1, WNOHANG); + last if !$pid || $pid == -1; +- my $child_stat = $?; ++ push(@children_exited, [$pid, $?, $sig, time]); ++ } + +- if (!defined $children{$pid}) { +- # ignore this child; we didn't realise we'd forked it. bug 4237 +- next; +- } ++ $SIG{CHLD} = \&child_handler; # reset as necessary, should be at end ++} ++ ++# takes care of dead children, as noted by a child_handler() ++# called in a main program flow (not from a signal handler) ++# ++sub child_cleaner { ++ while (@children_exited) { ++ my $tuple = shift(@children_exited); ++ next if !$tuple; # just in case ++ my($pid, $child_stat, $sig, $timestamp) = @$tuple; ++ ++ # ignore this child if we didn't realise we'd forked it. bug 4237 ++ next if !defined $children{$pid}; + + # remove them from our child listing + delete $children{$pid}; +@@ -2550,15 +2565,10 @@ + my $sock = $backchannel->get_socket_for_child($pid); + if ($sock) { $sock->close(); } + } +- +- unless ($Mail::SpamAssassin::Logger::LOG_SA{INHIBIT_LOGGING_IN_SIGCHLD_HANDLER}) { +- info("spamd: handled cleanup of child pid [%s]%s: %s", +- $pid, (defined $sig ? " due to SIG$sig" : ""), +- exit_status_str($child_stat,0)); +- } ++ info("spamd: handled cleanup of child pid [%s]%s: %s", ++ $pid, (defined $sig ? " due to SIG$sig" : ""), ++ exit_status_str($child_stat,0)); + } +- +- $SIG{CHLD} = \&child_handler; # reset as necessary, should be at end + } + + sub restart_handler { |