feat(libSceNKWebKit): implement WTF FileSystemImpl hardLinkOrCopyFile #25541

Merged
pinewhite merged 4 commits from upstream-pr/25541 into main 2026-11-23 20:13:25 +00:00
pinewhite commented 2026-11-22 08:06:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pinewhite on 2026-11-22T08:06:56Z.


What

Implement WTF::FileSystemImpl::hardLinkOrCopyFile in libSceNKWebKit so the export no longer reaches NotImplemented_nid_no_patch.

The body follows the pinned FileSystem.cpp:730–742: it first tries the existing guest libkernel_sys link export, and when linking fails it copies the target into the link path. The destination is created exclusively, so an existing link path is never overwritten and the call returns false; a missing target also returns false. The copy keeps the target's permission bits, uses the existing openFile/closeFile and guest read/write, and removes a partially written link path. libSceNKWebKit now links libkernel_sys, which provides link, and tests/WtfFileSystemLinks.cpp covers hard links inside one and across two directories, the cross-device copy fallback (source permissions preserved, different files), the missing-target and existing-link-path failures, an empty file and null paths.

The other link helpers next to it (hardLink, createSymbolicLink, appendFileContentsToFileHandle) stay stubs on purpose: open PR #19823 already implements them, so this PR does not duplicate that work.

Tested

Linux aarch64 (Ubuntu 24.04, GCC 13.3.0), host filesystem, mkdtemp under TMPDIR.

  • Hand-compiled proof harness (g++ -std=c++20 -O1 -ffunction-sections -fdata-sections -Icore/libs -c, linked with -Wl,--gc-sections) of the real src/WtfFileSystem.cpp, src/WtfString.cpp, src/WtfSystem.cpp, src/Bmalloc.cpp and tests/WtfFileSystemLinks.cpp, with only the guest libc/libkernel seam shimmed over host POSIX: stat, lstat, open, close, read, write, link, unlink, fchmod, __error, AddPathAlias and ApplicationHeapRegister. FileStat.st_birthtim is filled the way the tree's Linux stat does.
  • The committed test passes on the new code (exit 0), including the cross-device copy fallback (/dev/shm versus TMPDIR).
  • With the base revision of src/WtfFileSystem.cpp plus the base Export.cpp stub body, the same test stops at the first call: fatal error: _ZN3WTF14FileSystemImpl18hardLinkOrCopyFileERKNS_6StringES3_ not implemented (exit 134).
  • tools/progress.py --module libSceNKWebKit: 3915 -> 3916 done of 11252, identical to --root on the pristine baseline and to main at 8c815346d7.
  • python3 tools/check_conventions.py --base origin/main, python3 tools/debt_fold.py --check and git diff --check pass. The full CMake test target was not built locally: the ICU, QuickJS, Cairo and JSC submodules are not initialised in this checkout.

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 and the licence notice of code adapted from upstream
  • 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
  • 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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5437118557 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25541). Originally posted by [pinewhite](https://github.com/pinewhite) on 2026-11-22T08:06:56Z. --- ### What Implement `WTF::FileSystemImpl::hardLinkOrCopyFile` in libSceNKWebKit so the export no longer reaches `NotImplemented_nid_no_patch`. The body follows the pinned [FileSystem.cpp:730–742](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WTF/wtf/FileSystem.cpp#L730-L742): it first tries the existing guest libkernel_sys `link` export, and when linking fails it copies the target into the link path. The destination is created exclusively, so an existing link path is never overwritten and the call returns false; a missing target also returns false. The copy keeps the target's permission bits, uses the existing `openFile`/`closeFile` and guest `read`/`write`, and removes a partially written link path. `libSceNKWebKit` now links `libkernel_sys`, which provides `link`, and `tests/WtfFileSystemLinks.cpp` covers hard links inside one and across two directories, the cross-device copy fallback (source permissions preserved, different files), the missing-target and existing-link-path failures, an empty file and null paths. The other link helpers next to it (`hardLink`, `createSymbolicLink`, `appendFileContentsToFileHandle`) stay stubs on purpose: open PR #19823 already implements them, so this PR does not duplicate that work. ### Tested Linux aarch64 (Ubuntu 24.04, GCC 13.3.0), host filesystem, `mkdtemp` under `TMPDIR`. - Hand-compiled proof harness (`g++ -std=c++20 -O1 -ffunction-sections -fdata-sections -Icore/libs -c`, linked with `-Wl,--gc-sections`) of the real `src/WtfFileSystem.cpp`, `src/WtfString.cpp`, `src/WtfSystem.cpp`, `src/Bmalloc.cpp` and `tests/WtfFileSystemLinks.cpp`, with only the guest libc/libkernel seam shimmed over host POSIX: `stat`, `lstat`, `open`, `close`, `read`, `write`, `link`, `unlink`, `fchmod`, `__error`, `AddPathAlias` and `ApplicationHeapRegister`. `FileStat.st_birthtim` is filled the way the tree's Linux stat does. - The committed test passes on the new code (`exit 0`), including the cross-device copy fallback (`/dev/shm` versus `TMPDIR`). - With the base revision of `src/WtfFileSystem.cpp` plus the base `Export.cpp` stub body, the same test stops at the first call: `fatal error: _ZN3WTF14FileSystemImpl18hardLinkOrCopyFileERKNS_6StringES3_ not implemented` (exit 134). - `tools/progress.py --module libSceNKWebKit`: 3915 -> 3916 done of 11252, identical to `--root` on the pristine baseline and to `main` at `8c815346d7`. - `python3 tools/check_conventions.py --base origin/main`, `python3 tools/debt_fold.py --check` and `git diff --check` pass. The full CMake test target was not built locally: the ICU, QuickJS, Cairo and JSC submodules are not initialised in this checkout. ### 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 and the licence notice of code adapted from upstream - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical debt file - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
PrivacyOnion commented 2026-11-22 08:16:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-22T08:16:51Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 7b597d6568:

  • Conventions: tools/check_conventions.py passed.
  • Build: nkwebkit_wtffilesystemlinks_tests built cleanly.
  • CTest (nkwebkit_wtffilesystemlinks):
    1/1 Test #4995: nkwebkit_wtffilesystemlinks ......   Passed    0.02 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp, core/libs/prx/libSceNKWebKit/include/WtfExports.hpp, core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified in core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp:189-196 (ZN3WTF14FileSystemImpl18hardLinkOrCopyFileERKNS_6StringES3) that target and link path CString representations are checked for nullptr via Data() prior to calling link_nid_postfix, returning false on null inputs.
    • Verified in core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp:123-138 (CopyFileContents) that source.handle and destination.handle are verified against -1, ensuring missing targets return false without modifying linkPath and existing destination files reject openFile with failIfFileExists=true without truncation.
    • Verified in core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp:100-118 (ReadFromFile, WriteToFile) that EINTR loops correctly retry on GuestEintr (errno 4) and propagate I/O failure to trigger deleteFile cleanup of partially written link files.
    • Verified in core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp:128 that target permissions from Status(targetPath, status, true) are preserved on destination.handle using fchmod_nid_postfix with mode mask 07777.
    • Verified in core/libs/prx/libSceNKWebKit/CMakeLists.txt:23, Export.cpp, and InventoryExports.hpp that libkernel_sys is linked for link_nid_postfix, the unimplemented stub was cleanly replaced, and the gap removal was recorded in docs/dev/debt/changes/wtf-filesystem-hard-link-or-copy.md conforming to AGENTS.md.
    • Verified in core/libs/prx/libSceNKWebKit/tests/WtfFileSystemLinks.cpp that tests validate intra-directory and inter-directory links, cross-device copy fallback across distinct filesystems, empty source files, missing source, pre-existing destination conflict, and null paths.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6011190747 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25541#pullrequestreview-6011190747). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-22T08:16:51Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `7b597d6568`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `nkwebkit_wtffilesystemlinks_tests` built cleanly. - **CTest** (`nkwebkit_wtffilesystemlinks`): ``` 1/1 Test #4995: nkwebkit_wtffilesystemlinks ...... Passed 0.02 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/Export.cpp`, `core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp`, `core/libs/prx/libSceNKWebKit/include/WtfExports.hpp`, `core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified in core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp:189-196 (_ZN3WTF14FileSystemImpl18hardLinkOrCopyFileERKNS_6StringES3_) that target and link path CString representations are checked for nullptr via Data() prior to calling link_nid_postfix, returning false on null inputs. - Verified in core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp:123-138 (CopyFileContents) that source.handle and destination.handle are verified against -1, ensuring missing targets return false without modifying linkPath and existing destination files reject openFile with failIfFileExists=true without truncation. - Verified in core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp:100-118 (ReadFromFile, WriteToFile) that EINTR loops correctly retry on GuestEintr (errno 4) and propagate I/O failure to trigger deleteFile cleanup of partially written link files. - Verified in core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp:128 that target permissions from Status(targetPath, status, true) are preserved on destination.handle using fchmod_nid_postfix with mode mask 07777. - Verified in core/libs/prx/libSceNKWebKit/CMakeLists.txt:23, Export.cpp, and InventoryExports.hpp that libkernel_sys is linked for link_nid_postfix, the unimplemented stub was cleanly replaced, and the gap removal was recorded in docs/dev/debt/changes/wtf-filesystem-hard-link-or-copy.md conforming to AGENTS.md. - Verified in core/libs/prx/libSceNKWebKit/tests/WtfFileSystemLinks.cpp that tests validate intra-directory and inter-directory links, cross-device copy fallback across distinct filesystems, empty source files, missing source, pre-existing destination conflict, and null paths. Looks Good To Me
MarcZX10 commented 2026-11-22 08:21:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T08:21:44Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

Changes are required before merge: make the copy loop fail when a write returns zero bytes for a nonempty buffer, so it cannot spin indefinitely.

What I ran

Reviewed head 7b597d65687e7c2dc3697480b175f6e443edb919. No commands or tests were run during this review; I inspected the prepared diff and targeted source ranges using repo_read.py.

Results

Check Result Note
Diff and targeted source review passed Changed behavior and callers inspected
Full CMake test target not run Author reports required submodules are uninitialized

Findings

Blocking

  • core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp:115: WriteToFile adds bytesWritten to offset without handling a zero-byte write. For a nonempty chunk, a zero return leaves offset unchanged, causing the cross-device fallback to loop forever. Treat zero as failure (and let the existing cleanup path remove the partial destination).

Non-blocking

None.

Not verified

No tests or builds were run in this review. The author-reported host POSIX harness and convention checks were not independently rerun. The full CMake target and physical-console behavior were not verified. Read: core/libs/prx/libSceNKWebKit/CMakeLists.txt, core/libs/prx/libSceNKWebKit/Export.cpp (targeted range), core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp (targeted range), core/libs/prx/libSceNKWebKit/include/WtfExports.hpp, core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp, core/libs/prx/libSceNKWebKit/tests/WtfFileSystemLinks.cpp, core/libs/prx/libc/include/GuestErrno.hpp, core/libs/prx/libc/include/GuestFilesystemPrimitives.hpp, core/libs/prx/libkernel/include/Api.hpp (targeted range), core/libs/prx/libkernel_sys/include/Api.hpp (targeted range), and docs/dev/debt/changes/wtf-filesystem-hard-link-or-copy.md. The manifest lists all six changed files as reviewed; the two files excluded from the review folder due to size, Export.cpp and InventoryExports.hpp, were read through targeted ranges from the pinned head.

To get this to a good state

Handle a zero-byte write as a copy failure, then rerun the relevant test and full CMake target when dependencies are available.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6011205012 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25541#pullrequestreview-6011205012). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T08:21:44Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested Changes are required before merge: make the copy loop fail when a write returns zero bytes for a nonempty buffer, so it cannot spin indefinitely. ## What I ran Reviewed head `7b597d65687e7c2dc3697480b175f6e443edb919`. No commands or tests were run during this review; I inspected the prepared diff and targeted source ranges using `repo_read.py`. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted source review | passed | Changed behavior and callers inspected | | Full CMake test target | not run | Author reports required submodules are uninitialized | ## Findings ### Blocking - `core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp:115`: `WriteToFile` adds `bytesWritten` to `offset` without handling a zero-byte write. For a nonempty chunk, a zero return leaves `offset` unchanged, causing the cross-device fallback to loop forever. Treat zero as failure (and let the existing cleanup path remove the partial destination). ### Non-blocking None. ## Not verified No tests or builds were run in this review. The author-reported host POSIX harness and convention checks were not independently rerun. The full CMake target and physical-console behavior were not verified. Read: `core/libs/prx/libSceNKWebKit/CMakeLists.txt`, `core/libs/prx/libSceNKWebKit/Export.cpp` (targeted range), `core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp` (targeted range), `core/libs/prx/libSceNKWebKit/include/WtfExports.hpp`, `core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp`, `core/libs/prx/libSceNKWebKit/tests/WtfFileSystemLinks.cpp`, `core/libs/prx/libc/include/GuestErrno.hpp`, `core/libs/prx/libc/include/GuestFilesystemPrimitives.hpp`, `core/libs/prx/libkernel/include/Api.hpp` (targeted range), `core/libs/prx/libkernel_sys/include/Api.hpp` (targeted range), and `docs/dev/debt/changes/wtf-filesystem-hard-link-or-copy.md`. The manifest lists all six changed files as reviewed; the two files excluded from the review folder due to size, `Export.cpp` and `InventoryExports.hpp`, were read through targeted ranges from the pinned head. ## To get this to a good state Handle a zero-byte write as a copy failure, then rerun the relevant test and full CMake target when dependencies are available.
PrivacyOnion commented 2026-11-22 08:41:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-22T08:41:42Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 51f8d2ec53:

  • Conventions: tools/check_conventions.py passed.
  • Build: nkwebkit_wtffilesystemlinks_tests built cleanly.
  • CTest (nkwebkit_wtffilesystemlinks):
    1/1 Test #4997: nkwebkit_wtffilesystemlinks ......   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp, core/libs/prx/libSceNKWebKit/include/WtfExports.hpp, core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp:189: Verified that null paths and missing target/link CStrings return false via targetData/linkData null checks without crashing.
    • core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp:115: Verified that WriteToFile handles bytesWritten == 0 by returning false and avoids an infinite spin on stalled writes, propagating failure to deleteFile cleanup.
    • core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp:128: Verified that Status(targetPath, status, true) and fchmod_nid_postfix correctly apply target file permissions (st_mode & 07777) to the copied destination handle.
    • core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp:125: Verified that openFile mode and flags create the destination exclusively without truncating pre-existing files, and RAII FileCloser guarantees handle release.
    • core/libs/prx/libSceNKWebKit/tests/WtfFileSystemLinks.cpp:97: Verified the Windows Win32 HeapFree collision fix (FreeTestHeap) reported by 1tsethan is already present in the test source.
    • docs/dev/debt/changes/wtf-filesystem-hard-link-or-copy.md: Verified debt removal and addition format conforms to AGENTS.md.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6011305260 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25541#pullrequestreview-6011305260). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-22T08:41:42Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `51f8d2ec53`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `nkwebkit_wtffilesystemlinks_tests` built cleanly. - **CTest** (`nkwebkit_wtffilesystemlinks`): ``` 1/1 Test #4997: nkwebkit_wtffilesystemlinks ...... Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/Export.cpp`, `core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp`, `core/libs/prx/libSceNKWebKit/include/WtfExports.hpp`, `core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp:189: Verified that null paths and missing target/link CStrings return false via targetData/linkData null checks without crashing. - core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp:115: Verified that WriteToFile handles bytesWritten == 0 by returning false and avoids an infinite spin on stalled writes, propagating failure to deleteFile cleanup. - core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp:128: Verified that Status(targetPath, status, true) and fchmod_nid_postfix correctly apply target file permissions (st_mode & 07777) to the copied destination handle. - core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp:125: Verified that openFile mode and flags create the destination exclusively without truncating pre-existing files, and RAII FileCloser guarantees handle release. - core/libs/prx/libSceNKWebKit/tests/WtfFileSystemLinks.cpp:97: Verified the Windows Win32 HeapFree collision fix (FreeTestHeap) reported by 1tsethan is already present in the test source. - docs/dev/debt/changes/wtf-filesystem-hard-link-or-copy.md: Verified debt removal and addition format conforms to AGENTS.md. Looks Good To Me
MarcZX10 commented 2026-11-22 09:03:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T09:03:14Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the focused implementation and wiring review found no verified defect.

What I ran

Reviewed head 51f8d2ec53f8ad466a04bde2e80815d0a1bc9a08 using repo_read.py to inspect the prepared diff and targeted source ranges. No build or tests were run; the test results in the PR description are author-reported.

Results

Check Result Note
Diff and targeted source review passed Implementation, callers, test, and build wiring inspected
Build and tests not run Full CMake target was not built per PR description

Findings

Blocking

None.

Non-blocking

None.

Not verified

Export.cpp and include/InventoryExports.hpp were excluded from the prepared full-text bundle because they exceed its size limit; I read only the relevant Export.cpp range and InventoryExports.hpp declaration range through the pinned reader. No other repository files were read beyond the targeted ranges. No build, test, console behavior, or independent confirmation of author-reported checks was performed. The changed files read were core/libs/prx/libSceNKWebKit/CMakeLists.txt, core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp, core/libs/prx/libSceNKWebKit/include/WtfExports.hpp, core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp, core/libs/prx/libSceNKWebKit/tests/WtfFileSystemLinks.cpp, and docs/dev/debt/changes/wtf-filesystem-hard-link-or-copy.md. The manifest lists seven changed files; all were read at least in the relevant ranges. files.json was not available through the reader.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6011416399 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25541#pullrequestreview-6011416399). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T09:03:14Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the focused implementation and wiring review found no verified defect. ## What I ran Reviewed head `51f8d2ec53f8ad466a04bde2e80815d0a1bc9a08` using `repo_read.py` to inspect the prepared diff and targeted source ranges. No build or tests were run; the test results in the PR description are author-reported. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted source review | passed | Implementation, callers, test, and build wiring inspected | | Build and tests | not run | Full CMake target was not built per PR description | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified `Export.cpp` and `include/InventoryExports.hpp` were excluded from the prepared full-text bundle because they exceed its size limit; I read only the relevant `Export.cpp` range and `InventoryExports.hpp` declaration range through the pinned reader. No other repository files were read beyond the targeted ranges. No build, test, console behavior, or independent confirmation of author-reported checks was performed. The changed files read were `core/libs/prx/libSceNKWebKit/CMakeLists.txt`, `core/libs/prx/libSceNKWebKit/Export.cpp`, `core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp`, `core/libs/prx/libSceNKWebKit/include/WtfExports.hpp`, `core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp`, `core/libs/prx/libSceNKWebKit/tests/WtfFileSystemLinks.cpp`, and `docs/dev/debt/changes/wtf-filesystem-hard-link-or-copy.md`. The manifest lists seven changed files; all were read at least in the relevant ranges. `files.json` was not available through the reader. ## To get this to a good state Nothing is required.
MarcZX10 commented 2026-11-22 14:09:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T14:09:53Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

Changes are required before merge: failed hard-link attempts must not fall through to copying for failures other than cross-device links.

What I ran

  • Reviewed head 44b2e700228db95701613196b664163037385495; base is main. No merged-preview check or commands were run.
  • Read the prepared description, commits, manifest, diff, and the included full texts for CMakeLists.txt, WtfExports.hpp, WtfFileSystem.cpp, the new test, and the debt note. Read targeted ranges from Export.cpp through repo_read.py.

Results

Check Result Note
Source review failed One concrete behavior defect
Build and tests not run Author reports a hand-compiled harness; CMake test target was not built

Findings

Blocking

  • core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp:196: every link() error triggers a copy attempt. This includes errors such as permission denied, invalid source type, or a missing source, where the API should return false; it can also create a destination copy despite the hard-link operation failing for a reason unrelated to crossing filesystems. Restrict the fallback to the cross-device error (EXDEV), and return false for other link errors.

Non-blocking

None.

Not verified

  • The full text of Export.cpp and InventoryExports.hpp was excluded from the prepared folder; only targeted ranges were read. files.json was not available under the reader's review paths, so the excluded-file list could not be independently checked.
  • No build, tests, console run, or local precheck was performed. The test and progress results in the description are author-reported.

To get this to a good state

  • Limit copy fallback to cross-device link failures, then rerun the focused test and the project checks on the updated head.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:6012642582 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25541#pullrequestreview-6012642582). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T14:09:53Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested Changes are required before merge: failed hard-link attempts must not fall through to copying for failures other than cross-device links. ## What I ran - Reviewed head `44b2e700228db95701613196b664163037385495`; base is `main`. No merged-preview check or commands were run. - Read the prepared description, commits, manifest, diff, and the included full texts for `CMakeLists.txt`, `WtfExports.hpp`, `WtfFileSystem.cpp`, the new test, and the debt note. Read targeted ranges from `Export.cpp` through `repo_read.py`. ## Results | Check | Result | Note | |---|---|---| | Source review | failed | One concrete behavior defect | | Build and tests | not run | Author reports a hand-compiled harness; CMake test target was not built | ## Findings ### Blocking - `core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cpp:196`: every `link()` error triggers a copy attempt. This includes errors such as permission denied, invalid source type, or a missing source, where the API should return false; it can also create a destination copy despite the hard-link operation failing for a reason unrelated to crossing filesystems. Restrict the fallback to the cross-device error (EXDEV), and return false for other link errors. ### Non-blocking None. ## Not verified - The full text of `Export.cpp` and `InventoryExports.hpp` was excluded from the prepared folder; only targeted ranges were read. `files.json` was not available under the reader's review paths, so the excluded-file list could not be independently checked. - No build, tests, console run, or local precheck was performed. The test and progress results in the description are author-reported. ## To get this to a good state - Limit copy fallback to cross-device link failures, then rerun the focused test and the project checks on the updated head.
throny commented 2026-11-22 16:41:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by throny on 2026-11-22T16:41:08Z.

Review: APPROVED


Review: ✅ correct, I'd merge it

Basis: code read against PS5-WebKit-11.x 80f77e94c6 WTF/wtf/FileSystem.cpp:730-742

Checked

  • At the pin, hardLinkOrCopyFile tries create_hard_link, falls back to copy_file on any error, and returns !ec. copy_file fails when the destination exists and copies permissions. The PR does the same through guest exports: link_nid_postfix resolves both paths through the VFS, the copy uses openFile with O_CREAT|O_EXCL plus read/write, then fchmod. EXDEV comes from LinkNative, which maps ERROR_NOT_SAME_DEVICE on Windows.
  • An existing link path is never truncated. The partial-file cleanup runs only after an exclusive create, a zero-byte write returns false, and EINTR is retried.

Findings
none. MarcZX10's request to fall back only on EXDEV would diverge from the pin, which falls back on every error. A directory or unreadable source still returns false, because the copy's open/read fails.

Suggested action: merge

AI-assisted review (Claude Code) · head 44b2e70022 · base main 23b8772462

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6013315734 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25541#pullrequestreview-6013315734). Originally posted by [throny](https://github.com/throny) on 2026-11-22T16:41:08Z. **Review:** APPROVED --- ### Review: ✅ correct, I'd merge it **Basis:** code read against PS5-WebKit-11.x `80f77e94c6` `WTF/wtf/FileSystem.cpp:730-742` **Checked** - At the pin, `hardLinkOrCopyFile` tries `create_hard_link`, falls back to `copy_file` on any error, and returns `!ec`. `copy_file` fails when the destination exists and copies permissions. The PR does the same through guest exports: `link_nid_postfix` resolves both paths through the VFS, the copy uses `openFile` with `O_CREAT|O_EXCL` plus `read`/`write`, then `fchmod`. EXDEV comes from `LinkNative`, which maps `ERROR_NOT_SAME_DEVICE` on Windows. - An existing link path is never truncated. The partial-file cleanup runs only after an exclusive create, a zero-byte write returns false, and EINTR is retried. **Findings** none. MarcZX10's request to fall back only on EXDEV would diverge from the pin, which falls back on every error. A directory or unreadable source still returns false, because the copy's `open`/`read` fails. **Suggested action:** merge <sub>AI-assisted review (Claude Code) · head `44b2e70022` · base `main` `23b8772462`</sub>
throny commented 2026-11-23 07:03:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by throny on 2026-11-23T07:03:38Z.

Review: APPROVED


Review: ✅ re-review at e88c48ea18: rejecting non-regular sources matches copy_file

Basis: diff read · head e88c48ea18

Checked

  • CopyFileContents now stats the source first (following symlinks, as std::filesystem::copy_file does) and returns false unless it is a regular file. The old fallback blocked on a FIFO with no writer and copied device nodes; copy_file rejects both. A directory already failed at read. fchmod now always uses that stat. Returning false matches the pin's !ec and the other failure paths.
  • WtfFileSystemLinks.cpp:158-160 forces the cross-device fallback with a FIFO and requires false and no output file (POSIX only, like the other cross-volume cases).

Findings
none (the stat-then-open window remains, as it does upstream; fstat on the opened handle or O_NONBLOCK would close it)

Suggested action: merge

AI-assisted review (Claude Code) · head e88c48ea18 · base main 23b8772462

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6017641810 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25541#pullrequestreview-6017641810). Originally posted by [throny](https://github.com/throny) on 2026-11-23T07:03:38Z. **Review:** APPROVED --- ### Review: ✅ re-review at `e88c48ea18`: rejecting non-regular sources matches `copy_file` **Basis:** diff read · head `e88c48ea18` **Checked** - `CopyFileContents` now stats the source first (following symlinks, as `std::filesystem::copy_file` does) and returns false unless it is a regular file. The old fallback blocked on a FIFO with no writer and copied device nodes; `copy_file` rejects both. A directory already failed at `read`. `fchmod` now always uses that stat. Returning false matches the pin's `!ec` and the other failure paths. - `WtfFileSystemLinks.cpp:158-160` forces the cross-device fallback with a FIFO and requires false and no output file (POSIX only, like the other cross-volume cases). **Findings** none (the stat-then-open window remains, as it does upstream; `fstat` on the opened handle or `O_NONBLOCK` would close it) **Suggested action:** merge <sub>AI-assisted review (Claude Code) · head `e88c48ea18` · base `main` `23b8772462`</sub>
MarcZX10 commented 2026-11-23 07:24:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T07:24:50Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the tested host behavior supports the implementation, while console behavior and the full CMake test target were not verified.

What I ran

Reviewed head e88c48ea18ce93f2f6b8d3fc7115698a4b78228c and the prepared diff. No commands or tests were run in this review. The description reports a hand-compiled Linux host harness and convention/debt/diff checks; those results were not independently run here.

Results

Check Result Note
Diff and changed source review passed Core implementation and wiring inspected
Tests in this review not run Author-reported host harness only
Full CMake test target not run Not built per the description

Findings

Blocking

None.

Non-blocking

None.

Not verified

The full CMake test target, console behavior, and all repository files outside the reviewed changed files were not verified. Export.cpp and InventoryExports.hpp were excluded from the prepared full-text bundle; their relevant changed hunks were reviewed in diff.patch, but their full files were not read. Reviewed changed files: CMakeLists.txt, WtfExports.hpp, WtfFileSystem.cpp, WtfFileSystemLinks.cpp, and wtf-filesystem-hard-link-or-copy.md. Excluded changed files: Export.cpp and InventoryExports.hpp (full text excluded by size).

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6017813620 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25541#pullrequestreview-6017813620). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-23T07:24:50Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the tested host behavior supports the implementation, while console behavior and the full CMake test target were not verified. ## What I ran Reviewed head `e88c48ea18ce93f2f6b8d3fc7115698a4b78228c` and the prepared diff. No commands or tests were run in this review. The description reports a hand-compiled Linux host harness and convention/debt/diff checks; those results were not independently run here. ## Results | Check | Result | Note | |---|---|---| | Diff and changed source review | passed | Core implementation and wiring inspected | | Tests in this review | not run | Author-reported host harness only | | Full CMake test target | not run | Not built per the description | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The full CMake test target, console behavior, and all repository files outside the reviewed changed files were not verified. `Export.cpp` and `InventoryExports.hpp` were excluded from the prepared full-text bundle; their relevant changed hunks were reviewed in `diff.patch`, but their full files were not read. Reviewed changed files: `CMakeLists.txt`, `WtfExports.hpp`, `WtfFileSystem.cpp`, `WtfFileSystemLinks.cpp`, and `wtf-filesystem-hard-link-or-copy.md`. Excluded changed files: `Export.cpp` and `InventoryExports.hpp` (full text excluded by size). ## To get this to a good state Nothing is required.
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!25541
No description provided.