[PATCH] Re: any more sftp fixes?

John A Meinel john at arbash-meinel.com
Wed Nov 30 23:50:15 GMT 2005


Matthieu Moy wrote:
> John A Meinel <john at arbash-meinel.com> writes:
> 
>> The changes are available here:
>> http://bzr.arbash-meinel.com/branches/bzr/sftp-fix/
> 
> Still doesn't work for me.

Thanks for the bug report.
Maybe I missed it the first time around, but what is your specific use
case which is failing?
I want to make sure we get it added as a test case, so that we can make
sure not to have the problem in the future.

> 
> First, the error message for non-relative path is unclear, because the
> error can come from a different port number, different host, or
> different user.
> 
> The following patch gives a more detailed error message.

I see your point in doing it that way. But one advantage of giving the
complete paths is that if there is more than one of them which is
incorrect, you can see them all at once. Rather than finding "username
mismatch", fixing that, and then finding "host mismatch", etc.

What about having it be more:

'path %r is not under base URL %r: %s' % (abspath, self.base, messages)

Where messages would then contain:
'username mismatch', 'port mismatch', 'host mismatch', 'path mismatch', etc.

Then you would get

bzr: ERROR: path sftp://someone@foo.com/path/to/stuff is not under base
URL sftp://someoneelse@foo.com/path/to/stuff: username mismatch

Otherwise I think the thrown exception doesn't even make it clear that
it is a non relative path error. Just that some username doesn't match.

> 
> Moreover, in relpath(self, abspath) too, abspath does not necessarily
> contain a port number, so _split_url might return None for the port.
> The patch also fixes this by setting the port to 22 in _split_url()
> instead of _parse_url(). That seems to be sufficient for me.

Well, I'm just thought about the fact that because we are using the
installed ssh, ~/.ssh/config can certainly change the default port
number. So I'm thinking it should actually stay as None, rather than
forcing it to port 22. I'll change it back, and then can you let me know
if that also fixes your problem.

> 
> However, pushing gives me an error message which I think should be a
> warning.

I believe Robert is doing the work on handling working trees
(specifically remote ones). My original implementation wasn't accepted,
so I'm waiting to see what his integration branch turns up.

I'll want to see what the code in question is doing (because branch.py
should not be trying to update the remote working tree), and I'll
consider pulling your second patch.

John
=:->

> 
> $ ~/dev/sftp-fix/bzr push sftp://moy@localhost/%2ftmp/foobar
> Password: 
> bzr: ERROR: No WorkingTree exists for {'base': 'sftp://moy@localhost/%2Ftmp/foobar'}(base).
> 
> I suppose I should read this as
> 
> "dear user,
> 
> I'm sorry to inform you that bzr is not (yet ?) able to update remote
> working trees when doing a push. Please, run "bzr revert" from the
> remote location if you want to do so.
> 
> Best Regards,
> 
> The bzr team"
> 
> ;-).
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051130/32575f91/attachment.pgp 


More information about the bazaar mailing list