devfs
[Top] [All Lists]

Regex question

To: devfs@xxxxxxxxxxx
Subject: Regex question
From: Greg Ward <gward@xxxxxxxxxx>
Date: Sat, 13 Oct 2001 18:58:14 -0400
Sender: owner-devfs@xxxxxxxxxxx
User-agent: Mutt/1.3.22i
I'm a little unclear on the regex syntax used in devfsd.conf.  Or
rather, parentheses don't seem to be working for me, and I'm not sure if
it's my thick-headedness, inadequated docs, a real honest-to-goodness
bug.

Here's what I'm trying to do: whenever a "scsi/.*/cd" device is
registered, change the corresponding "generic" device to group "cdrom",
group writeable.  I would have *thought* that this would do the trick:

REGISTER        ^(scsi/.*/)cd$ EXECUTE chgrp cdrom \1/generic
REGISTER        ^(scsi/.*/)cd$ EXECUTE chmod 660 \1/generic

In fact, the Debian packaging of devfsd ships with an /etc/devfs/perms
that does basically this.

But it doesn't work.  As near as I can work out, that pattern is simply
never matched.  In fact, every pattern with parens in it has never
matched for me.  I tried doing this instead:

REGISTER        ^\(scsi/.*/\)cd$ EXECUTE chgrp cdrom \1/generic

with the same result, ie. nothing.  But if I change it to this:

REGISTER        ^scsi/host1/.*/cd$ EXECUTE chgrp cdrom 
scsi/host1/bus0/target0/lun0/generic
REGISTER        ^scsi/host1/.*/cd$ EXECUTE chmod 660 
scsi/host1/bus0/target0/lun0/generic

...it works fine.  That's gross, because it assumes my "SCSI" CD-ROM
(actually an IDE drive that is occasionally under the control of
ide-scsi) is always in the same place.  I don't like assumptions like
that -- they seem counter to the spirit of devfs.

Can someone tell me what the heck is wrong with my regexes-with-parens
above?  This is with kernel 2.4.12 and/or 2.4.10 (I've been bouncing
back and forth, I can't remember exactly what happened under which
kernel).  Debian "woody", devfsd 1.3.18-3.

Thanks --

        Greg
-- 
Greg Ward - geek                                        gward@xxxxxxxxxx
http://starship.python.net/~gward/
A day without sunshine is like night.

<Prev in Thread] Current Thread [Next in Thread>