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

DC <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #13 from DC <[email protected]> ---
FWIW, this maybe causing some unexpected/unintended behavior for 3.x
installations...

I manage SA for two sites which run 3.4.0 & 3.4.2 respectively.  Starting the
day they got the updated rules (revision 1905734) the sa-compile process began
to issue several warnings:

-------------------------------
body_neg2000.c: In function
‘XS_Mail__SpamAssassin__CompiledRegexps__body_neg2000_scan’:
body_neg2000.xs:45:17: warning: variable ‘pend’ set but not used
[-Wunused-but-set-variable]
  unsigned char *pend;
                 ^
body_neg2000.xs:43:17: warning: unused variable ‘cursor’ [-Wunused-variable]
  unsigned char *cursor;
                 ^
body_neg2000.xs:42:8: warning: unused variable ‘match’ [-Wunused-variable]
  char *match;
        ^
body_neg2000.c: At top level:
body_neg2000.xs:17:3: warning: ‘split_and_add’ defined but not used
[-Wunused-function]
   split_and_add (AV *results, char *match)
   ^
Running Mkbootstrap for Mail::SpamAssassin::CompiledRegexps::body_neg2000 ()
-------------------------------


After a couple of hours of reverse engineering how this all works, I determined
that it was due to these new -2000 priority designations -- more specifically
the two body rules.  Thanks to the comment in that revision, it lead me here.

What seems to happen is that the BodyRuleBaseExtractor produces an empty list
of "bases" because of the nature of those two rules not being typical string
matches.  As a result of that, rule2xs in sa-compile creates the .xs file with
the PREINIT section that declares those variables.  However, because $numscans
is still 0 (due to no bases), it skips the loop that builds $xscode that would
normally reference them.  As such, warnings about unused/etc.


For anyone else affected by this, a workaround is to ensure there is at least
one body rule that will get picked up by sa-compile.  Probably a bad idea, but
my quick'n'dirty fix was to create one like this:

body IGNOREME_NEG_2000 /neg2000/
score IGNOREME_NEG_2000 0.001
priority IGNOREME_NEG_2000 -2000
describe IGNOREME_NEG_2000 Just a workaround, see Bug 8078

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

Reply via email to