rule verification

Alexander E. Patrakov patrakov at ums.usu.ru
Tue May 2 22:16:34 PDT 2006


Archaic wrote:
> On Wed, May 03, 2006 at 10:02:48AM +0600, Alexander E. Patrakov wrote:
>> KERNEL=="capi", NAME="capi20",  SYMLINK="isdn/capi20"
>> KERNEL=="capi*", NAME="capi/%n", GROUP="dialout"
>>
>> Won't the second rule match the bare "capi" device and thus hide the result 
>> of the first one?
> 
> At one time it was (or at least was believed) that the 1st rule to match
> won. In that is still true, then the above construct makes sense. If it
> isn't true, then what order are the rules processed in?

The code (sorry, no better documentation yet):

         /* look for a matching rule to apply */
         udev_rules_iter_init(rules);
         while (1) {
                 rule = udev_rules_iter_next(rules);
                 if (rule == NULL)
                         break;

                 if (name_set && rule->name.operation != KEY_OP_UNSET) {
                         dbg("node name already set, rule ignored");
                         continue;
                 }

                 dbg("process rule");
                 /* The rest of processing goes here, snipped */
         }

So: for NAME, the first rule wins (but later rules produce dbg messages). For 
the rest of attributes, the last rule wins, unless the ":=" operator is used.

Therefore, my initial worrying was wrong, the capi rules seem to be OK (except 
for the warning about node name already set). But, I cannot verify this 
directly. Just in case, I propose to modify the second rule to:

KERNEL=="capi?*", NAME="capi/%n", GROUP="dialout"

> 
> The new tarball is here:
> http://downloads.linuxfromscratch.org/udev-config-20060502.tar.bz2

The firmware rule is duplicated in 26- and 27- files.

-- 
Alexander E. Patrakov



More information about the lfs-dev mailing list