Tests: under_wine preserves the calling thread's last error (#1125) #1128
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1128
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1128"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@mahfuzinam0045-spec on GitHub · 2026-11-24 12:10 UTC · original
mahfuzinam0045-spec:fix/util-under-wine-preserve-last-error→main· +29 −5 · 1 files · 1 commits · openThe first invocation of
under_wine()looks upwine_get_versioninntdll.dllviaGetProcAddress. On native Windows,wine_get_versiondoes not exist inntdll.dll, soGetProcAddressfails and WindowsSetLastErrormutates the calling thread's Win32 last error toERROR_PROC_NOT_FOUND(127).Any caller querying
under_wine()before checkingGetLastError()(such as tests or error paths) had its last error silently overwritten with 127. Save and restoreGetLastError()around the probe inprobe_wine_ntdll(), preserving the caller's last error across both initial probe and cached queries.Fixes #1125.
What is in it
crates/xcl/src/util.rs: save and restoreGetLastError()aroundGetProcAddressinprobe_wine_ntdll().crates/xcl/src/util.rs: add unit testunder_wine_preserves_last_errorverifying that bothprobe_wine_ntdll()andunder_wine()preserve the calling thread's last error.Tested
under_wine_preserves_last_error: asserts thatGetLastError()returns the preset error code (0x1234and0x5678) across probe execution and subsequent queries.Regression run
util::under_wine(). Awaiting maintainer review /test-onlylabel waiver.Not tested
wine_get_versionis absent and triggersERROR_PROC_NOT_FOUND).AI use
github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@JoaoPauluu on GitHub · 2026-11-24 13:45 UTC · original
The Wine side of this change.
Tested
x86_64-pc-windows-gnu.281fdd7as it is (based on47efa2e), no uncommitted changes. The lib test binary runs under Wine.util::tests::under_wine_preserves_last_error(--exact, one process): ok.ntdll.dllexportswine_get_version, so the probe'sGetProcAddresssucceeds and does not set the last error. This run therefore checks that the save and restore does no harm on Wine. It does not exercise the Windows failure from #1125, so it would pass without the fix too.Not tested
AI use
@Mischief8713 on GitHub · 2026-11-24 16:10 UTC · original
Native Windows run of
281fdd7(NVIDIA GTX 1660 Ti): the new test passes with the fix and fails without it, with 127 (ERROR_PROC_NOT_FOUND)Tested
wine_get_versiondoes not exist.cargo test -p xcl --lib util::tests::under_wine_preserves_last_erroron the head: 1 passed.SetLastError(err);line inprobe_wine_ntdlldeleted: FAILED atutil.rs:364, left 127, right 4660 (0x1234). So the test catches the bug on this platform and the fix removes it.main; it was run as it is.Not tested
AI use
@Toons29 on GitHub · 2026-11-25 03:12 UTC · original
Regression run of
281fdd73on the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon4178e888, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 100 % of
main's frames, 100 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; I checked the blocks before posting.@DavidM1911 on GitHub · 2026-11-25 08:02 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.