On Tue, 2007-08-07 at 18:08 +0100, Arran Cudbard-Bell wrote:
Daniel Larsson wrote:
I've encountered an unintuitive behaviour in the users file processing . I wanted to do something similar to:
DEFAULT Some-Attr !* "", Other-Attr !* "" ...
I.e. if neither "Some-Attr" nor "Other-Attr" is present, it should match.
However, this doesn't work, as paircmp in valuepair.c immediately returns the result as soon as an operator "!*" is found in the check list. No other check items in the user entry is checked. This seems to apply to both 1.1 and 2.0 branches.
Before I try to patch this, is this intended for some reason?
In the users file, the top line conditions are evaluated in sequence until one evaluates to false. It doesn't matter which operators you use.
Yes, this was my understanding too, but tests with the !* operator indicated it didn't work this way. Looking at the code seemed to confirm this too (see the patch).
I actually find it quite helpful, and *more* intuitive that way, also saves on processing for a line which could never match ...
Really if you want to be doing anything complicated with conditions I would try the CVS head and look at 'man unlang'.