[Bug 3504] file content lost after scp to same file at localhost

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Sun Nov 20 11:38:31 AEDT 2022


https://bugzilla.mindrot.org/show_bug.cgi?id=3504

Dominique Martinet <gmveqfhbronz.anqzf_ at noclue.notk.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gmveqfhbronz.anqzf_ at noclue.
                   |                            |notk.org

--- Comment #1 from Dominique Martinet <gmveqfhbronz.anqzf_ at noclue.notk.org> ---
A couple of notes:

 - that might look like a weird usecase (Don't do this!), but this can
happen with clustershell copy mode (clush --copy) where it's very easy
to send a file to all configured machines with the same path, and if
the source machine is included in that list we will run something like
this scp command (that's the reason Stephane found that out -- I just
think it's better to explain where we come from)

 - regardless of the localhost case, in case a transfer is interrupted
in the middle both the old scp protocol and sftp will leave the target
file clobbered. O_TRUNC is objectively better than leaving part of the
original content behind here, but a potential better alternative would
be to do like rsync and write to a temporary file (rsync uses
`.<originalfilename>.<randomchars>`)
That file can be removed safely if the connection is interrupted, and
the original file would be left untouched.


(perhaps it'd be better to ask this not to openssh portable but to the
bugs at openbsd list?)

Thank you!

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


More information about the openssh-bugs mailing list