HomeFreeBSD

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

Description

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

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) everywhere. 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.

Future work could expand this to break it out to the scripted
interfaces. We have discussed some options like a new built-in command,
or adding a flag to the existing set command, but haven't really come
up with a concrete plan to avoid confusion.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D50888

Details

Provenance
kevansAuthored on Aug 22 2025, 3:48 AM
Reviewer
imp
Differential Revision
D50888: stand: add a mechanism to avoid env var propagation to kenv
Parents
rG95e6fd1fd85a: stand: split fg/bg handling up a little further
Branches
Unknown
Tags
Unknown