[Bug 268479] lib/libc/stdlib/getenv.c may have a problem with putenv()
Date: Thu, 22 Dec 2022 03:54:06 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268479 --- Comment #7 from Mark Millard <marklmi26-fbsd@yahoo.com> --- (In reply to Dennis Clarke from comment #6) Not simple? # sysctl kern.supported_archs kern.supported_archs: aarch64 armv7 That is from a aarch64 Cortex-A72 system. It can have chroots and jails that are armv7 instead of aarch64: # uname -m arm64 # uname -p aarch64 # chroot /usr/obj/DESTDIRs/main-CA7-chroot # uname -m arm # uname -p armv7 # file /bin/sh /bin/sh: ELF 32-bit LSB executable, ARM, EABI5 version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, FreeBSD-style, for FreeBSD 14.0 (1400073), not stripped Same machine. Same kernel in operation. Different uname -m and uname -r results and a different execution environment. Are you expecting that? (This example lacks expect manipulation via UNAME_m and UNAME_p. I'll use uname -r and UNAME_r for an example of manipulation.) There is also running older worlds on newer kernels, such as poudriere building in/for for stable/13 or a releng/13.* on a system that booted main [so: 14] (both kernel and world). If I chroot to a tree that contains a stable/13 world (and, possibly an unused(!) kernel), what should uname -r report? Reporting 14.0-CURRENT would mess up various things that are trying to figure out what to build software for. Reporting 13.1-STABLE would make more sense for a port build targeting stable/13 . But just using chroot leads to: (chroot makes for simple to set up examples) # uname -r 14.0-CURRENT # bectl mount 13S-CA72 /be-13S-CA72-mnt # It is a 13.1 context here # chroot /be-13S-CA72-mnt/ # uname -r 14.0-CURRENT This is not what poudriere would want to provide to a builder process that is targeting a stable/13 context. Thus poudriere assigns UNAME_r in the processes for building to what a stable/13 kernel would indicate: 13.1-STABLE instead of 14-CURRENT . Then the builder sees uname -r as returning 13.1-STABLE . (Similar points could go for buildworld buildkernel targeting stable/13 in the chroot.) That is not to say that all jail/chroot contexts would want to see 13.1-STABLE . It is purpose driven: building things for stable/13 makes 13.1-STABLE appropriate. (The source tree involved has stable/13 material, including for kernel interface source code. main's source code is not in use, given the targeting of stable/13 .) So which do you expect to see: 14-CURRENT always? 13-STABLE always? A more context/purpose specific one or the other? I can not tell from what you have written what you mean by "and know the results". I can tell you that in various contexts FreeBSD assigns various UNAME_*'s to produce processes that see uname -* outputs appropriate to a specific purpose --and they need not match the boot environment. -- You are receiving this mail because: You are the assignee for the bug.