# Re: [augeas-devel] sudoers lens not working

• From: Raphaël Pinson <raphink gmail com>
• To: David Lutterkort <lutter redhat com>
• Cc: augeas-devel redhat com
• Subject: Re: [augeas-devel] sudoers lens not working
• Date: Fri, 20 Mar 2009 19:19:55 +0100

2009/3/20 David Lutterkort
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