[augeas-devel] escaping special characters in the path sent to aug_get()

Richard W.M. Jones rjones at redhat.com
Wed Dec 10 11:05:49 UTC 2014


On Tue, Dec 09, 2014 at 10:00:53AM +0000, Richard W.M. Jones wrote:
> On Fri, Dec 05, 2014 at 01:02:17PM -0500, Laine Stump wrote:
> > One person suggested creating an augeas variable whose value was the
> > contents of intf, then referencing that variable in the path sent to
> > aug_match(); unfortunately, having a path string like this:
> > 
> >     /files/sys/class/net/$interface/address/content
> > 
> > seems to never work. For that matter, defining a variable that contains
> > the entire path, then calling aug_get(aug, "$interface", &mac) doesn't
> > even do what I want - variable substitution does work when the *entire
> > path string* is "$variableName", but the xpath-like evaluation still
> > takes place, so the special characters are still interpreted and acted on.
> 
> Reading the documentation for aug_defvar it seems that I was wrong
> about how that works.  It parses and evaluates the path parameter.
> 
> However it would be nice to make this work, so I propose:
> 
>   aug_defconst (aug, const char *name, const char *value);
> 
> Instead of evaluating the 'value', this would simply add
> (name, T_STRING value) to aug->symtab, thus doing no parsing
> and requiring no escaping.
> 
> I'll see if I can implement something like this and if it works ...

Or I would do if the Augeas/pathx code didn't make my head hurt.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the augeas-devel mailing list