Page MenuHomeFreeBSD

Allow building bin/cat on non-FreeBSD systems
ClosedPublic

Authored by arichardson on Jan 16 2018, 7:40 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Mar 11, 5:35 PM
Unknown Object (File)
Mon, Mar 11, 5:35 PM
Unknown Object (File)
Mon, Mar 11, 5:21 PM
Unknown Object (File)
Mon, Mar 11, 5:21 PM
Unknown Object (File)
Fri, Mar 8, 2:27 AM
Unknown Object (File)
Jan 11 2024, 3:09 AM
Unknown Object (File)
Jan 6 2024, 3:55 AM
Unknown Object (File)
Jan 6 2024, 3:55 AM
Subscribers

Details

Summary

cat -l is needed during the installworld phase and other system's cat
don't support that flag. To avoid portability issues when compiling on
Linux/macOS (such as the the direct access to &fp->_mbstate), we
disable the entire multibyte support when building as a boostrap tool.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Came from rS305841.

bin/cat/cat.c
253–256 ↗(On Diff #38052)

How do other systems behave here? I worry that just addressing the compilation error (_mbstate) is insufficient, and we should have a different block (or perhaps just not support multibyte encoding on !FreeBSD)?

This patch was enough to make cat work enough to run installworld on Linux. But probably removing the whole wide stuff when not building for FreeBSD is better.

The other option here would be to write a small, portable build tool that take a file argument, opens and locks the file, and writes anything on stdin to the file until EOF.

Disable all flags except -l/-u when bootstrapping

This still feels a little icky to me but OK.

This revision is now accepted and ready to land.Jan 5 2020, 5:25 PM

This seems fine.

We got cat -l from NetBSD when I implemented the METALOG work. I do wonder if a dedicated (and easily bootstrapable) tool would make more sense.

I agree that a small separate tool would be nicer. I don't really have time to write one right now though. I'll wait before committing this until it's the last blocker for cross-building. Maybe by then I'll find some time to add a write_locked (or whatever name we want to choose) bootstrap tool.

I'll wait before committing this until it's the last blocker for cross-building.

In fact I think it's fine to commit this now, perhaps expanding the comment before main() mentioning the alternate path. We can always revert if the other approach makes it in.

This revision was not accepted when it landed; it landed in state Changes Planned.Jan 16 2020, 2:15 PM
This revision was automatically updated to reflect the committed changes.