cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: POSTQUOTE rename on SFTP

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Sun, 30 Oct 2011 12:59:16 -0700

On Sun, Oct 30, 2011 at 01:11:05PM +0100, Jonas Schnelli wrote:
> I try to do a kind-of atomic upload over sftp with libcurl.
>
> Currently i'm sending a postquote command "rename" (after uploading a random uuid filename).
> The rename works fine...
> But when the destination file already exists, then the command fails with "rename command failed: Operation failed".
>
> Libcurl tells libssh2 LIBSSH2_SFTP_RENAME_OVERWRITE: so, the overwrite should be possible.

Let me guess--the server is running Windows, right? This kind of problem has
been reported before, and IIRC seems to have something to do with the remote
server leaving the file open before the rename occurs. Renaming open files
is verboten under Windows, so it errs out. Search the mailing list archives
and you'll find some more details; I believe the conclusion was that it was
a problem in the remote server and not libcurl, but don't quote me on that.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-10-30