[augeas-devel] Transform and "Lenses xx and xx could be used to load this file"

David Lutterkort lutter at watzmann.net
Fri Nov 4 18:48:44 UTC 2016

Hi Rich,

On Thu, Nov 3, 2016 at 7:27 AM, Richard W.M. Jones <rjones at redhat.com>

> However if the Augeas lens happens to contain that path already,
> things go wrong:
>   augtool> transform passwd incl /etc/passwd
>   augtool> load
>   # /etc/passwd is not parsed by the passwd lens
>   augtool> get /augeas/files/etc/passwd/error/message
>   /augeas/files/etc/passwd/error/message = Lenses @Passwd and passwd.lns
> could be used to load this file
> This is specifically a problem when libguestfs adds a call to
> aug_transform to cater for a file that is not covered by an existing
> lens, but then Augeas adds that file, and then we get the error above
> until libguestfs removes the call to aug_transform.  We cannot control
> when Augeas and libguestfs are released in different Linux distros.

That's a good point that I hadn't thought about before.

> There are workarounds for this involving fishing out the existing
> transform and working out if it covers the file or not, but that's
> pretty tedious.
> It seems to be that Augeas could be cleverer here and could just
> ignore the case where two identical transforms apply to the same file
> and DWIM.

I just put up a PR[1] that makes it ok for multiple transforms to handle
the same file as long as they use the same lens. I'll wait with making the
release that I was going to make today until I hear back from you - could
you make sure you run this patch through whatever Augeas-relevant tests you
have in libguestfs ? I want to make sure I don't have some unintentional
screwup in there that might break loading or saving where it used to work.
(and hearing back some time next week is  early enough; there's nothing
requiring a release be made right now)


[1] https://github.com/hercules-team/augeas/pull/425
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20161104/0696535b/attachment.htm>

More information about the augeas-devel mailing list