Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: WInSCP Not Handle CR/LF Correctly in Ascii Mode

Thanks for your feedback.

billy2393 wrote:

It seems that this bug #1059 is same as bug #845, which was fixed in 5.0.7. Why the same bug happen again?

The 5.0.7 fix was not generic enough to cover all possibilities.
billy2393

Re: WInSCP Not Handle CR/LF Correctly in Ascii Mode

It seems that this bug #1059 is same as bug #845, which was fixed in 5.0.7. Why the same bug happen again?
billy2393

Re: WInSCP Not Handle CR/LF Correctly in Ascii Mode

Sorry for the late reply. Just back from holidays.
The bug fix version works. I tested files in different size with this issue. They failed in old version and okay in new version. Thanks for the support.
Size
====
4097
8193
12289
16385
20481
24577
martin

Re: WInSCP Not Handle CR/LF Correctly in Ascii Mode

Thanks.

This bug has been added to the tracker:
https://winscp.net/tracker/1059

I'm sending you a dev version for testing.
billy2393

Re: WInSCP Not Handle CR/LF Correctly in Ascii Mode

Sorry for the typo.
3. Testing approach
- data in client is 4097 bytes. It has 16 lines and the last CR/LF falls on 4096-4097.
- put to Windows SFTP Server (installed Cygwin) using binary mode.
- the size at server is 4097.
- then get it using ascii mode to data2.
- data2 is 4098 bytes. One additional x'0D' in last line after char "A"
billy2393

Re: WInSCP Not Handle CR/LF Correctly in Ascii Mode

martin wrote:

What protocol are you using? Can you please email me a sample file? (compressed to avoid it being converted by the email clients).

1. Protocol being used is SFTP
2. Attached is the testing files
3. Testing approach
- data in client is 4097 bytes. The last CR/LF falls on 4096 bondary.
- put to server using binary mode. The size at server should be 4096.
- then get it using ascii mode to data2.
- Server is Windows. Suppose size of data should also be 4096.
- data2 is 4098 bytes. One additional x'0D' in last line after char "A"
4. Content of cmdfile:
option batch on
option confirm off
option batch abort
open sftp://<user>:<password>@<remote_host>
binary
put "TEST_4097_DATA.txt" "/ITDSFTP/TEST_4097_DATA.txt"
ascii
get "/ITDSFTP/TEST_4097_DATA.txt" "TEST_4097_DATA2.txt"
Close
Exit
martin

Re: WInSCP Not Handle CR/LF Correctly in Ascii Mode

What protocol are you using? Can you please email me a sample file? (compressed to avoid it being converted by the email clients).
billy2393

WInSCP Not Handle CR/LF Correctly in Ascii Mode

When execute a script to get a text file from Windows server in Ascii mode. Some line ending x'0D0A' (cr/lf) are incorrectly converted to x'0D0D0A' (add 1 byte). I found that this happen when the x'0D0A' is located at offset 4096-4097, 8192-8193, etc. I check the profile for this server using gui. The end-of-line char in Environment is set to LF (default). I then change it to CR/LF and the problem is fixed. Of cause, change it to Binary mode also works. I just wonder if this is a bug in WinSCP because it handle CR/LF correctly execpt those fall on 4096 boundary only. It seems that the x'0D0A' are seperately handled by two process: (1) x'0D' remains unchanged and (2) x'0A' is converted to x'0D0A'.
Version: 5.1.3