On Tue, Sep 08, 2009 at 10:39:00AM +0200, Mario 'BitKoenig' Holbe wrote: > On Mon, Sep 07, 2009 at 08:56:31PM +0200, Julian Andres Klode wrote: > > If there is a statement like 'DPkg::Post-Invoke:: "blah"' a new subitem > > without a name is added to the configuration option DPkg::Post-Invoke. > > The same applies to 'DPkg::Post-Invoke { "blah" }'. We create a new option > > Ah, I got it now. > So, > DPkg::Post-Invoke { "blah" }; > is equal to > DPkg::Post-Invoke:: "blah"; > while > DPkg::Post-Invoke:: { "blah" }; > would be equal to > DPkg::Post-Invoke:::: "blah"; Yes, but its behavior is undefined. > > I guess it would be good to explain this in the manpage. Probably at the > place which talks about the trailing ::. As far as I can see, it only talks about command-line options, which do not use curly braces at all. > > A few questions remain to me: > 1. Shouldn't then the "list" term be removed from the manpage? Or is > Foo::Bar { "foo"; "bar"; } > the construct which is generally accepted to represent a "list"? This is accepted, yes. You just add two options to "Foo::Bar" which both have no name. > 2. In my #503481 DPkg::Post-Invoke example, why does > DPkg::Post-Invoke:: { "echo 99test3"; }; > get overwritten by > DPkg::Post-Invoke:: { "echo 99test4"; }; > To my understanding, this should expand to > DPkg::Post-Invoke { { "echo 99test3"; "echo 99test4"; }; }; I guess the problem is that you are first appending to the list, so the situation is (in Python style code): 1. [["echo 99test3"]] 2. [["echo 99test3"], []] 3. [["echo 99test3"], ["echo 99test4"]] The problem now is that the code loops to the last element of DPkg::Post-Invoke:: and takes all commands below this (e.g. "echo 99test4"). At least that's the impression I get from reading code some time ago. But all in all, the behavior of unnamed options below an unnamed option (i.e. lists in lists) is undefined. I guess it would be possible to check for cases where '::::' is specified and throw an error. > 3. Why does "echo 99test4" gets executed at all, it is not in the same > scope as the "normal"/other DPkg::Post-Invoke commands. No idea yet. I guess I should look at the code again. -- Julian Andres Klode - Debian Developer, Ubuntu Member See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.
Attachment:
pgpDWOFJ27y3R.pgp
Description: PGP signature