Russell Coker writes:
> On Tue, 1 Jan 2002 22:25, Richard Gooch wrote:
> > > Sometime in the last month or two, the syntax of regular expressions in
> > > devfsd as packaged in Debian woody has changed. It appears that
> > > escaping parentheses for their "special" regex-ish meaning is no longer
> > > necessary, ie. a bare paren is the same as in Perl or awk. I assume
> > > this change was deliberate and intentional; I certainly think it's the
> > > better syntax.
> > >
> > > However, the docs are lagging. devfsd.conf(5) has this example:
> > >
> > > LOOKUP
> > > ^\(\(ide\|scsi\)/host[0-9]\+/bus[0-9]\+/target[0-9]\+/lun[0-9]\+\)/part[0
> > >-9]\+$ EXECUTE /sbin/partx -a $mntpnt/\1/disc
> > >
> > > and the accompanying text says:
> > >
> > > Notice the use
> > > of regular expression substituation in the command "\1",
> > > corresponding to the first set of parentheses in the regu
> > > lar expression being matched (yes, the backslashes are
> > > syntactically necesary for the special meaning of the
> > > parentheses, the vertical bar and the plus sign).
> > >
> > > I assume this is just a doc bug, and that either Russell or Richard
> > > will see this and fix it (if they haven't already).
> >
> > IIRC, Russell has modified the expression handling code in Debian, to
> > support some other feature (I forget the details). This feature is
> > available in the mainline code, so I think Russell is planning to
> > remove the Debian hacks. In that case, the escaping of parenthesis is
> > still required.
>
> I changed exactly one thing, here's the relevant patch against devfsd.c:
> - if ( ( err = regcomp (&new->preg, name, 0) ) != 0 )
> + if ( ( err = regcomp (&new->preg, name, REG_EXTENDED) ) != 0 )
>
> This makes it use extended regular expressions not basic regular expressions.
>
> I originally did that because I couldn't get the \1 operator to work without
> it. However even after discovering that it's possible to use \1 with basic
> regular expressions I did not remove it because it seems generally useful,
> and the default config files that currently ship with the Debian packages (of
> which many people are using slightly modified versions) take advantage of
> extended RE functionality.
>
> I have included below some sections of the relevant man page.
> Perhaps you should consider making the default operation of devfsd
> use extended RE's?
Hm. Will anything break? Any old RE's that will now fail? I don't want
to bust people's config files.
I've updated my tree to use extended RE's and modified the man page
to remove the backslashes for '(', ')', '+' and '|'. If someone sees a
problem with this, speak now.
Regards,
Richard....
Permanent: rgooch@xxxxxxxxxxxxx
Current: rgooch@xxxxxxxxxxxxxxx
|