Skip to content

test(libkernel): skip the Windows lstat link checks without the symlink privilege - #3169

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
reyani-dev:fix/test-windows-symlink-privilege
Oct 11, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
reyani-dev:fix/test-windows-symlink-privilege

Conversation

@reyani-dev

Copy link
Copy Markdown
Contributor

What

guest_filesystem aborts on Windows machines without administrator rights or Developer Mode:

Filesystem check failed at line 276 (guest errno 14)

The Windows lstat link checks (7f2a882 / 314c372, @MarcZX100) create symbolic links with CreateSymbolicLinkW(..., SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE). Without the symlink privilege, that flag isn't honoured, and the call fails with ERROR_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 running ctest locally 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 the else branch.

Tested

Windows 11 (no Developer Mode, not elevated), WinLibs GCC 15.2.0 r7, Release, on main 59a8cba:

  • On main, guest_filesystem fails at line 276.
  • With this change it passes 3/3 (--repeat until-fail:3). The rest of the test still runs; only the link block is skipped.
  • check_conventions.py and pr_overlap.py --branch pass.

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

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

🤖 Generated with Claude Code

…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 Dextroid17 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@reyani-dev

reyani-dev commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor Author

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' Check helpers. The fork CI run on the privileged Windows runner will be posted here when it finishes.

@Zurisen

Zurisen commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

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 CreateSymbolicLinkW(..., SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE) here returns false with ERROR_PRIVILEGE_NOT_HELD (1314) and creates no link.

  • main f1ae427b: guest_filesystem fails 3/3 with Filesystem check failed at line 276 (guest errno 14).
  • main + c332bdb3 (merges cleanly): guest_filesystem passes 3/3 and prints Windows lstat link checks skipped: creating symbolic links needs Developer Mode or administrator rights.

I can't cover the privileged path on this machine; the fork CI run you mentioned covers that.

@reyani-dev

Copy link
Copy Markdown
Contributor Author

Fork CI for this head (run 38096782280), merged onto current main:

  • Windows: 756/756, including guest_filesystem. The runner has the symlink privilege, so the Windows lstat link checks ran in full there, which covers the privileged path.
  • Linux: agc_unit_shadow, agc_driver_flat_apertures (timeout) and agc_driver_image_packed16_load fail, and the same three fail on a rerun. They fail identically in main's own push build (run 38098335801), and this PR changes only the Windows branch of GuestFilesystem.cpp, so they're unrelated. Everything else passes.
  • Relinker jobs: green.

@oneandonlydean
oneandonlydean merged commit 7edd75e into boykopovar:main Oct 11, 2026
14 checks passed
@babyhuey babyhuey mentioned this pull request Oct 11, 2026
9 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants