You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by he...@apache.org on 2019/08/12 07:30:28 UTC
svn commit: r1864941 -
/spamassassin/branches/3.4/lib/Mail/SpamAssassin/Logger.pm
Author: hege
Date: Mon Aug 12 07:30:28 2019
New Revision: 1864941
URL: http://svn.apache.org/viewvc?rev=1864941&view=rev
Log:
Fix duplicate supressor logic to escape duplicated message properly
Modified:
spamassassin/branches/3.4/lib/Mail/SpamAssassin/Logger.pm
Modified: spamassassin/branches/3.4/lib/Mail/SpamAssassin/Logger.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/lib/Mail/SpamAssassin/Logger.pm?rev=1864941&r1=1864940&r2=1864941&view=diff
==============================================================================
--- spamassassin/branches/3.4/lib/Mail/SpamAssassin/Logger.pm (original)
+++ spamassassin/branches/3.4/lib/Mail/SpamAssassin/Logger.pm Mon Aug 12 07:30:28 2019
@@ -188,19 +188,29 @@ sub log_message {
} else {
if ($LOG_DUPCNT >= $LOG_DUPMIN) {
$LOG_DUPCNT -= $LOG_DUPMIN - 1;
- my $dupmsg = $LOG_DUPCNT > 1 ? " [... logline repeated $LOG_DUPCNT times]" : "";
- while (my ($name, $object) = each %{ $LOG_SA{method} }) {
- $object->log_message($level, "$LOG_DUPLINE$dupmsg", $LOG_DUPTIME);
+ if ($LOG_DUPCNT > 1) {
+ _log_message($level,
+ "$LOG_DUPLINE [... logline repeated $LOG_DUPCNT times]",
+ $LOG_DUPTIME);
+ } else {
+ _log_message($level, $LOG_DUPLINE, $LOG_DUPTIME);
}
}
$LOG_DUPCNT = 0;
$LOG_DUPLINE = $message;
}
+ _log_message($level, $message, $now);
+
+ $LOG_ENTERED = 0;
+}
+
+# Private helper
+sub _log_message {
# split on newlines and call log_message multiple times; saves
# the subclasses having to understand multi-line logs
my $first = 1;
- foreach my $line (split(/\n/, $message)) {
+ foreach my $line (split(/\n/, $_[1])) {
# replace control characters with "_", tabs and spaces get
# replaced with a single space.
$line =~ tr/\x09\x20\x00-\x1f/ _/s;
@@ -211,10 +221,9 @@ sub log_message {
$line =~ s/^([^:]+?):/$1: [...]/;
}
while (my ($name, $object) = each %{ $LOG_SA{method} }) {
- $object->log_message($level, $line, $now);
+ $object->log_message($_[0], $line, $_[2]);
}
}
- $LOG_ENTERED = 0;
}
=item dbg("facility: message")