[MERGE/RFC] hostnames are not always ascii
Mark Hammond
mhammond at skippinet.com.au
Sat Aug 16 05:51:11 BST 2008
Via a bug on launchpad (https://bugs.launchpad.net/bzr/+bug/256550), it has
bee noted that on Windows at least, its possible for socket.gethostname() to
return a non-ascii string (specifically, when the user has specified a
non-ascii computer name when installing Windows)
I'm attaching a patch which changes 2 places where calling
socket.gethostname() would cause a Unicode error in such cases (I recreated
the issue on a VM for the purpose). The patch introduces a new
osutils.get_host_name() function that always returns Unicode and the 2
problem callers of socket.gethostname() now call this function. This fixes
the specific error detailed in the above bug report and I think its OK - but
I note the test suite still has extra failures in the case of a unicode host
name - eg:
FAIL: blackbox.test_cat_revision.TestCatRevision.test_cat_revision
not equal:
a = '<revision committer="skip <skip at VMVISTA-\xa9HAR>"...
b = '<revision committer="skip <skip at VMVISTA-T\xa9HAR>" ...
Note the host name in this case is u"VMVISTA-\xa9HAR" (ie, VMVISTA-CHAR,
but the C is a copyright symbol.)
I'll look a little into these extra test suite failures, but they are fairly
low impact - they will not be seen by anyone running the tests on an ascii
named host. In the meantime though I thought I'd put the patch itself up
for comment.
Cheers,
Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unicode_hostname.patch
Type: application/octet-stream
Size: 4434 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080816/0dd2ddea/attachment.obj
More information about the bazaar
mailing list