Bug 7721

Summary: Trying to set relative score no longer works, emits error in tests.
Product: Spamassassin Reporter: John Hardin <jhardin>
Component: LibrariesAssignee: SpamAssassin Developer Mailing List <dev>
Status: NEW ---    
Severity: normal CC: apache, jhardin
Priority: P2    
Version: SVN Trunk (Latest Devel Version)   
Target Milestone: Future   
Hardware: All   
OS: All   
Whiteboard:

Description John Hardin 2019-06-15 16:27:56 UTC
The SA documentation states:

If any of the score values are surrounded by parenthesis '()', then all of 
the scores in the line are considered to be relative to the already set 
score. ie: '(3)' means increase the score for this rule by 3 points in all 
score sets. '(3) (0) (3) (0)' means increase the score for this rule by 3 
in score sets 0 and 2 only.

It looks like this feature isn't used much in the base rules, because I just added some score overrides like this to temporarily suppress stale net scores without affecting non-net scores:

    score FROM_IN_TO_AND_SUBJ    (0) 0.001 (0) 0.001
    score OBFU_TEXT_ATTACH       (0) 0.001 (0) 0.001

...and got this:

    not ok 1
    #   Failed test at t/SATest.pm line 786.
    # Looks like you failed 1 test of 1.
    1..2
    Argument "(0)" isn't numeric in numeric ne (!=) at t/basic_meta.t line 62.
    Argument "(0)" isn't numeric in numeric ne (!=) at t/basic_meta.t line 76.
    T_OBFU_ATTACH_MISSP depends on OBFU_TEXT_ATTACH with 0 score in set 0
    Argument "(0)" isn't numeric in numeric ne (!=) at t/basic_meta.t line 62.
    MIME_PHP_NO_TEXT depends on MIME_NO_TEXT with 0 score in set 0
    Argument "(0)" isn't numeric in numeric ne (!=) at t/basic_meta.t line 62.
    Argument "(0)" isn't numeric in numeric ne (!=) at t/basic_meta.t line 76.
    T_ZW_OBFU_FROMTOSUBJ depends on FROM_IN_TO_AND_SUBJ with 0 score in set 0
    Argument "(0)" isn't numeric in numeric ne (!=) at t/basic_meta.t line 62.
    Argument "(0)" isn't numeric in numeric ne (!=) at t/basic_meta.t line 62.
    Argument "(0)" isn't numeric in numeric ne (!=) at t/basic_meta.t line 62.
    Argument "(0)" isn't numeric in numeric ne (!=) at t/basic_meta.t line 62.
    Argument "(0)" isn't numeric in numeric ne (!=) at t/basic_meta.t line 62.
    Argument "(0)" isn't numeric in numeric ne (!=) at t/basic_meta.t line 76.
    T_OBFU_ATTACH_MISSP depends on OBFU_TEXT_ATTACH with 0 score in set 2
    Argument "(0)" isn't numeric in numeric ne (!=) at t/basic_meta.t line 62.
    Argument "(0)" isn't numeric in numeric ne (!=) at t/basic_meta.t line 62.
    MIME_PHP_NO_TEXT depends on MIME_NO_TEXT with 0 score in set 2
    Argument "(0)" isn't numeric in numeric ne (!=) at t/basic_meta.t line 62.
    Argument "(0)" isn't numeric in numeric ne (!=) at t/basic_meta.t line 62.
    Argument "(0)" isn't numeric in numeric ne (!=) at t/basic_meta.t line 62.
    Argument "(0)" isn't numeric in numeric ne (!=) at t/basic_meta.t line 76.
    T_ZW_OBFU_FROMTOSUBJ depends on FROM_IN_TO_AND_SUBJ with 0 score in set 2
    Argument "(0)" isn't numeric in numeric ne (!=) at t/basic_meta.t line 62.
    not ok 1
    #   Failed test at t/basic_meta.t line 92.
    ok 2
    # Looks like you failed 1 test of 2.

I'm not sure if this is an error in the test or in the interpretation of the `(n)` relative-score syntax.
Comment 1 John Hardin 2019-06-15 17:04:51 UTC
Ugh. Perhaps this is the issue:

  If **any** of the score values are surrounded by parenthesis '()', then **all** of 
  the scores in the line are considered to be relative...

This seems unnecessarily restrictive; it would be nice to be able to mix relative and specific scores...

Reducing severity.
Comment 2 Henrik Krohns 2022-04-16 06:28:13 UTC
Postponing into future, seems very uncommon usecase, not sure what all things it could affect.