Edgewall Software
Modify

Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#12374 closed defect (fixed)

IndexError: list index out of range

Reported by: Ryan J Ollos Owned by: Jun Omae
Priority: normal Milestone: 1.0.12
Component: wiki system Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Fix IndexError for patch with range information but no lines.

API Changes:
Internal Changes:

Description

[pid 4374 140573411886848] 2016-02-10 19:43:48,160 Trac[main] ERROR: Internal Server Error: <RequestWithSession "POST '/ticket/12222'">, referrer 'http://trac.edgewall.org/ticket/12222?action=diff'
Traceback (most recent call last):
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/trac/web/main.py", line 607, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/trac/web/main.py", line 276, in dispatch
    iterable=chrome.use_chunked_encoding)
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/trac/web/chrome.py", line 1156, in render_template
    encoding='utf-8')
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/core.py", line 184, in render
    return encode(generator, method=method, encoding=encoding, out=out)
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/output.py", line 58, in encode
    for chunk in iterator:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/output.py", line 350, in __call__
    for kind, data, pos in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/output.py", line 829, in __call__
    for kind, data, pos in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/output.py", line 669, in __call__
    for kind, data, pos in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/output.py", line 774, in __call__
    for kind, data, pos in chain(stream, [(None, None, None)]):
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/output.py", line 594, in __call__
    for ev in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/core.py", line 289, in _ensure
    for event in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/core.py", line 289, in _ensure
    for event in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/trac/web/chrome.py", line 1423, in _strip_accesskeys
    for kind, data, pos in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/core.py", line 289, in _ensure
    for event in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/trac/web/chrome.py", line 1412, in _generate
    for kind, data, pos in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/core.py", line 289, in _ensure
    for event in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/core.py", line 289, in _ensure
    for event in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/filters/transform.py", line 706, in _unmark
    for mark, event in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/filters/transform.py", line 1101, in __call__
    for mark, event in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/filters/transform.py", line 118, in __iter__
    event = self.stream.next()
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/filters/transform.py", line 734, in __call__
    for mark, event in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/filters/transform.py", line 702, in _mark
    for event in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/template/base.py", line 618, in _include
    for event in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/template/markup.py", line 378, in _match
    ctxt, start=idx + 1, **vars):
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/template/markup.py", line 378, in _match
    ctxt, start=idx + 1, **vars):
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/template/markup.py", line 378, in _match
    ctxt, start=idx + 1, **vars):
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/template/markup.py", line 326, in _match
    for event in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/template/base.py", line 558, in _flatten
    for kind, data, pos in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/core.py", line 289, in _ensure
    for event in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/path.py", line 588, in _generate
    subevent = next()
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/template/base.py", line 618, in _include
    for event in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/template/markup.py", line 326, in _match
    for event in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/template/markup.py", line 315, in _strip
    event = next()
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/template/base.py", line 558, in _flatten
    for kind, data, pos in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/core.py", line 289, in _ensure
    for event in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/path.py", line 588, in _generate
    subevent = next()
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/template/base.py", line 618, in _include
    for event in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/template/markup.py", line 315, in _strip
    event = next()
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/template/base.py", line 558, in _flatten
    for kind, data, pos in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/core.py", line 289, in _ensure
    for event in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/path.py", line 588, in _generate
    subevent = next()
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/template/base.py", line 618, in _include
    for event in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/template/markup.py", line 315, in _strip
    event = next()
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/template/base.py", line 558, in _flatten
    for kind, data, pos in stream:
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/template/directives.py", line 718, in __call__
    value = _eval_expr(expr, ctxt, vars)
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/template/base.py", line 289, in _eval_expr
    retval = expr.evaluate(ctxt)
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/template/eval.py", line 177, in evaluate
    return eval(self.code, _globals, {'__data__': data})
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/trac/templates/diff_div.html", line 95, in <Expression '?'>
    <table py:if="item.diffs" class="trac-diff $diff.style" summary="Differences" cellspacing="0"
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/genshi/template/eval.py", line 334, in lookup_item
    return obj[key]
IndexError: list index out of range

Attachments (0)

Change History (10)

comment:1 by Ryan J Ollos, 5 years ago

Owner: set to Ryan J Ollos
Status: newassigned

comment:2 by Ryan J Ollos, 4 years ago

Milestone: 1.0.111.0.12

comment:3 by Ryan J Ollos, 4 years ago

Can be reproduced with item['diffs'][0] = []; in tags/trac-1.0.11/trac/templates/diff_div.html@:96-97#L95.

comment:4 by Ryan J Ollos, 4 years ago

Milestone: 1.0.12
Resolution: worksforme
Status: assignedclosed

The behavior described in comment:3 was produced by inserting a <?python> block into the template. I haven't been able to reproduce by submitting requests through the web browser or using curl. I'll reopen late if a way to reproduce is found.

comment:5 by Jun Omae, 4 years ago

Component: ticket systemwiki system
Milestone: 1.0.12

The following wiki text can reproduce this issue:

{{{#!diff
Index: filename.txt
===================================================================
--- filename.txt
+++ filename.txt
@@ -14,7 +14,7 @@
}}}

comment:6 by Ryan J Ollos, 4 years ago

Resolution: worksforme
Status: closedreopened

comment:7 by Ryan J Ollos, 4 years ago

Status: reopenedassigned

comment:9 by Ryan J Ollos, 4 years ago

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

Committed to 1.0-stable in [14783] (incorrect target version in commit message) and merged to trunk in [14784].

comment:10 by Ryan J Ollos, 4 years ago

Owner: changed from Ryan J Ollos to Jun Omae

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae 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.