Bug 6560 - Network #testrules shouldn't be auto-promoted!
Summary: Network #testrules shouldn't be auto-promoted!
Status: RESOLVED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: RuleQA (show other bugs)
Version: SVN Trunk (Latest Devel Version)
Hardware: PC Linux
: P2 critical
Target Milestone: Undefined
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-23 07:17 UTC by Warren Togami
Modified: 2011-06-27 22:30 UTC (History)
2 users (show)



Attachment Type Modified Status Actions Submitter/CLA Status
proposed fix patch None Karsten Bräckelmann [HasCLA]

Note You need to log in before you can comment on or make changes to this bug.
Description Warren Togami 2011-03-23 07:17:24 UTC
Please see Bug #6220 where somehow a sandbox file beginning with "#testrules" had all six of its network rules auto-promoted into sa-update.

http://svn.apache.org/repos/asf/spamassassin/trunk/rulesrc/sandbox/smf/30_bug_6220_sem.cf

This bug is to investigate and fix whatever caused it to ignore "#testrules".
Comment 1 Karsten Bräckelmann 2011-03-23 14:45:02 UTC
The problem is in build/mkupdates/listpromotable, starts around line 207, see the following 20 lines. Also related, bug 5545.

The following few lines of comments fully explain the logic.

    # all of these tflags force publication;
    # include "net", since otherwise this script has to be aware [...]

  # rule was from a file marked with "#testrules" (bug 5545)
  # note: this is after "tflags publish" support, so you can override
  # it on a rule-by-rule basis anyway

Of course, the rules autopromoted unintentionally are net rules.


Suggest the following change in the autopromotion / exclusion logic.

* ONLY tflags publish comes first and can actually override #testrules.
* Then chicken out, if #testrules has been set.
* Last, check for the other tflags as currently done early.

* Go on with the rest of the autopromotion magic...
Comment 2 Warren Togami 2011-03-23 16:11:29 UTC
NOTE: The only reason #testrules was used in this particular sandbox file was Bug #6527 where "tflags nopublish" not only excluded it from auto-promotion but also from nightly masscheck.
Comment 3 Karsten Bräckelmann 2011-03-23 16:32:24 UTC
Created attachment 4858 [details]
proposed fix

This rather trivial patch moves tflags (userconf|learn|net) handling *after* checking for #testrules. Only an explicit tflag publish can override testrules.

Please note that the patch is entirely UNTESTED. Don't have an environment to run the code. Please review carefully. ;)
Comment 4 Karsten Bräckelmann 2011-03-23 16:38:05 UTC
Didn't commit to trunk either, since I don't know which branch actually is used for autopromotion. Doe this need to be committed to both, 3.3 and trunk?
Comment 5 Warren Togami 2011-03-23 17:12:00 UTC
I looked into if this change will cause anything else unexpected.

http://svn.apache.org/repos/asf/spamassassin/trunk/rulesrc/sandbox/jm/20_bug_5984.cf

RCVD_IN_BRBL_LASTEXT was never meant to escape testing? =)
Comment 6 Daryl C. W. O'Shea 2011-03-24 01:07:38 UTC
(In reply to comment #4)
> Didn't commit to trunk either, since I don't know which branch actually is used
> for autopromotion. Doe this need to be committed to both, 3.3 and trunk?

autopromotion runs off of trunk.  The code will update itself to the latest rev.  So just commit to trunk.  If it breaks its no big deal.  Rule updates are disabled.  Try to do it ASAP though just in case it breaks so that it can be fixed before the weekly mass-check is tagged.
Comment 7 Warren Togami 2011-03-24 01:28:29 UTC
May I propose that we insert a temporary "short-circuit" into the auto-update mechanism to allow for manual inspection prior to it being pushed live?

Let all but the DNS update happen then post the URL somewhere public so many eyes can download and examine diffs from the previous rules.
Comment 8 Karsten Bräckelmann 2011-03-24 18:56:00 UTC
(In reply to comment #6)
> autopromotion runs off of trunk.  The code will update itself to the latest
> rev.  So just commit to trunk.  If it breaks its no big deal.  Rule updates are
> disabled.  Try to do it ASAP though just in case it breaks so that it can be
> fixed before the weekly mass-check is tagged.

Great, let me break it then. :)

Sending listpromotable
Committed revision 1085175.

  Bug 6560, specifically declared #testrules may only be overridden on a
  rule-by-rule basis by tflags publish, not tflags net.


Keeping this bug open, until the untested code at least has proven not to break the process.


(In reply to comment #7)
> May I propose that we insert a temporary "short-circuit" into the auto-update
> mechanism to allow for manual inspection prior to it being pushed live?

You may, though I suggest to do it somewhere else and not hijack this #testrules bug. ;)  The dev list seems appropriate for kicking around ideas.
Comment 9 Darxus 2011-06-27 21:59:03 UTC
Daryl provided a generated but un-released sa-update for testing this:

http://mail-archives.apache.org/mod_mbox/spamassassin-dev/201105.mbox/%3C4DD482AD.10304@dostech.ca%3E

Warren thought he tested it, but was apparently looking at the wrong tarball (said in IRC today).  Kevin also tested it, but presumably didn't specifically look for the SEM rules that were being a problem.  

(In case anybody else has been thinking "Wait, didn't we test this?")
Comment 10 Kevin A. McGrail 2011-06-27 22:06:03 UTC
(In reply to comment #9)
> Daryl provided a generated but un-released sa-update for testing this:
> 
> http://mail-archives.apache.org/mod_mbox/spamassassin-dev/201105.mbox/%3C4DD482AD.10304@dostech.ca%3E
> 
> Warren thought he tested it, but was apparently looking at the wrong tarball
> (said in IRC today).  Kevin also tested it, but presumably didn't specifically
> look for the SEM rules that were being a problem.  
> 
> (In case anybody else has been thinking "Wait, didn't we test this?")

As they were flagged as T_ which is what the cf file said to do, I wouldn't have flagged it as wrong.  A few DNS queries don't bug me and it won't swing ham/spam scores excep by almost negligible amounts.
Comment 11 Warren Togami 2011-06-27 22:09:03 UTC
(In reply to comment #10)
> 
> As they were flagged as T_ which is what the cf file said to do, I wouldn't
> have flagged it as wrong.  A few DNS queries don't bug me and it won't swing
> ham/spam scores excep by almost negligible amounts.

They are wrong as in we never intended for any T_ rule to become active?
Comment 12 Kevin A. McGrail 2011-06-27 22:30:53 UTC
(In reply to comment #11)
> (In reply to comment #10)
> > 
> > As they were flagged as T_ which is what the cf file said to do, I wouldn't
> > have flagged it as wrong.  A few DNS queries don't bug me and it won't swing
> > ham/spam scores excep by almost negligible amounts.
> 
> They are wrong as in we never intended for any T_ rule to become active?

#Testrules and nopublish are not the same thing.  I worry people are confusing the two OR the code doesn't implement what people thought it implemented. 

Considering this bug resolved and outstanding issues duplicate of bug 6527.