fix(libkernel): report getdirentries basep position #5253

Closed
MarcZX10 wants to merge 2 commits from upstream-pr/5253 into main
MarcZX10 commented 2026-10-13 15:40:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T15:40:49Z.


What

Carry Hussein Kadhim's getdirentries basep fix onto current main, preserving his commit author. Windows now reports the directory entry index at the start of a successful read and leaves basep unchanged on failure. The Linux path likewise writes basep only after a successful read. Add a Linux regression assertion that a too-small-buffer error leaves the caller's basep untouched.

Closes #5237.

Tested

  • Linux: built guest_directory_entry_tests; guest_directory_entries passed (1/1).
  • Linux: guest_directory and guest_fdopendir passed (2/2).
  • The new Linux failure-path assertion fails against unchanged main and passes with this change.
  • Linux: python3 tools/check_conventions.py --base upstream/main passed.
  • The dedicated successful-offset regression target is Windows-only. Hussein's issue report records Windows builds and passing guest_directory_buffer, guest_directory and guest_fdopendir checks. I could not rerun the Windows target here: MinGW configuration stops because libgcc_s_seh-1.dll is unavailable.

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: #4999 (merge order for the shared libkernel.md debt entry; the runtime fix is independent)
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4845718555 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5253). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T15:40:49Z. --- ### What Carry Hussein Kadhim's `getdirentries` `basep` fix onto current `main`, preserving his commit author. Windows now reports the directory entry index at the start of a successful read and leaves `basep` unchanged on failure. The Linux path likewise writes `basep` only after a successful read. Add a Linux regression assertion that a too-small-buffer error leaves the caller's `basep` untouched. Closes #5237. ### Tested - Linux: built `guest_directory_entry_tests`; `guest_directory_entries` passed (1/1). - Linux: `guest_directory` and `guest_fdopendir` passed (2/2). - The new Linux failure-path assertion fails against unchanged `main` and passes with this change. - Linux: `python3 tools/check_conventions.py --base upstream/main` passed. - The dedicated successful-offset regression target is Windows-only. Hussein's issue report records Windows builds and passing `guest_directory_buffer`, `guest_directory` and `guest_fdopendir` checks. I could not rerun the Windows target here: MinGW configuration stops because `libgcc_s_seh-1.dll` is unavailable. ### 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 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: #4999 (merge order for the shared `libkernel.md` debt entry; the runtime fix is independent) - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-13 15:50:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T15:50:21Z.


Commit history is now split by authorship: Hussein Kadhim’s original getdirentries fix remains its own commit, and my added Linux failure-path regression is a separate MarcZX100-authored test commit. Linux validation recorded in the PR remains unchanged; the latest conventions check is running.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6149503107 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5253#issuecomment-6149503107). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T15:50:21Z. --- Commit history is now split by authorship: Hussein Kadhim’s original `getdirentries` fix remains its own commit, and my added Linux failure-path regression is a separate MarcZX100-authored test commit. Linux validation recorded in the PR remains unchanged; the latest conventions check is running.
simonbronk commented 2026-10-13 21:36:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-13T21:36:48Z.


On Windows this no longer builds once merged onto current main (cf5f5b53b), although Git merges it without conflicts (Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7; AI-assisted: Claude Code):

core/libs/tests/GuestDirectoryBuffer.cpp:109:13: error: 'getdirentries_nid_postfix' was not declared in this scope

d31e28308 (fix(libkernel): throw for unsupported directory entry names) removed the then-unused getdents_nid_postfix, getdirentries_nid_postfix and __error_nid_postfix declarations from GuestDirectoryBuffer.cpp, and CheckBase here still calls getdirentries_nid_postfix. The test is registered only on Windows, so a Linux build does not compile it. A rebase that restores int APS5_VABI getdirentries_nid_postfix(int, char*, int, std::int64_t*); in the extern "C" block fixes it.

With that line restored, and #4999 also applied: guest_directory_buffer passes 20/20 and the full ctest passes. With this PR and #4999, guest_directory_entries (Linux-only today) also passes on Windows.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6155717970 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5253#issuecomment-6155717970). Originally posted by [simonbronk](https://github.com/simonbronk) on 2026-10-13T21:36:48Z. --- On Windows this no longer builds once merged onto current `main` (`cf5f5b53b`), although Git merges it without conflicts (Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7; AI-assisted: Claude Code): ``` core/libs/tests/GuestDirectoryBuffer.cpp:109:13: error: 'getdirentries_nid_postfix' was not declared in this scope ``` `d31e28308` (fix(libkernel): throw for unsupported directory entry names) removed the then-unused `getdents_nid_postfix`, `getdirentries_nid_postfix` and `__error_nid_postfix` declarations from `GuestDirectoryBuffer.cpp`, and `CheckBase` here still calls `getdirentries_nid_postfix`. The test is registered only on Windows, so a Linux build does not compile it. A rebase that restores `int APS5_VABI getdirentries_nid_postfix(int, char*, int, std::int64_t*);` in the `extern "C"` block fixes it. With that line restored, and #4999 also applied: `guest_directory_buffer` passes 20/20 and the full `ctest` passes. With this PR and #4999, `guest_directory_entries` (Linux-only today) also passes on Windows.
oneandonlydean commented 2026-10-14 02:30:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T02:30: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:6159563085 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5253#issuecomment-6159563085). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T02:30: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!5253
No description provided.