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: [email protected]
          Reporter: [email protected]

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.
_______________________________________________
openssh-bugs mailing list
[email protected]
https://lists.mindrot.org/mailman/listinfo/openssh-bugs

Reply via email to