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, Oct 13, 2:28 AM
Unknown Object (File)
Aug 12 2025, 8:21 PM
Unknown Object (File)
Aug 12 2025, 8:31 AM
Unknown Object (File)
Aug 9 2025, 3:02 PM
Unknown Object (File)
Aug 2 2025, 5:40 AM
Unknown Object (File)
Jul 29 2025, 5:31 AM
Unknown Object (File)
Jul 28 2025, 6:45 PM
Unknown Object (File)
Jul 27 2025, 4:28 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.