ww: preserve original environment for directory tests

This commit is contained in:
2026-08-21 12:57:55 +09:00
parent bcc3aa9336
commit 8a5fc8977f
5 changed files with 424 additions and 67 deletions

View File

@@ -770,6 +770,17 @@ compatibility route. It does not apply to build tools, `ww build`, `ww run`,
compile-only or assembly-only test requests, no-test products, or later direct
execution of a retained binary.
An executed directory product otherwise receives the caller's original Unix
environment, not the build plan's tool environment. The snapshot keeps the
first occurrence of each normal case-sensitive `key=value`, omits later normal
duplicates and raw empty entries, and retains every nonempty malformed entry in
order. It then applies only the effective `PATH` above and the package `PWD`.
Consequently caller `LC_ALL`, `TMPDIR`, empty-valued variables, case-distinct
keys, and arbitrary variables remain visible to production or test-only
initialization and test bodies. The compiler, assembler, archiver, linker, and
coordinator scratch continue to use their separate build-plan locale and
temporary directory.
The same coordinator-executed product reads standard input from the null
device. Its first read observes EOF regardless of the terminal, pipe, or file
connected to the invoking command. Each parallel product owns a separate null