Russell Coker writes:
> On Sun, 14 Oct 2001 21:34, Greg Ward wrote:
> > > 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.
Cough! As if I know! The regular subexpression code was contributed by
Chris Rankin. I assume he tested it, since I think he used it. Check
the devfsd.conf(5) man page for examples of regular subexpression use.
In that page it tells you what you need to know to get it working. I
won't tell you the answer, because I want you to read the manual :-)
> > > 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...
No, just use regular subexpressions, which should work.
Regards,
Richard....
Permanent: rgooch@xxxxxxxxxxxxx
Current: rgooch@xxxxxxxxxxxxxxx
|