2561: Subversion diff failed to parse

csa****@hotma****** (Google Code) (Is this you? Claim this profile.)
April 3, 2012
2359
What version are you running? 1.6.5


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

http://www.rbdemo.com


What steps will reproduce the problem?
1.post-review from Windows system
2.
3.

What is the expected output? What do you see instead? A valid post-review.

Got API Error 105 (HTTP code 400): One or more fields had errors
>>> Error data: {u'fields': {u'path': [u'list index out of range']}, u'stat': u'fail', u'err': {u'msg': u'One or more fields had errors', u'code': 105}}
Error uploading diff
The generated diff file was empty. This usually means no files were modified in this change.

There were diffs generated.

ReviewBoard Server log:

2012-04-02 10:14:27,554 - DEBUG - DiffParser.parse: Beginning parse of diff, size = 622
2012-04-02 10:14:27,555 - ERROR - Error uploading new diff: list index out of range
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.6.5-py2.7.egg/reviewboard/webapi/resources.py", line 1509, in create
    request.FILES.get('parent_diff_path'))
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.6.5-py2.7.egg/reviewboard/reviews/forms.py", line 286, in create
    history)
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.6.5-py2.7.egg/reviewboard/diffviewer/forms.py", line 63, in create
    diff_file, basedir, check_existance=(not parent_diff_file)))
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.6.5-py2.7.egg/reviewboard/diffviewer/forms.py", line 136, in _process_files
    for f in tool.get_parser(file.read()).parse():
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.6.5-py2.7.egg/reviewboard/diffviewer/parser.py", line 49, in parse
    next_linenum, new_file = self.parse_change_header(i)
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.6.5-py2.7.egg/reviewboard/diffviewer/parser.py", line 74, in parse_change_header
    linenum = self.parse_special_header(linenum, info)
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.6.5-py2.7.egg/reviewboard/scmtools/svn.py", line 407, in parse_special_header
    linenum = super(SVNDiffParser, self).parse_special_header(linenum, info)
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.6.5-py2.7.egg/reviewboard/diffviewer/parser.py", line 125, in parse_special_header
    info['index'] = self.lines[linenum].split(None, 2)[1]
IndexError: list index out of range


What operating system are you using? Win 7

What browser? ie9


Please provide any additional information below.

The post-review works from a Linux system but does not work from my Windows system.
chipx86
#1 chipx86
So something about the diff itself is breaking the parser. We apparently don't handle the format.

What's generating the diff?

It'll be important to see the headers of the diff. Everything but file content is necessary, and spaces/tabs/etc. must be preserved.
  • +NeedInfo
  • +Component-DiffParser
  • +Subversion diff failed to parse
#2 csa****@hotma****** (Google Code) (Is this you? Claim this profile.)
Here is the version of diff post-review is using:

  Z:\myrepo>diff --version
  diff (GNU diffutils) 2.8.7
  Written by Paul Eggert, Mike Haertel, David Hayes,
  Richard Stallman, and Len Tower.

  Copyright (C) 2004 Free Software Foundation, Inc.
  This is free software; see the source for copying conditions.  There is NO
  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Here is the entire output of the post-review --debug --output-diff:

  Z:\myrepo>post-review --debug --output-diff
  >>> RBTools 0.4.1
  >>> Home = C:\Users\salech01\AppData\Roaming
  >>> HTTP GETting api/
  >>> HTTP GETting http://www.rbdemo.com/api/info/
  >>> Using the new web API
  Index:
  ===================================================================
  ---     (revision 12)
  +++     (working copy)

  Property changes on: .
  ___________________________________________________________________
  Modified: reviewboard:url
  ## -1 +1 ##
  -http://www.charlie.com
  +http://www.rbdemo.com
  \ No newline at end of property
  Index: /trunk/terrytest.txt
  ===================================================================
  --- /trunk/terrytest.txt        (revision 12)
  +++ /trunk/terrytest.txt        (working copy)
  @@ -1,3 +1,5 @@
  test 2
  test 3
  -test 4
  \ No newline at end of file
  +test 4
  +Charlie 5
  +Charlie 6

  Z:\myrepo>

Here is an svn diff of the repository:

  Z:\myrepo>svn diff
  Index: .
  ===================================================================
  --- .   (revision 12)
  +++ .   (working copy)

  Property changes on: .
  ___________________________________________________________________
  Modified: reviewboard:url
  ## -1 +1 ##
  -http://www.charlie.com
  +http://www.rbdemo.com
  \ No newline at end of property
  Index: trunk/terrytest.txt
  ===================================================================
  --- trunk/terrytest.txt (revision 12)
  +++ trunk/terrytest.txt (working copy)
  @@ -1,3 +1,5 @@
  test 2
  test 3
  -test 4
  \ No newline at end of file
  +test 4
  +Charlie 5
  +Charlie 6

  Z:\myrepo>

Thanks!
#3 csa****@hotma****** (Google Code) (Is this you? Claim this profile.)
I created another Windows environment and tried to run a post-review from that system.  The results were the same.  That would indicate an issue on the server hosting ReviewBoard.  The question now is what is that issue?
#4 csa****@hotma****** (Google Code) (Is this you? Claim this profile.)
OK, after more investigation I found the issue:
The diff on my windows system includes the following:
Index:
===================================================================
--- (revision 12)
+++ (working copy)
Property changes on: .
___________________________________________________________________
Modified: reviewboard:url
## -1 +1 ##
-http://www.charlie.com
+http://www.rbdemo.com
because I committed the property change at one time to the repository and then tried to change the svn property reviewboard:url from www.charlie.com to www.rbdemo.com.
 
Christian, Is this a bug that diff cannot handle changes to SVN properties? Should post-review ignore these types of diffs.
 
Thanks,
Charlie
chipx86
#6 chipx86
Yeah, that's what I was alluding to in the e-mail thread. Commit the property change (it's something you must commit instead of just having locally), and then other diffs should work fine.
#7 Charlie*******@Niels****** (Google Code) (Is this you? Claim this profile.)
Is this the recommended way to overcome this issue?  I guess I'm wondering if this is a bug in RB where it does not handle the diff of a property change correctly.