To answer your subject, no, nothing with __ has changed in quite some time that I can recollect. More information below but I believe you are misreading the docs.

On 11/27/2011 11:52 AM, Martin Gregorie wrote:
The SA wiki says: "rules starting with a double undescore are
evaluated with no score, and are intended for use in meta rules where
you don't want the sub-rules to have a score." on this page:
http://wiki.apache.org/spamassassin/WritingRules and yes, the typo
(undescore) is on the web page - thats a cut and paste, not copy typing.

I read this as saying that there is no default score for subrules whose
name starts with a double underscore,


The score of a rule has nothing to do with the arithmetic for meta operations in determining if the rule is true. Specifically "An arithmetic meta rule can be used to tell if more than a certain number of sub rules matched."

In pseudo rule code:

Rule __TEST1
Rule __TEST2
Rule TEST3
Score TEST3 0.05
Rule 4 T_TEST4

meta test (__TEST1 + __TEST2 + TEST3 + T_TEST4 >= 4) will be true if all 4 rules hit regardless of their underlying score math which would be 0 + 0 + 0.05 + 0.01 based on the info above.

So the meta is more of a (hit/no hit) check not a check of the score.

I fixed the typo thank you.

i.e., that given the rules:

body __SUB1 /test/
body __SUB2 /message/
meta USTEST1 (__SUB1 + __SUB2>  1.0)
meta USTEST2 (__SUB1&&  __SUB2)

body SUB3 /test/
body SUB4 /message/
meta USTEST3 (SUB3 + SUB4>  1.0)
meta USTEST4 (SUB3&&  SUB4)

and a message containing:

==================================================================
> From  [email protected]
Date:         Wed, 25 Mar 2009 22:00:27 -0100
From:         [email protected]
To:           [email protected]
Subject:      Test message

A test message.
==================================================================

I expected that the meta USTEST1 would not fire while other three rules
(USTEST2, USTEST3, USTEST4) would. When I ran the test, all four metas
fired.

Did I mis-understand the wiki or has something changed in SA since that
wiki page was last updated?

Yes, all four metas should hit. __SUB1 & __SUB2 will be merged (see below). But yes, the message includes "test" and "message" so all 4 rules will be true.

I use my initials in my rules so I can watch them in a debug situation. So for example, I added KAM_ to all your rules and created an mbox valid email from your example above.

As you can see below, there is merger of the duplicate rules and the meta rules all hit.

spamassassin -t -D < /tmp/2.mbox 2>&1 | grep -i KAM

Nov 27 11:27:03.661 [22589] dbg: config: read file /etc/mail/spamassassin/KAM-devel.cf Nov 27 11:27:06.849 [22589] dbg: rules: KAM_SUB4 merged duplicates: __KAM_SUB2 Nov 27 11:27:06.853 [22589] dbg: rules: KAM_SUB3 merged duplicates: __KAM_SUB1 Nov 27 11:27:07.781 [22589] dbg: rules: ran body rule KAM_SUB4 ======> got hit: "message" Nov 27 11:27:07.782 [22589] dbg: rules: ran body rule KAM_SUB3 ======> got hit: "test" Nov 27 11:27:08.637 [22589] dbg: check: tests=KAM_SUB3,KAM_SUB4,KAM_USTEST1,KAM_USTEST2,KAM_USTEST3,KAM_USTEST4,MISSING_MID,NO_RECEIVED,NO_RELAYS Nov 27 11:27:08.637 [22589] dbg: check: subtests=__GATED_THROUGH_RCVD_REMOVER,__HAS_DATE,__HAS_FROM,__HAS_SUBJECT,__KAM_SUB1,__KAM_SUB2,__MISSING_REF,__MISSING_REPLY,__NAKED_TO,__NONEMPTY_BODY,__NOT_SPOOFED,__TOCC_EXISTS,__TO_NO_ARROWS_R,__UNUSABLE_MSGID X-Spam-Status: Yes, score=6.1 required=5.0 tests=KAM_SUB3,KAM_SUB4,KAM_USTEST1, KAM_USTEST2,KAM_USTEST3,KAM_USTEST4,MISSING_MID,NO_RECEIVED,NO_RELAYS
 1.0 KAM_SUB4               BODY: KAM_SUB4
 1.0 KAM_SUB3               BODY: KAM_SUB3
 1.0 KAM_USTEST3            KAM_USTEST3
 1.0 KAM_USTEST4            KAM_USTEST4
 1.0 KAM_USTEST1            KAM_USTEST1
 1.0 KAM_USTEST2            KAM_USTEST2
 1.0 KAM_SUB4               BODY: KAM_SUB4
 1.0 KAM_SUB3               BODY: KAM_SUB3
 1.0 KAM_USTEST3            KAM_USTEST3
 1.0 KAM_USTEST4            KAM_USTEST4
 1.0 KAM_USTEST1            KAM_USTEST1
 1.0 KAM_USTEST2            KAM_USTEST2

Regards,
KAM

Reply via email to