fix(libkernel): fail reads on Windows directory descriptors #4917

Merged
MarcZX10 merged 1 commit from upstream-pr/4917 into main 2026-10-14 01:25:44 +00:00
MarcZX10 commented 2026-10-13 04:04:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T04:04:28Z.


What

Fixes #4912. Carries David's d7ef271ef commit, preserving his original commit authorship. On Windows, reads from the directory descriptors AnyPS5 models with NUL now match the Linux/FreeBSD error behavior: read, readv, pread and preadv return EISDIR; pwrite returns EBADF. Regular file and pipe paths are unchanged.

The focused regression checks also confirm that getdents still works after the failed reads.

Tested

Linux, GCC 12.2, Release, BUILD_TESTING=ON:

  • guest_filesystem: passed (1/1).
  • tools/check_conventions.py --base upstream/main: passed.
  • git diff --check upstream/main...HEAD: passed.

Windows runtime validation is reported in issue #4912; I did not run that validation locally. No title run or full build was performed for this carry.

  • The initial hosted conventions run reported an incomplete template field; the current title and body pass the local template check.

Checklist

  • Based on current main; no open PR implements this change
  • 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 notes or investigation files added to the repository
  • No new third-party code
  • Generic behavior, not title-specific
  • Depends on: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4838198640 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4917). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T04:04:28Z. --- ### What Fixes #4912. Carries David's `d7ef271ef` commit, preserving his original commit authorship. On Windows, reads from the directory descriptors AnyPS5 models with `NUL` now match the Linux/FreeBSD error behavior: `read`, `readv`, `pread` and `preadv` return `EISDIR`; `pwrite` returns `EBADF`. Regular file and pipe paths are unchanged. The focused regression checks also confirm that `getdents` still works after the failed reads. ### Tested Linux, GCC 12.2, Release, `BUILD_TESTING=ON`: - `guest_filesystem`: passed (1/1). - `tools/check_conventions.py --base upstream/main`: passed. - `git diff --check upstream/main...HEAD`: passed. Windows runtime validation is reported in issue #4912; I did not run that validation locally. No title run or full build was performed for this carry. - The initial hosted conventions run reported an incomplete template field; the current title and body pass the local template check. ### Checklist - [x] Based on current `main`; no open PR implements this change - [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 notes or investigation files added to the repository - [x] No new third-party code - [x] Generic behavior, not title-specific - [x] Depends on: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
xXPBSXx commented 2026-10-13 06:15:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T06:15:39Z.


Windows test: head 2f1eb100a merged onto current main 2cc97e105 (clean merge, no conflicts). Windows 10, MinGW GCC (WinLibs), Ninja Release, -j2: full build 0 errors; ctest with the filter guest_filesystem: guest_filesystem passed (1 test(s), 0 failed); python tools/check_conventions.py --base upstream/main passed. I did not run the new tests against main without the change.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6139508358 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4917#issuecomment-6139508358). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-13T06:15:39Z. --- Windows test: head `2f1eb100a` merged onto current `main` `2cc97e105` (clean merge, no conflicts). Windows 10, MinGW GCC (WinLibs), Ninja Release, `-j2`: full build 0 errors; ctest with the filter `guest_filesystem`: guest_filesystem passed (1 test(s), 0 failed); `python tools/check_conventions.py --base upstream/main` passed. I did not run the new tests against `main` without the change. AI-assisted (Claude Code).
xXPBSXx commented 2026-10-13 12:00:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T12:00:17Z.


Windows counter-test (follow-up to the earlier Windows run): Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, this PR merged onto main 2a2a3dc65. guest_filesystem passes with the PR; with the PR's source files replaced by main's, same test, it aborts at line 686 (guest errno 13). The "without" run also prints that the Windows lstat link checks were skipped on this host (creating symbolic links needs Developer Mode or administrator rights), so the symlink-dependent checks did not run in either case.

Not tested: Linux, a console, a title run.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6145052327 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4917#issuecomment-6145052327). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-13T12:00:17Z. --- Windows counter-test (follow-up to the earlier Windows run): Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, this PR merged onto `main` `2a2a3dc65`. `guest_filesystem` passes with the PR; with the PR's source files replaced by `main`'s, same test, it aborts at line 686 (guest errno 13). The "without" run also prints that the Windows lstat link checks were skipped on this host (creating symbolic links needs Developer Mode or administrator rights), so the symlink-dependent checks did not run in either case. Not tested: Linux, a console, a title run. AI-assisted (Claude Code).
xXPBSXx commented 2026-10-14 00:55:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-14T00:55:29Z.


Windows 10 (19045), MinGW-w64 GCC 15.2.0, Release, -j4: head 2f1eb100a of this PR merged onto main 0dea07ab2 (clean merge, 3 files; the description reports Linux only).

  • guest_filesystem passes (0.30 s, ctest).
  • With Open.cpp and Stdio.cpp (core/libs/prx/libkernel/File/src/) taken back to main and the PR's new test lines kept, guest_filesystem fails (Filesystem check failed at line 725 (guest errno 13, Win32 error 0), exit code 0xc0000409).
  • Not run: Linux, a console, a title.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6158442365 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4917#issuecomment-6158442365). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-14T00:55:29Z. --- Windows 10 (19045), MinGW-w64 GCC 15.2.0, Release, `-j4`: head `2f1eb100a` of this PR merged onto `main` `0dea07ab2` (clean merge, 3 files; the description reports Linux only). - `guest_filesystem` passes (0.30 s, ctest). - With `Open.cpp` and `Stdio.cpp` (`core/libs/prx/libkernel/File/src/`) taken back to `main` and the PR's new test lines kept, `guest_filesystem` fails (`Filesystem check failed at line 725 (guest errno 13, Win32 error 0)`, exit code `0xc0000409`). - Not run: Linux, a console, a title. AI-assisted (Claude Code).
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!4917
No description provided.