[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[augeas-devel] [Augeas] #56: last()+1 doesn't behave very logically



#56: last()+1 doesn't behave very logically
---------------------+------------------------------------------------------
 Reporter:  raphink  |       Owner:  lutter
     Type:  defect   |      Status:  new   
 Priority:  minor    |   Milestone:  next  
Component:  Augeas   |     Version:  devel 
 Keywords:           |  
---------------------+------------------------------------------------------
 ...or maybe it's me who is not very logical. This is a bit similar to the
 issue I reported some time ago about double conditions on a node where
 "[field = 'value'][field2 = 'value2']" was to be matched one after the
 other, the second condition acting to refine the first.

 In this new case, I'm using "last()+1" to insert a new node. Here is what
 happens:
 {{{
 augtool> print /augeas/load/Dput/
 /augeas/load/Dput
 /augeas/load/Dput/lens = "@Dput"
 /augeas/load/Dput/incl[1] = "~/.dput.cf"
 /augeas/load/Dput/incl[2] = "/etc/dput.cf"
 /augeas/load/Dput/excl[1] = "*.augnew"
 /augeas/load/Dput/excl[2] = "*.augsave"
 /augeas/load/Dput/excl[3] = "*.rpmsave"
 /augeas/load/Dput/excl[4] = "*.rpmnew"
 /augeas/load/Dput/excl[5] = "*~"

 augtool> set /augeas/load/Dput/incl[last()+1] "/home/rpinson/.dput.cf"

 augtool> print /augeas/load/Dput/
 /augeas/load/Dput
 /augeas/load/Dput/lens = "@Dput"
 /augeas/load/Dput/incl[1] = "~/.dput.cf"
 /augeas/load/Dput/incl[2] = "/etc/dput.cf"
 /augeas/load/Dput/excl[1] = "*.augnew"
 /augeas/load/Dput/excl[2] = "*.augsave"
 /augeas/load/Dput/excl[3] = "*.rpmsave"
 /augeas/load/Dput/excl[4] = "*.rpmnew"
 /augeas/load/Dput/excl[5] = "*~"
 /augeas/load/Dput/incl[3] = "/home/rpinson/.dput.cf"
 }}}

 The node got added after /augeas/load/Dput/*[last()] and not after
 /augeas/load/Dput/incl[last()] which I was expecting. [[BR]]


 In a way, I expected
 {{{
 set /augeas/load/Dput/incl[last()+1] "some value"
 }}}

 to behave the same way as
 {{{
 ins incl after /augeas/load/Dput/incl[last()]
 set /augeas/load/Dput/incl[last()] "some value"
 }}}

 I think it would be clearer this way.

-- 
Ticket URL: <https://fedorahosted.org/augeas/ticket/56>
Augeas <http://augeas.net/>
a configuration API



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]