> On 10/15/2009 10:12 PM, Michael Tautschnig wrote: > >> On 30.09.2009 09:02, Juergen Kahnert wrote: > >>> Hi, > >>> > >>> On Wed, Sep 30, 2009 at 03:06:41AM +0200, Darshaka Pathirana wrote: > >>>>>> ainsl -a $target/etc/sudoers "%adm ALL = NOPASSWD: /bin/su -[mp]" > >>>> Any help greatly appreciated. Thanks! > >>> try this as a quick workaround: > >>> > >>> ainsl -a $target/etc/sudoers '%adm ALL = NOPASSWD: /bin/su -[mp]' > >>> '^%adm ALL = NOPASSWD: /bin/su -.mp.$' > >> Thx very much. Figured that out a bit later (but was to lazy to post > >> it here). > >> > >> Nevertheless the question is: is it a mistake on my side? > >> > > > > I don't think so, I think it's a weakness in ainsl. And the \[ \] probably > > doesn't work either because the shell will strip off the \, you'll need > > something like \\[ or even \\\[. > > > > Thomas, shouldn't ainsl not escape anything while matching and instead use > > \Q > > and \E in the match operation to disable regexp specials? Of course, it > > should > > take care of ^ and $ and change that to ^\Q$line\E$. > > Any progress on this? >
I just noticed that there are several options that might be helpful, but probably not even -Q does exactly what you would want it to do. I tried to come up with a patch, but the sometimes-regular-expressions-in-LINE-are-escaped thing is so weird that I gave up. Sorry, Thomas, but this violates your beloved KISS principle in several ways. For example, using -Q without a pattern might give very strange results. ainsl takes a LINE and an optional PATTERN. Why not do it the straightforward way that PATTERN is a regular expression and LINE is always escaped using \Q, \E and anchored using ^ $ when used as a pattern? Are -q, -Q, -s just a series of historic hacks or are there actually good reasons for this set of options? Puzzled, Michael
pgp6WnW3MrZz1.pgp
Description: PGP signature