www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples

Archive Index This month's Index

Subject: Possible libssh2_sftp_rename_ex bug?

Possible libssh2_sftp_rename_ex bug?

From: Jonas Schnelli <jonas.schnelli_at_include7.ch>
Date: Wed, 9 Nov 2011 22:17:32 +0100

Hi

I'm using libssh2 via libcurl.
I upload some files to a sftp filespace.
I'd like to make a kind of atomically upload:

1. upload the file with a temp-filename
2. rename the file after the upload is finished

When the file (rename destination) exists, i'll always get a "Operation Failed" from sftp_libssh2_strerror.
I'm (curl's) using the LIBSSH2_SFTP_RENAME_OVERWRITE flag.

code-snippet from curl:
rc = libssh2_sftp_rename_ex(sshc->sftp_session, sshc->quote_path1,
                                  (unsigned int)strlen(sshc->quote_path1),
                                  sshc->quote_path2,
                                  (unsigned int)strlen(sshc->quote_path2),
                                  LIBSSH2_SFTP_RENAME_OVERWRITE |
                                  LIBSSH2_SFTP_RENAME_ATOMIC |
                                  LIBSSH2_SFTP_RENAME_NATIVE);

When the file not exists: all fine.

I'm running against linux debian lenny update version.

I tried libssh 1.3.0 (sorry, i did not test the git version because i could not find any commit which aimed on my issue).

Anyone has a idea how we can fix this?

Jonas

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2011-11-09

the libssh2 team