On Jun 15 08:51:27, LEVAI Daniel wrote:
> On Tue, Jun 14, 2011 at 22:34:46 -0500, Corey wrote:
> > On 06/14/2011 04:52 AM, LEVAI Daniel wrote:
> > >Hi!
> > >
> > >
> > >Uploading a directory recursively fails if it doesn't exist on the
> > >remote site:
> > >
> > >sftp>  put -r nonexistent\ directory/
> > >Uploading nonexistent directory/ to /tmp/nonexistent directory
> > >Couldn't canonicalise: No such file or directory
> > >sftp>  mkdir nonexistent\ directory/
> > >sftp>  put -r nonexistent\ directory/
> > >       ^^^ success
> > >
> > >It should create the directory first, and then copy the content, no?
> > >This is on -current:
> > >$ ssh -V
> > >OpenSSH_5.8, OpenSSL 1.0.0a 1 Jun 2010
> > >
> > >
> > >Daniel
> > >
> > Did you try doing it with a directory without a space in it?  Not
> > that the space shouldn't work, but it might narrow down the problem
> > (as might grepping the source for that error message).
> 
> Yep, it breaks when using a name without space, but it seems that this
> is only reproducible with an ssh server running on Linux:
> $ ssh -V
> OpenSSH_5.8p1, OpenSSL 0.9.8r 8 Feb 2011
> 
> So the client is on OpenBSD (also 5.8), and the server is the Linux
> version. This is the environment where the bug happens.

It works fine with an OpenBSD sftp server:

$ mkdir '/tmp/my dir'
$ sftp localhost
hans@localhost's password: 
Connected to localhost.
sftp> put -r /tmp/my\ dir
Uploading /tmp/my dir/ to /home/hans/my dir
sftp> version
SFTP protocol version 3
sftp> ^D
$ ssh -V
OpenSSH_5.8, OpenSSL 1.0.0a 1 Jun 2010
$ uname -a
OpenBSD stary.dhcp.fjfi.cvut.cz 4.9 GENERIC.MP#794 i386

It also works with a linux client and obsd sevrer.

So it's probably the Linux server's problem.  Indeed, grepping
the source shows that the error message appears in exactly one
place, namely

$ grep "Couldn't canonicalise" *
sftp-client.c:          error("Couldn't canonicalise: %s", fx2txt(status));

which is

if (type == SSH2_FXP_STATUS) {
        u_int status = buffer_get_int(&msg);
        error("Couldn't canonicalise: %s", fx2txt(status));
        /* ... */
}

That's the server reporting a problem status to the client.

Trying with a Linux server:

sftp> put -r /tmp/my\ dir/
Uploading /tmp/my dir/ to /home/jsta6559/my dir
Couldn't canonicalise: No such file or directory
Unable to canonicalise path "/home/jsta6559/my dir"

The server cannot resolve the absolute canonicalized name of the dir
to be uploaded if the dir does not already exist; it seems irrelevant
whether the dir name is nice or not (I have tried both 'dir' and 'my
dir', wit the same results).

        Jan

Reply via email to