| Issue 1155: | "Array index 1 out of range" trying to view diff for changed CSS file | |
| 17 people starred this issue and may be notified of changes. | Back to list |
Affected Version: 2.2.1 What steps will reproduce the problem? 1. Upload a change for review involving a CSS file: - example diff here: https://gist.github.com/d136eb01dbf41977fc26 - here's the before version of the file: https://gist.github.com/ef545aa3305fd4d7c476 - and the after version: https://gist.github.com/2e2416ab0eec80285903 (Will also add the before and after images as attachments.) 2. Try to view diff for that file in the Gerrit UI What is the expected output? Expect to see side-by-side or unified diff, depending on which link is clicked. What do you see instead? No visible change on page; error output produced on JavaScript console: https://gist.github.com/628ba04b3a073a396240 That's the Safari console output. Here's the Firefox/Firebug output as well just in case that's any more readable: https://gist.github.com/3f80cf5fbe1f34a9688c Please provide any additional information below. I've searched the tracker and it looks like in the past there were similar errors involving viewing diffs ( issue #786 , issue #773 , issue #802 , issue #877 ). At least one of them mentions that it only occurred with files that removed the newline at the end of the file, but that isn't the case of the example at hand. So far I've seen this happen with a bunch of different CSS files, but not all CSS files. I don't think I've seen it yet with any other type of file. Just to be sure I could reproduce, I downloaded the before and after images from those gists I linked to above, added the "before" in a commit in a test project in Gerrit, then added the "after" in another commit; it failed to display the diffs for both commits, funnily enough, so if you need an even more reduced test case I think that sample file could be whittled further down.
Nov 15, 2011
#1
simoncog...@gmail.com
Dec 5, 2011
This is an upstream bug with google-code-prettify (Gerrit's JS syntax highlighter). I have submitted a patch to the maintainer there. Equivalent patch for gerrit attached.
Dec 5, 2011
As a workaround you can replace all isntances of url() with url('') - the syntax highlighter is failing on the non-quoted empty url (which appears to be valid css).
Dec 5, 2011
Upstream patch: https://code.google.com/p/google-code-prettify/issues/detail?id=181
Dec 6, 2011
I've applied the patch locally and can confirm that it solves the issue.
Mar 30, 2012
Fixed in google-code-prettify r208: https://code.google.com/p/google-code-prettify/source/detail?r=208
Jul 20, 2012
Issue 1208 has been merged into this issue.
Nov 13, 2012
Bug is still present as of Gerrit 2.5, but now at least it degrades gracefully, showing the diff without syntax highlighting.
Dec 17, 2012
I was having a similar issue with a few files throwing Array index (number) out of range. Ended up finding out it was a combination of Syntax Coloring and Show Line Endings causing the problem. Had to change them at different times and update/save to allow the right combination of settings to work. The underlying bug is still present.
Jan 29, 2013
I am hitting on a similar issue if not the exact one. "Uncaught Class$Z1c: Array index 337 out of range" when trying to view diff for changed PHP file. And it is so easy to hit. If that is a bug caused by google-code-prettify, is there a way to disable the prettfiy if it happen and use RAW plaintext diff?
Jan 29, 2013
I am using Gerrit(2.5.1), if it does matter.
Jan 30, 2013
(No comment was entered for this change.)
Status:
Started
Owner: sop@google.com
Jan 30, 2013
@hkdennis2k: the prettify bug I patched was specific to CSS, but given the nature of the bug I wouldn't be surprised if you were seeing a very similar one. If you can find the exact trigger for it you might find an easy workaround like #3 above.
Jan 30, 2013
(No comment was entered for this change.)
Status:
Submitted
Labels: FixedIn-2.6
Feb 18, 2013
Issue 1790 has been merged into this issue.
Mar 14, 2013
I have had this problem happen to one of the people in my Gerrit installation. This person unchecked "Show Line Endings" in her diff preferences, and one of the changes in the side-by-side diff she was trying to view was that the left file had CRLF line endings, but the fixed right-side version was just using LF. After I cleared her preferences from the reviewdb, it started working again. But now whenever she tries to turn off "show line endings" in her preferences and the hits update, the preferences form just greys out and never updates.
Apr 4, 2013
I can confirm exactly the same buggy behaviour. After unchecking "show line endings" in preferences I get "Uncaught Class$Z1c: Array index 127 out of range" in Chrome 26 on Ubuntu 12.04 when trying to view diff on some php files. After re-checkig "show line endings" the problem disappears. Also, after unchecking "show line endings" and trying to save the new settings they are grey out forever, but unlike in previous report, the settings eventually get stored.
May 6, 2013
Is this bug supposed to be fixed in gerrit 2.6 rc1 ? I am having exactly the same problem as post #18 and 20, on 2.6rc1
May 6, 2013
The "Array index N out of range" error message is generic and the issues later posters are seeing are almost certainly different from the original bug in this ticket (which was in the CSS syntax highlighting code). This ticket has been submitted, so please help the gerrit developers by opening new tickets for new bugs with reproduction steps like in this ticket's body. |
|
| ► Sign in to add a comment |