Bug 5449 - [review] allow_user_rules produces errors with active Rule2XSBody Plugin
Summary: [review] allow_user_rules produces errors with active Rule2XSBody Plugin
Status: RESOLVED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: sa-compile (show other bugs)
Version: 3.2.0
Hardware: All All
: P5 normal
Target Milestone: 3.2.2
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard: go
Keywords:
: 5542 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-05-06 05:57 UTC by Wolfgang Breyha
Modified: 2007-07-23 03:23 UTC (History)
2 users (show)



Attachment Type Modified Status Actions Submitter/CLA Status
fix patch None Justin Mason [HasCLA]
redone fix patch None Justin Mason [HasCLA]

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfgang Breyha 2007-05-06 05:57:08 UTC
If Rule2XSBody Plugin is active and "allow_user_rules" is true spamd reports
errors like...
[10778] error: Can't locate Mail/SpamAssassin/CompiledRegexps/body_neg950.pm in
@INC (@INC contains: ...) at (eval 931) line 1.
... for all of
body_1000.pm
body_500.pm
body_900.pm
body_neg1000.pm
body_neg400.pm
body_neg900.pm
body_neg950.pm

spamd starts without error and reports errors for every submission afterwards.

In SpamAssassin.pm the function finish_parsing() is called if allow_user_rules
is true. This way Mail::SpamAssassin::Plugin::Rule2XSBody::finish_parsing_end()
get's called again.

Since Logger.pm does
  $SIG{__DIE__} = sub {
    log_message("error", $_[0]) if $_[0] !~ /\bin eval\b/;
  };
the failing "eval" there get's logged.

I don't know exactly if it's only a duplicate of big #5445 or if it's more
complicated. So I'm filing a new bug.
Comment 1 Sidney Markowitz 2007-06-04 22:10:36 UTC
Moving items off the 3.2.1 queue to 3.2.2 to facilitate a quick release.
If you can get this in Review status right away feel free to move it back
Comment 2 Justin Mason 2007-06-29 08:46:00 UTC
Created attachment 4028 [details]
fix

This patch fixes it, I think -- please try it and confirm.

It also fixes a number of other bugs with allow_user_rules, I think.

Now, there's an architectural question here; basically, there are a number of
bugs that require that finish_parsing() be called both after parsing the
system-wide config *and* the user configs, instead of just after the user
configs (which is what was previously done).  There's a side effect in terms of
the plugin API, though, which is that "finish_parsing_end" is now called
multiple times too.  I had to modify Rule2XSBody.pm to take this into account,
for example.

So, committers -- should we:

1. apply this patch and change the semantics of "finish_parsing_end" as noted
above;

2. add a new plugin API "user_rules_parsing_end", and preserve the old
"finish_parsing_end" semantics, or;

3. add a boolean flag to the "finish_parsing_end" API indicating if it's
user-rules or system rules that have finished parsing?
Comment 3 Justin Mason 2007-07-02 02:23:14 UTC
*** Bug 5542 has been marked as a duplicate of this bug. ***
Comment 4 Daryl C. W. O'Shea 2007-07-04 11:55:04 UTC
For me #1 is out, I've yet to decide between #2 or #3.
Comment 5 Justin Mason 2007-07-07 11:18:49 UTC
I think I'm leaning towards #2...
Comment 6 Michael Parker 2007-07-07 11:34:04 UTC
My vote is #2.
Comment 7 Daryl C. W. O'Shea 2007-07-07 12:43:14 UTC
Yeah, #2 is good, #3 has the same consequences as #1 for anyone who doesn't
check for a new flag.
Comment 8 Justin Mason 2007-07-12 08:35:02 UTC
Created attachment 4045 [details]
redone fix

here's a new patch that takes option #2, adding a new plugin API,
"user_conf_parsing_end", which is now called after the user config
file is read (allow_user_rules or not).

I also added an implementation in the REplaceTags plugin, since it
may need to be called in the user-rules case.
Comment 9 Justin Mason 2007-07-12 08:38:19 UTC
moving back to 3.2.2, in case we can get it reviewed in time.

checked into trunk:

: jm 182...; svn commit -m "bug 5449: allow_user_rules causes Rule2XSBody plugin
to emit spurious warnings; fix.  also, add a new 'user_conf_parsing_end' plugin
hook, which is called after the per-user configuration is parsed"
Sending        lib/Mail/SpamAssassin/Conf/Parser.pm
Sending        lib/Mail/SpamAssassin/Conf.pm
Sending        lib/Mail/SpamAssassin/Plugin/Check.pm
Sending        lib/Mail/SpamAssassin/Plugin/ReplaceTags.pm
Sending        lib/Mail/SpamAssassin/Plugin.pm
Sending        lib/Mail/SpamAssassin.pm
Transmitting file data ......
Committed revision 555664.
Comment 10 Sidney Markowitz 2007-07-18 13:03:52 UTC
+1
Comment 11 Justin Mason 2007-07-19 09:32:38 UTC
btw, if anyone wants to put out a 3.2.2, this can be deferred for 3.2.3 no
problem...
Comment 12 Daryl C. W. O'Shea 2007-07-23 01:41:54 UTC
sure, +1
Comment 13 Justin Mason 2007-07-23 03:23:20 UTC
thanks - applied to 3.2.2.

Sending        lib/Mail/SpamAssassin/Conf/Parser.pm
Sending        lib/Mail/SpamAssassin/Conf.pm
Sending        lib/Mail/SpamAssassin/Plugin/Check.pm
Sending        lib/Mail/SpamAssassin/Plugin/ReplaceTags.pm
Sending        lib/Mail/SpamAssassin/Plugin.pm
Sending        lib/Mail/SpamAssassin.pm
Transmitting file data ......
Committed revision 558682.