[augeas-devel] sudoers lens not working

Raphaël Pinson raphink at gmail.com
Fri Mar 20 18:19:55 UTC 2009


2009/3/20 David Lutterkort <lutter at redhat.com>

> On Fri, 2009-03-20 at 17:29 +0100, Raphaël Pinson wrote:
> > I'm actually guessing that even something like
> >
> > Def\
> > aults  env_k\
> > eep = "COLORS DISPLAY HOSTNAME"
> >
> > might work with the official parser, while Augeas has absolutely no
> > way (at least as it is today) to understand that "Def\\\naults"
> > actually stands for a multiline "Defaults" entry.
>
> The problem with processing this is that we also have to be able to
> write the file out exactly the way it was when we read it.
>
> So if we allowed both 'Defaults' and 'Def\\\naults' to result in a tree
> node with label 'Defaults' we'd have no way to know which of those
> possibilities to write out.
>
> >         Is this expected behaviour, or should I file a bug report?
>
> Definitely file a bug for this.
>
> > As it is, it is the expected behaviour of the lens because I found no
> > workaround for this. You could file a bug, although there is
> > absolutely no garantee that I can fix this. In the best situation I
> > can think of, I could add "\" and "\n" as authorized characters within
> > value fields, so they would appear as such in the value.
>
> Another option would be to store such multiline strings as one line per
> node, i.e. we can either do something like
>
>        { "Defaults"
>           { "env_keep" = "line1\\\nline2\\\n" } }
>
> or
>
>    { "Defaults"
>       { "env_keep"
>         { "line" = "line1" }
>         { "line" = "line2" } } }
>

> Any preferences for one or the other ?


I find the second one clearer to understand (this is kind of what I had
proposed for logrotate, too), but I see a problem with it, which is that
having a  "line" sublevel makes field heavier, when most of the time they'll
only have one line.



> We could also special case
> env_keep and parse it into something like this (completely obscuring
> continuation lines):
>
>   { "Defaults"
>     { "env_keep"
>       { "var" = "COLORS" }
>       { "var" = "DISPLAY" }
>       { "var" = "HOSTNAME" }
>       ... } }


Afaik, I gave up parsing the contents of Defaults because it was pretty
complex. It could be worth giving it another try though.


Raphaël
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20090320/1047fd9a/attachment.htm>


More information about the augeas-devel mailing list