Repository navigation
test(libkernel): skip the Windows lstat link checks without the symlink privilege - #3169
Conversation
…nk privilege guest_filesystem creates symbolic links for the Windows lstat checks. Without administrator rights or Developer Mode, CreateSymbolicLinkW fails with ERROR_PRIVILEGE_NOT_HELD even with SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE, and the test aborted there (reported as a stale guest errno). Skip those checks with a note in that case; any other failure to create the first link still fails the test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dextroid17
left a comment
There was a problem hiding this comment.
The diagnosis is the valuable part here, and it is complete: a Windows machine without the symlink privilege refuses SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE with ERROR_PRIVILEGE_NOT_HELD, the check aborts, and the guest errno in the failure message is stale — so the message points away from the cause. Establishing that with a direct call, and saying that the CI runner has the privilege and therefore never sees it, is what turns "this test is flaky" into a specific and testable claim.
The skip is scoped correctly. Trying the first link and skipping the block only on that exact error, while any other failure still fails the test, keeps the coverage that can run and refuses to let a real failure hide behind the skip. Printing a note instead of skipping silently is the other half of that, and confirming the block still runs when links can be created is what makes this a skip rather than a removal.
The verification is what the platform allows, and it says so. On main it fails at line 276; with the change it passes three times running, with the rest of the test still active and only the link block skipped. A Windows-only path cannot be exercised from here — CI is the only place this runs — so a triple repeat is the right substitute for a local build.
One thing worth filing rather than leaving in a description: the stale errno. A test that reports guest errno 14 for a Windows privilege failure will mislead exactly the next person it misled this time, and this fix works around the abort without correcting the message. If that error path is not already tracked somewhere, it reads like it deserves its own issue.
Written with AI assistance.
|
Thanks @Dextroid17. Agreed on the stale errno, so I filed it as #3178. I kept it out of this PR so this one stays a scoped test fix; the message is shared by several tests' |
|
Native run of the skip path, on a machine without the symlink privilege: Windows 11 Home (26200), Developer Mode off, not elevated, WinLibs GCC 15.2.0 r7, Release. A direct
I can't cover the privileged path on this machine; the fork CI run you mentioned covers that. |
|
Fork CI for this head (run 38096782280), merged onto current
|
What
guest_filesystemaborts on Windows machines without administrator rights or Developer Mode:The Windows
lstatlink checks (7f2a882 / 314c372, @MarcZX100) create symbolic links withCreateSymbolicLinkW(..., SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE). Without the symlink privilege, that flag isn't honoured, and the call fails withERROR_PRIVILEGE_NOT_HELD(1314). I checked this with a direct call on such a machine. The guest errno in the message is stale, so it points away from the cause. The CI runner has the privilege, so CI doesn't see this, but anyone runningctestlocally on a default Windows install does.The test now tries the first link. If that fails with
ERROR_PRIVILEGE_NOT_HELD, it prints a note and skips the link checks. Any other failure still fails the test. When links can be created, the checks run as before, unchanged apart from moving into theelsebranch.Tested
Windows 11 (no Developer Mode, not elevated), WinLibs GCC 15.2.0 r7, Release, on
main59a8cba:main,guest_filesystemfails at line 276.--repeat until-fail:3). The rest of the test still runs; only the link block is skipped.check_conventions.pyandpr_overlap.py --branchpass.The privileged path, where the link checks run, is covered by the Windows CI job. A fork CI run for this head will be posted here.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code