<div dir="ltr"><br><br><div class="gmail_quote">On Fri, Aug 1, 2008 at 7:05 PM, David Lutterkort <span dir="ltr"><<a href="mailto:dlutter@redhat.com">dlutter@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">On Fri, 2008-08-01 at 15:05 +0200, Raphaël Pinson wrote:<br>
<br>
<br>
>         And this notation is only valid for "leaf". As "higher" level<br>
>         arrays like<br>
>         /etc/host/ use another notation even with only one element in<br>
>         the array:<br>
><br>
>         augtool> print /files/etc/hosts<br>
>         /files/etc/hosts<br>
>         /files/etc/hosts/1<br>
>         /files/etc/hosts/1/ipaddr = "<a href="http://127.0.0.1" target="_blank">127.0.0.1</a>"<br>
>         /files/etc/hosts/1/canonical = "localhost"<br>
>         /files/etc/hosts/1/alias = "localhost"<br>
><br>
><br>
> No, this is not another notation. /files/etc/hosts/1<br>
> and /files/etc/hosts/2 are not two /etc/hosts files ;) In the first<br>
> case, Subsystem was declared using "label" (or most likely "key",<br>
> which gives the same result), resulting in the same of the label being<br>
> used to refer to an array of values. In the second case, "seq" was<br>
> used because the file is only made of the same kind of entries. It<br>
> could have been made into :<br>
><br>
> /files/etc/hosts/entry<br>
> /files/etc/hosts/entry/ipaddr = "<a href="http://127.0.0.1" target="_blank">127.0.0.1</a>"<br>
> /files/etc/hosts/entry/canonical = "localhost"<br>
> /files/etc/hosts/entry/alias = "localhost"<br>
><br>
> which would then give trees like /files/etc/hosts/entry[1]<br>
> and /files/etc/hosts/entry[2] in the case of multiple entries, but<br>
> since there's only one kind of entry, it's really useless, hence the<br>
> use of numbers only to refer to lines (although I'm not a big fan of<br>
> "seq", I find it harder to parse the tree).<br>
<br>
</div></div>I agree with that, and thought about removing 'seq' completely at some<br>
point. The reason it's still there has to do with how whitespace is<br>
preserved: if you have two lines in your /etc/hosts and you do a<br>
'rm /files/etc/hosts/1', the remaining line will be restored exactly as<br>
it was before, because the whitespace for it is keyed off the label of<br>
the node ('2' when using 'seq')<br>
<br>
If you don't use seq and use multiple 'entry' labels instead, and you do<br>
'rm /files/etc/hosts/entry[1]', when you save the tree, the remaining<br>
line will use the whitespace from the first line, since for multiple<br>
identical labels, the whitespace  is put on a list, and that list is<br>
consulted in order as entries are restored.</blockquote><div><br>Oh, good to know!<br><br><br>Raphael<br><br><br><br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
That is the only reason I still use 'seq' - if it weren't for that I<br>
would have removed it completely.<br>
<font color="#888888"><br>
David<br>
<br>
<br>
<br>
</font></blockquote></div><br></div>