<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.E-MailFormatvorlage17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hello David,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>thank you very much for looking into this (even more so since I gave up on it already)! </span><span style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'>J</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> I'm quite relieved, that this was not an issue created by my own stupidity.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Ciao,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Xavier.<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=DE style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=DE style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> David Lutterkort [mailto:lutter@watzmann.net] <br><b>Sent:</b> Thursday, November 26, 2015 3:11 AM<br><b>To:</b> Mol, Xavier (SCC)<br><b>Cc:</b> Dominic Cleal; augeas-devel@redhat.com<br><b>Subject:</b> Re: [augeas-devel] Inconsistent matching of multiple predicates (involving last/position)<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><div><div><p class=MsoNormal>Sorry for the very late reply ...<br><br>On Fri, Aug 28, 2015 at 5:24 AM, Mol, Xavier (SCC) <<a href="mailto:xavier.mol@kit.edu" target="_blank">xavier.mol@kit.edu</a>> wrote:<o:p></o:p></p><p class=MsoNormal>Hi again,<br><br>for some reason I cannot explain, now a couple of things work suddenly as expected:<br><br>augtool> match $master/*[last()]<br>/files/etc/auto.master/3 = +<br>augtool> match $master/*[position() = 2]<br>/files/etc/auto.master/#comment[1] = Sample auto.master file<br>augtool> match $master/*[label() != '#comment'][last()]<br>/files/etc/auto.master/3 = +<br><br><br>Though not everything does...<br><br>augtool> match $master/*[label() != '#comment']<br>/files/etc/auto.master/1 = /misc<br>/files/etc/auto.master/2 = /net<br>/files/etc/auto.master/3 = +<br>augtool> match $master/*[label() != '#comment'][position() = 2]<br>  (no matches)<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'>This is a bona fide bug - "match $master/*[label() != '#comment'][2]" should absolutely return the $master/2 node.<o:p></o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'>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')<o:p></o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'>I've put up <a href="https://github.com/hercules-team/augeas/pull/323">https://github.com/hercules-team/augeas/pull/323</a> that fixes that issue.<o:p></o:p></p></div><div><p class=MsoNormal>David<o:p></o:p></p></div></div></div></div></div></div></body></html>