Tests: under_wine preserves the calling thread's last error (#1125) #1119
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from ivall/xcl. Originally posted by mahfuzinam0045-spec on 2026-11-24T12:10:50Z.
The 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
Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-24T13:45:24Z.
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
Imported from ivall/xcl. Originally posted by Mischief8713 on 2026-11-24T16:10:26Z.
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
upstream-sync referenced this pull request2026-11-24 19:06:45 +00:00
Imported from ivall/xcl. Originally posted by Toons29 on 2026-11-25T03:12:38Z.
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.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T08:02:23Z.
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!
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T07:40:25Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:52:45Z.
Triage (#1607) – head
281fdd7#1135 made the same change (save and restore the last error around the
wine_get_versionprobe inutil::under_wine); it is closed, unmerged, and main still has the unguarded probe. No other open PR touches it.No problems found in the diff. Minor: the subject says
Tests:bututil.rsis runtime code, so the PR needs the smoke runs; the failing check is the PR description check.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.