devfs
[Top] [All Lists]

Re: Regex question - maybe devfsd should use REG_EXTENDED

To: Greg Ward <gward@xxxxxxxxxx>, devfs@xxxxxxxxxxx
Subject: Re: Regex question - maybe devfsd should use REG_EXTENDED
From: Russell Coker <russell@xxxxxxxxxxxx>
Date: Sun, 14 Oct 2001 13:37:00 +0200
In-reply-to: <20011013185814.A1334@xxxxxxxxxxxxxxxxxxxxxxxxx>
References: <20011013185814.A1334@xxxxxxxxxxxxxxxxxxxxxxxxx>
Reply-to: Russell Coker <russell@xxxxxxxxxxxx>
Sender: owner-devfs@xxxxxxxxxxx
On Sun, 14 Oct 2001 00:58, Greg Ward wrote:
> 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.

That was a mistake, I don't think I ever uploaded that version to Debian, I 
hope that was only a test version.

Devfsd only uses basic regular expressions.  I have been thinking of enabling 
extended regex compilation, but have been hesitant to allow Debian users to 
create config files that won't work anywhere else...

> 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.

You could use the following (default for the next Debian package):
REGISTER ^ide/.*/cd$            PERMISSIONS root.cdrom  0660
REGISTER ^scsi/.*/cd$           PERMISSIONS root.cdrom  0660
REGISTER ^ide/.*/disc$          PERMISSIONS root.disk   0660
REGISTER ^ide/.*/part[0-9]*$    PERMISSIONS root.disk   0660
REGISTER ^scsi/.*/disc$         PERMISSIONS root.disk   0660
REGISTER ^scsi/.*/part[0-9]*$   PERMISSIONS root.disk   0660
REGISTER ^cciss/.*              PERMISSIONS root.disk   0660

> 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.

Kernel version doesn't matter for these things (as long as the kernel isn't 
inherantly buggy in this regard).

-- 
http://www.coker.com.au/bonnie++/     Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/       Postal SMTP/POP benchmark
http://www.coker.com.au/projects.html Projects I am working on
http://www.coker.com.au/~russell/     My home page


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