bugzilla-daemon at mindrot.org
2022-May-10 22:19 UTC
[Bug 3431] New: scp truncates file when copying file over itself
https://bugzilla.mindrot.org/show_bug.cgi?id=3431 Bug ID: 3431 Summary: scp truncates file when copying file over itself Product: Portable OpenSSH Version: v9.0p1 Hardware: All OS: Linux Status: NEW Severity: major Priority: P5 Component: scp Assignee: unassigned-bugs at mindrot.org Reporter: christof.schmitt at us.ibm.com With the new sftp based scp, using scp to copy a file over itself, truncates that file: Steps to Reproduce: 1. echo foo > /tmp/bar 2. scp /tmp/bar $(hostname):/tmp/bar 3. cat /tmp/bar All data in that file is then lost. This is a problem for scripts, e.g. cluster automation tools that rely on the fact that a file /tmp/bar can be copied with scp to all cluster nodes as /tmp/bar, including the node itself. Changing this behavior is unexpected, and silently dropping the data seems to be the worst possibly outcome. In addition to scripts, admins might also be surprised that copying files (maybe accidentally) to the same host, leaves those files corrupted. Would it be possible to change the behavior in this case? Either explicitly returning an error, or finding a way to preserve the data would be a better outcome. https://lists.mindrot.org/pipermail/openssh-unix-dev/2022-February/040059.html suggests that possibly the sftp server could use a temp file. -- You are receiving this mail because: You are watching the assignee of the bug.
bugzilla-daemon at mindrot.org
2022-May-10 22:20 UTC
[Bug 3431] scp truncates file when copying file over itself
https://bugzilla.mindrot.org/show_bug.cgi?id=3431 Christof Schmitt <christof.schmitt at us.ibm.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned-bugs at mindrot.org |dbelyavs at redhat.com -- You are receiving this mail because: You are watching the assignee of the bug.
bugzilla-daemon at mindrot.org
2022-May-11 07:08 UTC
[Bug 3431] scp truncates file when copying file over itself
https://bugzilla.mindrot.org/show_bug.cgi?id=3431 Dmitry Belyavskiy <dbelyavs at redhat.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|dbelyavs at redhat.com |unassigned-bugs at mindrot.org --- Comment #1 from Dmitry Belyavskiy <dbelyavs at redhat.com> --- Not sure that assignment to an external contributor is a good idea :) -- You are receiving this mail because: You are watching the assignee of the bug.
bugzilla-daemon at mindrot.org
2022-May-13 03:10 UTC
[Bug 3431] scp truncates file when copying file over itself
https://bugzilla.mindrot.org/show_bug.cgi?id=3431 Damien Miller <djm at mindrot.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |djm at mindrot.org, | |dtucker at dtucker.net Attachment #3594| |ok?(dtucker at dtucker.net) Flags| | --- Comment #2 from Damien Miller <djm at mindrot.org> --- Created attachment 3594 --> https://bugzilla.mindrot.org/attachment.cgi?id=3594&action=edit don't overwrite files This fixes it for 'scp foo localhost:foo' and 'scp localhost:foo foo', but not 'scp localhost:foo localhost:foo' -- You are receiving this mail because: You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
bugzilla-daemon at mindrot.org
2022-May-13 03:16 UTC
[Bug 3431] scp truncates file when copying file over itself
https://bugzilla.mindrot.org/show_bug.cgi?id=3431 Darren Tucker <dtucker at dtucker.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #3594|ok?(dtucker at dtucker.net) |ok+ Flags| | -- You are receiving this mail because: You are watching someone on the CC list of the bug. You are watching the assignee of the bug.
bugzilla-daemon at mindrot.org
2022-May-13 07:01 UTC
[Bug 3431] scp truncates file when copying file over itself
https://bugzilla.mindrot.org/show_bug.cgi?id=3431 Damien Miller <djm at mindrot.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |3418 Resolution|--- |FIXED Status|NEW |RESOLVED --- Comment #3 from Damien Miller <djm at mindrot.org> --- This fix has been committed and will be in OpenSSH 9.1, due in a few months. commit 56a0697fe079ff3e1ba30a2d5c26b5e45f7b71f8 (HEAD -> master, origin/master, origin/HEAD) Author: djm at openbsd.org <djm at openbsd.org> Date: Fri May 13 06:31:50 2022 +0000 upstream: arrange for scp, when in sftp mode, to not ftruncate(3) files early previous behavious of unconditionally truncating the destination file would cause "scp ~/foo localhost:" and "scp localhost:foo ~/" to delete all the contents of their destination. spotted by solene@ sthen@, also bz3431; ok dtucker@ OpenBSD-Commit-ID: ca39fdd39e0ec1466b9666f15cbcfddea6aaa179 Referenced Bugs: https://bugzilla.mindrot.org/show_bug.cgi?id=3418 [Bug 3418] tracking bug for openssh-9.1 -- You are receiving this mail because: You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
bugzilla-daemon at mindrot.org
2022-Oct-04 10:59 UTC
[Bug 3431] scp truncates file when copying file over itself
https://bugzilla.mindrot.org/show_bug.cgi?id=3431 --- Comment #4 from Damien Miller <djm at mindrot.org> --- Closing bugs from openssh-9.1 release cycle -- You are receiving this mail because: You are watching someone on the CC list of the bug. You are watching the assignee of the bug.
bugzilla-daemon at mindrot.org
2023-Mar-17 02:38 UTC
[Bug 3431] scp truncates file when copying file over itself
https://bugzilla.mindrot.org/show_bug.cgi?id=3431 Damien Miller <djm at mindrot.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED --- Comment #5 from Damien Miller <djm at mindrot.org> --- OpenSSH 9.3 has been released. Close resolved bugs -- You are receiving this mail because: You are watching the assignee of the bug. You are watching someone on the CC list of the bug.