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

Merged
reyani-dev merged 1 commit from upstream-pr/3169 into main 2026-10-11 05:55:04 +00:00
reyani-dev commented 2026-10-10 23:57:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-10T23:57:21Z.


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 (7f2a8826 / 314c3722, @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 59a8cbab:

  • 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

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4815317899 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3169). Originally posted by [reyani-dev](https://github.com/reyani-dev) on 2026-10-10T23:57:21Z. --- ### 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 (7f2a8826 / 314c3722, @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` 59a8cbab: - 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 - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Dextroid17 commented 2026-10-11 00:09:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-11T00:09:07Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5481281737 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3169#pullrequestreview-5481281737). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-11T00:09:07Z. **Review:** COMMENTED --- 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 commented 2026-10-11 00:17:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-11T00:17:49Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6103676385 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3169#issuecomment-6103676385). Originally posted by [reyani-dev](https://github.com/reyani-dev) on 2026-10-11T00:17:49Z. --- 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 commented 2026-10-11 00:24:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Zurisen on 2026-10-11T00:24:54Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6103730929 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3169#issuecomment-6103730929). Originally posted by [Zurisen](https://github.com/Zurisen) on 2026-10-11T00:24:54Z. --- 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 commented 2026-10-11 00:38:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-11T00:38:25Z.


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.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6103832732 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3169#issuecomment-6103832732). Originally posted by [reyani-dev](https://github.com/reyani-dev) on 2026-10-11T00:38:25Z. --- Fork CI for this head ([run 38096782280](https://github.com/AchrafReyani/AnyPS5/actions/runs/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](https://github.com/boykopovar/AnyPS5/actions/runs/38098335801)), and this PR changes only the Windows branch of `GuestFilesystem.cpp`, so they're unrelated. Everything else passes. - Relinker jobs: green.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!3169
No description provided.