SFTP Unexpected size of data stream

Get help for specific problems
Posts: 4
Joined: 21 Apr 2016

pp_user

Hello,

I copy files from FTP server (SFTP-connection) and sometimes get an error ("Unexpected size of data stream") - files can be updated during sync. Can I supress it and copy files anyway?
Posts: 4
Joined: 21 Apr 2016

pp_user

For example, WinSCP does it without such an error.
User avatar
Site Admin
Posts: 7211
Joined: 9 Dec 2007

Zenju

The error indicates data corruption, so this is not something to be ignored. Either the file size reported by the SFTP folder is wrong (stat) or the data retrieved is invalid (read), in the best case only returning short or adding superfluous bytes.
Posts: 4
Joined: 21 Apr 2016

pp_user

The problem is that the file I've been copying, is frequently updated, so the size differs. Can ffs copy all the file not regarding to it's size at the beginning of the sync?
User avatar
Site Admin
Posts: 7211
Joined: 9 Dec 2007

Zenju

FFS opens the file handle, retrieves the file size and then starts copying the file, it does not consider the file size of the time of comparison. If there is still a mismatch it means the file was changed while the file copy is in progress, so data is very likely partially invalid.
Posts: 4
Joined: 21 Apr 2016

pp_user

Thanks!