On 09/06/15 05:20, Florian Pritz wrote:
On 08.06.2015 11:28, Dominik Fischer wrote:
When templates recursively include other templates, a diamond problem, similar to multiple inheritance, may occur. It is illustrated in the test case. As templates may consist of arbitrary code, it may be unwanted to execute a template twice. This patch provides a solution to some simple cases of this problem by completely ignoring every template occurrence but the first for each template name.
I'm not a fan of this being a command line option, but I'm also unsure if I like the option at all. templates shouldn't change their meaning (they shouldn't go from a simple variable definition to a package() function) and if a PKGBUILD includes 2 templates that both provide package() then that's a bug in the PKGBUILD and will be noticed when the templates are used the first time.
Not really... If you provide two package functions in a PKGBUILD, the last one will be used.
Anyone else wants to weigh in?
Can we just error out if the recursive inclusion brings in any template twice? If someone ever demonstrates the need for a diamond inclusion (that is not stupid...), we can rethink our position. Do we have infinite recursion protection as it is? (A -> B -> A -> ...) I see it being reasonable to use the same template twice in a package (e.g. in split package_*() functions). So this needs detected only during recursion. A