[PATCH xfree86] Signed-off-by: Oleh Nykyforchyn <oleh.nyk at gmail.com>

Oleh Nykyforchyn oleh.nyk at gmail.com
Mon May 23 07:26:44 PDT 2011


On Mon, 23 May 2011 05:54:55 -0700
Dan Nicholson <dbn.lists at gmail.com> wrote:

> 
> The whole reason why the current setup is weird is that it's
> completely implicit what type of matching happens in each statement.
> MatchProduct is string comparison (case sensitive) while
> MatchDevicePath is a path pattern. 

I agree that this is a problem. Nobody who has not read the code can not know
that for Product and Vendor we look for a substring, for DevicePath, PnPID
and USBID a path pattern is matched etc, although these choices probably
are optimal. My suggestion is the following:

1) preserve the existing behaviour, but clarify it in docs, including man page;

>In your suggestion, how is the
> regex specified? If you say another sentinel character, how is that
> less complex than adding an argument to specify what the other string
> means? We're again making up our own syntax.

2) [already posted, but repeated]
BTW, if we adopt two modes: simple |-separated sequence and regex, we don't
even need an optional argument. Consider e.g. a string of the form "|regex|".
It is useless in the simple mode, hence regex is recognized and two |-s are dropped.
Syntax for regex inside, e.g., can be compatible with regex library, so we do not
invent anything. People who do not use new regex syntax simply do not notice anything.

Of course, there is also nothing bad with optional "regex" keyword,
I am just not sure that "strcmp", "strstr" etc are necessary. BTW, somebody can also
want to mix "strstr" and "strcmp" in one pattern sequence, then an optional argument
also becomes a sequence, and so on.

What do You think about such an approach?

Oleh


More information about the xorg-devel mailing list