Page MenuHomeFreeBSD

md5: Create md5sum, etc compatible programs
ClosedPublic

Authored by imp on May 17 2021, 5:08 AM.

Details

Summary

On Linux, there's a similar set of programs to ours, but that end in the
letters 'sum'. These act basically like FreeBSD versions run with the -r
option. Add code so that when the program ends in 'sum' you get the
linux -r behavior. This is enough to make most things that use sha*sum
work correctly (the -c / --check options, as well as the long args
are not implemented).

Relnotes: yes
Sponsored by: Netflix

Test Plan

Note: I've not implemented all the flags of *sum, but this is enough to make qemu's test suite
happier with FreeBSD and it's not the first time I've hit this issue.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

imp requested review of this revision.May 17 2021, 5:08 AM
imp created this revision.
sef added a subscriber: sef.

lgtm.

This revision is now accepted and ready to land.May 17 2021, 5:30 AM

I think there should be some updates to the man page to note the links and that they are for (limited) Linux compatibility.

sbin/md5/md5.c
187

A comment about why this is done would be good.

man page update and comment

This revision now requires review to proceed.May 17 2021, 1:05 PM
imp marked an inline comment as done.May 17 2021, 1:07 PM
This revision is now accepted and ready to land.May 17 2021, 1:08 PM
bcr added a subscriber: bcr.

Manpages is also fine with the change. Thanks!

kp added a subscriber: kp.
kp added inline comments.
sbin/md5/md5.c
191

s/proide/provide/

Does it mean that FreeBSD *sum versions of those utilities are going to support all the existing FreeBSD flags? Shouldn't we restrict the flags of the *sum utilities to only those that provide the same functionality both on FreeBSD and on GNU?

Shouldn't we restrict the flags of the *sum utilities to only those that provide the same functionality both on FreeBSD and on GNU?

Not a bad idea, we can introduce *sum flags intentionally, as necessary.

Shouldn't we restrict the flags of the *sum utilities to only those that provide the same functionality both on FreeBSD and on GNU?

Not a bad idea, we can introduce *sum flags intentionally, as necessary.

I think the best bet is to flag the -c use in this mode because they are different. We could also accept-b and -t as nops too easily enough. Any extensions from there, though, I don't think we should prohibit.

Better compatibility with gnu versions from coreutils. Note this
in man page.

This revision now requires review to proceed.May 17 2021, 5:29 PM

Tweak wording, and provide sha1sum for consistency.

sbin/md5/md5.c
376

this is a trivial trailing whitespace thing emacs decided to fix... Normally, I'd split it out, but it's trivial enough to be flexible on the style / substance division we normally do)

imp marked an inline comment as done.May 18 2021, 3:42 AM
sef added inline comments.
sbin/md5/md5.1
104

Traditional English convention is "-sum" not "*sum". Not worth changing unless a) you agree, and b) have other changes to make.

This revision is now accepted and ready to land.May 18 2021, 3:45 AM
This revision was automatically updated to reflect the committed changes.