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

Richard W.M. Jones rjones at redhat.com
Tue Dec 9 10:00:53 UTC 2014


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 ...

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the augeas-devel mailing list