1473: Upload diff including binary file failed with postreview.py

guenten*******@gmai***** (Google Code) (Is this you? Claim this profile.)
Feb. 21, 2010
What version are you running?
postreview.py with diff (GNU diffutils) 2.8.7

What's the URL of the page containing the problem?
- (local, when uploading diff to RB)

What steps will reproduce the problem?
1. Use a diff tool for which the special handling for binary files is
necessary in postreview.py and which reports line endings \r\n
2. Try to upload a change with binary files

What is the expected output? What do you see instead?
There is a 'list index out of range' exception, because the equality check
for the binary file case did not succeed.


What operating system are you using? What browser?
Windows XP 64


Please provide any additional information below.
The check there should not be an equality check but should be a
'startswith'. We used a regexp to also easily get the rest of the string
appended, here is a proposal for the relevant part in postreview.py:

        # Special handling for the output of the diff tool on binary files:
        #     diff outputs "Files a and b differ"
        # and the code below expects the output to start with
        #     "Binary files "
        if len(dl) == 1:
            binfile_regexp = re.compile(r'Files (.*) and (.*) differ(.*)',
re.DOTALL)
            m = binfile_regexp.search(dl[0])
            if m:
                dl = ['Binary files %s and %s differ%s'% (m.group(1),
m.group(2), m.group(3))]
chipx86
#1 chipx86
It sounds like your version of RBTools/post-review is quite old. Please upgrade to
RC1. This was fixed long ago.
  • +Fixed
  • +Component-RBTools