SA Bugzilla – Bug 4648
[review] Illegal declaration of anonymous subroutine - Rules starting with digits
Last modified: 2005-12-08 18:27:06 UTC
Custom rule writing is becoming more and more popular. We ran into an issue today with a rule starting with a number causing a lint failure in an unrelated file. To see this yourself, create a new .cf file and add a test rule whose name starts with a number. Run lint on this rule and it will produce something like: [500] warn: rules: failed to compile body tests, skipping: [500] warn: _(Illegal declaration of anonymous subroutine at C:\Perl\Site\Share\ SpamAssassin/20_drugs.cf, rule __DRUGS_DIET7, line 10. [500] warn: ) On different systems the error message varies: (Illegal declaration of anonymous subroutine at (no file), rule RADAR, line 10.) And another system gave us: [23637] warn: _(Illegal declaration of anonymous subroutine at /etc/mail/spamassassin/70_sare_oem.cf, rule __OEM_MS_9, line 10. [23637] warn: ) 20_drugs.cf has nothing to do with this lint error, the file at fault was named 00_test.cf The error message produced by lint also makes it somewhat difficult to track down what is causing this problem. I'm asking if lint could be enhanced to catch this better? I have read someplace (possibly docs) that rules can not start with a number, I'm not asking for that to change, just that it be more clear when this does happen why it's happening. Thank you! Frederic Tarasevicius
Triage: Not knowing much about the --lint process, IMO it should be easy to add a quick check "if any rule begins with a digit, report this as a --lint error and disable that rule from further checking". I'm assigning a target milestone hoping I'm right. No problem if this has to get shifted to 3.2.0.
hi Fred, Bob, yep -- agreed. not a major issue, though, since at least the documentation is explicit about this being a bad idea ;)
Created attachment 3222 [details] patch Fixes rule name check and also checks for rule names that cause subroutine identifiers to be too long.
trunk revision 330694
+1
ping: 1 vote needed
3.1: Committed revision 355322.