Skip to content

fix(libkernel): share guest rename semantics with sceKernelRename - #6484

Merged
adriadam10 merged 3 commits into
boykopovar:mainfrom
Ondra97:codex/team-20261015-worker-2
Oct 19, 2026
Merged

adriadam10 merged 3 commits into
boykopovar:mainfrom
Ondra97:codex/team-20261015-worker-2

Conversation

@Ondra97

@Ondra97 Ondra97 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What

On Windows, sceKernelRename rejects replacement of an empty directory and collapses distinct filesystem failures to EIO. I route it through the existing guest rename helper and translate its guest errno to the kernel error result. The rebase preserves current main's EFAULT result for null source or destination paths, including all three null combinations covered by guest_posix_scalar_io.

The shared Windows helper replaces an empty directory using the existing atomic FileRenameInfoEx operation, opening directory handles with FILE_FLAG_BACKUP_SEMANTICS. It no longer deletes the destination before attempting the rename. A failed operation preserves both source and destination. The regression covers libc and kernel routes, moved contents and specific kernel errors.

The eligibility test retains startup, input-read and completion markers and reports captured output on timeout. It preserves main's existing 90-second subprocess limit; the cause of the earlier unreproduced CI stall remains unknown.

All three existing commits and their authorship are preserved. The inherited #6452 fixture is already in main. The agreed order is #6484 before #6583; #6583 declares Depends on: #6484 and will adapt the failure diagnostics to its persistent harness.

Tested

Exact head: 8e1f06b51134e52d64837c450b1a7eecf9deb98d. Base: 66702f1cffd3646f2d674ed093fde0a85a70761f.

Windows (native host): Windows 11 Pro 10.0.26300, AMD Ryzen 9 7900X, 32 GB RAM, NVIDIA GeForce RTX 4070 Ti SUPER. WinLibs MinGW-w64 GCC 15.2.0 r7, CMake 4.3.1, Ninja 1.13.2, Release, bundled dependencies, BUILD_TESTING=ON, Python 3.14.7, Node 24.20.0. Graphics: not exercised.

  • Full default application and patched-library build passed: cmake --build build-team-worker-2-runtime --parallel 2.
  • 20/20 selected CTests passed, zero CTest skips, with --parallel 2 --timeout 30. The symbolic-link subcases inside guest_kernel_sys reported unavailable and remain untested on Windows.
  • Registration audit passed: 942 test executables, none unregistered.

Linux (VirtualBox): Ubuntu 24.04.5 LTS, kernel 7.0.0-38-generic, GCC 13.3.0, CMake 3.28.3, Ninja 1.11.1, Release, bundled dependencies, BUILD_TESTING=ON, Python 3.12.3. VirtualBox 7.2.20 r175154 on the Windows host above, 4 vCPU, 8 GiB RAM, native ext4. Graphics: not exercised. Node 24.20.0 is an official portable runtime added only to the test subprocess PATH.

  • Full default build passed, including graphics component compilation: cmake --build build --parallel 2.
  • 17/17 corresponding CTests passed, zero skips, with --parallel 1. The three directory-buffer/rewind/close tests are registered only on Windows.
  • All 16052 source files/symlinks and 18 recursive submodules matched the exact final-head manifest before building and after testing.
  • JUnit output on both platforms confirms that all seven Python eligibility cases actually ran, without internal unittest skips.

The Windows selection is patched_libraries, guest_kernel_sys, file_position, guest_working_directory, guest_realpath, guest_path_case, guest_directory, file_streams, guest_posix_filesystem, guest_file_timestamps, guest_filesystem, guest_kernel_rename, guest_dup, guest_directory_buffer, guest_directory_rewind, guest_directory_close, guest_kernel_fcntl, build_eligibility, guest_pthread_cancel, guest_posix_scalar_io. Linux uses the same filter except the three Windows-only tests. The scalar-I/O test verifies the EFAULT behavior retained during this rebase.

Conventions, whitespace and main-sync checks pass. Before execution, static review covered the complete five-file PR diff and all 159 files in the upstream delta 673f7406c5ceedffc48bd2054d02c48096bb258a..66702f1cffd3646f2d674ed093fde0a85a70761f, including build/test code and new files.

Earlier before/after API control, retained from the preceding revision: Linux (VirtualBox), Ubuntu 24.04.5 LTS, kernel 7.0.0-31-generic. An independent probe loads the real unpatched libkernel.prx and checks ownership of sceKernelRename with dladdr. The before variant rebuilt the three rename-related implementation files from bf2053816976bb9c821e37df58ef64a7362b81c7; the after variant used fix 6bf2ce4714bed96acfc31354cb255561d83b97ae on base 673f7406c5ceedffc48bd2054d02c48096bb258a. One invocation per variant, four filesystem cases, the same environment and fixtures, with paths and marker contents checked. This historical probe was not repeated for the current rebase; the current CTests above cover the integrated behavior.

Metric Before (base rename sources) After (preceding fix)
Missing parent kernel error 0x80020005 (EIO) 0x80020002 (ENOENT)
File over directory kernel error 0x80020005 (EIO) 0x80020015 (EISDIR)
Nonempty directory kernel error 0x80020005 (EIO) 0x80020042 (ENOTEMPTY)
Successful empty-directory replacement 0 0

The earlier base probe matched 1/4 expected results; the fixed probe matched 4/4, with expected data preserved. The base regression process aborted without an assertion diagnostic; the table uses the separate ownership-checked API probe and does not assign that abort to a particular assertion.

Linux graphics/Vulkan tests: NOT RUN — intentionally excluded from VirtualBox validation. Native/bare-metal Linux was not tested. Native Linux GPU validation: not tested. No full CTest suite, console or retail-title run is claimed. Full hosted Windows/Linux builds require collaborator dispatch under CONTRIBUTING.md; the full builds above are local.

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 (Codex). I am responsible for the change.

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 6942 core/libs/prx/libkernel/File/src/Stdio.cpp L1326-1343

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/Rename.cpp
core/libs/prx/libkernel/File/src/Stdio.cpp
PR 6044 core/libs/tests/GuestFilesystem.cpp
PR 6879 core/libs/prx/libkernel/File/src/Stdio.cpp
PR 6897 core/libs/tests/GuestFilesystem.cpp
PR 6936 core/libs/prx/libkernel/File/src/Stdio.cpp
PR 6977 core/libs/prx/libkernel/File/src/Stdio.cpp
PR 7121 core/libs/prx/libkernel/File/src/Stdio.cpp
PR 7201 core/libs/prx/libc/src/Rename.cpp
core/libs/prx/libkernel/File/src/Stdio.cpp
PR 7332 core/libs/prx/libc/src/Rename.cpp
core/libs/prx/libkernel/File/src/Stdio.cpp

@jotitadev jotitadev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linux run at the updated head, since the description says Linux was not rerun there.

Ubuntu 26.04, i7-8700, gcc 15.2, Release, BUILD_TESTING=ON, full build. Head 1719a0f1f applied on main 03c4cb5 (its merge base).

  • Test only (the PR's GuestFilesystem.cpp on main's source): guest_filesystem fails, but not where it fails on Windows. On Linux main already replaces the empty directory, because rename(2) does, so that check passes. The first failure is line 533: renaming to absent/target returns 0x80020005 instead of 0x80020002, because main's sceKernelRename turns every native failure into EIO. So on Linux the new block covers the errno translation, and the directory replacement part only fails on Windows.
  • With the PR: guest_filesystem, guest_kernel_rename and the other rename, directory, realpath, path-case and guest_kernel_sys tests (11) pass 5 times in a row.
  • Non-GPU suite (649 tests, -E "^agc|gpu|vulkan|video_out", -j8): same result as main. Only file_writer_binary and file_writer_text fail, on main too (this host's coreutils rejects the command they run). In one of the two suite runs guest_pthread_start timed out under -j8 load. It passed in the other run and 10 of 10 times on its own.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

@johnmaia

Copy link
Copy Markdown
Contributor

Windows run. Windows 11, WinLibs GCC 15.2.0 r7 (MinGW), Release, BUILD_TESTING=ON, RTX 4080, ctest -j4 --timeout 300. Head 886d647 merged into main 5d9dcc4.

Not tested: a negative control on Windows.

AI-assisted: yes (Claude Code)

@blawesom

Copy link
Copy Markdown
Contributor

Rebase handoff — rebased onto current main (all four commits, authorship unchanged). One conflict, in tools/tests/test_build_eligibility.py: your timeout-reporting wrapper now wraps main's raised 90 s timeout (the PR's 20 s was against the older harness timing).

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV):

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/6484
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is 40b76774d.

@blawesom

Copy link
Copy Markdown
Contributor

Re-anchored rebase handoff — main moved since the earlier handoff; rebased onto current main again (all three commits apply cleanly now, authorship unchanged).

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV):

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/6484
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is a7e6bee73.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 17, 2026
@Ondra97
Ondra97 force-pushed the codex/team-20261015-worker-2 branch from 6bf2ce4 to 8e1f06b Compare October 17, 2026 16:39
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 17, 2026
@adriadam10 adriadam10 self-assigned this Oct 19, 2026
@adriadam10
adriadam10 merged commit 79d7d26 into boykopovar:main Oct 19, 2026
15 checks passed
@Ondra97
Ondra97 deleted the codex/team-20261015-worker-2 branch October 19, 2026 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants