bug: comments in md5 (checksum) files

Please report only one bug per message!

Moderators: white, Hacker, petermad, Stefan2

Lexor
Junior Member
Junior Member
Posts: 6
Joined: 2023-05-14, 12:43 UTC

bug: comments in md5 (checksum) files

Post by *Lexor »

I was using TC 9.21 since long time and this bug troubled me a lot. Today, before reporting, I updated to TC 10.52 and the bug is still here.

I often use possibility to comment inside my md5 files by using "#" character at the start of comment line and sometime these lines are taken by TC as they contain the file checksum instead of the text comment.

By trial and error I managed to find out that this bug happens when the comment line ends with a string of 8 characters.

For example, if I have some md5 file with 3 comments like these:

Code: Select all

# 1 1234567
# 2 12345678
# 3 123456789
.. then the second comment line will be marked as error by TC with an info:

Code: Select all

Cannot open input file # 2!
Note: this bug does NOT happen if I use ";" character instead of "#" to comment, but I would prefer to use "#".

Can you find out what is going on inside TC code with such type of comments and fix that?
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6450
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: bug: comments in md5 (checksum) files

Post by *Horst.Epp »

1. To me that is a wish and not a bug.
2. Add it under suggestions if you want
3. Use ; as work-around
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
Lexor
Junior Member
Junior Member
Posts: 6
Joined: 2023-05-14, 12:43 UTC

Re: bug: comments in md5 (checksum) files

Post by *Lexor »

How is it a "wish" if "#" is already implemented and it works for all other cases?

Yes, I'm using ";" in these cases but it breaks the look of my standard md5 file content as I use "#" not just to type a comment but also to draw some simple tables with "#" character used as a field border.
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6450
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: bug: comments in md5 (checksum) files

Post by *Horst.Epp »

Lexor wrote: 2023-05-14, 15:41 UTC How is it a "wish" if "#" is already implemented and it works for all other cases?
It is a wish because nowhere is said that # is a TC comment option for checksum files.
Only because you like something doesn't make it a standard or option.
Do you have a Standard document that says how comments should be added ?
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
Lexor
Junior Member
Junior Member
Posts: 6
Joined: 2023-05-14, 12:43 UTC

Re: bug: comments in md5 (checksum) files

Post by *Lexor »

Horst.Epp wrote: 2023-05-14, 15:56 UTCIt is a wish because nowhere is said that # is a TC comment option for checksum files.
"#" is accepted as a standard comment in md5 files. Other md5 tools on Unix, Mac and Windows support "#" in md5 files, TC supports md5 files.

";" is mostly used as a comment on Windows, md5 tools on other systems can have some troubles with ";", "#" is more safe to use in md5 files.

If, as you say, it is not a standard then how is it possible that TC already accepts "#" in all other cases and just one brings this error?
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: bug: comments in md5 (checksum) files

Post by *Dalai »

I'm not sure if there's a standard defined in an RFC or something. But here's a discussion on that very topic:
https://stackoverflow.com/questions/63196630/is-there-a-way-to-add-comments-in-md5-file

TC should support # properly to be able to easily exchange checksum files between Linux/Unix and Windows systems. IIRC TC already supports LF line endings, which is typical for Linux systems. However, I also consider this a suggestion rather than a bug (report).

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
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: bug: comments in md5 (checksum) files

Post by *ghisler(Author) »

The problem is that "# 1" is a valid file name, and 12345678 is a valid checksum. TC tries to support as many formats as possible, with the name before the checksum and the name behind it. Where should I draw the line?
Author of Total Commander
https://www.ghisler.com
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6450
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: bug: comments in md5 (checksum) files

Post by *Horst.Epp »

If "# 1" is a valid file name them simply don't change anything here.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: bug: comments in md5 (checksum) files

Post by *Dalai »

Well, "; 1" is also a valid file name... But I can see your point. It's still a pity that lines starting with a semi-colon are not considered comments by Linux tools and lines starting with a sharp are not considered comments by TC. So no easy exchange of checksum files between platforms.

It's interesting though how different people's needs can be. In more than two decades I never had the need or did it cross my mind to add comments to such files (and probably never will have such need). Yet, here we are discussing such a thing.

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
Lexor
Junior Member
Junior Member
Posts: 6
Joined: 2023-05-14, 12:43 UTC

Re: bug: comments in md5 (checksum) files

Post by *Lexor »

Dalai wrote: 2023-05-16, 18:53 UTCIt's interesting though how different people's needs can be. In more than two decades I never had the need or did it cross my mind to add comments to such files (and probably never will have such need). Yet, here we are discussing such a thing.
Well, I have scripts to generate md5 files in my own way. These scripts add some more info to md5 files so I can use them not only as pure checksum files but also as readme. With a lot of md5 files having these 2-in-1 also saves the HDD space. For example, here is the content of such one file where the whole content (data table and checksums) was auto-generated by my script:

Code: Select all

#                                 FILENAME # EXT #   RESOLUT # NS # VIDBR # AUDBR #     DURATION #       SIZE
#############################################################################################################
# bbb_sunflower_1080p_30fps_normal ....... # mp4 # 1920x1080 #  3 #  2998 #   160 #   0:10:34.53 #   76134947
# bbb_sunflower_1080p_60fps_normal ....... # mp4 # 1920x1080 #  3 #  4001 #   160 #   0:10:34.53 #  355856562
# bbb_sunflower_native_60fps_normal ...... # mp4 # 4000x2250 #  3 # 10002 #   160 #   0:10:34.53 #  831871244
#############################################################################################################
# 22-02-18 12:48 / v15               TOTAL #   3 #           #    #       #       #   0:31:43.59 #           

babbe51b47146187a66632daa791484b *bbb_sunflower_1080p_30fps_normal.mp4
7a7bc8ae38ccbd700e07977a9deb8cb7 *bbb_sunflower_1080p_60fps_normal.mp4
f92a3b97e9f4b7a7577ab16a2c8b07f7 *bbb_sunflower_native_60fps_normal.mp4
As you can see I can use any normal text editor on any system and see some additional info on the checksumed files.
Last edited by Lexor on 2023-05-16, 21:46 UTC, edited 1 time in total.
User avatar
Gral
Power Member
Power Member
Posts: 1460
Joined: 2005-01-26, 15:12 UTC

Re: bug: comments in md5 (checksum) files

Post by *Gral »

Note that if such data were included in the comment, it would also be copied and moved automatically along with the files. They could also be displayed in tooltips (which can also be achieved with content plugins)
Why use a text editor when all you need to do is hover the mouse over the file?

For such cases, I would also imagine another solution - https://www.ghisler.ch/board/viewtopic.php?t=78870
Lexor
Junior Member
Junior Member
Posts: 6
Joined: 2023-05-14, 12:43 UTC

Re: bug: comments in md5 (checksum) files

Post by *Lexor »

ghisler(Author) wrote: 2023-05-16, 16:34 UTCThe problem is that "# 1" is a valid file name, and 12345678 is a valid checksum. TC tries to support as many formats as possible, with the name before the checksum and the name behind it. Where should I draw the line?
From what I can see in every md5 file: checksum is always the first in line and filename is preceded by "*".
That is also the format TC uses itself to generate checksums.
Are there any other formats for md5 checksum? I've never heard about them.

Do you know why TC shows the error only in the case when the last string in "#"-commented line has 8 characters?
Gral wrote: 2023-05-16, 20:28 UTCWhy use a text editor when all you need to do is hover the mouse over the file?
Not every environment has GUI / uses mouse and I don't use TC on every machine I have access to, so simple text files are often more preferable.
User avatar
Gral
Power Member
Power Member
Posts: 1460
Joined: 2005-01-26, 15:12 UTC

Re: bug: comments in md5 (checksum) files

Post by *Gral »

OK, i understand.
The only possibility I see in this case is a options set in the ini file.
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: bug: comments in md5 (checksum) files

Post by *Dalai »

Lexor wrote: 2023-05-16, 20:37 UTCFrom what I can see in every md5 file: checksum is always the first in line and filename is preceded by "*".
That is also the format TC uses itself to generate checksums.
Are there any other formats for md5 checksum? I've never heard about them.
Instead of the asterisk can also be another space character, i.e. two spaces separating the filename from the checksum. Then the file/checksum is to be interpreted as text instead of binary. That's (unfortunately) the default to create checksums for md5sum (on Linux).
Do you know why TC shows the error only in the case when the last string in "#"-commented line has 8 characters?
Ghisler explained this above, didn't he? A string of 8 consecutive characters is a valid checksum, at least for CRC/SFV. TC doesn't care about the checksum file's extension, making it possible to use SFV checksums in .md5 files, for example.

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
Lexor
Junior Member
Junior Member
Posts: 6
Joined: 2023-05-14, 12:43 UTC

Re: bug: comments in md5 (checksum) files

Post by *Lexor »

Dalai wrote: 2023-05-16, 21:27 UTCInstead of the asterisk can also be another space character, i.e. two spaces separating the filename from the checksum. Then the file/checksum is to be interpreted as text instead of binary. That's (unfortunately) the default to create checksums for md5sum (on Linux).
Does it also create checksum lines in "reverse order"? I mean: first filename and then checksum?
Ghisler explained this above, didn't he? A string of 8 consecutive characters is a valid checksum, at least for CRC/SFV. TC doesn't care about the checksum file's extension, making it possible to use SFV checksums in .md5 files, for example.
Oh, that's... weird. I've never noticed / used that "option" as I always use the "correct" extensions.
Post Reply