Log corruption with log > 4 GB

Bug reports will be moved here when the described bug has been fixed

Moderators: Hacker, Stefan2, white, sheep

Post Reply
User avatar
Hacker
Moderator
Moderator
Posts: 10999
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Log corruption with log > 4 GB

Post by *Hacker » 2018-05-10, 00:08 UTC

Hi,
TC 9.20b2 x64, Windows 10 x64, but I assume this is not a new behavior in 9.20.
It seems the log gets corrupted when it reaches a certain size, here it is 4 295 006 800 bytes. The entries do not get appended at the end but the first entries get overwritten - looks like an unsigned long integer is used as the position pointer or something like that.

TIA
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 36354
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) » 2018-05-10, 15:36 UTC

Thanks, I can reproduce it. Apparently it's a limitation of SetFilePointer: I call it like this:
SetFilePointer(hFile,0,NULL,FILE_END);
It tells Windows to position the read/write position to the end of the file. However, this fails when the file is > 4GB, although the parameter lpDistanceToMoveHigh is described as optional.

It works when I call it like this:

highPosition=0;
SetFilePointer(hFile,0,&highPosition,FILE_END);

Apparently it's because of this limitation:
If lpDistanceToMoveHigh is NULL and the new file position does not fit in a 32-bit value, the function fails and returns INVALID_SET_FILE_POINTER.
Author of Total Commander
http://www.ghisler.com

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 36354
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) » 2018-05-16, 16:43 UTC

This should be fixed in beta 3, please test it!

Note: Both the normal log and ftp log are affected.
Author of Total Commander
http://www.ghisler.com

User avatar
Hacker
Moderator
Moderator
Posts: 10999
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker » 2018-05-16, 20:09 UTC

Christian,
Seems to work fine, thank you!

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.

Post Reply