Page MenuHomeFreeBSD

md5: Improve compatibility.
ClosedPublic

Authored by des on Apr 6 2023, 10:27 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, May 9, 10:41 PM
Unknown Object (File)
Apr 11 2024, 7:00 AM
Unknown Object (File)
Mar 11 2024, 5:19 AM
Unknown Object (File)
Mar 5 2024, 7:44 PM
Unknown Object (File)
Mar 5 2024, 7:44 PM
Unknown Object (File)
Mar 5 2024, 7:44 PM
Unknown Object (File)
Mar 5 2024, 7:43 PM
Unknown Object (File)
Mar 5 2024, 7:43 PM

Details

Summary
  • Overhaul the GNU compatibility mode to more closely emulate what the GNU tools do.
  • Add a Perl compatibility mode which emulates the shasum tool that ships with Perl. This is currently not installed.
  • Overhaul the tests.

Sponsored by: Klara, Inc.

Diff Detail

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

Event Timeline

des requested review of this revision.Apr 6 2023, 10:27 AM

Implement --ignore-missing, --version.
Use bool for flags.

kevans added inline comments.
sbin/md5/md5.c
464

Ideally all of these that have a corresponding short option should really just be using that for the struct option val, rather than having to handle both cases for each duplicated option (the first enum optval value would start at CHAR_MAX).

We're already at 20 options, over half-way to the printable character range that could conceivably be used as flags and we're at the mercy of both GNU *sum and the Perl shasum for a chunk of our flags. If we can cleanly avoid having to maybe care about this in the future, I think we should.

Ensure longopts don't collide with shortopts.

des marked an inline comment as done.Apr 12 2023, 10:35 AM
kevans added inline comments.
sbin/md5/md5.c
464

This is still really ugly, but I guess at least it's not a potential future conflict now.

This revision is now accepted and ready to land.Apr 12 2023, 3:43 PM
des marked an inline comment as done.Apr 12 2023, 4:43 PM
  • In bits mode, check that the length is a multiple of 8.
  • Remove unused test files.
  • Don't install shasum for now.
  • Improve the man page.
This revision now requires review to proceed.May 5 2023, 3:01 PM

I think this LGTM; one request that you can deal with pre-push.

sbin/md5/Makefile
30

Since we're adding these commented out, please pair it with a brief comment explaining why so that someone doesn't come along and just think it's a dead idea.

This revision is now accepted and ready to land.May 6 2023, 4:30 PM

Explain why shasum is commented out of the Makefile.

This revision now requires review to proceed.May 6 2023, 7:18 PM
This revision is now accepted and ready to land.May 6 2023, 8:37 PM
This revision was automatically updated to reflect the committed changes.
yuripv added inline comments.
sbin/md5/md5.c
1032

Looks like referencing __FreeBSD_version broken cross-builds in github CI:

https://github.com/freebsd/freebsd-src/actions/runs/4912938253/jobs/8772539897

Probably including <osreldate.h> should help here?