[patch] Fix invalid cache generation when there are empty <match /> rules

Sjoerd Simons sjoerd at luon.net
Sat Dec 22 13:49:46 PST 2007


On Sat, Dec 22, 2007 at 09:46:59PM +0100, Danny Kukawka wrote:
> On Samstag, 22. Dezember 2007, Sjoerd Simons wrote:
> > Hi,
> >
> >   See attached patch. Ok to commit ? :)
> 
> Wasn't this already fixed by commit #111326d934c783716582eb3d4af1bc992421109c 
> or is there an other problem? 

Well.. I think you fixed another symptom of the same problem. Actually i'm
reasonably sure your fix isn't needed anymore after my patch.

Particularity our bugreports all revolved around the ``DIE(("Rule is NULL on
jump"));'' in rules_match_and_merge_device being hit.

To be more precise. A match rule in the create_cache is saved in two stages.

0: store_rule saves the rule struct in the cache
1: set_jump_position sets the jump position of a match rule.

Now normally, the start of a rule within a match triggers store_rule to be
called for the match. Now with an empty match this doesn't happen, so one of
the two following cases happens:

  - The empty match is the final rule in a file. Which means store_rule is
    never called for that match rule. Thus you end up with an completely empty
    rule apart from the the jump_position. Which is what your patch worked
    around.

  - Their are other rules after the empty match. Which means store_rule is
    called by the rule _after_ the empty match.. Which in turn means it will
    overwrite jump_position with 0. Thus triggering the DIE.

Now with my patch the actual cause of these issues should be fixed. Tbh the
default case should probably be a DIE too. As it's an indication of something
being broken in the cache and you can't be sure that di_jump will actually do
something usefull

  Sjoerd
-- 
If you are smart enough to know that you're not smart enough to be an
Engineer, then you're in Business.


More information about the hal mailing list