https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8442

            Bug ID: 8442
           Summary: sa-update --score-multiplier and --score-limit don't
                    adjust relative scores
           Product: Spamassassin
           Version: 4.0.2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: sa-update
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: Undefined

Created attachment 6133
  --> https://bz.apache.org/SpamAssassin/attachment.cgi?id=6133&action=edit
patch sa-update to handle relative scores

sa-update's --score-multiplier and --score-limit options don't handle relative
scores. A line such as `score R (1)` is passed through unchanged, without the
multiplier being applied or the limit being checked after the addition.

You can reproduce it with an update channel that has a plain score for a rule
followed by a relative score for the same rule (a relative score on its own
fails sa-update's lint check, because there is no earlier score for it to add
to). Install it with sa-update using either or both options, and look at the
score lines in the rule file that is written.

In fixing this I found that it isn't practical to apply --score-limit to
relative scores, because sa-update adjusts one line at a time, and a relative
score adds to a score that was set, and already limited, on an earlier line.
Limiting the relative amount on its own doesn't keep the total under the limit.

However, relative scores were never intended to be used in sa-update channels.
They were introduced in bug 2201 for users to use in local changes, before
sa-update existed. None of our update rules files use them. That doesn't rule
out someone using them in a private channel, but it is unlikely.

This patch handles relative scores this way:

  with neither option, keep current behavior
  with --score-multiplier alone, write the line with the relative score
multiplied, which when added to the multiplied score gets the correct result
  with --score-limit, with or without --score-multiplier, write the line with
the relative score commented out. This keeps the limit from being exceeded. It
isn't an ideal result, but is not a likely case

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

Reply via email to