fix(libc): map a Windows symbolic link loop to ELOOP when opening #8640

Merged
Dom3005 merged 1 commit from upstream-pr/8640 into main 2026-10-21 00:13:02 +00:00
Dom3005 commented 2026-10-20 19:41:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dom3005 on 2026-10-20T19:41:56Z.


What

On Windows, CreateFileW fails a symbolic link that resolves to itself with ERROR_CANT_RESOLVE_FILENAME (1921). WindowsOpenError_nid_no_patch had no case for it and returned EINVAL, so sceKernelOpen returned 0x80020016 and open and fopen set errno 22 where FreeBSD reports ELOOP (62). This adds the mapping. sceKernelStat already reports ELOOP for the same link (#6992, #8149).

This is the sceKernelOpen("loop") row of #6983. The loop/inside and 300-character name rows are not changed.

Tested

Windows 11 10.0.26200 (NTFS, Developer Mode on), WinLibs GCC 15.2.0 r7 UCRT, Release, BUILD_TESTING=ON.

  • guest_filesystem: new checks for sceKernelOpen, open and fopen on the existing stat-loop link. Without the fix it fails at the sceKernelOpen check (guest errno 22, Win32 error 1921); with the fix it passes.
  • ctest -R 'file|path|stream|open|stat|dir|fopen|libc|errno|symlink|link': 124/124 passed.
  • python tools/check_conventions.py: passed.

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 under Silent stubs in their library's technical debt file
  • 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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4941438111 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8640). Originally posted by [Dom3005](https://github.com/Dom3005) on 2026-10-20T19:41:56Z. --- ### What On Windows, `CreateFileW` fails a symbolic link that resolves to itself with `ERROR_CANT_RESOLVE_FILENAME` (1921). `WindowsOpenError_nid_no_patch` had no case for it and returned `EINVAL`, so `sceKernelOpen` returned `0x80020016` and `open` and `fopen` set errno 22 where FreeBSD reports `ELOOP` (62). This adds the mapping. `sceKernelStat` already reports `ELOOP` for the same link (#6992, #8149). This is the `sceKernelOpen("loop")` row of #6983. The `loop/inside` and 300-character name rows are not changed. ### Tested Windows 11 10.0.26200 (NTFS, Developer Mode on), WinLibs GCC 15.2.0 r7 UCRT, Release, `BUILD_TESTING=ON`. - `guest_filesystem`: new checks for `sceKernelOpen`, `open` and `fopen` on the existing `stat-loop` link. Without the fix it fails at the `sceKernelOpen` check (`guest errno 22, Win32 error 1921`); with the fix it passes. - `ctest -R 'file|path|stream|open|stat|dir|fopen|libc|errno|symlink|link'`: 124/124 passed. - `python tools/check_conventions.py`: passed. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-20 20:15:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T20:15:49Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 core/libs/prx/libc/src/General.cpp
PR 6044 core/libs/tests/GuestFilesystem.cpp
PR 6226 core/libs/prx/libc/src/General.cpp
PR 6879 core/libs/prx/libc/src/General.cpp
PR 7201 core/libs/prx/libc/src/General.cpp
PR 7530 core/libs/tests/GuestFilesystem.cpp
PR 8550 core/libs/tests/GuestFilesystem.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6300524143 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8640#issuecomment-6300524143). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T20:15:49Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libc/src/General.cpp` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestFilesystem.cpp` | | [PR 6226](https://www.github.com/boykopovar/AnyPS5/pull/6226) | `core/libs/prx/libc/src/General.cpp` | | [PR 6879](https://www.github.com/boykopovar/AnyPS5/pull/6879) | `core/libs/prx/libc/src/General.cpp` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libc/src/General.cpp` | | [PR 7530](https://www.github.com/boykopovar/AnyPS5/pull/7530) | `core/libs/tests/GuestFilesystem.cpp` | | [PR 8550](https://www.github.com/boykopovar/AnyPS5/pull/8550) | `core/libs/tests/GuestFilesystem.cpp` |
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!8640
No description provided.