[merge] Unicode Exception fixes

John Arbash Meinel john at arbash-meinel.com
Mon Aug 21 20:34:09 BST 2006


There are a few bugs listed, which occur because of how we raise errors
with Unicode strings.

The basic issue is that str(foo) must always be a string, never a
Unicode object. And as it stands BzrNewError.__str__() would sometimes
return a unicode object, depending on the arguments passed. Which would
then be cast to a str(), and sometimes fail with a UnicodeError.

The attached patch directly fixes this bug:
https://launchpad.net/products/bzr/+bug/57123

By raising a custom error when a command is not ascii.

It also should fix part of this bug:
https://launchpad.net/products/bzr/+bug/53880

At least, it should fix the part where bzr is failing. It might
introduce a new bug, where bzr can't find plugins on czech windows,
because it misinterprets APPDATA.

Interestingly enough, this exposes some bugs in FTP. Because FTP doesn't
support unicode paths. But in the past there was a mutter() call that
would raise UnicodeError, and cause us to skip the test.
Since I fixed mutter(), I need to explicitly call str() on the path, so
that we skip the test. Otherwise we pass the utf8 path to Medusa, and
get a Server error, rather than skipping the test.

I don't know if this is trivial enough. But it doesn't change any
non-broken APIs. (It changes BzrNewError.__str__() to always return a
string, but returning a Unicode error is actually broken.) It does
introduce a couple new Exception classes, so that might be enough to not
count as trivial.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: unicode-error-fixes.patch
Type: text/x-patch
Size: 25340 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060821/d1df9839/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060821/d1df9839/attachment.pgp 


More information about the bazaar mailing list