[Bug 268479] lib/libc/stdlib/getenv.c may have a problem with putenv()

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 25 Dec 2022 08:46:37 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268479

--- Comment #10 from Mark Millard <marklmi26-fbsd@yahoo.com> ---
(In reply to Tatsuki Makino from comment #9)

I'm confused about your point.

uname(1) and uname(3) are not the same as the sysctl but can
use the sysctl, absent an overriding UNAME_* . Various
usages of uname(1) and uname(3) do not want the value that
sysctl provides: some deliberately different UNAME_* assignments
are used at times. sysctl values are provide defaults.

lib/libc/gen/getosreldate.c's getosreldate() checks for
OSVERSION in the environment and only uses the sysctl when
OSVERSION is not found. (Analogous to UNAME_* usage.)

Also, uname -U is not ever via a sysctl: the default is from
the world (not kernel) __FreeBSD_version macro value for
uname's compilation context.

kern.build_id, kern.ident, kern.osreldate, kern.osrelease, and
kern.version reflect the actual kernel running, not the one
being simulated in, say, a chroot into an older version of world.
Various things instead need identify the simulated kernel version
being targeted instead. Mostly this involves providing alternate
definitions to kern.osreldate and kern.osrelease .

Similarly, there are contexts in which the hw.machine and
hw.machine_arch from the booted kernel are inappropriate to
identifying a simulated/emulated environment.

-- 
You are receiving this mail because:
You are the assignee for the bug.