[augeas-devel] Inconsistent matching of multiple predicates (involving last/position)
Dominic Cleal
dcleal at redhat.com
Fri Aug 28 08:58:13 UTC 2015
On 28/08/15 09:50, Mol, Xavier (SCC) wrote:
> What Augeas version?
> augeas-1.0.0-10.el6.x86_64
This is quite old, it appears to have been fixed some time since.
> augtool> defvar master /files/etc/auto.master
> augtool> match $master/*[map]
> /files/etc/auto.master/1 = /misc
> /files/etc/auto.master/2 = /net
> /files/etc/auto.master/3 = +
> 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/*[map][last()]
> /files/etc/auto.master/3 = +
> augtool> match $master/*[map][position() = 2]
> /files/etc/auto.master/2 = /net
> augtool> match $master/*[label() != '#comment'][last()]
> (no matches)
On 1.4.0:
augtool> match $master/*[label() != '#comment'][last()]
/files/etc/auto.master/3 = +
> augtool> match $master/*[label() != '#comment'][position() = 2]
> (no matches)
augtool> match $master/*[label() != '#comment'][position() = 3]
/files/etc/auto.master/1 = /misc
augtool> match $master/*[label() != '#comment'][position() = 6]
/files/etc/auto.master/2 = /net
I'd guess position() is the position under the original node, not in the
filtered results (!= '#comment').
A git bisect would probably narrow down which commit fixed it, as I
can't remember now. If you need it fixed in el6, please file a BZ with
Red Hat.
--
Dominic Cleal
Red Hat Engineering
More information about the augeas-devel
mailing list