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

Michal Filka michal.filka at suse.cz
Fri Apr 13 11:27:03 UTC 2012


On Fri, 13 Apr 2012 00:27:27 +0200, David Lutterkort <lutter at redhat.com>  
wrote:

> On Wed, 2012-03-28 at 13:27 +0200, Michal Filka wrote:
>> I don't understand one thing. Why is sysconfig.aug present when it
>> contains such bugs and can be replaced by shellvars.aug?
>
> As Dominic said, Sysconfig came about as a simplified Shellvars lens
> that would strip quotes out - not as successfully as one might hope, as
> you've discovered.
>
> I looked at it a while ago, and haven't figured out a proper fix yet,
> either. There seem to be two options on how to tackle the problem of
> parsing and stripping the quotes off a string:
>
>      1. Enhance the square lens: right now 'square RE LENS' is roughly
>         the same as 'key RE . LENS . del RE STR', with the constraint
>         that key and del operate on exactly the same string; we could
>         change it so that it would become 'square L1 L2 L3' equivalent
>         to 'L1 . L2 . L3' and the constraint that L1 and L3 operate on
>         identical strings - I haven't convinced myself that that will
>         address all the quoting issues
>      2. Add a 'quoted' lens primitive, roughly equivalent to the
>         tortuous Sysconfig.assign, but written in C. The question is: do
>         we need to worry about differences in quoted string syntax ? Can
>         we just implement Bash syntax ? Or will we need variants for
>         other string syntaxes ?
>
In fact, I'm not sure that removing quotes is meaningfully possible using  
augeas.

Example:
	VAR_1="a\"b\"c"
	VAR_2='a\"b\"c'

then expected values are:
	echo $VAR_1 ---> a"b"c
	echo $VAR_2 ---> a\"b\"c

if augeas removes quoting and do not unescape the value, then there is no  
chance to determine correct value in app (app will see a\"b\"c for above  
example and cannot know if it should remove '\' or not)

So, it would be nice to have a "tool" which can transform qvq -> v on q's  
value basis (e.g. for parsing C++ / XML like block comments or something  
like this), but it won't help to sysconfig or generally to any file which  
uses quoting and escaping together, because in such case you need bigger  
hammer.

Michal Filka




More information about the augeas-devel mailing list