4369: Getting a UnicodeDecodeError in set_default_password (RB 2.5.3)

jhagan

RB 2.5.3 on centos 6.5 using Chrome browser

    1. I am using version 2.5.3 (recently upgraded from 2.0.18)
  1. Everything else is now working pretty good
  2. However, when clicking on certain reviews in my existing RB database (a copy of a real production RB database) I am getting a 500 error which on the backend end throws the following log...

NOTE: I posted this to the Google message board and David Trowbridge suggested filing a but.

When clicking on certain resources I'm seeing some of these errors in the backend (not all)...

File "/wayfair/pkg/python2.7/Python-2.7.3/lib/python2.7/site-packages/ReviewBoard-2.5.3-py2.7.egg/reviewboard/scmtools/svn/init.py", line 451, in build_client
client = Client(config_dir, repopath, username, password)
File "/wayfair/pkg/python2.7/Python-2.7.3/lib/python2.7/site-packages/ReviewBoard-2.5.3-py2.7.egg/reviewboard/scmtools/svn/pysvn.py", line 41, in init
self.client.set_default_password(six.text_type(password))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb8 in position 0: ordinal not in range(128)

Has anyone come accross this. It seems like it may be a red herring related to SVN not being configured correctly, but not sure.

#1 jhagan

I am able to workaround this is I remove teh six.text_type(...) cast from the user password below. Note, I ran into this bug because
I'm using an LDAP/Active Directory authentication and the automatically generated passwords which are in fact not used by Django anyway will
tend to have extended characters. I don't even think the default_username is used by my SVN client anyway.

class Client(base.Client):
31 required_module = 'pysvn'
32
33 def init(self, config_dir, repopath, username=None, password=None):
34 super(Client, self).init(config_dir, repopath, username, password)
35 self.client = pysvn.Client(config_dir)
36
37 if username:
38 self.client.set_default_username(six.text_type(username))
39
40 if password:
41 self.client.set_default_password(password)
42
43 def set_ssl_server_trust_prompt(self, cb):
44 self.client.callback_ssl_server_trust_prompt = cb

#2 jhagan

Here is a more formal DIFF

--- pysvn.py.old 2016-03-22 10:42:28.977449720 -0400
+++ pysvn.py 2016-03-22 10:48:21.590715519 -0400
@@ -38,7 +38,7 @@
self.client.set_default_username(six.text_type(username))

     if password:
  • self.client.set_default_password(six.text_type(password))
  • self.client.set_default_password(password)

    def set_ssl_server_trust_prompt(self, cb):
    self.client.callback_ssl_server_trust_prompt = cb

#3 jhagan

Here is a more formal DIFF
```
--- pysvn.py.old 2016-03-22 10:42:28.977449720 -0400

+++ pysvn.py 2016-03-22 10:48:21.590715519 -0400

@@ -38,7 +38,7 @@

         self.client.set_default_username(six.text_type(username))

 if password:

self.client.set_default_password(six.text_type(password))
self.client.set_default_password(password)

def set_ssl_server_trust_prompt(self, cb):
self.client.callback_ssl_server_trust_prompt = cb```

#4 jhagan

https://reviews.reviewboard.org/r/8071/

david
#5 david

Thanks for the patch! Fixed in release-2.0.x (fcac5e4). This will ship in 2.0.23 and 2.5.4).

  • -New
    +Fixed