SA Bugzilla – Bug 7848
Rule parser doesn't support nested if/ifplugins.
Last modified: 2021-04-15 17:16:30 UTC
When then Mail::SpamAssassin::Plugin::WLBLEval module is not loaded the linter fails in 60_whitelist.cf with: Aug 7 16:34:50.947 [22409] warn: rules: error: unknown eval 'check_from_in_whitelist' for USER_IN_WELCOMELIST Aug 7 16:34:50.986 [22409] warn: rules: error: unknown eval 'check_to_in_whitelist' for USER_IN_WELCOMELIST_TO I assume that's an issues in the parser, because it reverts $skip_parsing unconditionally when reaching the first "else" while it should be still disabled because of the "ifplugin".
Thanks Matthias. What version of SA are you using? Does this warn cause sa-update not to install updates or a lint to fail?
As far as I can tell, just the lint fail.
Can you confirm sa-update -D that you are have the latest rules and run spammassassin --lint && echo 'Worked' and tell me the output, please? That will tell me if it's failing or just a warning.
Hi Kevin, the exit code is 0, it's just warning. I guess the error is here: https://github.com/apache/spamassassin/blob/trunk/lib/Mail/SpamAssassin/Conf/Parser.pm#L360 the $skip_parsing is negated when the parser finds any 'else'. The structure of 60_whitelist.cf is as follows: ifplugin Mail::SpamAssassin::Plugin::WLBLEval //skip_parsing=true ...statements... if can(Mail::SpamAssassin::Conf::feature_blocklist_welcomelist) //skip_parsing=true ...statements... else //skip_parsing=false, reverted skip_parsing header USER_IN_WELCOMELIST eval:check_from_in_whitelist() // (warning) ...statements... endif ....
I can replicate this issue by commenting WLBLEval plugin in v320.pre sa-update && echo 'worked' rules: error: unknown eval 'check_from_in_whitelist' for USER_IN_WELCOMELIST rules: error: unknown eval 'check_to_in_whitelist' for USER_IN_WELCOMELIST_TO worked spamassassin --lint && echo 'worked' Aug 10 19:36:26.417 [21876] warn: rules: error: unknown eval 'check_from_in_whitelist' for USER_IN_WELCOMELIST Aug 10 19:36:26.806 [21876] warn: rules: error: unknown eval 'check_from_in_list' for __FROM_INTERNALSUMMER Aug 10 19:36:26.807 [21876] warn: rules: error: unknown eval 'check_to_in_whitelist' for USER_IN_WELCOMELIST_TO Aug 10 19:36:26.808 [21876] warn: rules: error: unknown eval 'check_to_in_list' for __TO_INTERNALSUMMER worked I checked with 4.0.0 trunk and with 3.4.5 pre1. In both cases you get output but the sa-update works and the lint passes. We need to fix this because it is noisy but it does not break anything.
Sad case of parser. Just have to remember not to use nested if-if-else clauses anywhere for a while. Committed fix to 3.4 too just in case we release something. Sending spamassassin-3.4/MANIFEST Sending spamassassin-3.4/lib/Mail/SpamAssassin/Conf/Parser.pm Adding spamassassin-3.4/t/if_else.t Sending trunk/MANIFEST Sending trunk/lib/Mail/SpamAssassin/Conf/Parser.pm Adding trunk/t/if_else.t Transmitting file data ......done Committing transaction... Committed revision 1888798.