Page MenuHomeFreeBSD

truncate(1): Fix cross-build CI failure due to missing fspacectl
ClosedPublic

Authored by khng on Aug 20 2021, 5:14 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 20, 5:32 PM
Unknown Object (File)
Oct 2 2024, 5:10 AM
Unknown Object (File)
Oct 1 2024, 3:51 PM
Unknown Object (File)
Sep 30 2024, 4:48 PM
Unknown Object (File)
Sep 27 2024, 12:48 PM
Unknown Object (File)
Sep 25 2024, 12:12 AM
Unknown Object (File)
Sep 24 2024, 10:47 AM
Unknown Object (File)
Sep 19 2024, 2:51 AM

Details

Summary

For other platforms, fspacectl(2) is absent. This commit masks out the
calls to fspacectl(2) and replace them with a ENODEV errno.

Sponsored by: The FreeBSD Foundation

Diff Detail

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

Event Timeline

khng requested review of this revision.Aug 20 2021, 5:14 PM

I must admit this is kind of dirty.

Use SPACECTL_DEALLOC to allow BOOTSTRAP_ALL_TOOLS from lower version

markj added inline comments.
usr.bin/truncate/truncate.c
68 ↗(On Diff #94029)

You can't just use #ifdef __FreeBSD__?

211 ↗(On Diff #94029)

ENOSYS probably makes more sense?

usr.bin/truncate/truncate.c
68 ↗(On Diff #94029)

Bootstrapping from lower version still requires the system call to be presented if BOOTSTRAP_ALL_TOOLS.

khng marked an inline comment as done.

ENOSYS suggestion

usr.bin/truncate/truncate.c
68 ↗(On Diff #94029)

But isn't that an internal flag, only set when cross-building? In any case I think the usual solution is to provide stub implementations in tools/build, like commit d80f1dd1d78ddebee8de9cfba9413032a1fedba8 did. I'm not an expert in this area, though, so I will bow out now. :)

I doubt this is needed for bootstrapping, so using the current ifdef looks good to me. It would be good to see if/which flags are used during the build that aren't universally supported, but for now this should be sufficient.

A wrapper that returns enosys in tools/build might be a bit cleaner though since it avoids ifdefs here.

usr.bin/truncate/truncate.c
68 ↗(On Diff #94029)

I generally set that flag when building on FreeBSD to ensure bootstrapping isn't broken.

Introduce stub in tools/build to eliminate the ifdef in truncate(1)

This revision was not accepted when it landed; it landed in state Needs Review.Aug 24 2021, 9:18 AM
This revision was automatically updated to reflect the committed changes.