[augeas-devel] Inconsistent matching of multiple predicates (involving last/position)
Mol, Xavier (SCC)
xavier.mol at kit.edu
Fri Aug 28 08:55:24 UTC 2015
Hello Augeas developers, Dominic,
I ran into a strange problem when match multiple predicates.
What file?
/etc/auto.master (unmodified default shipped with autofs-5.0.5-113.el6.x86_64, attached for reference to this mail)
What lens?
Automaster
What Augeas version?
augeas-1.0.0-10.el6.x86_64
What problem?
The Automaster lens uses a NULL label for the records of auto.master, which is why I try to find different ways of filtering them and found two (seemingly) equivalent methods (*). Yet, only one of them allows for further filtering using last() or position() (**). Reducing matches with other conditions seems fine, as far as I tested it, but I'm not sure, that I have covered all cases (***). Using a positive filter in the first step can be combined with last()/position() (4*).
I have consulted the Augeas wiki thoroughly and searched the GitHub issues as well as the devel mailing list archive for "multiple predicates" (which yielded https://www.redhat.com/archives/augeas-devel/2009-February/msg00093.html), but found nothing regarding this incident.
Did I overlook something or might this actually be a bug?
Best regards,
Xavier.
*)
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)
augtool> match $master/*[label() != '#comment'][position() = 2]
(no matches)
***)
augtool> match $master/*[label() != '#comment'][map = '-hosts']
/files/etc/auto.master/2 = /net
Yes, the result is the same without filtering comments first:
augtool> match $master/*[map = '-hosts']
/files/etc/auto.master/2 = /net
4*)
augtool> match $master/*[label() = '#comment'][position() = 1]
/files/etc/auto.master/#comment[1] = Sample auto.master file
augtool> match $master/*[label() = '#comment'][last()]
/files/etc/auto.master/#comment[13] = precedence.
****
Karlsruher Institute of Technology (KIT)
Steinbuch Centre for Computing (SCC)
B. Sc. Xavier Mol
GridKa Storage Administrator and Support Manager
Hermann-von-Helmholtz-Platz 1
Geb. 449
76344 Eggenstein-Leopoldshafen
Phone: +49 721 608 23041
Email: xavier.mol at kit.edu
www.kit.edu
KIT - University of the State of Baden-Württemberg and National Large-scale Research Center of the Helmholtz Association
"Since 2010, the KIT has been certified as a family-friendly university."
****
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6401 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20150828/23619949/attachment.p7s>
More information about the augeas-devel
mailing list