You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by km...@apache.org on 2019/05/12 05:27:31 UTC
svn commit: r1859129 - in /spamassassin:
branches/3.4/masses/rule-dev/seek-phrases-in-log
trunk/masses/rule-dev/seek-phrases-in-log
Author: kmcgrail
Date: Sun May 12 05:27:31 2019
New Revision: 1859129
URL: http://svn.apache.org/viewvc?rev=1859129&view=rev
Log:
fixed some whitespace issues thanks to Kevin Golding
Modified:
spamassassin/branches/3.4/masses/rule-dev/seek-phrases-in-log
spamassassin/trunk/masses/rule-dev/seek-phrases-in-log
Modified: spamassassin/branches/3.4/masses/rule-dev/seek-phrases-in-log
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/masses/rule-dev/seek-phrases-in-log?rev=1859129&r1=1859128&r2=1859129&view=diff
==============================================================================
--- spamassassin/branches/3.4/masses/rule-dev/seek-phrases-in-log (original)
+++ spamassassin/branches/3.4/masses/rule-dev/seek-phrases-in-log Sun May 12 05:27:31 2019
@@ -397,12 +397,20 @@ sub assemble_regexps {
foreach my $done (@done_pats, @pats_new) {
# pattern == existing pattern, or existing pattern is contained by
# pattern, or pattern is contained in existing pattern
- if ($pat eq $done || $pat =~ /\Q${done}\E/ || $done =~ /\Q${pat}\E/)
- { $subsumed=1; last; }
+ if ($pat eq $done || $pat =~ /\Q${done}\E/ || $done =~ /\Q${pat}\E/) {
+ $subsumed=1;
+ last;
+ }
# or one pattern contains the other (but interpreted as a regexp!)
# this deals with /foo.{0,10} bar/ vs /foo ish bar/
- if ($pat =~ /$done/) { $subsumed=1; last; }
- if ($done =~ /$pat/) { $subsumed=1; last; }
+ if ($pat =~ /$done/) {
+ $subsumed=1;
+ last;
+ }
+ if ($done =~ /$pat/) {
+ $subsumed=1;
+ last;
+ }
}
next if $subsumed;
@@ -674,8 +682,8 @@ sub expand_with_dots {
sub ensure_reqpatlength {
my @ret = @_;
if ($opt{reqpatlength}) {
- @ret = grep { (length($_) >= $opt{reqpatlength}) && (length($_) < $opt{maxreqpatlength}) } @ret;
- return () unless @ret;
+ @ret = grep { (length($_) >= $opt{reqpatlength}) && (length($_) < $opt{maxreqpatlength}) } @ret;
+ return () unless @ret;
}
return @ret;
}
Modified: spamassassin/trunk/masses/rule-dev/seek-phrases-in-log
URL: http://svn.apache.org/viewvc/spamassassin/trunk/masses/rule-dev/seek-phrases-in-log?rev=1859129&r1=1859128&r2=1859129&view=diff
==============================================================================
--- spamassassin/trunk/masses/rule-dev/seek-phrases-in-log (original)
+++ spamassassin/trunk/masses/rule-dev/seek-phrases-in-log Sun May 12 05:27:31 2019
@@ -150,7 +150,7 @@ sub proc_text_spam {
$text = substr $text, 0, $opt{maxtextread}; # chop!
}
- $text =~ s/ +/ /gs; # single spaces, please
+ $text =~ s/ +/ /gs; # single spaces, please
# we only need to save spam samples in memory, ignore ham samples
push @text_string, $text;
@@ -300,7 +300,7 @@ sub filter_into_message_subsets {
}
logmsg "message subsets found: ".(scalar
- keys %{$asmstate->{all_patterns_for_set}});
+ keys %{$asmstate->{all_patterns_for_set}});
$asmstate->{ngram_count} = \%ngram_count;
$asmstate->{msg_subset_hit} = \%msg_subset_hit;
@@ -363,8 +363,8 @@ sub assemble_regexps {
my $count = 0;
my $count_out = 0;
foreach my $id (sort {
- $asmstate->{ngram_count}->{$b} <=> $asmstate->{ngram_count}->{$a}
- } keys %{$asmstate->{ngram_count}})
+ $asmstate->{ngram_count}->{$b} <=> $asmstate->{ngram_count}->{$a}
+ } keys %{$asmstate->{ngram_count}})
{
my $set = $asmstate->{msg_subset_hit}->{$id};
next if $done_set{$set}; $done_set{$set}++;
@@ -391,14 +391,22 @@ sub assemble_regexps {
foreach my $pat (@pats) {
my $subsumed = 0;
foreach my $done (@done_pats, @pats_new) {
- # pattern == existing pattern, or existing pattern is contained by
- # pattern, or pattern is contained in existing pattern
- if ($pat eq $done || $pat =~ /\Q${done}\E/ || $done =~ /\Q${pat}\E/)
- { $subsumed=1; last; }
- # or one pattern contains the other (but interpreted as a regexp!)
- # this deals with /foo.{0,10} bar/ vs /foo ish bar/
- if ($pat =~ /$done/) { $subsumed=1; last; }
- if ($done =~ /$pat/) { $subsumed=1; last; }
+ # pattern == existing pattern, or existing pattern is contained by
+ # pattern, or pattern is contained in existing pattern
+ if ($pat eq $done || $pat =~ /\Q${done}\E/ || $done =~ /\Q${pat}\E/) {
+ $subsumed=1;
+ last;
+ }
+ # or one pattern contains the other (but interpreted as a regexp!)
+ # this deals with /foo.{0,10} bar/ vs /foo ish bar/
+ if ($pat =~ /$done/) {
+ $subsumed=1;
+ last;
+ }
+ if ($done =~ /$pat/) {
+ $subsumed=1;
+ last;
+ }
}
next if $subsumed;
@@ -434,15 +442,15 @@ sub assemble_regexps {
foreach my $pat (sort @pats) {
my $name = generate_rule_name($pat);
- if ($opt{ruletype} eq 'header') {
- # deal with header-specific munging.
- # "\[\\n\]" is the result of "[\n]", at this stage
- $pat =~ s/\Q\[\\n\]\E/\\n/gs;
- $pat =~ s/\Q\[\\t\]\E/\\t/gs;
- }
+ if ($opt{ruletype} eq 'header') {
+ # deal with header-specific munging.
+ # "\[\\n\]" is the result of "[\n]", at this stage
+ $pat =~ s/\Q\[\\n\]\E/\\n/gs;
+ $pat =~ s/\Q\[\\t\]\E/\\t/gs;
+ }
print "$opt{ruletype} $opt{ruleprefix}${name} /$pat/\n";
- $count_out++;
+ $count_out++;
}
} else {