Last modified: 2010-05-15 15:37:40 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T4897, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 2897 - distinguish limited recursion (n times only) from infinite recursion
distinguish limited recursion (n times only) from infinite recursion
Product: MediaWiki
Classification: Unclassified
Templates (Other open bugs)
All All
: Normal enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
Blocks: 2376
  Show dependency treegraph
Reported: 2005-07-18 13:18 UTC by lɛʁi לערי ריינהארט
Modified: 2010-05-15 15:37 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description lɛʁi לערי ריינהארט 2005-07-18 13:18:19 UTC

[[meta:Help:Template#Repetition within a page]] describes how to handle
repetitive inclusions of the same template by making *n* copies of it.

I would say this is not according to the [[kiss]] principle and "newbies" would
probably not understand templates as [[meta:Template:List of template calls]]
especially because the parameters are *not* named.

feature request:

a) The template syntax should support a parameter as "SELFINCLUSIONS|<template
or page name>|<counter>" and "SELFINCLUSIONS|<template or page
name_1>|<counter>|SELFINCLUSIONS|<template or page
name_2>|<counter>|SELFINCLUSIONS|<template or page name_n>|<counter>" either at
the beginning or at the end of the parameter list.

b) It should be possible to limit the SELFINCLUSIONS numbers by a new variable
defined in DefaultSettings LocalSettings (see [[meta:Help:Configuration settings
index]], [[meta:Global variables]] etc.).

Best regards Reinhardt [[user:gangleri]]
Comment 1 Brion Vibber 2005-07-18 16:42:38 UTC
I don't understand how the referenced page has anything to do with the request or summary on this bug.

The referenced page describes how to use a template multiple times with different parameters. (By... 
using it multiple times, with different parameters.)

This summary seems to be requesting some change about recursion detection, but I'm not sure why or 
for what purpose. Currently multiple includes and recursive includes are *not* treated the same; recursive 
cycles in the inclusion graph are detected and halted. This is not related in any way to multiple side-by-
side inclusions.

I'm closing this bug report as INVALID.

If you reopen, please provide a detailed and complete description of:

1) What are you trying to accomplish?

2) What is the exact example you tried to use? (Wikitext source.)

3) What did you expect to happen, exactly?

4) What actually happened?

5) How do they differ?

6) What do you want to happen differently?
Comment 2 lɛʁi לערי ריינהארט 2005-07-24 09:31:48 UTC
in response to comment 1

Thanks Brion for your feedback. provides
an example where Template:T006 is supposed to be called 4 times only. This is
*not* "infinite recursion" but what I called "repetitive template inclusion" in
the summary.

The page refered above and is a start of a
wikibook about special algebraic properties of "Jain squares" (order 4), their
coherence to Jain toughts about the world / universe and patterns about
equilibrium, transformations etc.

Because the involved templates at are
"called" in "trace mode" you can see that Template:T006 is substituted exatly
one time and substitution is stopped at the second recursion.

What I wanted to show in the example is that T006^4=T001. By the way:
T006^2=T011 (the "complementary" of T000) and T006^3=T016. These are some
"simple" examples. The book might use some X(Y(X^n(x))).

[[meta:Help:Template#Repetition_within_a_page]] suggests to create "copies" of
the original template. *But*: There would be 384 templates already. Adding up to
"n" copies of each does not make life easier.

At this point we need to think about what MediaWiki is and what it is not and
what are the consequences. MediaWiki is *not* a programming language. To some
extend some programming is possible. Nevertheless it can be used as a
"substitute" of a programming language (for some specific tasks) with
"questionable" performance when complexity is increased. I used "questionable"
because I have no clue about performance, about how many resources are used etc.

About the original URL [[meta:Help:Template#Repetition_within_a_page]],
[[meta:Template:List_of_Languages]] or the other examples refred there. I assume
that the construct "List of Languages" is equivalent to a "repetitive template
inclusion" or could be handeled in similar fashion. I mean "execution of some
code for the items of a specified list one by one".

Your questions:
1) What are you trying to accomplish?
: To my understanding detection of "selfinclusion" is hardcoded. As the writer
of the code I would know that Template:T006 will be called four times (on a
distinct substitution path) in Template:T .
: a) What I was suggesting (I agree without specifying the details)
1 to 16)|NOTE=|LINKS=→ |TRACE=y}}
should be somthing like
1 to 16)|NOTE=|LINKS=→ |TRACE=y}} 
or **SELFINCLUSIONS:Template:T006:4* or whatever is necessary to specify that 4
substitutions of Template:T006 are *legal repetitive template inclusion* and
should not be interpreted as "infinite recursion" where substitution would stop.
: b) "It should be possible to limit the SELFINCLUSIONS numbers by a new
variable defined in DefaultSettings LocalSettings" is a requirement against
vandalism and DoS, against *SELFINCLUSIONS|Template:foo|65.535*. This new
variable set to "2" for an arbitrary wiki would offer same "security" as
implemented now.

2) What is the exact example you tried to use? (Wikitext source.)
see above
where "transitions of transitions" are defined as iterative actions *and*
further transitions as
and */* being the "stop" condition

3) What did you expect to happen, exactly?
described above
have control of the "stop substitution mechanism" *on a case by case basis*

4) What actually happened?
the "stop substitution mechanism" stops at the second substitution of the same

5) How do they differ?
the actual code stops before generating the intended square; the required would not

6) What do you want to happen differently?
Dear Brion, dear developers. The requested enhancement does not mean some
personal benefit for me. I hope to be able use the known workarounds or to find
new ones. The main question is if it would bring an enhancement *for the
comunity* or not, if it would make life easier or not, if it would simlify
things *without* adding security relevant issues.

Best regards Reinhardt [[user:gangleri]]
Comment 3 Brion Vibber 2005-07-24 09:41:46 UTC
Can anyone understand this?
Comment 4 Carlos 2005-07-24 16:55:46 UTC
(In reply to comment #3)
> Can anyone understand this?

Yes... he wants a way to tell the software how many times the template can be
expanded without being infinite recursion.

For example, if you have a template named T(A) with the following contents:

 {{T({{{next 1}}})|next 1={{{next 2}}}|next 2=stop}} x

when you write {{T(A)|next 1=A|next 2=A}}, it should be expanded to:

first: {{T(A)|next 1=A|next 2=stop}} x
then:  {{T(A)|next 1=stop|next 2=stop}} x x
lastly:{{T(stop)|next 1=stop|next 2=stop}} x x x

(and then comes the expansion of {{T(stop)}}). So, he wants to let the software
know that expanding T(A) three times in a row isn't infinite recursion. (Too
complicated, IMHO.)

Note You need to log in before you can comment on or make changes to this bug.