Opened 9 years ago
Closed 9 years ago
#12676 closed defect (fixed)
Infinite recursion upon rendering repository files
| Reported by: | 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: | |||
Description
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 , 9 years ago
comment:2 by , 9 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 , 9 years ago
| Component: | version control/browser → rendering |
|---|---|
| Keywords: | pygments added |
It can be reproduced with Pygments 1.3.
comment:4 by , 9 years ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
comment:5 by , 9 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): 238 238 239 239 # Pygments < 1.4 doesn't know application/javascript 240 240 if 'application/javascript' not in types: 241 js_entry = self._types.get('text/javascript')241 js_entry = types.get('text/javascript') 242 242 if js_entry: 243 243 types['application/javascript'] = js_entry 244 244
comment:6 by , 9 years ago
| Release Notes: | modified (diff) |
|---|---|
| Resolution: | → fixed |
| Status: | assigned → closed |



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.0Not sure if Trac could/should handle this case (broken dep?) itself.