Potential bug with file order in checksum file

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
johngalt2022
Junior Member
Junior Member
Posts: 3
Joined: 2022-03-30, 20:53 UTC

Potential bug with file order in checksum file

Post by *johngalt2022 »

Hello all!

I would like to report the following behavior, which is maybe a bug: when selecting files and sub-directories and creating a checksum file, files are sorted in the following way in the generated checksum file:
  • Files belonging to the main directory are in the same sort order as displayed on screen, which is good
I'm not sure if this the desired behavior? I guess it would probably make more sense if the sort order selected for the main directory also applies to all sub-directories.

(This was tested on Windows 7 64-bit with Total Commander 64-bit v10.00.)

Thanks!
User avatar
Horst.Epp
Power Member
Power Member
Posts: 7012
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Potential bug with file order in checksum file

Post by *Horst.Epp »

There is no need for any order as all files are there with path.
The sequence has no impact on later checking.
Windows 11 Home, Version 24H2 (OS Build 26100.4351)
TC 11.55 RC7 x64 / x86
Everything 1.5.0.1395a (x64), Everything Toolbar 1.5.5.0, Listary Pro 6.3.2.88
QAP 11.9.0.4 x64
johngalt2022
Junior Member
Junior Member
Posts: 3
Joined: 2022-03-30, 20:53 UTC

Re: Potential bug with file order in checksum file

Post by *johngalt2022 »

No indeed: I agree all files should be here, and the checksum file should work as expected; however since the sort order is taken into account for the main directory, I think it could be nice if it was also applied for sub-directories if possible ;)
User avatar
Dalai
Power Member
Power Member
Posts: 10022
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Potential bug with file order in checksum file

Post by *Dalai »

Sorting a directory costs resources, i.e. time and performance. A directory needs to be iterated completely before it can be sorted, meaning TC would need to iterate every directory twice. The way it is now, TC iterates every directory only once (in a FindFirstFile/FindNextFile loop, I guess) and calculates the checksums for every file immediately. While it may not matter much (or at all) for smaller directories, it will matter for directories containing large number of files.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
johngalt2022
Junior Member
Junior Member
Posts: 3
Joined: 2022-03-30, 20:53 UTC

Re: Potential bug with file order in checksum file

Post by *johngalt2022 »

Thanks for your replies!

Yes, performance-wise, there would be a slight cost to sort sub-directories, but after all, it is the same when you browse these directories from Total Commander, so I guess it would be acceptable (especially when compared against the time required to calculate the checksums); we could also imagine an option to enable or disable sorting in the "create crc-checksum file" dialog.

I just wanted to explain why I created this topic: since the sub-directories sort order indeed seems to rely on FindFirstFile/FindNextFile functions, the result is different depending on the file system: e.g. with NTFS, default order is "approximately alphabetical", but with FAT32, it is much more random (see https://devblogs.microsoft.com/oldnewthing/?p=1603); which is what confused me since the behavior was different between two checksum files, with everything being the same, except the file system.
Post Reply