4932: Error creating a review request with a SVN repository

dkmorgan
chipx86
chipx86

What version are you running?

4.02

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

<root_url>/r/new/

What steps will reproduce the problem?

  1. Create a new review request
  2. Select a SVN repository
  3. Select a commit

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

Expect to be able to create a new review request but an error is shown instead.

What operating system are you using? What browser?

Server side: Ubuntu 18.04 LTS
Client side: Windows 10, Edge browser

Please provide any additional information below.

The error in the log is as follows:

File "/usr/local/lib/python2.7/dist-packages/reviewboard/scmtools/svn/init.py", line 590, in parse_diff_header
if parsed_file.modified_file_details.endswith(b'(nonexistent)'):
AttributeError: 'NoneType' object has no attribute 'endswith'

The original code on lines 590-591 did not produce an error with Review Board 3.x.
My guess is that the merge into the 4.x branch had some adverse effects.

chipx86
#1 chipx86

Hmm, interesting. There must be a situation our unit tests aren't covering. Wonder what that diff looks like.

We'll get a fix into 4.0.4.

  • -New
    +Confirmed
  • +Release-4.0.x
  • +SCM:Subversion
  • +chipx86
chipx86
#2 chipx86

Are there any changes in that diff aside from standard modifications to files, deleted files, or newly-introduced files?

dkmorgan
#3 dkmorgan

As far as I can tell no.
I got the same error with the addition of the attached file to the repository. (created for testing purposes)
It looks like 'modified_file_details' is undefined in this case.
If I comment out the following two lines, I no longer get the error, but obviously this isn't a very good workaround...

590 if parsed_file.modified_file_details.endswith(b'(nonexistent)'):
591 parsed_file.deleted = True

  • +
    /* Test Source Code */
#4 unicodon

Hi, I ran into the same issue with a simple diff (attached) on 4.0.3.

    if parsed_file.modified_file_details is not None and parsed_file.modified_file_details.endswith(b'(nonexistent)'):

also works for me as a workaround.

This error occurs on linenum=4 started with "@@", just after the first parse of diff header.
The line is not distinguished as "is_diff_header" by the DiffParser class and modified_file_details remains None. However SVNDiffParser tries to invoke modified_file_details.endswith() and results in an AttributeError exception.

  • +
    Index: main.c
    ===================================================================
    --- main.c	(revision 2)
    +++ main.c	(working copy)
    @@ -1,4 +1,4 @@
     int main()
     {
    -	return 0;
    +	return 1;
     }