4769: UnicodeDecodeError from svn_info() method in rbtools/clients/svn.py

j2sdk

What version are you running?

windows RBTools 1.0.1

What steps will reproduce the problem?

Execute rbt command line:
rbt post --svn-show-copies-as-adds=y --debug --open --exclude .Opt --exclude .xls --exclude *.lib --description none --server {{SVN_URL}}

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

The "rbt post" should work properly and post a new review request on reviewboard sever, as the case of RBT 0.7.11. Instead, an exception occurs with the following message:

What operating system are you using?

Windows 7

Attach the debug out from the command.

Traceback (most recent call last):
  File "C:\Program Files (x86)\RBTools\bin\..\Python27\Scripts\rbt-script.py", l
ine 11, in <module>
    load_entry_point('RBTools==1.0.1', 'console_scripts', 'rbt')()
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-1.0.1-
py2.7.egg\rbtools\commands\main.py", line 120, in main
    command.run_from_argv([RB_MAIN, command_name] + args)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-1.0.1-
py2.7.egg\rbtools\commands\__init__.py", line 719, in run_from_argv
    exit_code = self.main(*args) or 0
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-1.0.1-
py2.7.egg\rbtools\commands\post.py", line 806, in main
    extra_args=extra_args)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-1.0.1-
py2.7.egg\rbtools\clients\svn.py", line 520, in diff
    diff = self.convert_to_absolute_paths(diff, repository_info)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-1.0.1-
py2.7.egg\rbtools\clients\svn.py", line 845, in convert_to_absolute_paths
    info = self.svn_info(file, True)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-1.0.1-
py2.7.egg\rbtools\clients\svn.py", line 894, in svn_info
    parts = info.strip().split(': ', 1)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb6 in position 46: ordinal
 not in range(128)

Please provide any additional information below.

  1. According to github history, the implementation of svn_info() changed from spliting with b': ' to ': ' (commit f158f41e98a48ccca23eb8bbee76352aab6b65e5). If this change is reverted, the exception no longer exists and "rbt post" works as expected.

  2. I guess it's because there are non-ascii, non-unicode characters in my "svn info" output(as attached below). It is a big5-encoded string.

Path: .
Working Copy Root Path: ***
URL: ***
Relative URL: ^/
Repository Root: ***
Repository UUID: ***
Revision: ***
Node Kind: directory
Schedule: normal
Last Changed Author: ***
Last Changed Rev: ***
Last Changed Date: 2018-11-21 18:06:50 +0800 (週三, 21 十一月 2018)
#1 kmierzej

In order to fix it, you need to modify your rbtools-1.0.1-py2.7.egg\rbtools\clients\svn.py
by changing line 894 to :

parts = info.decode(_fs_encoding).strip().split(': ', 1)

david
#2 david

This was fixed in release-1.0.x (a9305e7, and will ship in 1.0.2. Thanks!

  • -New
    +Fixed