[augeas-devel] Match trees on labels and values

David Lutterkort lutter at redhat.com
Mon Aug 31 22:09:38 UTC 2009


One of the deficiencies of the way we do tree matching is that it wasn't
possible to write a lens that strips quotes and adds them to new entries
when needed.

This series of patches fixes that; for an example, see 5/6. The meat of
this changeset is in 4/6, where we cleverly encode the labels and values of
one level in the tree into a string and match it against an equally clever
regexp, built from the label and value regexps of the lens.

To make this construct work, we have to restrict the letters that can be
used in a value - we do that automatically and behind the scenes by
removing the characters \001 to \004 from the alphabet of any regexp used
in a store. The alternative, requiring that the user never uses a regexp
that can match one of these characters in a store seems less palatable,
since it would require that every 'store /[^ \t\n]/' gets rewritten as
'store /[^\001-\004 \t\n]/'

I'd like to get rid of that kind of surgery eventually, but it would
require that we'd switch to a bigger internal character set, both for libfa
and the regexp matcher, like Unicode. Given the unpleasantness of the
gnulib matcher when it comes to handling these things, we'd have to
implement our own regexp matcher.

David




More information about the augeas-devel mailing list