fix(libkernel): report symlink types in Windows getdents #4936

Closed
MarcZX10 wants to merge 1 commit from upstream-pr/4936 into main
MarcZX10 commented 2026-10-13 05:32:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T05:32:23Z.


What

The Windows directory descriptor backend classified each entry by following it with directory_entry::is_directory(). As a result, a symlink to a directory was reported as DT_DIR, and a symlink to a file was reported as DT_REG. Linux getdents reports the directory entry itself as DT_LNK; libc readdir in this project already uses symlink_status for that distinction.

Classify Windows sceKernelGetdents entries using symlink_status, preserving symlinks as guest type 10. Extend the shared directory-entry regression to include both a file symlink and a directory symlink.

Tested

  • Debian 12 / GCC 12.2 / Release / Ninja: guest_directory_entry_tests built.
  • ctest --test-dir build-getdents -R '^guest_directory_entries$' --output-on-failure: passed (1/1).
  • MinGW-w64 GCC 12 -Wall -Wextra -Werror compile of the Windows DirectoryDescriptor.cpp path: passed.
  • python3 tools/check_conventions.py --base upstream/main --head HEAD: passed.
  • python3 tools/check_test_registration.py build-getdents: 762 test executables, 0 built and unrun.
  • git diff --check upstream/main...HEAD: passed.
  • Windows runtime execution was not available in this Linux session; the regression assertions are included for Windows runs.

Checklist

  • Based on current main; no other open PR implements the same behavior
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no silent stubs added
  • No investigation notes or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behavior, not specific to one title
  • Depends on: none
  • Unblocks: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4838836132 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4936). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T05:32:23Z. --- ### What The Windows directory descriptor backend classified each entry by following it with `directory_entry::is_directory()`. As a result, a symlink to a directory was reported as `DT_DIR`, and a symlink to a file was reported as `DT_REG`. Linux `getdents` reports the directory entry itself as `DT_LNK`; libc `readdir` in this project already uses `symlink_status` for that distinction. Classify Windows `sceKernelGetdents` entries using `symlink_status`, preserving symlinks as guest type 10. Extend the shared directory-entry regression to include both a file symlink and a directory symlink. ### Tested - Debian 12 / GCC 12.2 / Release / Ninja: `guest_directory_entry_tests` built. - `ctest --test-dir build-getdents -R '^guest_directory_entries$' --output-on-failure`: passed (1/1). - MinGW-w64 GCC 12 `-Wall -Wextra -Werror` compile of the Windows `DirectoryDescriptor.cpp` path: passed. - `python3 tools/check_conventions.py --base upstream/main --head HEAD`: passed. - `python3 tools/check_test_registration.py build-getdents`: 762 test executables, 0 built and unrun. - `git diff --check upstream/main...HEAD`: passed. - Windows runtime execution was not available in this Linux session; the regression assertions are included for Windows runs. ### Checklist - [x] Based on current `main`; no other open PR implements the same behavior - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; no silent stubs added - [x] No investigation notes or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behavior, not specific to one title - [x] Depends on: none - [x] Unblocks: none - [x] AI-assisted: yes
xXPBSXx commented 2026-10-13 08:20:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T08:20:42Z.


Windows build check of this PR.

Environment: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, BUILD_TESTING=ON, -j2, libusb-cmake from a local checkout. Built from main c2565f014 with this PR and ten other open PRs (#4972, #4967, #4966, #4945, #4938, #4936, #4933, #4898, #4896, #4888) merged together; the merges had no conflict.

Result: the merged tree builds, but no test of this PR runs on Windows: its test (guest_directory_entry) is registered only for non-Windows builds (if(NOT WIN32)), although the change is for Windows getdents.

Not checked: any behaviour of the change on Windows; no title run.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6141386574 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4936#issuecomment-6141386574). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-13T08:20:42Z. --- Windows build check of this PR. Environment: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, `BUILD_TESTING=ON`, `-j2`, `libusb-cmake` from a local checkout. Built from `main` `c2565f014` with this PR and ten other open PRs (#4972, #4967, #4966, #4945, #4938, #4936, #4933, #4898, #4896, #4888) merged together; the merges had no conflict. Result: the merged tree builds, but no test of this PR runs on Windows: its test (`guest_directory_entry`) is registered only for non-Windows builds (`if(NOT WIN32)`), although the change is for Windows `getdents`. Not checked: any behaviour of the change on Windows; no title run. AI-assisted (Claude Code).
oneandonlydean commented 2026-10-14 02:35:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T02:35:49Z.


Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6159621357 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4936#issuecomment-6159621357). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T02:35:49Z. --- Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.

Pull request closed

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!4936
No description provided.