Edgewall Software

Opened 6 years ago

Closed 6 years ago

#12676 closed defect (fixed)

Infinite recursion upon rendering repository files

Reported by: strk@… Owned by: Ryan J Ollos
Priority: normal Milestone: 1.2.1
Component: rendering Version: 1.2dev
Severity: normal Keywords: pygments
Cc: Branch:
Release Notes:

Fixed regression from r14208 for Pygments < 1.4.

API Changes:
Internal Changes:


After upgrading from 1.0 to 1.2 (r15395), attempts to read *any* file from the Browse Source tree result in an infinite recursion, eventually handled by a Maximum recursion depth exceeded while calling a Python object error.

The backtrace:

  File "/usr/local/lib/python2.6/dist-packages/Trac-1.2.1dev-py2.6.egg/trac/util/__init__.py", line 1197, in __get__
    result = self.fn(instance)
  File "/usr/local/lib/python2.6/dist-packages/Trac-1.2.1dev-py2.6.egg/trac/mimeview/pygments.py", line 241, in _types
    js_entry = self._types.get('text/javascript')
  File "/usr/local/lib/python2.6/dist-packages/Trac-1.2.1dev-py2.6.egg/trac/util/__init__.py", line 1197, in __get__
    result = self.fn(instance)
  File "/usr/local/lib/python2.6/dist-packages/Trac-1.2.1dev-py2.6.egg/trac/mimeview/pygments.py", line 241, in _types
    js_entry = self._types.get('text/javascript')

I've also reported this on the user list: https://groups.google.com/forum/#!topic/trac-users/yaMesS3G6uo

Attachments (0)

Change History (6)

comment:1 by strk@…, 6 years ago

Uninstalling package-manager installed python-pygments (Pygments==1.3.1) fixed the issue. It looks like the package was shadowing a newer Pygments==2.2.0

Not sure if Trac could/should handle this case (broken dep?) itself.

comment:2 by Jun Omae, 6 years ago

Milestone: 1.2.1

Thanks for the reporting. PygmentsRenderer._types method decorated with @lazy recursively use self._types property at tags/trac-1.2/trac/mimeview/pygments.py@:231-232,241#L231.

It seems this issue introduced in [14208].

comment:3 by Jun Omae, 6 years ago

Component: version control/browserrendering
Keywords: pygments added

It can be reproduced with Pygments 1.3.

comment:4 by Ryan J Ollos, 6 years ago

Owner: set to Ryan J Ollos
Status: newassigned

comment:5 by Ryan J Ollos, 6 years ago

It looks like a simple fix would be:

  • trac/mimeview/pygments.py

    diff --git a/trac/mimeview/pygments.py b/trac/mimeview/pygments.py
    index 41cdeab73..4dab18e59 100644
    a b class PygmentsRenderer(Component):  
    239239        # Pygments < 1.4 doesn't know application/javascript
    240240        if 'application/javascript' not in types:
    241             js_entry = self._types.get('text/javascript')
     241            js_entry = types.get('text/javascript')
    242242            if js_entry:
    243243                types['application/javascript'] = js_entry

comment:6 by Ryan J Ollos, 6 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed to 1.2-stable in r15488, merged to trunk in r15489.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.