[augeas-devel] Inconsistent matching of multiple predicates (involving last/position)

David Lutterkort lutter at watzmann.net
Thu Nov 26 02:10:58 UTC 2015


Sorry for the very late reply ...

On Fri, Aug 28, 2015 at 5:24 AM, Mol, Xavier (SCC) <xavier.mol at kit.edu>
wrote:

> Hi again,
>
> for some reason I cannot explain, now a couple of things work suddenly as
> expected:
>
> augtool> match $master/*[last()]
> /files/etc/auto.master/3 = +
> augtool> match $master/*[position() = 2]
> /files/etc/auto.master/#comment[1] = Sample auto.master file
> augtool> match $master/*[label() != '#comment'][last()]
> /files/etc/auto.master/3 = +
>
>
> Though not everything does...
>
> augtool> match $master/*[label() != '#comment']
> /files/etc/auto.master/1 = /misc
> /files/etc/auto.master/2 = /net
> /files/etc/auto.master/3 = +
> augtool> match $master/*[label() != '#comment'][position() = 2]
>   (no matches)
>

This is a bona fide bug - "match $master/*[label() != '#comment'][2]" should
absolutely return the $master/2 node.

What's going wrong is that the tree has a bunch of 'hidden' nodes (nodes
whose label is NULL); they weren't being suppressed properly during the
match; in that last match, we actually matched such a hidden node, but when
Augeas goes to print the result it acts as if there was no node (hence the
name 'hidden')

I've put up https://github.com/hercules-team/augeas/pull/323 that fixes
that issue.

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20151125/1e4f9341/attachment.htm>


More information about the augeas-devel mailing list