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

Can you send me an email, so I can send you back a debug version of WinSCP to track the problem? Please include link back to this topic in your email. Also note in this topic that you have sent the email. Thanks.

You will find my address (if you log in) in my forum profile.
Guest

ads_green wrote:

I have this too.

It's really annoying as it is random if it will add a null character in the middle of the file or not.

However, only ever happens to me when using the internal WinScp editor to change a file.
Unfortunately, this makes winscp a problem as it'll upload the file apparently "fine" but will cause all sorts of problems to a server relying on the xml thats changed.

If you then reload the file and highlight the text in the editor you can see the new character that has been created.

I've cases where files have been loaded, edited, saved fine and then re-edited in the same winscp session, saved fine, re-edited and bang - random null.


Forgot to add -this is with 5.0.6
ads_green

I have this too.

It's really annoying as it is random if it will add a null character in the middle of the file or not.

However, only ever happens to me when using the internal WinScp editor to change a file.
Unfortunately, this makes winscp a problem as it'll upload the file apparently "fine" but will cause all sorts of problems to a server relying on the xml thats changed.

If you then reload the file and highlight the text in the editor you can see the new character that has been created.

I've cases where files have been loaded, edited, saved fine and then re-edited in the same winscp session, saved fine, re-edited and bang - random null.
Guest

Re: adding characters at the beginning of the file

martin wrote:

iworkonline wrote:

I am transferring file from from windows & Pro to unix server from SSIS using Execute Process task
C:\Program Files (x86)\WinSCP\WinSCP.com version number is 5.0.6(Build 2074)
...

First, the log is for a different script that you have posted.

Second, what characters at beginning of what file?


Please disregard my request, it had nothing to do with WinSCP.
martin

Re: adding characters at the beginning of the file

iworkonline wrote:

I am transferring file from from windows & Pro to unix server from SSIS using Execute Process task
C:\Program Files (x86)\WinSCP\WinSCP.com version number is 5.0.6(Build 2074)
...

First, the log is for a different script that you have posted.

Second, what characters at beginning of what file?
iworkonline

adding characters at the beginning of the file

I am transferring file from from windows & Pro to unix server from SSIS using Execute Process task
C:\Program Files (x86)\WinSCP\WinSCP.com version number is 5.0.6(Build 2074)

I am using the following script to connect:
option batch abort

option confirm off
open sftp:// username:password@IPAdress
cd \myfolder\
lcd c:\temp\myfile.txt
close
exit


There are some characters added at the beginning of the file.
Here is the log file



. 2012-03-06 15:47:30.262 --------------------------------------------------------------------------

. 2012-03-06 15:47:30.262 WinSCP Version 5.0.6 (Build 2074) (OS 6.1.7601 Service Pack 1)
. 2012-03-06 15:47:30.262 Configuration: HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\
. 2012-03-06 15:47:30.262 Local account: PNMAC\mabedin
. 2012-03-06 15:47:30.262 Login time: Tuesday, March 06, 2012 3:47:30 PM
. 2012-03-06 15:47:30.262 --------------------------------------------------------------------------
. 2012-03-06 15:47:30.262 Session name: C0010956@00.00.82.22 (Modified stored session)
. 2012-03-06 15:47:30.262 Host name: 00.00.82.22 (Port: 22)
. 2012-03-06 15:47:30.262 User name: C0010988 (Password: Yes, Key file: No)
. 2012-03-06 15:47:30.262 Tunnel: No
. 2012-03-06 15:47:30.262 Transfer Protocol: SFTP
. 2012-03-06 15:47:30.262 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2012-03-06 15:47:30.262 Proxy: none
. 2012-03-06 15:47:30.262 SSH protocol version: 2; Compression: No
. 2012-03-06 15:47:30.262 Bypass authentication: No
. 2012-03-06 15:47:30.262 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2012-03-06 15:47:30.262 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2012-03-06 15:47:30.262 SSH Bugs: -,-,-,-,-,-,-,-,-,-
. 2012-03-06 15:47:30.262 SFTP Bugs: -,-
. 2012-03-06 15:47:30.262 Return code variable: Autodetect; Lookup user groups: -
. 2012-03-06 15:47:30.262 Shell: default
. 2012-03-06 15:47:30.262 EOL: 0, UTF: 2
. 2012-03-06 15:47:30.262 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2012-03-06 15:47:30.262 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2012-03-06 15:47:30.262 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2012-03-06 15:47:30.262 Cache directory changes: Yes, Permanent: Yes
. 2012-03-06 15:47:30.262 DST mode: 1
. 2012-03-06 15:47:30.262 --------------------------------------------------------------------------
. 2012-03-06 15:47:30.263 Looking up host "00.00.82.22"
. 2012-03-06 15:47:30.263 Connecting to 00.00.82.22 port 22
. 2012-03-06 15:47:30.365 Server version: SSH-2.0-Connect:Enterprise_UNIX_2.4.03
. 2012-03-06 15:47:30.365 Using SSH protocol version 2
. 2012-03-06 15:47:30.365 We claim version: SSH-2.0-WinSCP_release_5.0.6
. 2012-03-06 15:47:30.413 Doing Diffie-Hellman group exchange
. 2012-03-06 15:47:30.604 Doing Diffie-Hellman key exchange with hash SHA-1
. 2012-03-06 15:47:30.722 Verifying host key rsa2 0x23,0xb528c7f69d099f7116a999b1f3265bc9e3c6ad1bf72047bc5b91d170da1c7f01a051c6174c0999ded938ac6b8256f41457471b355ab152a2dfb8fa8c5253aabe6afcc0f06655855277328bea0bfff48098078ef24ffb34e8314d18d023cfbdcb8774fd233c53b37d877f69bd0e9bbd0d6e035c80fbcdb8557ff7df8010781931 with fingerprint ssh-rsa 1024 0c:54:bf:ec:5a:bc:07:8b:73:40:15:13:cd:81:82:7b
. 2012-03-06 15:47:30.722 Host key matches cached key
. 2012-03-06 15:47:30.722 Host key fingerprint is:
. 2012-03-06 15:47:30.722 ssh-rsa 1024 0c:54:bf:ec:5a:bc:07:8b:73:40:15:13:cd:81:82:7b
. 2012-03-06 15:47:30.722 Initialised AES-256 CBC client->server encryption
. 2012-03-06 15:47:30.722 Initialised HMAC-SHA1 client->server MAC algorithm
. 2012-03-06 15:47:30.722 Initialised AES-256 CBC server->client encryption
. 2012-03-06 15:47:30.722 Initialised HMAC-SHA1 server->client MAC algorithm
! 2012-03-06 15:47:31.006 Using username "C0010900".
. 2012-03-06 15:47:31.053 Attempting keyboard-interactive authentication
. 2012-03-06 15:47:31.096 Server refused keyboard-interactive authentication
. 2012-03-06 15:47:31.096 Prompt (7, SSH password, , &Password: )
. 2012-03-06 15:47:31.096 Using stored password.
. 2012-03-06 15:47:31.096 Sent password
. 2012-03-06 15:47:31.160 Access granted
. 2012-03-06 15:47:31.204 Opened channel for session
. 2012-03-06 15:47:31.407 Started a shell/command
. 2012-03-06 15:47:31.408 --------------------------------------------------------------------------
. 2012-03-06 15:47:31.408 Using SFTP protocol.
. 2012-03-06 15:47:31.408 Doing startup conversation with host.
> 2012-03-06 15:47:31.408 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2012-03-06 15:47:31.461 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2012-03-06 15:47:31.461 SFTP version 3 negotiated.
. 2012-03-06 15:47:31.461 We believe the server has signed timestamps bug
. 2012-03-06 15:47:31.461 We will use UTF-8 strings for status messages only
. 2012-03-06 15:47:31.461 Getting current directory name.
. 2012-03-06 15:47:31.461 Getting real path for '.'
> 2012-03-06 15:47:31.461 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2012-03-06 15:47:31.504 Type: SSH_FXP_NAME, Size: 39, Number: 16
. 2012-03-06 15:47:31.504 Real path is '/C001000'
. 2012-03-06 15:47:31.504 Startup conversation with host finished.
< 2012-03-06 15:47:31.505 Script: Active session: [1] C0010977@69.87.82.22
> 2012-03-06 15:47:31.505 Script: lcd c:\Temp\CoreLogic
< 2012-03-06 15:47:31.505 Script: c:\Temp\CoreLogic
> 2012-03-06 15:47:31.506 Script: put TASFA.TXT
. 2012-03-06 15:47:31.506 Copying 1 files/directories to remote directory "/C0010900"
. 2012-03-06 15:47:31.506   PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask:
. 2012-03-06 15:47:31.506   TM: A; ClAr: No; CPS: 0; InclM:
. 2012-03-06 15:47:31.506   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2012-03-06 15:47:31.507 File: "TASFA.TXT"
. 2012-03-06 15:47:31.507 Copying "TASFA.BNA.TXT" to remote directory started.
. 2012-03-06 15:47:31.507 Ascii transfer mode selected.
. 2012-03-06 15:47:31.507 Opening remote file.
> 2012-03-06 15:47:31.507 Type: SSH_FXP_OPEN, Size: 62, Number: 259
< 2012-03-06 15:47:31.551 Type: SSH_FXP_HANDLE, Size: 13, Number: 259
> 2012-03-06 15:47:31.552 Type: SSH_FXP_WRITE, Size: 4121, Number: 774
. 2012-03-06 15:47:31.999 43 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2012-03-06 15:47:31.999 Type: SSH_FXP_CLOSE, Size: 13, Number: 7172
> 2012-03-06 15:47:31.999 Type: SSH_FXP_SETSTAT, Size: 58, Number: 521
< 2012-03-06 15:47:32.005 Type: SSH_FXP_STATUS, Size: 24, Number: 5638
< 2012-03-06 15:47:32.039 Type: SSH_FXP_STATUS, Size: 24, Number: 5894
< 2012-03-06 15:47:32.071 Type: SSH_FXP_STATUS, Size: 24, Number: 6150
< 2012-03-06 15:47:32.105 Type: SSH_FXP_STATUS, Size: 24, Number: 6406
< 2012-03-06 15:47:32.137 Type: SSH_FXP_STATUS, Size: 24, Number: 6662
< 2012-03-06 15:47:32.161 Type: SSH_FXP_STATUS, Size: 24, Number: 6918
< 2012-03-06 15:47:32.204 Type: SSH_FXP_STATUS, Size: 38, Number: 7172
< 2012-03-06 15:47:32.204 Status code: 0
< 2012-03-06 15:47:32.204 Type: SSH_FXP_STATUS, Size: 24, Number: 521
< 2012-03-06 15:47:32.204 Status code: 0
> 2012-03-06 15:47:32.205 Script: close
. 2012-03-06 15:47:32.205 Closing connection.
. 2012-03-06 15:47:32.205 Sending special code: 12
. 2012-03-06 15:47:32.205 Sent EOF message
martin

Nilpo wrote:

I'm running Version 5.02 (Build 1456) on Windows Vista and getting null characters in the middle of files.

Please post a full log file showing the problem.

To generate log file, enable logging, log in to your server and do the operation and only the operation that causes the error. For posting extensive logs you may use pastebin or similar application. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you may email it to me. You will find my address (if you log in) in my forum profile. Please include link back to this topic in your email. Also note in this topic that you have emailed the log.
Nilpo

Has this been confirmed as a bug and/or resolved?

I'm running Version 5.02 (Build 1456) on Windows Vista and getting null characters in the middle of files.
Dmitry Ogarkov

martin wrote:

Can you email me Debug-1 level log file?

Done.
martin

Thanks. So far, everything seems ok. Can you email me Debug-1 level log file?
Dmitry Ogarkov

Here you are. The host/user names and the IP address are replaced with x-es if you don't mind.

. 2010-02-01 10:45:27.513 --------------------------------------------------------------------------

. 2010-02-01 10:45:27.513 WinSCP Version 4.2.5 (Build 624) (OS 5.1.2600 Service Pack 3)
. 2010-02-01 10:45:27.513 Login time: 1 Февраль 2010 г. 10:45:27
. 2010-02-01 10:45:27.513 --------------------------------------------------------------------------
. 2010-02-01 10:45:27.513 Session name: xxxxxxx
. 2010-02-01 10:45:27.513 Host name: xxxxxxx.xxx (Port: 22)
. 2010-02-01 10:45:27.513 User name: xxxxxxxx (Password: No, Key file: No)
. 2010-02-01 10:45:27.513 Tunnel: No
. 2010-02-01 10:45:27.513 Transfer Protocol: SFTP (SCP)
. 2010-02-01 10:45:27.513 Ping type: N, Ping interval: 30 sec; Timeout: 15 sec
. 2010-02-01 10:45:27.513 Proxy: none
. 2010-02-01 10:45:27.513 SSH protocol version: 2; Compression: No
. 2010-02-01 10:45:27.513 Bypass authentication: No
. 2010-02-01 10:45:27.513 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2010-02-01 10:45:27.513 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2010-02-01 10:45:27.513 SSH Bugs: -,-,-,-,-,-,-,-,-
. 2010-02-01 10:45:27.513 SFTP Bugs: -,-
. 2010-02-01 10:45:27.513 Return code variable: Autodetect; Lookup user groups: Yes
. 2010-02-01 10:45:27.513 Shell: default, EOL: 0
. 2010-02-01 10:45:27.513 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2010-02-01 10:45:27.513 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2010-02-01 10:45:27.513 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2010-02-01 10:45:27.513 Cache directory changes: Yes, Permanent: Yes
. 2010-02-01 10:45:27.513 DST mode: 1
. 2010-02-01 10:45:27.513 --------------------------------------------------------------------------
. 2010-02-01 10:45:27.529 Looking up host "xxxxxxx.xxx"
. 2010-02-01 10:45:27.529 Connecting to xx.xx.xxx.xxx port 22
. 2010-02-01 10:45:27.904 Server version: SSH-2.0-mod_sftp/0.9.7
. 2010-02-01 10:45:27.904 Using SSH protocol version 2
. 2010-02-01 10:45:27.904 We claim version: SSH-2.0-WinSCP_release_4.2.5
. 2010-02-01 10:45:27.904 Doing Diffie-Hellman group exchange
. 2010-02-01 10:45:28.279 Doing Diffie-Hellman key exchange with hash SHA-1
. 2010-02-01 10:45:28.607 Host key fingerprint is:
. 2010-02-01 10:45:28.607 ssh-rsa 2048 0d:7b:3d:35:38:f9:27:23:f7:f6:7d:47:ec:b6:b3:bc
. 2010-02-01 10:45:28.607 Initialised AES-256 SDCTR client->server encryption
. 2010-02-01 10:45:28.607 Initialised HMAC-SHA1 client->server MAC algorithm
. 2010-02-01 10:45:28.794 Initialised AES-256 SDCTR server->client encryption
. 2010-02-01 10:45:28.794 Initialised HMAC-SHA1 server->client MAC algorithm
! 2010-02-01 10:45:28.982 Using username "xxxxxxxx".
. 2010-02-01 10:45:29.169 Prompt (6, SSH password, , &Password: )
. 2010-02-01 10:45:31.826 Sent password
. 2010-02-01 10:45:32.029 Access granted
. 2010-02-01 10:45:32.216 Opened channel for session
. 2010-02-01 10:45:32.638 Started a shell/command
. 2010-02-01 10:45:32.638 --------------------------------------------------------------------------
. 2010-02-01 10:45:32.638 Using SFTP protocol.
. 2010-02-01 10:45:32.638 Doing startup conversation with host.
> 2010-02-01 10:45:32.638 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2010-02-01 10:45:32.826 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2010-02-01 10:45:32.826 SFTP version 3 negotiated.
. 2010-02-01 10:45:32.826 We believe the server has signed timestamps bug
. 2010-02-01 10:45:32.826 We will use UTF-8 strings for status messages only
. 2010-02-01 10:45:32.826 Getting current directory name.
. 2010-02-01 10:45:32.826 Getting real path for '.'
> 2010-02-01 10:45:32.826 Type: SSH_FXP_REALPATH, Size: 10, Number: 1296
< 2010-02-01 10:45:33.013 Type: SSH_FXP_NAME, Size: 108, Number: 1296
. 2010-02-01 10:45:33.013 Real path is '/'
. 2010-02-01 10:45:33.013 Listing directory "/".
> 2010-02-01 10:45:33.013 Type: SSH_FXP_OPENDIR, Size: 10, Number: 1547
< 2010-02-01 10:45:33.185 Type: SSH_FXP_HANDLE, Size: 15, Number: 1547
> 2010-02-01 10:45:33.185 Type: SSH_FXP_READDIR, Size: 15, Number: 1804
< 2010-02-01 10:45:33.388 Type: SSH_FXP_NAME, Size: 1545, Number: 1804
> 2010-02-01 10:45:33.388 Type: SSH_FXP_READDIR, Size: 15, Number: 2060
< 2010-02-01 10:45:33.576 Type: SSH_FXP_STATUS, Size: 33, Number: 2060
< 2010-02-01 10:45:33.576 Status code: 1
> 2010-02-01 10:45:33.576 Type: SSH_FXP_CLOSE, Size: 15, Number: 2308
. 2010-02-01 10:45:33.576 Startup conversation with host finished.
. 2010-02-01 10:45:48.561 Copying 1 files/directories to remote directory "/"
. 2010-02-01 10:45:48.561   PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 01; Resume: S (102400); CalcS: Yes; Mask: *.*
. 2010-02-01 10:45:48.561   TM: M; ClAr: No; CPS: 0; ExclM(No):
. 2010-02-01 10:45:48.561   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2010-02-01 10:45:48.561 File: "D:\Documents\test.php"
. 2010-02-01 10:45:48.561 Copying "D:\Documents\test.php" to remote directory started.
. 2010-02-01 10:45:48.561 Ascii transfer mode selected.
. 2010-02-01 10:45:48.561 Opening remote file.
> 2010-02-01 10:45:48.576 Type: SSH_FXP_OPEN, Size: 34, Number: 2563
< 2010-02-01 10:45:48.576 Type: SSH_FXP_STATUS, Size: 24, Number: 2308
. 2010-02-01 10:45:48.576 Discarding reserved response
< 2010-02-01 10:45:48.811 Type: SSH_FXP_HANDLE, Size: 15, Number: 2563
> 2010-02-01 10:45:48.826 Type: SSH_FXP_WRITE, Size: 29, Number: 3078
> 2010-02-01 10:45:48.826 Type: SSH_FXP_CLOSE, Size: 15, Number: 3332
> 2010-02-01 10:45:48.826 Type: SSH_FXP_SETSTAT, Size: 30, Number: 2825
< 2010-02-01 10:45:49.045 Type: SSH_FXP_STATUS, Size: 24, Number: 3078
< 2010-02-01 10:45:49.201 Type: SSH_FXP_STATUS, Size: 24, Number: 3332
< 2010-02-01 10:45:49.201 Status code: 0
< 2010-02-01 10:45:49.201 Type: SSH_FXP_STATUS, Size: 24, Number: 2825
< 2010-02-01 10:45:49.201 Status code: 0
. 2010-02-01 10:45:49.201 Listing directory "/".
> 2010-02-01 10:45:49.201 Type: SSH_FXP_OPENDIR, Size: 10, Number: 3595
< 2010-02-01 10:45:49.389 Type: SSH_FXP_HANDLE, Size: 15, Number: 3595
> 2010-02-01 10:45:49.389 Type: SSH_FXP_READDIR, Size: 15, Number: 3852
< 2010-02-01 10:45:49.592 Type: SSH_FXP_NAME, Size: 1658, Number: 3852
> 2010-02-01 10:45:49.592 Type: SSH_FXP_READDIR, Size: 15, Number: 4108
< 2010-02-01 10:45:49.780 Type: SSH_FXP_STATUS, Size: 33, Number: 4108
< 2010-02-01 10:45:49.780 Status code: 1
> 2010-02-01 10:45:49.780 Type: SSH_FXP_CLOSE, Size: 15, Number: 4356
. 2010-02-01 10:45:58.593 File: "/test.php"
. 2010-02-01 10:45:58.593 Copying "/test.php" to local directory started.
. 2010-02-01 10:45:58.593 Ascii transfer mode selected.
. 2010-02-01 10:45:58.593 Confirming overwriting of file.
. 2010-02-01 10:45:58.593 Asking user:
. 2010-02-01 10:45:58.593 Local file 'test.php' already exists. Overwrite?
. 2010-02-01 10:45:58.593 
. 2010-02-01 10:45:58.593 New:         3 bytes, 01.02.2010 10:44:29
. 2010-02-01 10:45:58.593 Existing:    3 bytes, 01.02.2010 10:44:29 ()
. 2010-02-01 10:46:00.202 Opening remote file.
> 2010-02-01 10:46:00.202 Type: SSH_FXP_OPEN, Size: 26, Number: 4611
< 2010-02-01 10:46:00.202 Type: SSH_FXP_STATUS, Size: 24, Number: 4356
. 2010-02-01 10:46:00.202 Discarding reserved response
< 2010-02-01 10:46:00.389 Type: SSH_FXP_HANDLE, Size: 15, Number: 4611
> 2010-02-01 10:46:00.389 Type: SSH_FXP_FSTAT, Size: 15, Number: 4872
> 2010-02-01 10:46:00.389 Type: SSH_FXP_READ, Size: 27, Number: 5125
< 2010-02-01 10:46:00.577 Type: SSH_FXP_ATTRS, Size: 37, Number: 4872
. 2010-02-01 10:46:00.577 Storing reserved response
< 2010-02-01 10:46:00.952 Status code: 1
. 2010-02-01 10:46:00.952 3 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2010-02-01 10:46:00.952 Type: SSH_FXP_CLOSE, Size: 15, Number: 5636
. 2010-02-01 10:46:07.484 Copying 1 files/directories to remote directory "/"
. 2010-02-01 10:46:07.484   PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 01; Resume: S (102400); CalcS: Yes; Mask: *.*
. 2010-02-01 10:46:07.484   TM: M; ClAr: No; CPS: 0; ExclM(No):
. 2010-02-01 10:46:07.484   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2010-02-01 10:46:07.484 File: "D:\Documents\test.php"
. 2010-02-01 10:46:07.484 Copying "D:\Documents\test.php" to remote directory started.
. 2010-02-01 10:46:07.484 Ascii transfer mode selected.
. 2010-02-01 10:46:07.484 Opening remote file.
> 2010-02-01 10:46:07.484 Type: SSH_FXP_OPEN, Size: 34, Number: 5891
< 2010-02-01 10:46:07.484 Type: SSH_FXP_STATUS, Size: 24, Number: 5636
. 2010-02-01 10:46:07.484 Discarding reserved response
< 2010-02-01 10:46:07.671 Type: SSH_FXP_STATUS, Size: 41, Number: 5891
< 2010-02-01 10:46:07.671 Status code: 4, Message: 5891, Server: File already exists, Language: en-US
> 2010-02-01 10:46:07.687 Type: SSH_FXP_LSTAT, Size: 18, Number: 6151
< 2010-02-01 10:46:07.874 Type: SSH_FXP_ATTRS, Size: 37, Number: 6151
. 2010-02-01 10:46:07.874 Asking user:
. 2010-02-01 10:46:07.874 Remote file 'test.php' already exists. Overwrite?
. 2010-02-01 10:46:07.874 
. 2010-02-01 10:46:07.874 New:         4 bytes, 01.02.2010 10:44:29
. 2010-02-01 10:46:07.874 Existing:    3 bytes, 01.02.2010 10:44:29 ()
> 2010-02-01 10:46:09.265 Type: SSH_FXP_OPEN, Size: 34, Number: 6403
< 2010-02-01 10:46:09.468 Type: SSH_FXP_HANDLE, Size: 15, Number: 6403
> 2010-02-01 10:46:09.468 Type: SSH_FXP_WRITE, Size: 30, Number: 6918
> 2010-02-01 10:46:09.468 Type: SSH_FXP_CLOSE, Size: 15, Number: 7172
> 2010-02-01 10:46:09.468 Type: SSH_FXP_SETSTAT, Size: 30, Number: 6665
< 2010-02-01 10:46:09.656 Type: SSH_FXP_STATUS, Size: 24, Number: 6918
< 2010-02-01 10:46:09.843 Type: SSH_FXP_STATUS, Size: 24, Number: 7172
< 2010-02-01 10:46:09.843 Status code: 0
< 2010-02-01 10:46:09.843 Type: SSH_FXP_STATUS, Size: 24, Number: 6665
< 2010-02-01 10:46:09.843 Status code: 0
. 2010-02-01 10:46:09.843 Listing directory "/".
> 2010-02-01 10:46:09.843 Type: SSH_FXP_OPENDIR, Size: 10, Number: 7435
< 2010-02-01 10:46:10.031 Type: SSH_FXP_HANDLE, Size: 15, Number: 7435
> 2010-02-01 10:46:10.031 Type: SSH_FXP_READDIR, Size: 15, Number: 7692
< 2010-02-01 10:46:10.234 Type: SSH_FXP_NAME, Size: 1658, Number: 7692
> 2010-02-01 10:46:10.234 Type: SSH_FXP_READDIR, Size: 15, Number: 7948
< 2010-02-01 10:46:10.421 Type: SSH_FXP_STATUS, Size: 33, Number: 7948
< 2010-02-01 10:46:10.421 Status code: 1
> 2010-02-01 10:46:10.421 Type: SSH_FXP_CLOSE, Size: 15, Number: 8196
. 2010-02-01 10:46:13.328 File: "/test.php"
. 2010-02-01 10:46:13.328 Copying "/test.php" to local directory started.
. 2010-02-01 10:46:13.328 Ascii transfer mode selected.
. 2010-02-01 10:46:13.328 Confirming overwriting of file.
. 2010-02-01 10:46:13.328 Asking user:
. 2010-02-01 10:46:13.328 Local file 'test.php' already exists. Overwrite?
. 2010-02-01 10:46:13.328 
. 2010-02-01 10:46:13.328 New:         4 bytes, 01.02.2010 10:44:29
. 2010-02-01 10:46:13.328 Existing:    4 bytes, 01.02.2010 10:44:29 ()
. 2010-02-01 10:46:14.296 Opening remote file.
> 2010-02-01 10:46:14.296 Type: SSH_FXP_OPEN, Size: 26, Number: 8451
< 2010-02-01 10:46:14.296 Type: SSH_FXP_STATUS, Size: 24, Number: 8196
. 2010-02-01 10:46:14.296 Discarding reserved response
< 2010-02-01 10:46:14.484 Type: SSH_FXP_HANDLE, Size: 15, Number: 8451
> 2010-02-01 10:46:14.484 Type: SSH_FXP_FSTAT, Size: 15, Number: 8712
> 2010-02-01 10:46:14.484 Type: SSH_FXP_READ, Size: 27, Number: 8965
< 2010-02-01 10:46:14.687 Type: SSH_FXP_ATTRS, Size: 37, Number: 8712
. 2010-02-01 10:46:14.687 Storing reserved response
< 2010-02-01 10:46:15.062 Status code: 1
. 2010-02-01 10:46:15.062 3 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2010-02-01 10:46:15.062 Type: SSH_FXP_CLOSE, Size: 15, Number: 9476
. 2010-02-01 10:46:18.031 Closing connection.
. 2010-02-01 10:46:18.031 Sending special code: 12
. 2010-02-01 10:46:18.031 Sent EOF message
martin

Re: Null characters added when transferring files in text mode

Please post a full log file showing the problem.

To generate log file, enable logging, log in to your server and do the operation and only the operation that causes the error. For posting extensive logs you may use pastebin or similar application. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you may email it to me. You will find my address (if you log in) in my forum profile. Please include link back to this topic in your email. Also note in this topic that you have emailed the log.
Dmitry Ogarkov

Null characters added when transferring files in text mode

I'm using WinSCP 4.25 with "Commander" interface running on Windows 7, the problem existed with 4.19 as well. Please note that I'm not sure whether this is a WinSCP problem or my hoster's one. I'm using SFTP-3, the remote server is running Linux.

Steps to reproduce:

1. Locally, create a text file test.php containing a letter and CR/LF symbols (3 bytes in total, ending with 0D 0A).

2. Upload it to the remote server. With the .php extension, it uploads in text mode by default, and I expect CR/LF to be converted to simply LF. It is, but the file size is still 3 bytes (2 expected): there is a null character appended to the end of the file.

3. Download the file back, it's 4 bytes in size now (LF converted to CR/LF + the null character).

4. Upload the file again. It's 4 bytes on the server (CR/LF converted to LF, another null character added).

5. Download the file. It's 5 bytes already (LF converted to CR/LF, two null characters at the end).

...