Bugs item #3215314, was opened at 2011-03-16 12:44
Message generated for change (Tracker Item Submitted) made by mydreamzz
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3215314&group_id=976
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: SCP/SFTP
Group: bad behaviour
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Rajesh Naganathan (mydreamzz)
Assigned to: Daniel Stenberg (bagder)
Summary: Post quote operation to rename fails in Windows
Initial Comment:
There is already posting done for this issue(http://curl.haxx.se/mail/lib-2011-02/0322.html) and below is the abstract.
We are using CURLOPT_POSTQUOTE option to rename a file after transfer of the file using sftp protocol.But the POSTQUOTE option for rename is failing when the sftp server is runing in Windows O/S.The same code works perfectly when the sftp server is Linux or Sun OS. Following is the Log from the server side.
Complete FTP:
2011-02-23 14:46:31,203 INFO SFTPSubsystemServer [48:temp] Opened /C-drive/.A20110223.0826+0000-XYZ.TBD.0000075BCD15.1 for writing
2011-02-23 14:46:31,844 ERROR SFTPSubsystemServer [48:temp] Failed to move file .A20110223.0826+0000-XYZ.TBD.0000075BCD15.1 => A20110223.0826+0000-XYZ.TBD.0000075BCD15.1: The process cannot access the file because it is being used by another process.
Cerebres SFTP :
2011/02/23 15:05:33 [5] File Open command received
2011/02/23 15:05:33 [5] File handle to '//.A20110223.0931+0000-XYZ.TBD.0000075BCD15.1' opened
2011/02/23 15:05:33 [5] Upload started for file 'C:\.A20110223.0931+0000-XYZ.TBD.0000075BCD15.1'
2011/02/23 15:05:34 [5] Unable to rename file 'C:\.A20110223.0931+0000-XYZ.TBD.0000075BCD15.1'
2011/02/23 15:05:34 [5] Upload complete for file 'C:\.A20110223.0931+0000-XYZ.TBD.0000075BCD15.1'
2011/02/23 15:05:34 [5] Handle '//.A20110223.0931+0000-XYZ.TBD.0000075BCD15.1' closed
It was suggested that libcurl uses libssh2 to do the SFTP operations and the thing libcurl can do here is to make sure that libssh2_sftp_close() is done on the file properly before it does the POST_QUOTE operations. Since this can be supported by libcurl,it would be better for libcurl to do the libssh2_sftp_close first followed by the execution of the rename operation instead of any server specific implementation.
Currently this works fine in Linux because linux doesnt care about the open files..Suppose Linux also makes sure that the file should be closed to perform the rename operation,the entire post quote operation supported by libcurl will fail on Linux and Windows.
So its better if libcurl could support the behaviour of doing the libssh2_close before doing the postquote operations.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3215314&group_id=976
Received on 2011-03-16