Repository navigation
fix(timeout): children resolve with Win32 PATH semantics and the package-sibling fallback (main CI regression from #1567) - #1569
Merged
Conversation
Root cause of the #1567 main-CI regression (25 timeout-family ctest failures on clean runners): the bridge snapshots a Win32 environment block, whose PATH entry is spelled however the parent wrote it — "Path" from a PowerShell/cmd runner parent, "PATH" from MSYS — but MapEnv::get is an exact POSIX-style match. The rust2 timeout missed the block's only PATH entry, invented the System32/Windows default (childproc.cppm:274 analog), and every wrapped sibling 127'd ('failed to run command 'sleep.exe''; System32\where.exe even returned rc 2 with no arguments). Green locally for the worst reason: a Git Bash parent exports uppercase PATH. win32_env_get is the case-insensitive, first-occurrence-wins lookup (GetEnvironmentVariableW semantics) as an explicit resolution-only escape hatch; EnvSource::get stays exact because environ-semantics commands must keep GNU's POSIX match — printenv gfoo vs GFoo is gate row pe10-lowercase and stays green. Ref: #1567 regression, #1488
…sibling fallback Two halves of the #1567 main-CI regression fix: - PATH/PATHEXT/COMSPEC now read through win32_env_get: the spawned timeout.exe carries whatever casing its parent used, and a case miss fell through to the System32/Windows default before any PATH entry was consulted. - bare-name resolution falls back to the running image's own directory after every PATH entry missed (std::env::current_exe parent). GNU execvp is PATH-only because on POSIX the package prefix IS on PATH by construction (/usr/bin); a Windows multicall package is that analog — every entry image (timeout.exe, echo.exe, sleep.exe, ...) is one directory, and CreateProcess's own legacy search puts "the directory from which the application loaded" first (Microsoft Learn, CreateProcess search order). The fallback is appended LAST, so PATH shadowing and the GNU 126/127 diagnostics keep their shapes; it only rescues same-package siblings when the package bin dir is not on PATH (portable runs, test rigs, clean runners). Tests: path_env_casing_does_not_break_child_resolution (mixed-case "Path" block resolves a wrapped batch, rc 0) and win32_env_get_is_case_insensitive_first_match in winux-core. Clean-PATH simulation (System32+PowerShell+Git\cmd only, no package dir): the 25 previously failing timeout/childproc ctest cases all pass; normal-env full ctest failing set equals the 20-test pre-existing baseline. Ref: #1567 regression, #1488
Member
Author
|
Root-cause evidence chain, for review convenience: on the failing main run (43018585303), |
caomengxuan666
added a commit
that referenced
this pull request
Nov 12, 2026
…s duplicate block (#1569 semantics preserved) E0255: the restored wave4b childproc.rs and timeout.rs both defined resolve_child / quote_windows_arg / ChildResolve. childproc.rs is the single authority (the restored wave4b bodies were byte-identical to the timeout.rs copies modulo pub visibility, so the #1569 win32_env_get case-insensitive PATHEXT lookup and the package-sibling fallback are unchanged). timeout.rs keeps only its timeout-specific logic and delegates via the existing `use crate::childproc::{...}` import; nice.rs re-points the same import from crate::timeout to crate::childproc. Pinned by timeout::tests::path_env_casing_does_not_break_child_resolution.
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.
Fixes the main CI regression introduced by the wave3b timeout wiring (#1567): 25 ctest failures on the clean runner (
build-windows (x64, x64, x64, default)red since e466808), all in the timeout family —timeout.timeout_basic/timeout_signal_kILL/... (22) andchildproc.timeout_bare_name_colliding_with_system32_resolves_from_path/timeout_posix_mixed_path_entries_are_resolved/timeout_batch_script_from_path_routes_through_interpreter(3).Root cause (two stacked defects, both in the rust2 child-resolution path)
GetEnvironmentStringsWverbatim; the entry is spelled however the parent wrote it —Pathfrom a PowerShell/cmd CI runner parent,PATHfrom an MSYS one.MapEnv::getis an exact POSIX-style match, soresolve_childmissed the block's only PATH entry and invented the System32/Windows default: wrappedsleep.exe/echo.exe→timeout: failed to run command 'sleep.exe': No such file or directory(127);timeout 5 whereresolvedSystem32\where.exe, which exits 2 with no arguments — exactly the observed rc shapes. Green locally for the worst reason: a Git Bash parent exports uppercase PATH (plus an installed entry-link state on PATH).echo.exe/sleep.exewrapped bytimeoutcannot resolve. GNU never hits this because on POSIX the package prefix IS on PATH by construction (/usr/bin).Fix (option a — dispatcher-own-children fallback; option b entry-link materialization rejected)
winux_core::win32_env_get— case-insensitive, first-occurrence-wins lookup (GetEnvironmentVariableWsemantics) as an explicit resolution-only tier;EnvSource::getstays exact because environ-semantics commands keep GNU's POSIX match (printenv gfoovsGFoo= gate rowpe10-lowercase, still green). timeout reads PATH/PATHEXT/COMSPEC through it.resolve_childappends the running image's own directory as the LAST search entry for bare names. Windows' own loader blesses this: the CreateProcess legacy search consults "the directory from which the application loaded" (Microsoft Learn, CreateProcess search order, entry 1) — the Windows analog of POSIX's always-on-PATH/usr/bin. PATH stays authoritative (appended last, so shadowing and the GNU 126/127 diagnostics keep their shapes); the fallback only rescues same-package siblings when the package bin dir is not on PATH (portable runs, test rigs, clean runners). Entry-link materialization (option b) was rejected: it cannot help clean-machine multicall/portable runs at all and it couples packaging to a resolution invariant.Verification
PATH=System32;PowerShell;Git\cmdonly — no package dir, no Git\usr\bin, i.e. stricter than the real runner): the previously failing 25 — in fact all 36timeout/childproc.timeout_*cases — pass 36/36; pre-fix build failstimeout_basic127 under the identical simulation.childprocPATH-only path this PR does not touch (same class as the regression, separate owner); plus the 20 baseline environment tests.cargo testwinux-core + winux-cmds: 341 green (incl. newpath_env_casing_does_not_break_child_resolutionandwin32_env_get_is_case_insensitive_first_match).run-gate.sh timeout printenv pwd users numfmt— 140 GNU-gated + 17 win-only, all green (pe10-lowercase pins the POSIX exactness thatwin32_env_getdeliberately does not leak into).