fix(libkernel): accept trailing slashes in sceKernelMkdir #2819

Merged
MarcZX10 merged 4 commits from upstream-pr/2819 into main 2026-10-10 22:52:01 +00:00
MarcZX10 commented 2026-10-10 16:07:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T16:07:13Z.


What

Fixes #2743. sceKernelMkdir now accepts trailing slashes by resolving the path to its final component before checking and creating the directory. It returns the expected guest errors for an empty path, an existing directory, and a non-directory parent. Regression coverage includes guest root, empty paths, trailing separators, and the non-directory parent case.

Tested

  • Linux x86_64, Debian GCC 12.2, Release on current main: rebuilt libkernel.prx and guest_kernel_sync_tests; guest_kernel_sync passed (1/1).
  • tools/check_conventions.py --base upstream/main and git diff --check passed.
  • Achraf reported Windows 11/WinLibs GCC 15.2 validation of the same fix and follow-up cases on an earlier main base (guest_kernel_sync 3/3 and 380 additional tests passed); that report is in the issue comments and was not rerun on this rebased head.
  • Current-head Windows and macOS builds were not run locally.

Checklist

  • Based on current main; no open PR implements the same fix
  • One topic
  • No comments added to code
  • No investigation files added
  • No third-party code added
  • Generic behavior
  • Depends on: none
  • AI-assisted: yes (Codex assisted review and PR preparation; original fix authored by Achraf Reyani, with follow-up commits by MarcZX100)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4812588550 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2819). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-10T16:07:13Z. --- ### What Fixes #2743. `sceKernelMkdir` now accepts trailing slashes by resolving the path to its final component before checking and creating the directory. It returns the expected guest errors for an empty path, an existing directory, and a non-directory parent. Regression coverage includes guest root, empty paths, trailing separators, and the non-directory parent case. ### Tested - Linux x86_64, Debian GCC 12.2, Release on current `main`: rebuilt `libkernel.prx` and `guest_kernel_sync_tests`; `guest_kernel_sync` passed (1/1). - `tools/check_conventions.py --base upstream/main` and `git diff --check` passed. - Achraf reported Windows 11/WinLibs GCC 15.2 validation of the same fix and follow-up cases on an earlier `main` base (`guest_kernel_sync` 3/3 and 380 additional tests passed); that report is in the issue comments and was not rerun on this rebased head. - Current-head Windows and macOS builds were not run locally. ### Checklist - [x] Based on current `main`; no open PR implements the same fix - [x] One topic - [x] No comments added to code - [x] No investigation files added - [x] No third-party code added - [x] Generic behavior - [x] Depends on: none - [x] AI-assisted: yes (Codex assisted review and PR preparation; original fix authored by Achraf Reyani, with follow-up commits by MarcZX100)
MarcZX10 commented 2026-10-10 16:30:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T16:30:03Z.


The reported macOS Intel timeout comes from the unrelated write_watch_threads stress test, which polls continuously while four threads write to protected pages. I opened #2846 as a separate test reliability follow-up: it keeps the four writers and concurrency assertions, yields between collection polls, and lowers the stress loop from 200 to 50 rounds to stay within the documented 30-second test limit. Its macOS CI is running now.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6099706931 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2819#issuecomment-6099706931). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-10T16:30:03Z. --- The reported macOS Intel timeout comes from the unrelated `write_watch_threads` stress test, which polls continuously while four threads write to protected pages. I opened [#2846](https://github.com/boykopovar/AnyPS5/pull/2846) as a separate test reliability follow-up: it keeps the four writers and concurrency assertions, yields between collection polls, and lowers the stress loop from 200 to 50 rounds to stay within the documented 30-second test limit. Its macOS CI is running now.
MarcZX10 commented 2026-10-10 16:33:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T16:33:08Z.


Validation update: #2846 now passes the macOS Intel write_watch CI job, including write_watch_threads; the macOS arm64 job, all register-context jobs, all three relinker jobs, conventions, intake, and eligibility also pass. The Linux and Windows full builds were skipped by the repository workflow policy. PR #2819 remains separate and its earlier failed run cannot be rerun, but the test adjustment has now passed on the same macOS Intel runner that timed out.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6099737479 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2819#issuecomment-6099737479). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-10T16:33:08Z. --- Validation update: [#2846](https://github.com/boykopovar/AnyPS5/pull/2846) now passes the macOS Intel `write_watch` CI job, including `write_watch_threads`; the macOS arm64 job, all register-context jobs, all three relinker jobs, conventions, intake, and eligibility also pass. The Linux and Windows full builds were skipped by the repository workflow policy. PR #2819 remains separate and its earlier failed run cannot be rerun, but the test adjustment has now passed on the same macOS Intel runner that timed out.
screamm commented 2026-10-10 20:00:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-10T20:00:30Z.


Windows validation of the current head 046680da merged onto main 43e1425b.

Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including the libs target.

  • guest_kernel_sync passes 3/3 (--repeat until-fail:3).
  • ctest -E "^agc_|video_out" passes 383/383.
  • With main's Stdio.cpp and this PR's test, guest_kernel_sync fails at line 40 (the empty-path check), so the new coverage does detect the previous behaviour.

Validation run with Claude Code assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6101616339 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2819#issuecomment-6101616339). Originally posted by [screamm](https://github.com/screamm) on 2026-10-10T20:00:30Z. --- Windows validation of the current head `046680da` merged onto `main` `43e1425b`. Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, full build including the `libs` target. - `guest_kernel_sync` passes 3/3 (`--repeat until-fail:3`). - `ctest -E "^agc_|video_out"` passes 383/383. - With `main`'s `Stdio.cpp` and this PR's test, `guest_kernel_sync` fails at line 40 (the empty-path check), so the new coverage does detect the previous behaviour. Validation run with Claude Code assistance.
adriadam10 commented 2026-10-10 22:51:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T22:51:58Z.


Checked on Linux (build + guest_kernel_sync): passes, and fails with Stdio.cpp reverted, so the new cases pin the fix. Trailing slashes, empty path (ENOENT), existing dir (EEXIST) and non-directory parent (ENOTDIR) match FreeBSD mkdir. Windows run by @screamm on the current head also green. The red macOS Intel write_watch_threads job is unrelated (#2846) and was re-run. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6103039600 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2819#issuecomment-6103039600). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T22:51:58Z. --- Checked on Linux (build + `guest_kernel_sync`): passes, and fails with `Stdio.cpp` reverted, so the new cases pin the fix. Trailing slashes, empty path (ENOENT), existing dir (EEXIST) and non-directory parent (ENOTDIR) match FreeBSD `mkdir`. Windows run by @screamm on the current head also green. The red macOS Intel `write_watch_threads` job is unrelated (#2846) and was re-run. Merging.
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!2819
No description provided.