Page MenuHomeFreeBSD

Makefile.inc1: Let the buildetc target run outside of etc
ClosedPublic

Authored by markj on Apr 22 2025, 2:30 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Aug 2, 6:44 AM
Unknown Object (File)
Sun, Jul 27, 11:15 AM
Unknown Object (File)
Sun, Jul 27, 4:57 AM
Unknown Object (File)
Thu, Jul 24, 11:23 PM
Unknown Object (File)
Mon, Jul 21, 5:31 PM
Unknown Object (File)
Jul 9 2025, 9:44 AM
Unknown Object (File)
Jul 8 2025, 4:48 PM
Unknown Object (File)
Jul 7 2025, 8:00 PM
Subscribers

Details

Summary

Commit 49bc071f4088 ("nsswitch.conf: Avoid modification after
installation") changes handling of nsswitch.conf such that we make a
copy in the objdir during a build. Historically, the in-tree
nsswitch.conf lived under etc.

The buildetc target and its copy set SUBDIR_OVERRIDE=etc when building
the object tree, but I think this isn't right when conf files are
scattered around the src tree. If any of them require non-trivial
processing, they'll get skipped during buildetc, and then some
build-time commands may run during installetc. In the linked PR, this
fails because the src tree is mounted read-only and no objdir was
created during buildetc.

Remove the SUBDIR_OVERRIDE for the _obj target, and build the
buildconfig target across the tree.

PR: 286072

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 63646
Build 60530: arc lint + arc unit

Event Timeline

markj requested review of this revision.Apr 22 2025, 2:30 PM
markj created this revision.
This revision is now accepted and ready to land.Apr 22 2025, 4:14 PM
Makefile.inc1
1688

Does this do anything that buildconfig won't? I don't love that this (presumably) builds things twice in etc?

Makefile.inc1
1688

There is at least one difference, in etc/sendmail/Makefile: the all target builds some configuration files by running .cf files through m4.

I don't love the duplication either. Perhaps I should update the sendfile rules to be built by "buildconfig".

Makefile.inc1
1688

If it's not a pervasive issue then yeah having everything be under buildconfig would be great

usr.sbin/etcupdate/etcupdate.sh
225 ↗(On Diff #154092)

So this code here is a fallback for using new etcupdate with older source trees, and should correspond to what their old etcupdate was doing. Given 49bc071f4088 only applies to new source trees, it should be using buildetc for them. All this change does is risk breaking running etcupdate on older trees if for some reason dropping the SUBDIR_OVERRIDE or adding buildconfig doesn't work there.

usr.sbin/etcupdate/etcupdate.sh
225 ↗(On Diff #154092)

I agree with @jrtc27, this code is only for old trees that predate buildetc and probably should be left as-is.

Revert the change to etcupdate

This revision now requires review to proceed.Apr 22 2025, 7:38 PM
dim added a subscriber: dim.

I tried this out, and it solved my issue of etcupdate leaving around a /usr/src/lib/libc/nsswitch.conf file.

This revision is now accepted and ready to land.Apr 24 2025, 2:29 PM