On 14 October 2001, Russell Coker said:
> > 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!
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.
> 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.
> 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.
Greg
--
Greg Ward - programmer-at-large gward@xxxxxxxxxx
http://starship.python.net/~gward/
Support bacteria -- it's the only culture some people have!
|