Page MenuHomeFreeBSD

Fix md5.1 example
ClosedPublic

Authored by gbe on Feb 27 2024, 5:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 26, 8:18 PM
Unknown Object (File)
Mon, Apr 22, 4:04 AM
Unknown Object (File)
Sun, Apr 21, 7:34 PM
Unknown Object (File)
Thu, Apr 4, 12:10 AM
Unknown Object (File)
Thu, Apr 4, 12:09 AM
Unknown Object (File)
Mar 12 2024, 12:50 PM
Unknown Object (File)
Mar 6 2024, 2:57 AM
Unknown Object (File)
Feb 28 2024, 8:33 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