When I use SCP file download and overwrite a local file I expect the local file to be completely overwritten. What I'm finding is that the bytes are written to the existing file starting at offset 0. This can be reproduce by using SCP file download to retrieve a file which is smaller in size then the local file it will overwrite.
- Make a file on the local system with text "abcdef" call it a.txt
- Make a file on a remote system with text "def" call it a.txt
- Use SCP to download the remote file into the same directory as the local file
- View contents of local a.txt file
- I expect the contents to be
def instead the contents of the file is def\nef
I initially reported this against Posh-SSH over at darkoperator/Posh-SSH#320. I was told it was a SSH.NET library issue.