[augeas-devel] Augeas and likewise-open

David Lutterkort lutter at redhat.com
Tue Sep 29 17:29:09 UTC 2009


Hi Marcello,

On Mon, 2009-09-28 at 23:53 +0200, Marcello de Sousa wrote:
> I wanted to use augeas to manage my /etc/krb5.conf but the standard krb5.aug
> lens doesn't work after likewise-open modifies it.

Do you have some before/after examples - I am not familiar with
likewise-open at all.

> The lens should support white spaces in the value field, and a "kdc" section
> (present on RH4).

The kdc section is fine to add; allowing spaces in values requires a
little more finesse, and I am not sure what exactly the krb5 libs allow
there. But this change is problematic:

> -let value = store /[^;# \t\n{}]+/
> +let value = store /[^;#\t\n{}]+/
>  let entry (kw:regexp) (sep:lens) (comment:lens)
>      = [ indent . key kw . sep . value . (comment|eol) ] | comment

since sep matches /[ \t]*=[ \t]*/: it's now not clear whether whitespace
after the '=' should be part of 'sep', and therefore not appear in the
tree, or be part of 'value'.

I suspect you'll need a more complicated regexp that essentially says
'allow whitespace inside a value', i.e. something like

        let value = store /[^;# \t\n{}]|[^;# \t\n{}][^;#\t\n{}]*[^;# \t\n{}]/
        
this becomes a little clearer with abbreviations for the 'allow space'
and 'no space' regexps:

        let value =
          let n = /[^;# \t\n{}]/ in (* no space allowed *)
          let s = /[^;#\t\n{}]/ in  (* space allowed *)
          store (n | n . s* . n)
        
As for how to submit: you should modify the tests in
tests/test_krb5.conf to add something that exercises your lens changes
and run that through 'augparse -I some_dir/
lenses/tests/test_krb5.conf' (where some_dir is where your modified
krb5.conf lives)

As for what to submit: ideally you'd use 'git format-patch' and 'git
send-email', but a unified diff is good enough for this change.

David





More information about the augeas-devel mailing list