[augeas-devel] Is augeas weak for sysconfig files, or missing something?

Dominic Cleal dcleal at redhat.com
Sun Apr 1 14:46:45 UTC 2012


On 28/03/12 08:20, Michal Filka wrote:
> I believe that the problem is mainly because of quoting. You can have
> valid values in form: value (without quotes), "value", 'value'. If you
> want to describe that in augeas you have to do something like this: let
> entry = [ value ] | [ dels "\"" . value . dels "\"" ] | [ dels "'" . value
> . dels "'" ]. But this will not pass through put direction when parsing
> (augeas don't know which quoting to use by default). Only trick (which I
> know and which is used in Sysconfig.lns) is to define required values in
> value part of the patern (e.g. double quoted value has to contain space),
> but this leads to ignoring valid formats in get direction (see above
> example).
> 
> One possible solution is to introduce new primitive into augeas. Something
> like trim RE1 RE2 -> dels RE1 . store RE2 . dels RE1 with constraint that
> values deleted by dels has to match the pattern and be equal. Another
> approach would be introduce "default" branch into union (|). Something
> like, if you have lns = branch1 | branch2 | branch3 and some of them
> overlaps, than use first one for string which satisfies more than one
> branch.

We're certainly missing a tool to tackle quoting properly.  Lately we've
had bugs flagged up against the XML lens too as it can only support
double quotes.

There was a discussion last year with some ideas about how to build on
the square lens that Francis introduced, to create a new primitive
similar to your suggestion:
https://www.redhat.com/archives/augeas-devel/2011-November/msg00016.html

I don't know the history of Sysconfig, but it looks like it tries to
solve the problem in a different way to Shellvars.  Shellvars always
passes quotes back through to the user which makes their life harder,
but means it can parse more.  Sysconfig seems to try and strip them out.

-- 
Dominic Cleal
Red Hat Consulting
m: +44 (0)7817 878113




More information about the augeas-devel mailing list