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
BUILD-2127: Honor legacy CRT wildcard flags and match ordering - #6463
The legacy msvcrt.dll!__getmainargs and __wgetmainargs shims ignored doWildCard, leaving patterns literal even when callers requested expansion. Microsoft documents the fourth argument as the expansion switch: __getmainargs / __wgetmainargs.
An original MSVC fixture with both functions in its actual msvcrt.dll import table reproduces the problem in native versus mapped execution. The native oracle also establishes that legacy expansion sorts each pattern's matches case-insensitively after conversion to the requested character width. That differs from the enumeration order retained by UCRT startup.
Enable sorting only for legacy calls, within each original pattern's result range. Literal arguments and separate wildcard groups retain their positions.
Preserve zero-flag behavior, unmatched patterns, environment lookup, independent narrow/wide storage, and the existing UCRT startup path.
Add an import-library-only fixture, native/mapped comparisons, and registered-shim program-token controls. No replacement CRT DLL is built.
This is a stacked follow-up on exact #6117 head a906994c9f0b9672b6647e571fa0a573fe171dae. Its published branch is unchanged. The follow-up delta is seven files above that commit.
Validation
Windows 11 x64, MSVC 19.44.35228, Windows SDK 10.0.26100.0, RelWithDebInfo, ACP 1252. CPU only; no GPU, driver exercise, or game inputs.
The same final fixture and runner were used before and after the fix:
Parent production: 16 of 20 mapped cases differ from their native controls. Zero-flag and unmatched-pattern controls agree. All child processes complete normally.
Fixed production: all 20 native/mapped pairs agree in their complete argument tables, including argv[0]. Output is never reordered by the test.
Four additional native program-token controls pass. Both registered-shim program-token failures on parent production pass after the fix.
Coverage includes both widths and flag values, quoted patterns, unmatched patterns, relative path prefixes, ACP-dependent patterns/results, both reconfiguration orders, mixed-case and punctuation ordering, and two wildcard groups separated by a literal.
process_cmdline, run_argv_modes, run_startup_cmdline, and the new run_legacy_argv CTests pass. Python syntax, the three text-line-ending checks, and git diff --check pass.
The fixture, seeded input bytes, and synthetic package are preserved.
Exact current-main snapshot f6c6d11eee62b614eafc2a8ae75ffbf3e0f4f9fd accepts #6117 and this follow-up through clean three-way application, with no manual resolutions. This is a source-only integration check; the executed results above are on the exact parent stack. The main snapshot's newer CMake stack/queue settings and unrelated runtime changes are retained. A final fetch at main 4beffda88aa4fc0c266623b311272078e0ad4079 found no subsequent changes to any of the seven affected paths.
This does not add console-path wildcard routing, change the loader's program-token policy, or alter host CRT argument globals. Native expectations are obtained from the active code page; only ACP 1252 was exercised here.
AI-assisted: yes. Independent read-only peer review and root review of the source, fixture, native oracle, and final sorting delta found no actionable issue. Root also verified all 28 frozen source, binary, and evidence hashes.
Independent Windows check of 2aea6a78, stacked on #6117 at a906994c. Windows 11 x64 build 26300, MSVC 19.38.33145, Windows SDK 10.0.26100, ANSI code page 1252, RelWithDebInfo.
All four stock CTests passed. run_legacy_argv matched all 20 native and mapped argument tables and passed the four native program-token controls. run_argv_modes matched all 26 UCRT native and mapped pairs. process_cmdline and run_startup_cmdline also passed. The built guest imported both legacy argument functions from msvcrt.dll. Synthetic inputs only. AI-assisted.
Independent integration check for 2aea6a78c8fbfae01ed2e4cc822e57b9bc3de04e, stacked on #6117 at a906994c9f0b9672b6647e571fa0a573fe171dae.
Both commits applied cleanly to main 1cc6e3c121969761d9dad8fdec99f19928213973 (tested tree 332014a2cd51b135204fe7de1ff9ff9e9965117f). I built again from that integrated tree. On both the exact PR head and the integration build, process_cmdline, run_argv_modes, run_startup_cmdline, and run_legacy_argv passed. That covers 20 legacy and 26 UCRT native/mapped pairs per build, plus four native program-token controls. No actionable findings in the follow-up delta.
Windows 11 build 26300, MSVC 19.44.35230, Windows SDK 10.0.26100.0, x64 RelWithDebInfo, ACP 1252. Synthetic CPU fixtures only. Other code pages were untested.
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
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.
Problem
The legacy
msvcrt.dll!__getmainargsand__wgetmainargsshims ignoreddoWildCard, leaving patterns literal even when callers requested expansion. Microsoft documents the fourth argument as the expansion switch: __getmainargs / __wgetmainargs.An original MSVC fixture with both functions in its actual
msvcrt.dllimport table reproduces the problem in native versus mapped execution. The native oracle also establishes that legacy expansion sorts each pattern's matches case-insensitively after conversion to the requested character width. That differs from the enumeration order retained by UCRT startup.Changes
Coordination: BUILD-2127, original claim, carried to current coordinator #6414.
Depends on: #6117
This is a stacked follow-up on exact #6117 head
a906994c9f0b9672b6647e571fa0a573fe171dae. Its published branch is unchanged. The follow-up delta is seven files above that commit.Validation
Windows 11 x64, MSVC 19.44.35228, Windows SDK 10.0.26100.0, RelWithDebInfo, ACP 1252. CPU only; no GPU, driver exercise, or game inputs.
The same final fixture and runner were used before and after the fix:
argv[0]. Output is never reordered by the test.process_cmdline,run_argv_modes,run_startup_cmdline, and the newrun_legacy_argvCTests pass. Python syntax, the three text-line-ending checks, andgit diff --checkpass.Build the focused targets and run:
Integration and scope
Exact current-main snapshot
f6c6d11eee62b614eafc2a8ae75ffbf3e0f4f9fdaccepts #6117 and this follow-up through clean three-way application, with no manual resolutions. This is a source-only integration check; the executed results above are on the exact parent stack. The main snapshot's newer CMake stack/queue settings and unrelated runtime changes are retained. A final fetch at main4beffda88aa4fc0c266623b311272078e0ad4079found no subsequent changes to any of the seven affected paths.This does not add console-path wildcard routing, change the loader's program-token policy, or alter host CRT argument globals. Native expectations are obtained from the active code page; only ACP 1252 was exercised here.
AI-assisted: yes. Independent read-only peer review and root review of the source, fixture, native oracle, and final sorting delta found no actionable issue. Root also verified all 28 frozen source, binary, and evidence hashes.