3579: patch file contains BOM can't be uploaded

Simon*****@gmai***** (Google Code) (Is this you? Claim this profile.)
david
david
Sept. 24, 2014
What version are you running?
2.0.7

What's the URL of the page containing the problem?
http://server/r/new/

What steps will reproduce the problem?
1.Create a patch file that contains a new file been created with utf-8 encoding that contains a BOM in the file, or contains any modification related with the first line of a file that has BOM
2.Upload the patch to the reviewboard

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

Expected:
Review can be created

Actual:
Reviewboard always showing loading but never finish. 

What operating system are you using? What browser?
Win 8.1, tried IE9/Firefox 32.0.2/Chrome 37.0.2062.120 m


Please provide any additional information below.

If we manually remove the BOM from the patch file a review can be created with no problem.
david
#1 david
Are there any errors in the server's log file?
david
#2 david
Also, what repository type?
  • +NeedInfo
#3 Simon*****@gmai***** (Google Code) (Is this you? Claim this profile.)
repository type is svn

I can see an error report Email sent from server:

Traceback (most recent call last):

  File "/usr/local/lib/python2.7/dist-packages/Django-1.6.7-py2.7.egg/django/core/handlers/base.py", line 112, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)

  File "/usr/local/lib/python2.7/dist-packages/Django-1.6.7-py2.7.egg/django/views/decorators/cache.py", line 52, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/Django-1.6.7-py2.7.egg/django/views/decorators/vary.py", line 19, in inner_func
    response = func(*args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/Djblets-0.8.10-py2.7.egg/djblets/webapi/resources.py", line 495, in __call__
    request, method, view, api_format=api_format, *args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/Djblets-0.8.10-py2.7.egg/djblets/webapi/resources.py", line 566, in call_method_view
    return view(request, *args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/Djblets-0.8.10-py2.7.egg/djblets/webapi/decorators.py", line 117, in _call
    return view_func(*args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.0.7-py2.7.egg/reviewboard/webapi/decorators.py", line 110, in _check
    return view_func(*args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/Djblets-0.8.10-py2.7.egg/djblets/webapi/decorators.py", line 117, in _call
    return view_func(*args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.0.7-py2.7.egg/reviewboard/webapi/decorators.py", line 33, in _check
    return view_func(*args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/Djblets-0.8.10-py2.7.egg/djblets/webapi/decorators.py", line 117, in _call
    return view_func(*args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/Djblets-0.8.10-py2.7.egg/djblets/webapi/decorators.py", line 117, in _call
    return view_func(*args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/Djblets-0.8.10-py2.7.egg/djblets/webapi/decorators.py", line 287, in _validate
    return view_func(*args, **new_kwargs)

  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.0.7-py2.7.egg/reviewboard/webapi/resources/repository_commits.py", line 86, in get
    items = repository.get_commits(branch=branch, start=start)

  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.0.7-py2.7.egg/reviewboard/scmtools/models.py", line 366, in get_commits
    cache_period)

  File "/usr/local/lib/python2.7/dist-packages/Djblets-0.8.10-py2.7.egg/djblets/cache/backend.py", line 120, in cache_memoize
    data = lookup_callable()

  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.0.7-py2.7.egg/reviewboard/scmtools/models.py", line 351, in <lambda>
    lambda: self.get_scmtool().get_commits(**commits_kwargs)

  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.0.7-py2.7.egg/reviewboard/scmtools/svn/__init__.py", line 195, in get_commits
    commit['message']))

  File "/usr/lib/python2.7/UserDict.py", line 23, in __getitem__
    raise KeyError(key)

KeyError: u'message'

#4 Simon*****@gmai***** (Google Code) (Is this you? Claim this profile.)
Double checked the error in the log is the same as I got from Email, no further message can be seen
david
#5 david
OK, that's definitely something we'll get fixed, but I'm not sure it's causing your problem.

Can you look in the browser's Network console while uploading the file and check the request/reponses there for errors?
#6 Simon*****@gmai***** (Google Code) (Is this you? Claim this profile.)
Looks like a Javscript error:

TypeError: rsp is null

in http://servername/static/rb/js/newReviewRequest.min.4427138a3b1f.js

Code is where it try to parse error code:

switch(rsp.err.code) { ....
david
#7 david
Can you look in the network tab of the browser tools to find the response that's creating that error? It's probably a 500.
#8 Simon*****@gmai***** (Google Code) (Is this you? Claim this profile.)
Sorry I didn't mention it clear here, I can see no network traffic at all after I click OK, it looks JS crashed before that. I tried using both Firebug and Fiddler.
david
#9 david
What about the last request to the .../commits/ endpoint? (before clicking OK)
david
#10 david
And/or any POSTS to validate-diff/ or diffs/
#11 Simon*****@gmai***** (Google Code) (Is this you? Claim this profile.)
Sorry no 500 error, there are some others after I chose Repository but all 200 normal request which I also believed is for Post-Commit review as the result is a revision history. Only thing after that is the JS error, nothing else
david
#12 david
Can you show me the responses to any POSTs (successful or not) to /api/validation/diffs/ or /api/review-requests/XX/diffs/?
#13 Simon*****@gmai***** (Google Code) (Is this you? Claim this profile.)
Sorry in this failed case there is no post to /api/validation/diffs/ or /api/review-requests/XX/diffs/ at all.
david
#14 david
OK, I have a reproduction case. We'll get this fixed for 2.0.8, which should come out today.
  • -NeedInfo
    +PendingReview
  • +david
david
#15 david
Fixed in release-2.0.x (e7e671a). Thanks for all your help!
  • -PendingReview
    +Fixed
#16 Simon*****@gmai***** (Google Code) (Is this you? Claim this profile.)
Thank you for your quick fix, looking forward to the upgrade.