Page MenuHomeFreeBSD

stand: add a mechanism to avoid env var propagation to kenv
ClosedPublic

Authored by kevans on Jun 16 2025, 10:36 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Sep 27, 7:08 AM
Unknown Object (File)
Wed, Sep 24, 7:44 PM
Unknown Object (File)
Sep 12 2025, 11:17 PM
Unknown Object (File)
Sep 12 2025, 7:42 PM
Unknown Object (File)
Sep 11 2025, 6:21 AM
Unknown Object (File)
Sep 10 2025, 6:27 AM
Unknown Object (File)
Sep 6 2025, 4:54 PM
Unknown Object (File)
Sep 6 2025, 5:46 AM
Subscribers

Details

Summary

Our only user of this at the moment is teken.{fg,bg}_color. These are
special because teken is a library common to both the kernel and the loader,
and we want to avoid having special vars to control the loader vs. the
kernel. Ideally, if a user wants a different set of console colors, then
they set the appropriate teken variable and it Just Works(TM) everywher.
We can't just avoid setting the env vars, because we specifically want to
install a hook to adjust how loader is drawn.

This allows us to avoid breaking a kernel config(5) that has some default
teken colors set with our defaults. That's a valid configuration, even if
it might seem weird that they don't want to set colors in both loader and
the kernel -- they may not anticipate spending any time in loader, and thus
prefer to just let it do its default behavior.

NOKENV is expected to be unset if the value is overwritten, rather than
acting as a persistent marker that we do not want the value to persist under
any circumstance. We can always add another flag bit later for persistence
if we find a use for that, but most variables are fine to carry over. This
is mostly needed for environment variables that we really just want to set
a hook for.

Diff Detail

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

Event Timeline

Do we want to add anything to the set command? Or some other way of exposing it to the scripting languages?

This revision is now accepted and ready to land.Aug 20 2025, 5:40 PM
In D50888#1189076, @imp wrote:

Do we want to add anything to the set command? Or some other way of exposing it to the scripting languages?

I think that'd be a good idea, but I don't have an immediate use-case for it. I think I'll call that out as future work in the commit language and spend a little more time munching on a good design here -- we had talked through some options on IRC, but I'm not sure I'm really sold on any of them.