Page MenuHomeFreeBSD

release: Support GNU stat in mkisoimages.sh
ClosedPublic

Authored by jrtc27 on Jul 14 2022, 12:14 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Jun 16, 2:44 PM
Unknown Object (File)
May 17 2025, 1:19 AM
Unknown Object (File)
May 12 2025, 8:36 PM
Unknown Object (File)
May 8 2025, 7:02 PM
Unknown Object (File)
May 8 2025, 6:48 AM
Unknown Object (File)
Apr 18 2025, 9:07 PM
Unknown Object (File)
Mar 31 2025, 7:41 PM
Unknown Object (File)
Mar 16 2025, 9:44 PM
Subscribers

Details

Summary

BSD stat and GNU stat differ significantly when it comes to using a
custom format string, both in the option name and in the format string
itself. Handle both here (assuming Linux means GNU stat rather than BSD
stat).

Obtained from: CheriBSD

Diff Detail

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

Event Timeline

Can we just make mkimg(1) to accept a filename as its parameter, basically by stat'ing the file and use that size as capacity instead?

gjb added a subscriber: gjb.

I do not object to the change, but I would prefer to test uname -s against "FreeBSD" and reverse the if/else logic. But I will not complain too loudly about this nit.

This revision is now accepted and ready to land.Jul 14 2022, 3:03 PM
In D35814#812882, @gjb wrote:

I do not object to the change, but I would prefer to test uname -s against "FreeBSD" and reverse the if/else logic. But I will not complain too loudly about this nit.

macOS wants the FreeBSD behaviour; currently Linux is the exception. I could flip it with != Linux, but if != .. else feels wrong to write.

In D35814#812882, @gjb wrote:

I do not object to the change, but I would prefer to test uname -s against "FreeBSD" and reverse the if/else logic. But I will not complain too loudly about this nit.

macOS wants the FreeBSD behaviour; currently Linux is the exception. I could flip it with != Linux, but if != .. else feels wrong to write.

Nope, that's fine then. I didn't realize the macOS behavior. So you can ignore my suggestion. :)

Can we just make mkimg(1) to accept a filename as its parameter, basically by stat'ing the file and use that size as capacity instead?

It's a bit of an unusual thing to want, and --capacity file would then be strange (especially if the file is of the form [0-9]+, it's then ambiguous). Adding an option just for mkisoimages.sh's use seems a little overkill.

This revision was automatically updated to reflect the committed changes.