devfs
[Top] [All Lists]

Re: Regex question - maybe devfsd should use REG_EXTENDED

To: Greg Ward <gward@xxxxxxxxxx>
Subject: Re: Regex question - maybe devfsd should use REG_EXTENDED
From: Russell Coker <russell@xxxxxxxxxxxx>
Date: Mon, 15 Oct 2001 01:39:03 +0200
Cc: devfs@xxxxxxxxxxx
In-reply-to: <20011014153424.C954@cthulhu.mems-exchange.org>
References: <20011013185814.A1334@cthulhu.mems-exchange.org> <20011014124259.01F0834CF7@lyta.coker.com.au> <20011014153424.C954@cthulhu.mems-exchange.org>
Reply-to: Russell Coker <russell@xxxxxxxxxxxx>
Sender: owner-devfs@xxxxxxxxxxx
On Sun, 14 Oct 2001 21:34, Greg Ward wrote:
> > > 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.
>
> I hope you mean "tweaking the permssions of CD-ROM generic devices" was
> a mistake, not "having /etc/devfsd/devfs.conf include perms".  The perms
> file is a great idea!

No to both.

The mistake was ever writing a config file that blatantly didn't work.  The 
fact that (AFAIK) I only sent it to 3-4 people before discovering it is a 
relief.

> Anyways, I'm pretty sure the devfsd 1.3.18-3 package did include a perms
> file that tweaked the "generic" permissions whenever a "cd" device was
> registered.  Seems like a good idea to me, although maybe not one that
> should be in Debian installation by default.

No, it should be the default.  The Debian way is to setup default permissions 
for all devices that fit with the Debian scheme (groups cdrom and video etc).

> > 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...
>
> But the devfsd man page says:
>
>   REGULAR EXPRESSION SUBSTITUTION
>          Sections of the matched regular expression can be included
>          in an action.  Use \0  to  refer  to  the  entire  regular
>          expression matched, \1 to refer to the first parenthesized
>          subexpression, \2 to refer to the second, and so on.  (Use
>          \\ to include an actual backslash.)
>
> ...which I take to mean that
>
>   REGISTER ^foo.*bar$ EXECUTE chown luser $devname
>
> is exactly equivalent to all three of the following:
>
>   REGISTER ^(foo.*bar)$ EXECUTE chown luser $devname
>   REGISTER ^(foo.*bar)$ EXECUTE chown luser \0
>   REGISTER ^(foo.*bar)$ EXECUTE chown luser \1
>
> Is this true or not?  As near as I can tell, the real rule is: any
> regular expression with parentheses in it fails.

I don't know.  We'll have to wait for clarification from Richard I think.

> > 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
>
> But that doesn't do anything about the "generic" device that's created
> alongside the "cd" device, does it?  What I want is this: whenever a
> "scsi/.*/cd" device is registered, set the permissions of the "generic"
> device in the same file to "root.cdrom 0660".  I don't see a clean way
> to do this without having regexes that support paren matching, just like
> the devfsd man page says they do.

Right.  Maybe I should just recompile it with EXTENDED...

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