You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
env: -i does not empty the environment, and environment blocks are alphabetically re-sorted #1352
env: -i does not empty the environment, and environment blocks are alphabetically re-sorted
Two probe-verified divergences in env's environment-block handling (same-source harness under Wine, twice, GNU coreutils 9.4):
env -i leaks the whole ambient environment. Probe: env -i Z=1 A=2 ./env (the child is env itself, printing the block it received). GNU child prints exactly:
Z=1
A=2
The winx child prints a long block: A=2, then the session's ambient variables (SystemDrive, SystemRoot, and every other inherited variable present in the harness process), and Z=1 last. So winx's -i merged the assignments into the existing process environment instead of starting from an empty block — on a real Windows machine this means env -i passes the user's full environment to the child.
Blocks are alphabetically sorted instead of insertion-ordered. In the same probe the winx block is ordered A=2 … Z=1 (alphabetical), while GNU preserves the order: inherited order, with command-line assignments appended in the order given. env.cpp builds the child block as a sorted map and also prints the no-command listing from that map, so plain env output order diverges from GNU's environment order too. Order is observable shell state (it is, for example, the iteration order of env output that scripts parse, and the search order some tools apply to duplicated keys).
Expected (GNU)
-i starts from an empty block; only the given assignments (plus the _= entry where applicable) reach the child.
No re-sorting: inherited order preserved, assignments appended in command-line order, for both the child block and the printed listing.
Regression seed
In-repo test named with this issue number: the env -i Z=1 A=2 ./env probe asserts the child's exact two lines in order; plain env output order asserted against a controlled two-variable parent block; duplicate-assignment override position asserted.
Activity
Merge pull request #1394 from unixwin/fix/winx4-proc
fix(differential): adjudicate the 23 gate-blocking cases (#1486 basel…
fix(differential): adjudicate the 23 gate-blocking cases (#1486 basel…