4411: Error migrating mercurial LegacyFileDiffData for (empty) binary diffs

mark.falconer

What version are you running?

v2.5.4

What's the URL of the page containing the problem?

<private reviewboard instance>/r/2463

What steps will reproduce the problem?

  1. Upgrade from reviewboard 1.6 to 1.7 to 2.0 to 2.5.4
  2. Open a review containing binary files

What is the expected output? What do you see instead?

The review request should be shown. Instead you see

Something broke! (Error 500)

It appears something broke when you tried to go to here. This is either a bug in Review Board or a server configuration error. Please report this to your administrator.

What operating system are you using? What browser?

Win7, Firefox 46.0.1
Reviewboard running on Ubuntu 12.04
Apache 2.2.22
mod-wsgi
Python 2.7

Please provide any additional information below.

Log:
2016-05-17 20:01:58,430 - DEBUG - - Migrating LegacyFileDiffData 2b4d9451221f9a3daea370e050cceee4aec9e14f to RawFileDiffData for diff in FileDiff 148740
2016-05-17 20:01:58,537 - DEBUG - - Recalculating insert/delete line counts on RawFileDiffData 1704
2016-05-17 20:01:58,537 - DEBUG - - DiffParser.parse: Beginning parse of diff, size = 93
2016-05-17 20:01:58,538 - ERROR - - Exception thrown for user at /r/2463/

list index out of range
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Django-1.6.11-py2.7.egg/django/core/handlers/base.py", line 112, in get_response
response = wrapped_callback(request, callback_args, callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.5.4-py2.7.egg/reviewboard/accounts/decorators.py", line 23, in _check
return login_required(view_func)(*args,
kwargs)
File "/usr/local/lib/python2.7/dist-packages/Django-1.6.11-py2.7.egg/django/contrib/auth/decorators.py", line 22, in _wrapped_view
return view_func(request,
args, kwargs)
File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.5.4-py2.7.egg/reviewboard/site/decorators.py", line 35, in _check
return view_func(request, local_site=local_site, *args,
kwargs)
File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.5.4-py2.7.egg/reviewboard/reviews/views.py", line 728, in review_detail
changedesc.fields_changed[field_id])
File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.5.4-py2.7.egg/reviewboard/reviews/fields.py", line 264, in get_change_entry_sections_html
'rendered_html': mark_safe(self.render_change_entry_html(info)),
File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.5.4-py2.7.egg/reviewboard/reviews/builtin_fields.py", line 475, in render_change_entry_html
counts = diffset.get_total_line_counts()
File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.5.4-py2.7.egg/reviewboard/diffviewer/models.py", line 518, in get_total_line_counts
for key, value in six.iteritems(filediff.get_line_counts()):
File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.5.4-py2.7.egg/reviewboard/diffviewer/models.py", line 287, in get_line_counts
self._migrate_diff_data()
File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.5.4-py2.7.egg/reviewboard/diffviewer/models.py", line 432, in _migrate_diff_data
self._recalculate_line_counts(self.diff_hash)
File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.5.4-py2.7.egg/reviewboard/diffviewer/models.py", line 477, in _recalculate_line_counts
self.diffset.repository.get_scmtool())
File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.5.4-py2.7.egg/reviewboard/diffviewer/models.py", line 100, in recalculate_line_counts
files = tool.get_parser(self.content).parse()
File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.5.4-py2.7.egg/reviewboard/diffviewer/parser.py", line 59, in parse
next_linenum, new_file = self.parse_change_header(i)
File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.5.4-py2.7.egg/reviewboard/diffviewer/parser.py", line 101, in parse_change_header
linenum = self.parse_diff_header(linenum, info)
File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.5.4-py2.7.egg/reviewboard/scmtools/hg.py", line 136, in parse_diff_header
self.lines[linenum].startswith(b"Binary file ")):
IndexError: list index out of range

The offending legacy file diff data (2b4d9451221f9a3daea370e050cceee4aec9e14f) contains

ZGlmZiAtciBhYjZiNGIwOGZhNDAgLXIgNTU5NDgzMmE5MGE1IFdpbmxvZy9IcmguV2lubG9nLlZpZXcvSW1hZ2VzL1NtYWxsL0hvcml6b250YWxHdWlkZS5wbmcK

which decoded is

diff -r ab6b4b08fa40 -r 5594832a90a5 Winlog/Hrh.Winlog.View/Images/Small/HorizontalGuide.png

The diff contains no data because the file that changed was a binary file.

#1 mark.falconer
  • -Error upgrading mercurial diff files containing binary diffs
    +Error migrating mercurial LegacyFileDiffData for (empty) binary diffs
#2 jamie
  • +Release-2.5.x
  • +SCM:Mercurial
#3 jamie
  • +Component:DiffParser