Archived Forum Post

Index of archived forum posts

Question:

GetFileSIze64 method returning "18446744073709551615" when no file exists instead of "-1" or less than 0

Jun 14 '14 at 08:49

It was used to work before. But, suddenly, GetFileSize64 method in SFTP returning "18446744073709551615" instead of "-1"(which is the value it used return before).

This is the session log i got :

Session Log = TRAN* Established TCP/IP connection with SSH server

TRAN> SSH-2.0-PuTTY_Local:_May_11_2009_17:22:38

TRAN< SSH-2.0-CrushFTPSSHD

TRAN> KEXINIT

TRAN< KEXINIT

TRAN* Key Algorithms: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256

TRAN* Host Key Algorithms: ssh-dss,ssh-rsa

TRAN* Out Encryption: aes128-cbc,aes128-ctr,3des-cbc,blowfish-cbc,arcfour128,arcfour

TRAN* In Encryption: aes128-cbc,aes128-ctr,3des-cbc,blowfish-cbc,arcfour128,arcfour

TRAN* Out MAC: hmac-md5,hmac-sha1,hmac-md5-96,hmac-sha1-96,hmac-sha256,hmac-sha2-256,hmac-sha256@ssh.com

TRAN* In MAC: hmac-md5,hmac-sha1,hmac-md5-96,hmac-sha1-96,hmac-sha256,hmac-sha2-256,hmac-sha256@ssh.com

TRAN* Out Compress: none,zlib

TRAN* In Compress: none,zlib

TRAN> KEX_DH_GEX_REQUEST

TRAN< KEX_DH_GEX_GROUP/KEXDH_REPLY

TRAN> KEXDH_INIT

TRAN< KEX_DH_GEX_REPLY

TRAN* DSS signature verified

TRAN> NEWKEYS

TRAN< NEWKEYS

TRAN* SSH Key Exchange Success.

TRAN> IGNORE

TRAN> SERVICE_REQUEST

TRAN< SERVICE_ACCEPT

TRAN> USERAUTH_REQUEST (none)

TRAN< USERAUTH_FAILURE

TRAN> USERAUTH_REQUEST (password)

TRAN< USERAUTH_SUCCESS

TRAN> CHANNEL_OPEN

TRAN< CHANNEL_OPEN_CONFIRMATION

TRAN> CHANNEL_REQUEST: subsystem

TRAN< CHANNEL_WINDOW_ADJUST

TRAN< CHANNEL_SUCCESS

SFTP> Sending SSH_FXP_INIT

TRAN> CHANNEL_DATA

TRAN* NumBytes: 9

TRAN< CHANNEL_DATA

SFTP< Received SSH_FXP_VERSION

SFTP> Sending SSH_FXP_LSTAT

TRAN> CHANNEL_DATA

TRAN* NumBytes: 45

TRAN< CHANNEL_DATA

SFTP< Received SSH_FXP_STATUS

SFTP> Sending SSH_FXP_OPEN

TRAN> CHANNEL_DATA

TRAN* NumBytes: 61

TRAN< CHANNEL_DATA

SFTP< Received SSH_FXP_HANDLE

SFTP> Sending SSH_FXP_WRITE

TRAN> CHANNEL_DATA

TRAN* NumBytes: 2121

SFTP> Sending SSH_FXP_WRITE

TRAN> CHANNEL_DATA

TRAN* NumBytes: 2121

SFTP> Sending SSH_FXP_WRITE

TRAN> CHANNEL_DATA

TRAN* NumBytes: 2121

SFTP> Sending SSH_FXP_WRITE

TRAN> CHANNEL_DATA

TRAN* NumBytes: 2121

SFTP> Sending SSH_FXP_WRITE

TRAN> CHANNEL_DATA

TRAN* NumBytes: 2121

SFTP> Sending SSH_FXP_WRITE

TRAN> CHANNEL_DATA

TRAN* NumBytes: 2121

SFTP> Sending SSH_FXP_WRITE

TRAN> CHANNEL_DATA

TRAN* NumBytes: 2121

SFTP> Sending SSH_FXP_WRITE

TRAN> CHANNEL_DATA

TRAN* NumBytes: 2121

SFTP> Sending SSH_FXP_WRITE

TRAN> CHANNEL_DATA

TRAN* NumBytes: 2121

SFTP> Sending SSH_FXP_WRITE

TRAN> CHANNEL_DATA

TRAN* NumBytes: 2121

SFTP> Sending SSH_FXP_WRITE

TRAN> CHANNEL_DATA

TRAN* NumBytes: 2121

SFTP> Sending SSH_FXP_WRITE

TRAN> CHANNEL_DATA

TRAN* NumBytes: 2121

SFTP> Sending SSH_FXP_WRITE

TRAN> CHANNEL_DATA

TRAN* NumBytes: 2121

SFTP> Sending SSH_FXP_WRITE

TRAN> CHANNEL_DATA

TRAN* NumBytes: 2121

SFTP> Sending SSH_FXP_WRITE

TRAN> CHANNEL_DATA

TRAN* NumBytes: 2121

SFTP> Sending SSH_FXP_WRITE

TRAN> CHANNEL_DATA

TRAN* NumBytes: 2121

SFTP> Sending SSH_FXP_WRITE

TRAN> CHANNEL_DATA

TRAN* NumBytes: 2121

SFTP> Sending SSH_FXP_WRITE

TRAN> CHANNEL_DATA

TRAN* NumBytes: 973

TRAN< CHANNEL_DATA

SFTP< Received SSH_FXP_STATUS

TRAN< CHANNEL_DATA

SFTP< Received SSH_FXP_STATUS

TRAN< CHANNEL_DATA

SFTP< Received SSH_FXP_STATUS

TRAN< CHANNEL_DATA

SFTP< Received SSH_FXP_STATUS

TRAN< CHANNEL_DATA

SFTP< Received SSH_FXP_STATUS

TRAN< CHANNEL_DATA

SFTP< Received SSH_FXP_STATUS

TRAN< CHANNEL_DATA

SFTP< Received SSH_FXP_STATUS

TRAN< CHANNEL_DATA

SFTP< Received SSH_FXP_STATUS

TRAN< CHANNEL_DATA

SFTP< Received SSH_FXP_STATUS

TRAN< CHANNEL_DATA

SFTP< Received SSH_FXP_STATUS

TRAN< CHANNEL_DATA

SFTP< Received SSH_FXP_STATUS

TRAN< CHANNEL_DATA

SFTP< Received SSH_FXP_STATUS

TRAN< CHANNEL_DATA

SFTP< Received SSH_FXP_STATUS

TRAN< CHANNEL_DATA

SFTP< Received SSH_FXP_STATUS

TRAN< CHANNEL_DATA

SFTP< Received SSH_FXP_STATUS

TRAN< CHANNEL_DATA

SFTP< Received SSH_FXP_STATUS

TRAN< CHANNEL_DATA

SFTP< Received SSH_FXP_STATUS

TRAN< CHANNEL_DATA

SFTP< Received SSH_FXP_STATUS

SFTP> Sending SSH_FXP_CLOSE

TRAN> CHANNEL_DATA

TRAN* NumBytes: 61

TRAN< CHANNEL_DATA

SFTP< Received SSH_FXP_STATUS

Thanks, Sai Jithendra


Accepted Answer

I verified that internally it is returning -1, and I also verified the Objective-C generated wrappers (which is internal Chilkat source code). The Objective-C API is essentially a very thin wrapping around the C++ API. For example, the wrapper for GetFileSize64 looks like this (again, this is not published source code) --

// method: GetFileSize64
- (NSNumber *)GetFileSize64: (NSString *)filePathOrHandle 
    bFollowLinks: (BOOL)bFollowLinks 
    bIsHandle: (BOOL)bIsHandle
{
    const char *arg1 = [filePathOrHandle UTF8String];
    bool arg2 = (bFollowLinks ? true : false);
    bool arg3 = (bIsHandle ? true : false);
    __int64 v = ((CkSFtp *)m_obj)->GetFileSize64(arg1,arg2,arg3);
    return [NSNumber numberWithLongLong: v];
}
Check to see if there is anything in your application's source code that might be treating the integer as an unsigned integer..


Answer

Sai, for this problem, I would need to see the contents of the LastErrorText. Unfortunately, the SessionLog doesn't have information that would help.


Answer

Thanks for quick response. Here is the LastErrorText you asked for. Its saying, it is not a valid path. If the file doesn't exist, it cannot be a valid path right? So, in that case it should return something less than "-1". right?

Make me correct if I am wrong in anything above.

Jun 14 11:24:40 JINNI SecureCellPro[4745] <notice>: Remote File Size = 18446744073709551615 Jun 14 11:24:40 JINNI SecureCellPro[4745] <notice>: Last Error Text = ChilkatLog: GetFileSize: DllDate: Jun 10 2014 ChilkatVersion: 9.5.0.40 UnlockPrefix: GOMYCESSH Architecture: Little Endian; 32-bit Language: IOS Objective-C VerboseLogging: 0 SshVersion: SSH-2.0-CrushFTPSSHD SftpVersion: 3 filename: A6952FCD36A556F9E77F31987E5B7973 followLinks: 0 isHandle: 0 fetchAttributes: filename: A6952FCD36A556F9E77F31987E5B7973 Using FXP_LSTAT Sent message to fetch attributes. StatusResponseFromServer: Request: FXP_LSTAT InformationReceivedFromServer: StatusCode: 2 StatusMessage: A6952FCD36A556F9E77F31987E5B7973 is not a valid file path --InformationReceivedFromServer --StatusResponseFromServer --fetchAttributes Failed. --GetFileSize --ChilkatLog