Mailing List Archive

scp gotcha on NFS
I ran into a nasty gotcha today with scp from openssh-1.2pre17.

If you use scp to copy a file between machines when the local and
remote file args correspond to the same physical file (e.g., exported
by a NFS mount) the file is trashed. E.g., if your home directories on
"homer" and "bart" share the same NFS-mounted volume and you do

homer$ scp foo bart:foo

file "foo" will be trashed. It'll be the same length as before, but
overwritten with something that looks like

scp -t foo<lots of binary 0's and other binary garbage>

which repeats for the length of the file.