SFTPHomeDirServer hangs with unicode urls
Robey Pointer
robey at lag.net
Thu Jan 26 22:50:55 GMT 2006
On 26 Jan 2006, at 8:01, John A Meinel wrote:
> Robey Pointer wrote:
>>
>> On 16 Jan 2006, at 14:27, John A Meinel wrote:
>>
>>> I haven't figured out exactly why yet, but the SFTPHomeDirServer is
>>> hanging when I try to create unicode paths.
>>> What is weird is that the AbsolutePath server (and Sibling)
>>> doesn't have
>>> any problems.
>>
>> Sorry that it took me a while to get to this, but if you look at line
>> 120 of tests/stub_sftp.py in the encodings branch, I think you'll
>> immediately see what the problem is. It's the same thing we fixed
>> earlier on bzr.dev when running the bzr tests against paramiko head.
>
> Unfortunately, I've merged jam-integration, so I've gotten those
> fixes,
> and it still hangs on test_unicode_paths(SFTPHomeDirServer)
>
> I could certainly be messing up something somewhere else, but I'm
> really
> surprised that the Absolute servers work, while the HomeDir does not.
After updating with your merge, I'm getting that error too now.
I got the actual traceback, and I'll spare you the dump, but the
error is:
File "/Users/robey/code/bzr.jam.encoding/bzrlib/tests/
stub_sftp.py", line 80,
in canonicalize
return os.path.normpath('/' + os.path.join(self.home, path))
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/posixpat
h.py", line 65, in join
path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
1: ordinal
not in range(128)
The fix turns out to be trivial:
=== modified file 'bzrlib/tests/stub_sftp.py'
--- bzrlib/tests/stub_sftp.py
+++ bzrlib/tests/stub_sftp.py
@@ -74,6 +74,7 @@
return self.root + self.canonicalize(path)
def canonicalize(self, path):
+ path = path.decode('utf-8')
if os.path.isabs(path):
return os.path.normpath(path)
else:
Probably in a future version of paramiko, server mode should auto-
decode the paths before calling into the server interface. For now,
it's passing in the raw UTF8. I filed that as a TODO for paramiko.
There are 37 failures after that patch, but they don't look related
to sftp. The tests finish.
robey
More information about the bazaar
mailing list