[Bug 3504] New: file content lost after scp to same file at localhost
bugzilla-daemon at mindrot.org
bugzilla-daemon at mindrot.org
Sun Nov 20 10:23:12 AEDT 2022
https://bugzilla.mindrot.org/show_bug.cgi?id=3504
Bug ID: 3504
Summary: file content lost after scp to same file at localhost
Product: Portable OpenSSH
Version: 8.7p1
Hardware: amd64
OS: Linux
Status: NEW
Severity: major
Priority: P5
Component: scp
Assignee: unassigned-bugs at mindrot.org
Reporter: sthiell at stanford.edu
It looks like that when scp is using the SFTP protocol (the default
now), the following use case doesn't work anymore.
Reproducer:
$ echo bar > /tmp/foo
$ cat /tmp/foo
bar
$ scp /tmp/foo localhost:/tmp/foo
foo
0% 0 0.0KB/s --:-- ETA
Then, data in /tmp/foo is lost:
$ cat /tmp/foo
$
It looks like sftp opens the destination file with O_TRUNC which is
different than with the legacy SCP, which works as expected:
$ echo bar > /tmp/foo
$ scp -O /tmp/foo localhost:/tmp/foo
foo
100% 4 2.6KB/s 00:00
$ cat /tmp/foo
bar
--
You are receiving this mail because:
You are watching the assignee of the bug.
More information about the openssh-bugs
mailing list