Item13374: Parameterized macros cause "Max recursive depth reached" warnings

pencil
Priority: Normal
Current State: Confirmed
Released In: n/a
Target Release: n/a
Applies To: Engine
Component: FoswikiPrefs
Branches:
Reported By: JohnKnutson
Waiting For:
Last Change By: CrawfordCurrie
Parameterized macros of multiple layers, (i.e. a macro that uses another) cause "Max recursive depth reached" warning messages in error.log.

As an example:
   * Set NONRECURSIVE = %DEFAULT%
   * Set REALLYNOT = %NONRECURSIVE{%DEFAULT%}%

%REALLYNOT{foo}%

The above will cause the warning to appear. In my specific case, I have been defining formatting parameterized macros (like NONRECURSIVE above) and linking macros (similar to REALLYNOT above) in WebPreferences for consistent, managed linking and formatting across the web. It seems to work, yet the warning messages appear, at least in the document containing the macro definitions (WebPreferences in this case). The problem seems to be that the parameters in the macro (DEFAULT above) do not get rendered to anything and the _processMacros call from _expandMacroOnTopicRendering keeps trying until it hits $depth (which in this case is always 1).

For more, see the conversation with jmk0 in

http://irclogs.foswiki.org/bin/irclogger_log/foswiki?date=2015-04-14,Tue

-- JohnKnutson - 14 Apr 2015

Analysis is correct, confirmed. Not sure what we can do about this, the recursion is real. The best option would be to suppress macro expansion when rendering * Set, but I'm reluctant to do that as it would require adding * Set to the syntax recognised by the macro parser, and I suspect the cost of that would be significant (unjustified by this limited case, anyway). For now, putting in a documentation fix. http://foswiki.org/Support/Faq77

-- CrawfordCurrie - 15 Apr 2015

 

ItemTemplate edit

Summary Parameterized macros cause "Max recursive depth reached" warnings
ReportedBy JohnKnutson
Codebase 1.1.9
SVN Range
AppliesTo Engine
Component FoswikiPrefs
Priority Normal
CurrentState Confirmed
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
masterCheckins
ItemBranchCheckins
Release01x01Checkins
Topic revision: r2 - 15 Apr 2015, CrawfordCurrie
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy