WinSCP Clobbers Symlinks that for 100KB + Files

Advertisement

JsD
Donor
Joined:
Posts:
7

WinSCP Clobbers Symlinks that for 100KB + Files

When using WinSCP in SFTP mode and copying a remote file to local where the local copy is a symbolic link, the symbolic link will get converted to a hard file when the file size is exactly 100KB or more. Worse yet, on linux it will actually delete the symlink target.

Here is the test setup:
  1. make test file where file is 100KB or greater.
    ...\src\test.txt
  2. Make folder with symlink back to (1)
    ...\link\test.txt -> ...\src\test.txt
  3. Open WinSCP to a SFTP site with default settings. I my case, the SFTP site is running via Cygwin port on port 22.
  4. Navigate to local ...\link\test.txt
  5. Copy ...\link\test.txt to remote site
  6. Copy back test.txt from remote to local
At this point, ...\link\test.txt is no longer a symlink but an actual file. However, if the file is < 100KB, it will still be a symlink.

When doing this on Linux via Wine, the same will happen but the link target (...\src\test.txt) file is now DELETED from the filesystem!

I ran tests on fully updated Windows Server 2016 Standard and Ubuntu 22.04 (wine 6.x and 8.0). On Wine, I tested all the way back to 5.11.3 and had the same behavior so this must be a really old issue.

Workaround: Don't use SFTP but instead use SCP.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,450
Location:
Prague, Czechia

Re: WinSCP Clobbers Symlinks that for 100KB + Files

Thanks for your report.
What does it mean "Navigate to local ~/link/test.txt"? Are you emulating Linux on Windows? Or are you accessing Linux files from Windows? Or is it Windows symbolic link?

Reply with quote

JsD
Donor

Re: WinSCP Clobbers Symlinks that for 100KB + Files

What I mean with ~/link/test.txt is just <some_path>\link\test.txt for Windows client test and <some_path>/link/test.txt when testing on Linux client test. I should have written ...\link\test.txt.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,450
Location:
Prague, Czechia

Re: WinSCP Clobbers Symlinks that for 100KB + Files

Ok, it makes sense now. I've edited your original post, with how I now understand it.

You want to turn off the automatic transfer resume:
https://winscp.net/eng/docs/resume#automatic

When uploading, WinSCP detects the symlinks and disables the feature when uploading to a symlink. But it does not do the same when downloading.
This feature request is now tracked here:
Issue 2184 – Do not enable resumable download when the target is symbolic link
You can vote for it.

Reply with quote

Advertisement

You can post new topics in this forum