3969: Exception when rbt posting from svn if the diff contains non-ascii file names

stefan.bohne

What version are you running?

RBTools 0.7.4

What steps will reproduce the problem?

  1. Create a svn repo
  2. Commit something with non-ascii file names
  3. Post this as review request via rbt post

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

I expect a review request being created without errors. I see an exception instead.

What operating system are you using?

Ubuntu 14.04

Attach the debug out from the command.

$ rbt post --publish --debug --user=xxx --password=yyy --server=http://reviews --repository-url=http://svn/svn/main/ --target-groups=CRBBBLACKSILO --target-people=xxx --description-file=/tmp/tmpvSF0WvcreateReviewForCommit --summary=longsummary --submit-as=xxx 11479

/usr/local/lib/python2.7/dist-packages/RBTools-0.7.4-py2.7.egg/rbtools/commands/main.py:101: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  elif opt.help or '--help' in args or '-h' in args:
>>> RBTools 0.7.4
>>> Python 2.7.6 (default, Jun 22 2015, 18:00:18) 
[GCC 4.8.2]
>>> Running on Linux-3.13.0-58-generic-i686-with-Ubuntu-14.04-trusty
>>> Home = /home/stbohne
>>> Current directory = /home/stbohne
>>> Running: git version
>>> Checking for a Subversion repository...
>>> Running: svn --non-interactive info http://svn/svn/main/
>>> Running: diff --version
>>> Running: svn --non-interactive --version -q
>>> repository info: Path: http://svn/svn/main, Base path: /, Supports changesets: False
>>> Making HTTP GET request to http://reviews/api/
>>> Making HTTP GET request to http://reviews/api/repositories/
>>> Cached response for HTTP GET http://reviews/api/repositories/ expired and was modified
>>> Making HTTP GET request to http://reviews/api/repositories/1/info/
>>> Cached response for HTTP GET http://reviews/api/repositories/1/info/ expired and was modified
>>> repository info: Path: http://svn/svn/main, Base path: /, Supports changesets: False
>>> Running: svn --non-interactive log --xml -r 11479 -l 1 http://svn/svn/main/
>>> Running: svn --non-interactive info http://svn/svn/main/
>>> Running: diff --version
>>> Running: svn --non-interactive --version -q
>>> repository info: Path: http://svn/svn/main, Base path: /, Supports changesets: False
>>> Running: svn --non-interactive status -q --ignore-externals
>>> Running: svn --non-interactive diff --diff-cmd=diff --notice-ancestry http://svn/svn/main/@11478 http://svn/svn/main/@11479
>>> Running: svn --non-interactive diff --diff-cmd=diff --notice-ancestry http://svn/svn/main/@11478 http://svn/svn/main/@11479 --no-diff-deleted
Traceback (most recent call last):
  File "/usr/local/bin/rbt", line 9, in <module>
    load_entry_point('RBTools==0.7.4', 'console_scripts', 'rbt')()
  File "/usr/local/lib/python2.7/dist-packages/RBTools-0.7.4-py2.7.egg/rbtools/commands/main.py", line 133, in main
    command.run_from_argv([RB_MAIN, command_name] + args)
  File "/usr/local/lib/python2.7/dist-packages/RBTools-0.7.4-py2.7.egg/rbtools/commands/__init__.py", line 612, in run_from_argv
    exit_code = self.main(*args) or 0
  File "/usr/local/lib/python2.7/dist-packages/RBTools-0.7.4-py2.7.egg/rbtools/commands/post.py", line 691, in main
    extra_args=extra_args)
  File "/usr/local/lib/python2.7/dist-packages/RBTools-0.7.4-py2.7.egg/rbtools/clients/svn.py", line 365, in diff
    'diff': b''.join(diff),
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 15: ordinal not in range(128)

Please provide any additional information below.

I tracked this down to rbtools/clients/svn.py line 626 in SVNClient.convert_to_absolute_paths. There, repository_info.base_path is a unicode string (just u'/' in my case). This unicode-ness is then propagated such that the result of convert_to_absolute_paths contains unicode and str. This then leads to the UnicodeDecodeError when the non-unicode strings contain non-ascii characters.

chipx86
#1 chipx86

Thanks for the analysis! We'll try to get this taken care of for 0.7.5 (which we were getting ready to release, but will hold off on).

Would you be able to supply a path/content that triggers this?

  • -New
    +NeedInfo
gmyers
#2 gmyers

Patch posted to https://reviews.reviewboard.org/r/7644/ for review.

david
#3 david

Fixed in release-0.7.x (7dd1ea2). Thanks!

  • -NeedInfo
    +Fixed