Edgewall Software

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11181 closed defect (fixed)

internal error with TracIni macro — at Version 2

Reported by: Christian Boos Owned by: Christian Boos
Priority: normal Milestone: 1.0.2
Component: i18n Version: 1.0dev
Severity: minor Keywords: renderingcontext macros
Cc: Branch:
Release Notes:

Modify .po files to expand TracIni to a wiki page link rather than a macro call, fixing a recursion in the TracIni macro documentation.

API Changes:
Internal Changes:

Description

Found the following error while looking in the trac.log:

[pid 18612 139956728231680] 2013-05-06 12:38:33,999 Trac[formatter] ERROR: Macro TracIni(None) failed:
Traceback (most recent call last):
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Trac-1.1.2dev_r11794-py2.6.egg/trac/wiki/formatter.py", line 765, in _macro_formatter
    return macro.ensure_inline(macro.process(args))
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Trac-1.1.2dev_r11794-py2.6.egg/trac/wiki/formatter.py", line 356, in process
    text = self.processor(text)
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Trac-1.1.2dev_r11794-py2.6.egg/trac/wiki/formatter.py", line 343, in _macro_processor
    text)
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Trac-1.1.2dev_r11794-py2.6.egg/trac/wiki/macros.py", line 784, in expand_macro
    for section, section_doc in sorted(sections.iteritems()))
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Genshi-0.7dev_r1134-py2.6.egg/genshi/builder.py", line 261, in __call__
    Fragment.__call__(self, *args)
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Genshi-0.7dev_r1134-py2.6.egg/genshi/builder.py", line 97, in __call__
    self.append(arg)
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Genshi-0.7dev_r1134-py2.6.egg/genshi/builder.py", line 129, in append
    for child in node:
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Trac-1.1.2dev_r11794-py2.6.egg/trac/wiki/macros.py", line 784, in <genexpr>
    for section, section_doc in sorted(sections.iteritems()))
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Genshi-0.7dev_r1134-py2.6.egg/genshi/builder.py", line 261, in __call__
    Fragment.__call__(self, *args)
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Genshi-0.7dev_r1134-py2.6.egg/genshi/builder.py", line 97, in __call__
    self.append(arg)
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Genshi-0.7dev_r1134-py2.6.egg/genshi/builder.py", line 129, in append
    for child in node:
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Trac-1.1.2dev_r11794-py2.6.egg/trac/wiki/macros.py", line 783, in <genexpr>
    if option.name.startswith(key_filter))))
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Genshi-0.7dev_r1134-py2.6.egg/genshi/builder.py", line 352, in __getattr__
    return Element(self.namespace and self.namespace[name] or name)
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Genshi-0.7dev_r1134-py2.6.egg/genshi/builder.py", line 248, in __init__
    Fragment.__init__(self)
RuntimeError: maximum recursion depth exceeded while calling a Python object
[pid 18612 139956728231680] 2013-05-06 12:38:36,906 Trac[formatter] ERROR: Macro TracIni(None) failed:
Traceback (most recent call last):
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Trac-1.1.2dev_r11794-py2.6.egg/trac/wiki/formatter.py", line 765, in _macro_formatter
    return macro.ensure_inline(macro.process(args))
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Trac-1.1.2dev_r11794-py2.6.egg/trac/wiki/formatter.py", line 392, in ensure_inline
    text = "</p>%s<p>" % _markup_to_unicode(text)
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Trac-1.1.2dev_r11794-py2.6.egg/trac/wiki/formatter.py", line 107, in _markup_to_unicode
    markup = stream.render('xhtml', encoding=None, strip_whitespace=False)
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Genshi-0.7dev_r1134-py2.6.egg/genshi/core.py", line 183, in render
    return encode(generator, method=method, encoding=encoding, out=out)
  File "/usr/local/virtualenv/1.1dev/lib/python2.6/site-packages/Genshi-0.7dev_r1134-py2.6.egg/genshi/output.py", line 57, in encode
    return _encode(''.join(list(iterator)))
MemoryError:

No idea yet how that was triggered. By looking at the access.log, it seems there's always a TracIni access around the same time, although going to that page doesn't show an issue. Must have been under a specific locale… yes ;-)

There's a recursion in trunk/trac/locale/ko/LC_MESSAGES/tracini.po@11794#L285 due to the use of [[TracIni]] instead of a simple TracIni like in the original.

IIRC, when deciding what to do for [[X]] when X is both a macro and a wiki page, I opted for a macro call for being backward compatible.

So I think that not expanding [[TracIni()]] while already in a [[TracIni()]] expansion is the best fix here.

Change History (2)

comment:1 by Christian Boos, 11 years ago

Resolution: fixed
Severity: majorminor
Status: newclosed

Hm, it's not like we don't have control here over what is produced by [[TracIni()]], so just clean-up the .po files.

Done so in r11801.

Now if someone writes a macro an calls [[WikiMacros]] within its documentation…

comment:2 by Ryan J Ollos, 11 years ago

Release Notes: modified (diff)
Note: See TracTickets for help on using tickets.