Page MenuHomeFreeBSD

Fix md5.1 example
ClosedPublic

Authored by gbe on Feb 27 2024, 5:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 11 2024, 10:59 AM
Unknown Object (File)
Sep 30 2024, 12:24 PM
Unknown Object (File)
Sep 30 2024, 12:22 PM
Unknown Object (File)
Sep 30 2024, 10:30 AM
Unknown Object (File)
Sep 22 2024, 11:04 AM
Unknown Object (File)
Sep 22 2024, 12:17 AM
Unknown Object (File)
Sep 21 2024, 4:07 PM
Unknown Object (File)
Sep 19 2024, 5:22 AM
Subscribers

Details

Summary

The last example in the manpage md5(1) wants to demonstrate GNU mode (md5sum) but uses BSD mode (md5) instead:

In GNU mode, the -c option does not compare against a hash string passed
as parameter. Instead, it expects a digest file, as created under the
name digest for /boot/loader.conf in the example above.

PR: 276560

Test Plan

mandoc output review and 'mandoc -Tlint' checks

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

gbe requested review of this revision.Feb 27 2024, 5:37 PM
This revision is now accepted and ready to land.Feb 27 2024, 6:02 PM
This revision was automatically updated to reflect the committed changes.
des added inline comments.
sbin/md5/md5.1
370

This example is still incorrect, md5 will take the file names to check from the digest file, not from the command line.

370

accidentally removed the newline in the edit suggestion above...

@des I am unsure, on how to update the example. I have tried it with these steps, which worked as expected besides the strange error message from md5sum.

gbe@fbsd-dev:~ % md5 /boot/loader.conf > digest
gbe@fbsd-dev:~ % md5sum -c digest /boot/loader.conf
/boot/loader.conf: OK
md5sum: WARNING: 22 lines are improperly formatted

I can't see how md5 would use a digest file.

In D44098#1008691, @gbe wrote:
gbe@fbsd-dev:~ % md5sum -c digest /boot/loader.conf

What purpose does /boot/loader.conf serve here?

In D44098#1008803, @des wrote:
In D44098#1008691, @gbe wrote:
gbe@fbsd-dev:~ % md5sum -c digest /boot/loader.conf

What purpose does /boot/loader.conf serve here?

That is just the example that was used before. Could be any file, but the patch from the PR has taken this, since it was used in other examples.

In D44098#1008828, @gbe wrote:
In D44098#1008803, @des wrote:

What purpose does /boot/loader.conf serve here?

That is just the example that was used before. Could be any file, but the patch from the PR has taken this, since it was used in other examples.

You're missing the forest for the trees...

A proper fix for the problem is coming in a few seconds.

  • Bump .Dd
  • Fix the md5sum example
  • Fix the md5 example when running in GNU mode (md5sum) the '-c' option expects a file containing the hash, but the file the hash is compared to is not needed since its already include in the digest file itself
gbe marked 2 inline comments as done.Mar 11 2024, 9:45 PM
This revision is now accepted and ready to land.Mar 12 2024, 10:41 AM