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

Mol, Xavier (SCC) xavier.mol at kit.edu
Mon Nov 30 07:32:02 UTC 2015


Hello David,



thank you very much for looking into this (even more so since I gave up on it already)! J I'm quite relieved, that this was not an 
issue created by my own stupidity.



Ciao,

Xavier.



From: David Lutterkort [mailto:lutter at watzmann.net]
Sent: Thursday, November 26, 2015 3:11 AM
To: Mol, Xavier (SCC)
Cc: Dominic Cleal; augeas-devel at redhat.com
Subject: Re: [augeas-devel] Inconsistent matching of multiple predicates (involving last/position)



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/20151130/f29bde32/attachment.htm>
-------------- 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/20151130/f29bde32/attachment.p7s>


More information about the augeas-devel mailing list