> so virtually nothing should have changed, besides the timestamps on > automaster.aug. I lied, something else did indead change: the last line of /etc/auto.master! If it is not empty or a sole '#' character, I can use last() as secondary predicate successfully. Though position() will still fail either way.
Best regards, Xavier. > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Mol, Xavier (SCC) > Sent: Friday, August 28, 2015 2:24 PM > To: Dominic Cleal > Cc: [email protected] > Subject: Re: [augeas-devel] Inconsistent matching of multiple predicates > (involving last/position) > > 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) > > > Yes, I did edit a copy of automaster.aug, just to experiment with a labeled > mount point, but I moved back the original, so virtually nothing > should have changed, besides the timestamps on automaster.aug. Is there maybe > some kind of cacheing in Augeas, which could have > updated just now (instead of when I installed the new packages)? > > Best regards, > Xavier. > > > -----Original Message----- > > From: [email protected] > > [mailto:[email protected]] On Behalf Of Mol, Xavier (SCC) > > Sent: Friday, August 28, 2015 1:58 PM > > To: Dominic Cleal > > Cc: [email protected] > > Subject: Re: [augeas-devel] Inconsistent matching of multiple predicates > > (involving last/position) > > > > Hi Dominic, > > > > I've updated Augeas, but for me the results stay the same... > > > > augtool> match /augeas/version > > /augeas/version = 1.4.0 > > augtool> match $master/*[label() != '#comment'][map] > > /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) > > augtool> match $master/*[label() != '#comment'][last()] > > (no matches) > > > > > > Maybe I misunderstand how to use last()/position() in the first place, > > because even this fails: > > > > augtool> match $master/*[last()] > > (no matches) > > augtool> match $master/*[position() = 1] > > (no matches) > > > > > > This should return the very last and first node, regardless whether it’s a > > comment or a mapping, right? Though it may work, if I mess > > around with the lens and introduce a label for the mount points. > > > > augtool> print $master/*[label() != '#comment'] > > /files/etc/auto.master/mount[1] = "/misc" > > /files/etc/auto.master/mount[1]/map = "/etc/auto.misc" > > /files/etc/auto.master/mount[2] = "/net" > > /files/etc/auto.master/mount[2]/map = "-hosts" > > /files/etc/auto.master/mount[3] = "+" > > /files/etc/auto.master/mount[3]/map = "auto.master" > > augtool> match $master/mount[last()] > > /files/etc/auto.master/mount[3] = + > > augtool> match $master/mount[position() = 2] > > /files/etc/auto.master/mount[2] = /net > > > > > > > > I'd guess position() is the position under the original node, not in the > > > > filtered results (!= '#comment'). > > Then this would qualify as a bug, correct? Quote from the Augeas wiki > > "Multiple predicates are evaluated by filtering node sets > > successively". > > > > match $master/*[label() != '#comment'][position() = 2] > > > > _in general_ should not yield the same result as > > > > match $master/*[position() = 2][label() != '#comment'] > > > > which is what you assume position() does (the result will be the same only > > if the filter for comments has no effect, e.g. when both first > > nodes are no comment)? > > > > > > Best regards, > > Xavier. > > > > > -----Original Message----- > > > From: [email protected] > > > [mailto:[email protected]] On Behalf Of Mol, Xavier (SCC) > > > Sent: Friday, August 28, 2015 11:02 AM > > > To: Dominic Cleal > > > Cc: [email protected] > > > Subject: Re: [augeas-devel] Inconsistent matching of multiple predicates > > > (involving last/position) > > > > > > Thank you for your quick reply, Dominic! > > > > > > I'll see if I can update Augeas first. > > > > > > Best regards, > > > Xavier. > > > > > > > -----Original Message----- > > > > From: Dominic Cleal [mailto:[email protected]] > > > > Sent: Friday, August 28, 2015 10:58 AM > > > > To: Mol, Xavier (SCC) > > > > Cc: [email protected] > > > > Subject: Re: Inconsistent matching of multiple predicates (involving > > > > last/position) > > > > > > > > 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 > > > > > > > > > > > > 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
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ augeas-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/augeas-devel
