You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2012/08/22 16:42:27 UTC

[Bug 6830] New: Obtaining the Message Length for Emails for Rules

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6830

          Priority: P2
            Bug ID: 6830
          Assignee: dev@spamassassin.apache.org
           Summary: Obtaining the Message Length for Emails for Rules
          Severity: normal
    Classification: Unclassified
                OS: Windows 7
          Reporter: kmcgrail@pccc.com
          Hardware: PC
            Status: NEW
           Version: SVN Trunk (Latest Devel Version)
         Component: Rules (Eval Tests)
           Product: Spamassassin

There was a lot of discussion about this
(http://www.gossamer-threads.com/lists/spamassassin/users/170301) and other
threads.

However, I don't believe we ever got anything definitive and I continually see
a use for length of the body as an indicator of spamminess.

I believe we need something similar to the rules for length in HTMLEval.pm that
identifies the length of the body of an email.

As an initial pass, I've used the pristine_body to get a simple length and
added an eval test to BodyEval.pm.  Will commit for review in a moment.

Suggestions for improvements appreciated but as a quick and dirty rule, this
looks like it will work.

Regards,
KAM

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 6830] Obtaining the Message Length for Emails for Rules

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6830

--- Comment #2 from Kevin A. McGrail <km...@pccc.com> ---
svn commit -m 'Body Length rule for Bug 6830' 
lib/Mail/SpamAssassin/Plugin/BodyEval.pm lib/Mail/SpamAssassin/Message.pm
rulesrc/sandbox/kmcgrail/20_body_tests.cf  
Sending        lib/Mail/SpamAssassin/Message.pm
Sending        lib/Mail/SpamAssassin/Plugin/BodyEval.pm
Adding         rulesrc/sandbox/kmcgrail/20_body_tests.cf
Transmitting file data ...
Committed revision 1376077.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 6830] Obtaining the Message Length for Emails for Rules

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6830

Kevin A. McGrail <km...@pccc.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #8 from Kevin A. McGrail <km...@pccc.com> ---
(In reply to comment #7)
> People running trunk code older than end-of-August started seeing:
> 
>   rules: failed to run __KAM_BODY_LENGTH_LT_256 test, skipping:
>     (Can't locate object method "check_body_length" via package
>     "Mail::SpamAssassin::PerMsgStatus" at (eval 1114) line 419.
> 
> The problem is that the new __KAM_BODY_LENGTH* rules
> test for version 3.4.0, although it would be more appropriate
> to test for a feature capability.

I agree.  Your fix is elegant though I view trunk as something that can break
at any time requiring an update, etc.

> While at it, I also added the possibility of letting the
> caller provide the original mail body size, which may be
> different from what arrived to SpamAssassin in case of
> message truncation (useful for example with amavis).

Neat.  Thanks as well.

Marking this resolved.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 6830] Obtaining the Message Length for Emails for Rules

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6830

--- Comment #5 from Kevin A. McGrail <km...@pccc.com> ---
(In reply to comment #4)
> Bug: 4691
> 
> This fell throught the Quinlan/Theo filter as they wanted it as a plugin.
> I believe the methods/ideas should be reviewed.

Bug 4691 has a lot of promise but is before the short circuit and array changes
in 3.3.  

Anyway I think it has merit and would love to see it picked back up. But in the
absence of that going forward, I still think this change has merit.

Just added these comments as well:

+  # This is currently used by an eval test check_body_length.  
+  # Possible To-Do: Base the length on the @message array later down?  Or a
different copy of the message post decoding?
   $self->{'pristine_body_length'} = length($self->{'pristine_body'});


svn commit -m 'Added possible improvement for check_body_length and more
comments re: bug 6830' lib/Mail/SpamAssassin/Message.pm
Sending        lib/Mail/SpamAssassin/Message.pm
Transmitting file data .
Committed revision 1376083.

regards,
KAM

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 6830] Obtaining the Message Length for Emails for Rules

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6830

--- Comment #4 from AXB <ax...@gmail.com> ---
Bug: 4691

This fell throught the Quinlan/Theo filter as they wanted it as a plugin.
I believe the methods/ideas should be reviewed.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 6830] Obtaining the Message Length for Emails for Rules

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6830

Mark Martinec <Ma...@ijs.si> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|Undefined                   |3.4.0

--- Comment #9 from Mark Martinec <Ma...@ijs.si> ---
Setting the Target Milestone (may help some future searches).

> though I view trunk as something that can break

Sure, I wasn't complaining :)
It just happened that some folks were hit by this.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 6830] Obtaining the Message Length for Emails for Rules

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6830

--- Comment #1 from AXB <ax...@gmail.com> ---
this rings a bell - hadn't Dallas submitted a patch for "range" many moons ago?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 6830] Obtaining the Message Length for Emails for Rules

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6830

Kevin A. McGrail <km...@pccc.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kmcgrail@pccc.com

--- Comment #3 from Kevin A. McGrail <km...@pccc.com> ---
(In reply to comment #1)
> this rings a bell - hadn't Dallas submitted a patch for "range" many moons
> ago?

Always possible but if he did, I don't know where to find it ;-)

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 6830] Obtaining the Message Length for Emails for Rules

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6830

--- Comment #6 from Mark Martinec <Ma...@ijs.si> ---
Created attachment 5089
  --> https://issues.apache.org/SpamAssassin/attachment.cgi?id=5089&action=edit
provide a has_check_body_length feature test capab., deal with truncated
messages

Bug 6830: check_body_length - provide a has_check_body_length feature
test capability, deal with truncated messages
  Sending lib/Mail/SpamAssassin/Message.pm
  Sending lib/Mail/SpamAssassin/Plugin/BodyEval.pm
  Sending rulesrc/sandbox/kmcgrail/20_body_tests.cf
Committed revision 1381591.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 6830] Obtaining the Message Length for Emails for Rules

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6830

--- Comment #7 from Mark Martinec <Ma...@ijs.si> ---
Just to explain my previous commit:

People running trunk code older than end-of-August started seeing:

  rules: failed to run __KAM_BODY_LENGTH_LT_256 test, skipping:
    (Can't locate object method "check_body_length" via package
    "Mail::SpamAssassin::PerMsgStatus" at (eval 1114) line 419.

The problem is that the new __KAM_BODY_LENGTH* rules
test for version 3.4.0, although it would be more appropriate
to test for a feature capability.

The patch just committed above does just that: provides a
capability test, and updates the conditional enclosing these rules.

While at it, I also added the possibility of letting the
caller provide the original mail body size, which may be
different from what arrived to SpamAssassin in case of
message truncation (useful for example with amavis).

-- 
You are receiving this mail because:
You are the assignee for the bug.