1864: Key Error for files with extension .sc

cthi****@gmai***** (Google Code) (Is this you? Claim this profile.)
chipx86
chipx86
Oct. 27, 2010
What version are you running?
1.5

What's the URL of the page containing the problem?
http://inspect.ingres.com/r/118/diff/?page=10
http://inspect.ingres.com/r/118/diff/?page=8

What steps will reproduce the problem?
1. Create a diff with files that have the extension .sc
2. Try and load the diff.
3.

What is the expected output? What do you see instead?
It should just come out with a diff, not an error.

What operating system are you using? What browser?
Seen in Chrome on Windows and Linux.


Please provide any additional information below.
It appears to be related to syntax highlighting.  If there were a way to just ignore this and revert to a simple diff instead of an error that would be more than acceptable as a fix.

Here's the error message for one of the .sc files.
Diff currently unavailable.
Error: '.sc'
Details
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/ReviewBoard-1.5-py2.4.egg/reviewboard/diffviewer/views.py", line 214, in view_diff_fragment
    file = get_requested_diff_file()
  File "/usr/lib/python2.4/site-packages/ReviewBoard-1.5-py2.4.egg/reviewboard/diffviewer/views.py", line 190, in get_requested_diff_file
    get_chunks)
  File "/usr/lib/python2.4/site-packages/ReviewBoard-1.5-py2.4.egg/reviewboard/diffviewer/diffutils.py", line 1063, in get_diff_files
    large_data=True)
  File "/usr/lib/python2.4/site-packages/Djblets-0.6.4-py2.4.egg/djblets/util/misc.py", line 166, in cache_memoize
    data = lookup_callable()
  File "/usr/lib/python2.4/site-packages/ReviewBoard-1.5-py2.4.egg/reviewboard/diffviewer/diffutils.py", line 1062, in <lambda>
    enable_syntax_highlighting)),
  File "/usr/lib/python2.4/site-packages/ReviewBoard-1.5-py2.4.egg/reviewboard/diffviewer/diffutils.py", line 624, in get_chunks
    register_interesting_lines_for_filename(differ, file)
  File "/usr/lib/python2.4/site-packages/ReviewBoard-1.5-py2.4.egg/reviewboard/diffviewer/diffutils.py", line 394, in register_interesting_lines_for_filename
    regexes = HEADER_REGEXES[HEADER_REGEX_ALIASES[ext]]
KeyError: '.sc'

Worse case is, it kills a whole page of the diff.  See page=8 in the links above.  This error is all that appears on page 8:
'.sc'

Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/ReviewBoard-1.5-py2.4.egg/reviewboard/diffviewer/views.py", line 153, in view_diff
    interdiffset, highlighting, True)
  File "/usr/lib/python2.4/site-packages/ReviewBoard-1.5-py2.4.egg/reviewboard/diffviewer/diffutils.py", line 1063, in get_diff_files
    large_data=True)
  File "/usr/lib/python2.4/site-packages/Djblets-0.6.4-py2.4.egg/djblets/util/misc.py", line 166, in cache_memoize
    data = lookup_callable()
  File "/usr/lib/python2.4/site-packages/ReviewBoard-1.5-py2.4.egg/reviewboard/diffviewer/diffutils.py", line 1062, in <lambda>
    enable_syntax_highlighting)),
  File "/usr/lib/python2.4/site-packages/ReviewBoard-1.5-py2.4.egg/reviewboard/diffviewer/diffutils.py", line 624, in get_chunks
    register_interesting_lines_for_filename(differ, file)
  File "/usr/lib/python2.4/site-packages/ReviewBoard-1.5-py2.4.egg/reviewboard/diffviewer/diffutils.py", line 394, in register_interesting_lines_for_filename
    regexes = HEADER_REGEXES[HEADER_REGEX_ALIASES[ext]]
KeyError: '.sc'

Thanks.
#1 cthi****@gmai***** (Google Code) (Is this you? Claim this profile.)
Forgot to mention this was not occurring when we used version 1.0.
chipx86
#2 chipx86
I'll get a release out soon with this fix. There is a short-term fix you can use, though.

Find the reviewboard/diffviewer/diffutils.py file in your Review Board installation. Look for a line saying:

    '.sc': '.sc',

Change that to:

    '.sc': '.py',

I will also make sure this is in tonight's nightly build.
  • +Confirmed
  • -Priority-Medium
    +Priority-Critical
    +Milestone-Release1.5.x
    +Component-DiffViewer
  • +chipx86
chipx86
#3 chipx86
Fixed on release-1.5.x (901eb6a).
  • -Confirmed
    +Fixed