SA Bugzilla – Bug 8060
[review] Fix meta handling for metas without dependencies
Last modified: 2022-10-11 17:41:20 UTC
As seen on list, metas without dependencies are not always run correctly. Depending on rule running order due to perl hashes being random order, SA4TA3 will not evaluate if both subrules did not run before it. meta __SA4TA3_1 6 meta __SA4TA3_2 2 meta SA4TA3 (__SA4TA3_1 > 2) && (__SA4TA3_2 > 1) This was because metas without dependencies were not recorder in $pms->{meta_check_ready}, thus do_meta_tests did not run them at all, and finish_meta_tests is not able to handle this scenario. Fixed by saving metas without dependencies to $conf->{meta_nodeps} and initializing $pms->{meta_check_ready} from it.
Created attachment 5840 [details] Fix metas without deps Fix with minor cleanups and improved test that catches this. Vote to commit.
The patch might affect the common "meta DISABLED_RULE 0" usage, which previously I think was considered an "unrun" rule, now it is considered run rule that did not hit. Which now differs from other common way of "score DISABLED_RULE 0", which still makes rule "unrun". I think both should have identical results, but should be allow metas depending on them to fully evaluate or not?
On the other hand, maybe this is an advantage, so user can choose which way to disable a rule? # Disable rule, consider rule unrun, don't let any meta depending on it be run score DISABLED_RULE 0 # Disable rule, consider result not hitting, let any meta depending on it be run meta DISABLED_RULE 0 --
More I think about it, more it seems to make sense. meta FOO 0 meta FOO 1 Those should not differ in the way they effect any metas. It's just a difference of rule hitting or not. So +1 for my original patch.
+1 to commit
+1 from me as well
Committed with few extra additions to basic_meta2.t tests: Sending trunk/lib/Mail/SpamAssassin/Conf/Parser.pm Sending trunk/lib/Mail/SpamAssassin/Conf.pm Sending trunk/lib/Mail/SpamAssassin/Plugin/Check.pm Sending trunk/t/basic_meta2.t Transmitting file data ....done Committing transaction... Committed revision 1904529.