[Bug 4007] sftp cp -- Directory Destination Issue
bugzilla-daemon at mindrot.org
bugzilla-daemon at mindrot.org
Wed Sep 23 01:10:47 AEST 2026
https://bugzilla.mindrot.org/show_bug.cgi?id=4007
--- Comment #1 from Tamilan <tamileceguru at gmail.com> ---
2. sftp cp with same file destroys the file because sftp_copy opens the
dest file with SSH2_FXF_WRITE|SSH2_FXF_CREAT|SSH2_FXF_TRUNC.
so before calling the sftp_copy better to check src and destination are
same or not.
-----------------
sftp> cp ok/abx.txt ok/abx.txt
debug2: Sending SSH2_FXP_STAT "/tmp/ok/abx.txt"
debug3: Sent message fd 3 T:17 I:12
debug3: Received stat reply T:105 I:12 F:0x000f M:100644
debug3: Sent message SSH2_FXP_OPEN I:13 P:/tmp/ok/abx.txt
debug3: Sent message SSH2_FXP_OPEN I:14 P:/tmp/ok/abx.txt
debug3: Sent message copy-data "/tmp/ok/abx.txt" 0 0 ->
"/tmp/ok/abx.txt" 0
debug3: SSH2_FXP_STATUS 4
Couldn't copy file "/tmp/ok/abx.txt" to "/tmp/ok/abx.txt": Failure
debug3: Sent message SSH2_FXP_CLOSE I:16
debug3: SSH2_FXP_STATUS 0
debug3: Sent message SSH2_FXP_CLOSE I:17
debug3: SSH2_FXP_STATUS 0
----------------------------
--
You are receiving this mail because:
You are watching the assignee of the bug.
More information about the openssh-bugs
mailing list