Repository navigation
winx4-proc process/environment control family (env #1352/#1353, timeout #1350, nice #1359) - #1394
Merged
Merged
Conversation
…ck (#1352) env's environment materialization used std::map throughout, so both the printed listing and the child environment block came out in alphabetical order instead of the inherited order with command-line assignments appended in the order given (GNU coreutils 9.4 oracle: 'env -i Z=1 A=2 env' prints exactly Z=1 then A=2; duplicate assignments replace in place at the first position). Replace the map with an ordered entry list (EnvEntries) across parse_env_block, read_env_file, materialize_environment, print_env and build_environment_block, with setenv-style replace-in-place/append and order-preserving unset. Regression: unit tests in tests/unit/env/env_unit_test.cpp (child block exact contents+order via a nested env, listing order, duplicate override position, unset order) and differential cases 70/71. Verification pending: the mingw+Wine harness build has not yet obtained the machine-wide build slot, so these changes are compile- and runtime-unverified. WIP.
…1353) env had no entry in option_policy_for_command, so the shared parser permuted across the whole command line: a child option such as the -l in 'env ./ls -l' was parsed as an env option and the launch died with parse-error exit 125, and path-form commands with option-like arguments never ran. GNU env parses with a leading-'+' getopt (coreutils 9.4 oracle verified): option processing stops at the first non-option argument (an assignment or the command name); everything after belongs to the command, and a dash token in command position is the command to run ('env FOO=1 -i ...' -> 127, tries to run '-i'). Give env stop_options_after_positionals = 1, the same policy shape nohup/xargs/getopt already use. Regression: unit tests (path-form command with child options, options after an assignment belong to the command, dash token after assignment is the command and reports 127) and differential case 72. Verification pending: mingw+Wine harness build still awaiting the machine-wide build slot; compile- and runtime-unverified. WIP.
The timeout branch mapped every timeout kill to exit 124 (or 128+SIG under --preserve-status) regardless of the signal sent. GNU timeout's rule is signal-dependent (coreutils 9.4 oracle, measured): without --preserve-status the status is 124 for TERM/INT/HUP/ABRT but 128+SIGKILL = 137 when the command is killed by SIGKILL; --preserve-status reports 128+SIG for every signal (TERM 143, INT 130, KILL 137). The --kill-after escalation branch already stamped 128+9; the initial timeout branch now does the same for -s KILL. Regression: unit tests (KILL 137, TERM 124, INT 124, preserve TERM 143, preserve KILL 137) and differential cases 73/74. Verification pending: mingw+Wine harness build still awaiting the machine-wide build slot; compile- and runtime-unverified. WIP.
) nice passed the priority class as a CreateProcessW creation flag and never checked the result, so a priority change that could not be applied (e.g. raising priority without the privilege) silently ran the command at the unchanged priority. GNU nice warns and continues (coreutils 9.4 oracle, measured unprivileged): 'nice: cannot set niceness: Permission denied' on stderr, the command still runs, and its exit status is propagated. Create the child suspended, apply the class with SetPriorityClass, cross-check with GetPriorityClass for silent clamps, print the GNU-shaped warning on failure, and resume the child either way. Regression: unit tests (unapplied raise produces either silence-when-applied or exactly the GNU warning line while the child's exit status 7 propagates; the permitted lowering direction stays silent). No differential case: the warning is permission-environment-dependent, so a byte-equality oracle case would be environment-fragile; the forcing environment is the cluster's Wine-unprivileged harness probe. Verification pending: mingw+Wine harness build still awaiting the machine-wide build slot; compile- and runtime-unverified. WIP. i18n note: the new message currently uses the established plain-text diagnostic shape of this command's other messages; catalog key assignment follows at integration.
Per the branch's own #1353 rule (verified GNU), option parsing stops at the first non-option argument, so '-u DROP' after 'KEEP1=1' would be the utility name (127). And GNU applies -u to the inherited block before assignments, so 'DROP=2' later on the same line survives anyway. Inject DROP through the inherited environment and assert survivor order positionally. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Member
Author
|
Verification landed (merge e3865b6 brings origin/main in cleanly; fixup f200a4b):
|
caomengxuan666
marked this pull request as ready for review
October 27, 2026 03:58
# Conflicts: # tests/differential/regressions/index.tsv # tests/unit/env/env_unit_test.cpp # tests/unit/timeout/timeout_unit_test.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Process/environment control family fixes for env, timeout, and nice — one commit per issue on
fix/winx4-proc(basea104bb28):2739325fenv:-idoes not empty the environment, and environment blocks are alphabetically re-sorted #1352 env: ordered environment entries replacestd::mapmaterialization — printed listing and child block keep inherited + assignment order, duplicates replace in place,-upreserves order (+4 unit tests, differential cases 70/71)ec7a2e29env's child-launch stop policy vs GNU: option-like first arguments (-l,./prog -x, absolute paths) fail to launch #1353 env:stop_options_after_positionals = 1policy so the shared parser no longer permutes across the wrapped command (+3 unit tests, differential case 72)b71ab78ctimeout: exit status after--signal=KILLis 124 instead of 137 #1350 timeout: initial timeout kill with-s KILLnow stamps 137 (128+SIGKILL) per the GNU rule instead of a blanket 124 (+5 unit tests, differential cases 73/74)7de8d051nice: a failed priority change is silently ignored (GNU warns and continues) #1359 nice: suspended create +SetPriorityClass+GetPriorityClasscross-check; on failure prints the GNU-shapednice: cannot set niceness: Permission denied, always resumes the child and propagates its exit status (+2 unit tests)Verification (mingw + Wine harness, 2026-10-26)
Local harness build landed: configure OK,
[97/97] Linking CXX executable mini.exe, build rc=0. Expectations are GNU coreutils 9.4 oracle values measured natively; full evidence is in the cluster REPORT (workspace record).repro.sh(24 gating cases): PASS=18, FAIL=6 — all six failures adjudicated as non-product issues with evidence:-l,./prog -x, absolute paths) fail to launch #1353: 7/7 pass. timeout: exit status after--signal=KILLis 124 instead of 137 #1350: 8/8 pass (KILL 137; TERM/INT 124; preserve 143/130/137; no-timeout passthrough).-idoes not empty the environment, and environment blocks are alphabetically re-sorted #1352: print order and inherited relative order pass. The two child-block exact matches differ only by Wine's ownWINE*bookkeeping variables, which the Wine loader appends to every child block; the product's materialized block is exactly{Z=1, A=2}in order, proven by theenv -vtrace — the-ileak half-question is ruled: no product leak. The intermixed-ucase's repro expectation contradicts the GNU oracle (native GNU 9.4 also returns 127 for that shape; the product matches GNU exactly);-uremoval/order itself verified with a correctly positioned shape./tmptmpfs; wineserver logged "No space left on device"); re-run with the prefix on a larger filesystem, all three exit codes/outputs match expectations. The warning branch itself is unreachable under Wine (Wine grants every priority class to unprivileged users, verified up to-n -20), so it remains a Windows CI surface, as the commit anticipated.Side finding (report-only):
stdbufshows the same missing stop-options policy shape as #1353 (stdbuf -o0 ./echo -n hi→stdbuf: invalid option -- 'n'); chroot was not behaviorally probed in this harness round.Still owed at integration: repo ctest/differential suites (need the full product build), the format pass, and the i18n catalog key for the new #1359 warning (the message currently uses the command's established plain-text diagnostic shape). Local
[local-build]harness shims (GCC template-disambiguator fixes, working tree only) are not part of this PR.Fixes #1350
Fixes #1352
Fixes #1353
Fixes #1359