Bug 39 - Line of yelling rule matches all periods
Summary: Line of yelling rule matches all periods
Status: RESOLVED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Rules (show other bugs)
Version: 2.30CVS
Hardware: All All
: P2 minor
Target Milestone: ---
Assignee: Craig Hughes
URL:
Whiteboard:
Keywords:
: 38 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-02-17 21:29 UTC by Dave Andersen
Modified: 2002-06-15 03:58 UTC (History)
1 user (show)



Attachment Type Modified Status Actions Submitter/CLA Status

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Andersen 2002-02-17 21:29:10 UTC
The line of yelling rule:
body LINE_OF_YELLING  /^[A-Z0-9\$\.,\'\!\?\s]{20,}[A-Z0-9\$\.,\'\!\?][A-Z0-9\$\.,\'\!\?\s]{20,}$/
describe LINE_OF_YELLING        A WHOLE LINE OF YELLING DETECTED

matches a line of periods used as a separator in a mailing list I'm on:

...........................................................
Foo text foo
Comment 1 Dave Andersen 2002-02-17 21:29:46 UTC
*** Bug 38 has been marked as a duplicate of this bug. ***
Comment 2 Rob McMillin 2002-03-03 16:45:09 UTC
Maybe something like

/^(?:(?:[A-Z]+[\d\$\.\'\!\?\s]*){20,}|(?:[\d\$\.\'\!\?\s]*[A-Z]+){20,})|
  (?:(?:[A-Z]+[\d\$\.\'\!\?\s]*){20,}|(?:[\d\$\.\'\!\?\s]*[A-Z]+){20,})$/x

I realize the above wouldn't work, but I'm suggesting it as an avenue, i.e., the
idea is to find

  <word> <punctuation> <word> <punctation> ... <word> <punctuation>

sets.  The problem with regexps like these is they tend to generate exponential
backoff strategies/times, which makes them VERY slow.

Someone in the list (can't recall who) suggested this should be an eval test as

s/[\d\$\.\'\!\?\s]//g

prior to the test, which would simplify the test substantially.
Comment 3 Rob McMillin 2002-03-03 17:07:30 UTC
Here's a patch (vs v2.1) for an eval test:

*** /usr/home/rlm/src/RPMS/BUILD/Mail-SpamAssassin-2.1/lib/Mail/SpamAssassin/EvalTests.pm.~1~	Fri Mar  1 05:29:36 2002
--- /usr/home/rlm/src/RPMS/BUILD/Mail-SpamAssassin-2.1/lib/Mail/SpamAssassin/EvalTests.pm	Sun Mar  3 17:04:50 2002
***************
*** 882,887 ****
--- 882,897 ----
    return 0;
  }
  
+ sub check_for_yelling {
+   my ($self, $body) = @_;
+   local ($_);
+   foreach (@{$body}) {
+       s/[\d\$\.,\'\"\!\?\s]//g;
+       return 1 if (/^[A-Z]{20,}/ && /[A-Z]{20,}$/);
+   }
+   return;
+ }
+ 
  ###########################################################################
  # FULL-MESSAGE TESTS:
  ###########################################################################

Comment 4 Rob McMillin 2002-03-03 17:08:43 UTC
Sorry, that should be
 /usr/home/rlm/src/RPMS/BUILD/Mail-SpamAssassin-2.1/lib/Mail/SpamAssassin/EvalTests.pm.~1~	Fri Mar  1 05:29:36 2002
--- /usr/home/rlm/src/RPMS/BUILD/Mail-SpamAssassin-2.1/lib/Mail/SpamAssassin/EvalTests.pm	Sun Mar  3 17:08:04 2002
***************
*** 882,887 ****
--- 882,897 ----
    return 0;
  }
  
+ sub check_for_yelling {
+   my ($self, $body) = @_;
+   local ($_);
+   foreach (@{$body}) {
+       s/[\d\$\.,\'\"\!\?\s]//g;
+       return 1 if (/^[A-Z]{20,}/ && /[A-Z]{20,}$/);
+   }
+   return 0;
+ }
+ 
  ###########################################################################
  # FULL-MESSAGE TESTS:
  ###########################################################################
Comment 5 Rob McMillin 2002-03-03 17:14:19 UTC
Jeez, try again -- can't modified $_ unless you like having $body modified:

*** /usr/home/rlm/src/RPMS/BUILD/Mail-SpamAssassin-2.1/lib/Mail/SpamAssassin/EvalTests.pm.~1~	Fri Mar  1 05:29:36 2002
--- /usr/home/rlm/src/RPMS/BUILD/Mail-SpamAssassin-2.1/lib/Mail/SpamAssassin/EvalTests.pm	Sun Mar  3 17:11:52 2002
***************
*** 882,887 ****
--- 882,899 ----
    return 0;
  }
  
+ sub check_for_yelling {
+   my ($self, $body) = @_;
+   local ($_);
+   my $l;
+   foreach $l (@{$body}) {
+       $_ = $l;
+       s/[\d\$\.,\'\"\!\?\s]//g;
+       return 1 if (/^[A-Z]{20,}/ && /[A-Z]{20,}$/);
+   }
+   return 0;
+ }
+ 
  ###########################################################################
  # FULL-MESSAGE TESTS:
  ###########################################################################
Comment 6 Craig Hughes 2002-03-03 17:45:29 UTC
You're missing a lot of files.  Download the distro again and retry.
Comment 7 Rob McMillin 2002-03-03 18:25:14 UTC
Not sure I understand

(a) what you mean by "you're missing a lot of files" (spam?)
(b) why this was tagged RESOLVED INVALID
Comment 8 Craig Hughes 2002-03-04 09:11:51 UTC
The directory listing you showed is missing files that are in the distribution
-- you either didn't download the full distribution, or there was some problem
in untarring or something.  Download again, and it should work.  It was closed
as "invalid" because the problem is not a bug in the distribution, but looks
more like some network or user error.
Comment 9 Rob McMillin 2002-03-04 18:03:21 UTC
Directory listing?  What directory listing?  Are we looking at the same bug?
Comment 10 Craig Hughes 2002-03-04 18:06:56 UTC
We're looking at different bugs -- my bad apparently. I'll reopen then re-close
as FIXED.