fix(libc): pass long host paths relative to the root so macOS accepts guest paths up to PATH_MAX #22932

Open
Romannachwievor wants to merge 4 commits from upstream-pr/22932 into main
Romannachwievor commented 2026-11-18 13:51:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Romannachwievor on 2026-11-18T13:51:34Z.


What

On macOS, a guest path close to the 1024-byte guest limit failed with ENAMETOOLONG. Its host form is the emulator root followed by the guest path, and macOS rejects host paths of 1024 bytes or more (#22270).

The host working directory is the emulator root for the life of the process: guest chdir only changes WorkingDirectory::current, and the only host change is in LoadExec, just before the process is replaced. So a path whose absolute host form would reach PATH_MAX is now passed to the host relative to the root. A guest path of at most 1023 bytes always fits that way. Shorter paths take the old route, and Windows is unchanged.

In core/libs/prx/libc/src/General.cpp:

  • HostPath resolves such a path against an empty root. MatchNames lists . for an empty directory, so case-insensitive matching still applies on that route.
  • SetWorkingDirectory no longer calls canonical, whose realpath result must fit in PATH_MAX, on such a path. It canonicalizes the longest prefix that fits, then appends the remaining components after checking with symlink_status that each exists and is not a symbolic link. A symbolic link past the host limit fails with ENAMETOOLONG, as before. The .. check against the root is unchanged.
  • SetWorkingDirectory and getcwd run their is_directory check on the relative form.

The debt entry for #22270 now lists the remaining limits: relative names used from a deep working directory, paths under an alias, descriptor-based *at calls, and fchdir on a long path. A separate M1 probe showed fchdir returning ENOTDIR for a valid directory at the 1023-byte guest limit; recovering that descriptor path needs work outside this PR.

Tested

  • Apple M1, macOS 26.5 (Darwin 25.5.0), x86_64 Release under Rosetta, -DCMAKE_OSX_ARCHITECTURES=x86_64, test targets and their libraries only:
    • guest_kernel_sys and guest_kernel_sys_execve: fail on main (Kernel sys check failed at line 1325 (guest errno 63), execve with a 1023 byte pathname did not reach the lookup), pass with this change.
    • 124 tests from the 85 test programs whose sources call the path functions, on main and with this change: the only difference is guest_kernel_sys. file_streams, guest_sce_net, guest_poll and guest_kernel_app_archive_mmap fail on both (#21720, #22443, #20161, #21538).
  • Rebased head dc77871833 on main 7281ddca51 plus #17425 and #11049 for the macOS build: Apple M1, macOS 26.5, x86_64 Release. libc, guest_kernel_sys_tests and guest_kernel_sys_execve_tests built. guest_kernel_sys_execve passed 3/3. With only CheckRawGetcwdPathLimit run from the test binary, this change passed 3/3 and main failed 1/1 at line 1456 with guest errno 63. Temporary test edits were removed and the targets rebuilt.
  • The full guest_kernel_sys now stops at line 1190 with guest errno 13 in a directory rename permission check. With the new long-path check temporarily skipped, both main and this change stop at that same line. The test therefore cannot give a full-suite result on current main.
  • A temporary fchdir probe on a valid 1023-byte guest directory returned ENOTDIR (20). The probe was removed; the limit is recorded in the debt fragment.
  • @Jazeupoi on an Apple M4, macOS 27.0.1, full x86_64 build with #17425 and #11049: both tests pass, and all 4006 non-AGC tests show no failure that the base without this change doesn't also show (https://github.com/boykopovar/AnyPS5/issues/22270#issuecomment-6980452894).
  • Not run on Linux or Windows. On Linux only a host path of 4096 bytes or more takes the new route. On Windows the route is never taken, and MatchNames builds the same path as before (directory / entry->path().filename() equals entry->path()).
  • python3 tools/check_conventions.py --base origin/main and git diff --check origin/main...HEAD pass on the rebased branch. python3 tools/debt_fold.py --check fails on two untouched fragments in current main: docs-libkernel-pro-measured-1360.md and fix-kernel-sys-title-workaround-bit-limit.md.

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 (see AGENTS.md)
  • 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: #22270
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5377278187 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22932). Originally posted by [Romannachwievor](https://github.com/Romannachwievor) on 2026-11-18T13:51:34Z. --- ### What On macOS, a guest path close to the 1024-byte guest limit failed with `ENAMETOOLONG`. Its host form is the emulator root followed by the guest path, and macOS rejects host paths of 1024 bytes or more (#22270). The host working directory is the emulator root for the life of the process: guest `chdir` only changes `WorkingDirectory::current`, and the only host change is in `LoadExec`, just before the process is replaced. So a path whose absolute host form would reach `PATH_MAX` is now passed to the host relative to the root. A guest path of at most 1023 bytes always fits that way. Shorter paths take the old route, and Windows is unchanged. In `core/libs/prx/libc/src/General.cpp`: - `HostPath` resolves such a path against an empty root. `MatchNames` lists `.` for an empty directory, so case-insensitive matching still applies on that route. - `SetWorkingDirectory` no longer calls `canonical`, whose `realpath` result must fit in `PATH_MAX`, on such a path. It canonicalizes the longest prefix that fits, then appends the remaining components after checking with `symlink_status` that each exists and is not a symbolic link. A symbolic link past the host limit fails with `ENAMETOOLONG`, as before. The `..` check against the root is unchanged. - `SetWorkingDirectory` and `getcwd` run their `is_directory` check on the relative form. The debt entry for #22270 now lists the remaining limits: relative names used from a deep working directory, paths under an alias, descriptor-based `*at` calls, and `fchdir` on a long path. A separate M1 probe showed `fchdir` returning `ENOTDIR` for a valid directory at the 1023-byte guest limit; recovering that descriptor path needs work outside this PR. ### Tested - Apple M1, macOS 26.5 (Darwin 25.5.0), x86_64 Release under Rosetta, `-DCMAKE_OSX_ARCHITECTURES=x86_64`, test targets and their libraries only: - `guest_kernel_sys` and `guest_kernel_sys_execve`: fail on `main` (`Kernel sys check failed at line 1325 (guest errno 63)`, `execve with a 1023 byte pathname did not reach the lookup`), pass with this change. - 124 tests from the 85 test programs whose sources call the path functions, on `main` and with this change: the only difference is `guest_kernel_sys`. `file_streams`, `guest_sce_net`, `guest_poll` and `guest_kernel_app_archive_mmap` fail on both (#21720, #22443, #20161, #21538). - Rebased head `dc77871833` on `main` `7281ddca51` plus #17425 and #11049 for the macOS build: Apple M1, macOS 26.5, x86_64 Release. `libc`, `guest_kernel_sys_tests` and `guest_kernel_sys_execve_tests` built. `guest_kernel_sys_execve` passed 3/3. With only `CheckRawGetcwdPathLimit` run from the test binary, this change passed 3/3 and `main` failed 1/1 at line 1456 with guest errno 63. Temporary test edits were removed and the targets rebuilt. - The full `guest_kernel_sys` now stops at line 1190 with guest errno 13 in a directory rename permission check. With the new long-path check temporarily skipped, both `main` and this change stop at that same line. The test therefore cannot give a full-suite result on current `main`. - A temporary `fchdir` probe on a valid 1023-byte guest directory returned `ENOTDIR` (20). The probe was removed; the limit is recorded in the debt fragment. - @Jazeupoi on an Apple M4, macOS 27.0.1, full x86_64 build with #17425 and #11049: both tests pass, and all 4006 non-AGC tests show no failure that the base without this change doesn't also show (https://github.com/boykopovar/AnyPS5/issues/22270#issuecomment-6980452894). - Not run on Linux or Windows. On Linux only a host path of 4096 bytes or more takes the new route. On Windows the route is never taken, and `MatchNames` builds the same path as before (`directory / entry->path().filename()` equals `entry->path()`). - `python3 tools/check_conventions.py --base origin/main` and `git diff --check origin/main...HEAD` pass on the rebased branch. `python3 tools/debt_fold.py --check` fails on two untouched fragments in current `main`: `docs-libkernel-pro-measured-1360.md` and `fix-kernel-sys-title-workaround-bit-limit.md`. ### 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 (see AGENTS.md) - [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 (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: none - [x] Fixes: #22270 - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes (Claude Code)
Jazeupoi commented 2026-11-18 14:05:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Jazeupoi on 2026-11-18T14:05:27Z.

Review: COMMENTED


Tested head b8276aee13 on the M4 with a full build: macOS 27.0.1, Apple clang 21.0.0, x86_64 Release under Rosetta. I merged it into my macOS base (main 57f7016922 with #17425 and #11049), which brings in main up to 3055e5830c.

  • guest_kernel_sys and guest_kernel_sys_execve: pass 3/3.
  • All non-AGC tests (ctest -j6 -E '^agc_', 4011 tests): 12 failures. Eleven of them are the ones in my run of e7de7040e0 on the issue (nkwebkit_affinetransformguestpointers now passes, since #22859 is in main). The new one, guest_refused_connect, also fails with this commit reverted on the same tree, so it comes from main, not from this change.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5958183891 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22932#pullrequestreview-5958183891). Originally posted by [Jazeupoi](https://github.com/Jazeupoi) on 2026-11-18T14:05:27Z. **Review:** COMMENTED --- Tested head `b8276aee13` on the M4 with a full build: macOS 27.0.1, Apple clang 21.0.0, x86_64 Release under Rosetta. I merged it into my macOS base (`main` `57f7016922` with #17425 and #11049), which brings in `main` up to `3055e5830c`. - `guest_kernel_sys` and `guest_kernel_sys_execve`: pass 3/3. - All non-AGC tests (`ctest -j6 -E '^agc_'`, 4011 tests): 12 failures. Eleven of them are the ones in my run of `e7de7040e0` on the issue (`nkwebkit_affinetransformguestpointers` now passes, since #22859 is in `main`). The new one, `guest_refused_connect`, also fails with this commit reverted on the same tree, so it comes from `main`, not from this change. AI-assisted: yes (Claude Code)
MarcZX10 commented 2026-11-18 15:51:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T15:51:19Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

Changes are required before merge: preserve guest-root containment when resolving paths whose host form exceeds PATH_MAX.

What I ran

Reviewed head b8276aee1364d46ad2ba0db3e04bdf3e845934d8 using the prepared review bundle and the pinned repository reader. No build or tests were run.

Results

Check Result Note
Diff and changed files passed Both changed files read
Targeted source review passed Path resolution and chdir inspected
Build and tests not run Author-reported results were not rerun

Findings

Blocking

  • core/libs/prx/libc/src/General.cpp:379: For long paths, HostPath calls ResolveHostPath({}, names, module) with an empty root. ResolveHostPath handles .. components by appending them to that root, so a guest path such as /../outside can resolve to a host path outside the emulator root. The short-path route retains the root and the later SetWorkingDirectory containment check, but this branch can pass the escaped path to filesystem operations without that check. Keep resolution anchored to the emulator root while avoiding an overlong absolute syscall path, and ensure .. cannot escape the guest root.

Non-blocking

None.

Not verified

  • No build, tests, or runtime checks were run; the macOS and cross-platform results in the description are author-reported.
  • The changed files read were core/libs/prx/libc/src/General.cpp and docs/dev/debt/changes/fix-libc-macos-long-host-paths.md. files.json was unavailable through the reader, so excluded files and the complete reviewed-file manifest were not independently confirmed.

To get this to a good state

Keep long-path resolution within the guest root, including paths containing .., then rerun the path tests that cover long paths and traversal.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5960084380 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22932#pullrequestreview-5960084380). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-18T15:51:19Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested Changes are required before merge: preserve guest-root containment when resolving paths whose host form exceeds `PATH_MAX`. ## What I ran Reviewed head `b8276aee1364d46ad2ba0db3e04bdf3e845934d8` using the prepared review bundle and the pinned repository reader. No build or tests were run. ## Results | Check | Result | Note | |---|---|---| | Diff and changed files | passed | Both changed files read | | Targeted source review | passed | Path resolution and chdir inspected | | Build and tests | not run | Author-reported results were not rerun | ## Findings ### Blocking - `core/libs/prx/libc/src/General.cpp:379`: For long paths, `HostPath` calls `ResolveHostPath({}, names, module)` with an empty root. `ResolveHostPath` handles `..` components by appending them to that root, so a guest path such as `/../outside` can resolve to a host path outside the emulator root. The short-path route retains the root and the later `SetWorkingDirectory` containment check, but this branch can pass the escaped path to filesystem operations without that check. Keep resolution anchored to the emulator root while avoiding an overlong absolute syscall path, and ensure `..` cannot escape the guest root. ### Non-blocking None. ## Not verified - No build, tests, or runtime checks were run; the macOS and cross-platform results in the description are author-reported. - The changed files read were `core/libs/prx/libc/src/General.cpp` and `docs/dev/debt/changes/fix-libc-macos-long-host-paths.md`. `files.json` was unavailable through the reader, so excluded files and the complete reviewed-file manifest were not independently confirmed. ## To get this to a good state Keep long-path resolution within the guest root, including paths containing `..`, then rerun the path tests that cover long paths and traversal.
MarcZX10 commented 2026-11-18 20:06:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T20:06:22Z.

Review: COMMENTED


Reviewed — comments

The changed path handling has a potentially incorrect canonicalization edge case, and the reported tests were not run during this review.

What I ran

Reviewed head 1933d3d41da6ce2beaa8509cfe782ed3316b4819 using the prepared diff.patch and the pinned reader repo_read.py. No commands or tests were run.

Results

Check Result Note
Diff and targeted source review passed All three changed files were read
Tests not run Author-reported results were not independently checked

Findings

Blocking

None verified.

Non-blocking

  • core/libs/prx/libc/src/General.cpp:545 — absolute resolved paths bypass the long-path handling. CanonicalHostPath immediately calls canonical(resolved) when resolved is absolute. If an alias or provided path resolves to an absolute host path at or beyond the host path limit, chdir still fails during canonicalization. The description explicitly leaves alias paths as open debt; consider documenting this limitation alongside the helper or adding a test to ensure this route remains intentionally unsupported.

Not verified

  • No tests or builds were run. The test results in description.md are author-reported.
  • Linux and Windows behavior was not run.
  • Read: core/libs/prx/libc/src/General.cpp, core/libs/tests/GuestKernelSys.cpp, and docs/dev/debt/changes/fix-libc-macos-long-host-paths.md (all changed files listed in manifest.json). The prepared artifacts read were description.md, commits.md, manifest.json, and diff.patch. No changed files were excluded.

To get this to a good state

Nothing is required. The alias path limitation is optional feedback.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5964159158 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22932#pullrequestreview-5964159158). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-18T20:06:22Z. **Review:** COMMENTED --- # Reviewed — comments The changed path handling has a potentially incorrect canonicalization edge case, and the reported tests were not run during this review. ## What I ran Reviewed head `1933d3d41da6ce2beaa8509cfe782ed3316b4819` using the prepared `diff.patch` and the pinned reader `repo_read.py`. No commands or tests were run. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted source review | passed | All three changed files were read | | Tests | not run | Author-reported results were not independently checked | ## Findings ### Blocking None verified. ### Non-blocking - **`core/libs/prx/libc/src/General.cpp:545` — absolute resolved paths bypass the long-path handling.** `CanonicalHostPath` immediately calls `canonical(resolved)` when `resolved` is absolute. If an alias or provided path resolves to an absolute host path at or beyond the host path limit, `chdir` still fails during canonicalization. The description explicitly leaves alias paths as open debt; consider documenting this limitation alongside the helper or adding a test to ensure this route remains intentionally unsupported. ## Not verified - No tests or builds were run. The test results in `description.md` are author-reported. - Linux and Windows behavior was not run. - Read: `core/libs/prx/libc/src/General.cpp`, `core/libs/tests/GuestKernelSys.cpp`, and `docs/dev/debt/changes/fix-libc-macos-long-host-paths.md` (all changed files listed in `manifest.json`). The prepared artifacts read were `description.md`, `commits.md`, `manifest.json`, and `diff.patch`. No changed files were excluded. ## To get this to a good state Nothing is required. The alias path limitation is optional feedback.
MarcZX10 commented 2026-11-22 10:57:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T10:57:00Z.

Review: COMMENTED


Reviewed — comments

The review covers the changed implementation, test, and debt note at head dc77871833c7ee122a53baaf4f2b4eb6fd6b9560; a potential edge case in root-relative chdir handling merits clarification before a formal decision.

What I ran

  • Read the prepared description, commit list, manifest, diff, and all three changed files at the pinned head.
  • No commands or tests were run in this review.

Results

Check Result Note
Changed files read passed All 3 reviewed files read
Tests run not run Author-reported results only
Excluded files not applicable Manifest lists no exclusions

Findings

Blocking

None.

Non-blocking

  • The new test constructs a path with enough leading ../ components to climb past the emulator root, then expects mkdirat to create inside within that root. The relevant changed test lines are core/libs/tests/GuestKernelSys.cpp:1453-1457. Please clarify how this exercises the stated root containment behavior, since its climb + inside path appears to leave the root before resolving inside.

Not verified

  • No tests, build, or checks were run. The reported macOS test outcomes and CI report were not independently verified.
  • Only the three changed files were read; repository callers and platform behavior beyond the targeted code were not verified.
  • files.json was not available through the review-folder reader; the manifest shows all three changed files included and no excluded files.

To get this to a good state

Nothing is required. The optional test-path clarification above is the only comment.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6011875979 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22932#pullrequestreview-6011875979). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T10:57:00Z. **Review:** COMMENTED --- # Reviewed — comments The review covers the changed implementation, test, and debt note at head `dc77871833c7ee122a53baaf4f2b4eb6fd6b9560`; a potential edge case in root-relative `chdir` handling merits clarification before a formal decision. ## What I ran - Read the prepared description, commit list, manifest, diff, and all three changed files at the pinned head. - No commands or tests were run in this review. ## Results | Check | Result | Note | |---|---|---| | Changed files read | passed | All 3 reviewed files read | | Tests run | not run | Author-reported results only | | Excluded files | not applicable | Manifest lists no exclusions | ## Findings ### Blocking None. ### Non-blocking - The new test constructs a path with enough leading `../` components to climb past the emulator root, then expects `mkdirat` to create `inside` within that root. The relevant changed test lines are `core/libs/tests/GuestKernelSys.cpp:1453-1457`. Please clarify how this exercises the stated root containment behavior, since its `climb + inside` path appears to leave the root before resolving `inside`. ## Not verified - No tests, build, or checks were run. The reported macOS test outcomes and CI report were not independently verified. - Only the three changed files were read; repository callers and platform behavior beyond the targeted code were not verified. - `files.json` was not available through the review-folder reader; the manifest shows all three changed files included and no excluded files. ## To get this to a good state Nothing is required. The optional test-path clarification above is the only comment.
MarcZX10 commented 2026-11-25 00:30:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T00:30:56Z.

Review: COMMENTED


Reviewed — comments

The change addresses absolute guest paths whose host form exceeds PATH_MAX; review is incomplete because one changed source file’s added lines were not all read, and no checks were run.

What I ran

Inspected prepared diff and source at head d6cde1fdd63b2f2b6e69190fb05b9238eed2883e using repo_read.py review-folder and source-reading tools. No build or tests were run.

Results

Check Result Note
Diff and targeted source review passed Core path handling inspected
Build and tests not run No local execution
All added lines read not run Some changed lines remain unread

Findings

Blocking

None verified.

Non-blocking

  • The test addition exercises mkdirat and unlinkat with a path containing leading .. components, but the debt entry states descriptor-based *at calls remain limited for long host paths. Consider adding a focused test or clarifying which *at case this regression test covers. The test additions are at core/libs/tests/GuestKernelSys.cpp:1453-1463.

Not verified

  • I read changed lines in core/libs/prx/libc/src/General.cpp, core/libs/tests/GuestKernelSys.cpp, and docs/dev/debt/changes/fix-libc-macos-long-host-paths.md, but did not read every added line listed in the manifest. In particular, changed lines in General.cpp outside the inspected ranges were not all reviewed.
  • Builds, tests, Linux behavior, and Windows behavior were not independently verified. The test results in the description are author-reported.
  • files.json was not available as a review-folder document; the manifest lists all three changed files as included.

To get this to a good state

Nothing is required. Optional: clarify the *at test coverage noted above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6049683027 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22932#pullrequestreview-6049683027). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-25T00:30:56Z. **Review:** COMMENTED --- # Reviewed — comments The change addresses absolute guest paths whose host form exceeds `PATH_MAX`; review is incomplete because one changed source file’s added lines were not all read, and no checks were run. ## What I ran Inspected prepared diff and source at head `d6cde1fdd63b2f2b6e69190fb05b9238eed2883e` using `repo_read.py` review-folder and source-reading tools. No build or tests were run. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted source review | passed | Core path handling inspected | | Build and tests | not run | No local execution | | All added lines read | not run | Some changed lines remain unread | ## Findings ### Blocking None verified. ### Non-blocking - The test addition exercises `mkdirat` and `unlinkat` with a path containing leading `..` components, but the debt entry states descriptor-based `*at` calls remain limited for long host paths. Consider adding a focused test or clarifying which `*at` case this regression test covers. The test additions are at `core/libs/tests/GuestKernelSys.cpp:1453-1463`. ## Not verified - I read changed lines in `core/libs/prx/libc/src/General.cpp`, `core/libs/tests/GuestKernelSys.cpp`, and `docs/dev/debt/changes/fix-libc-macos-long-host-paths.md`, but did not read every added line listed in the manifest. In particular, changed lines in `General.cpp` outside the inspected ranges were not all reviewed. - Builds, tests, Linux behavior, and Windows behavior were not independently verified. The test results in the description are author-reported. - `files.json` was not available as a review-folder document; the manifest lists all three changed files as included. ## To get this to a good state Nothing is required. Optional: clarify the `*at` test coverage noted above.
malekaifa commented 2026-11-25 00:57:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by malekaifa on 2026-11-25T00:57:16Z.

Review: APPROVED


Reviewed exact head d6cde1fdd63b2f2b6e69190fb05b9238eed2883e, including the earlier guest-root containment concern.

The long-host-path route no longer creates a guest escape. Resolve() normalizes path components before HostPath: a .. only pops when the normalized component stack is non-empty, so leading/excess .. stop at the guest root and never reach ResolveHostPath({}, names, ...). For a path whose root-prefixed host spelling reaches PATH_MAX, the resulting normalized component vector is resolved relative to the process CWD, which is the emulator root for normal execution; the invariant is unchanged until LoadExec replaces the process. CanonicalHostPath likewise canonicalizes the longest root-prefixed prefix that fits, then appends only existing non-symlink components, preserving the documented ENAMETOOLONG fallback for a symlink beyond the host limit.

The current regression covers excess .. through the changed plain-path/AT_FDCWD route, while the real-directory-descriptor *at limitation remains explicitly listed as debt. macOS M1/M4 evidence exercises the actual long-path route, Windows evidence verifies unchanged behavior and the traversal regression, and every exact-head hosted check is terminal/successful (with the unrelated Linux/pipe-write jobs intentionally skipped).

I found no remaining blocker on this exact head.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6049910283 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22932#pullrequestreview-6049910283). Originally posted by [malekaifa](https://github.com/malekaifa) on 2026-11-25T00:57:16Z. **Review:** APPROVED --- Reviewed exact head `d6cde1fdd63b2f2b6e69190fb05b9238eed2883e`, including the earlier guest-root containment concern. The long-host-path route no longer creates a guest escape. `Resolve()` normalizes path components before `HostPath`: a `..` only pops when the normalized component stack is non-empty, so leading/excess `..` stop at the guest root and never reach `ResolveHostPath({}, names, ...)`. For a path whose root-prefixed host spelling reaches `PATH_MAX`, the resulting normalized component vector is resolved relative to the process CWD, which is the emulator root for normal execution; the invariant is unchanged until `LoadExec` replaces the process. `CanonicalHostPath` likewise canonicalizes the longest root-prefixed prefix that fits, then appends only existing non-symlink components, preserving the documented `ENAMETOOLONG` fallback for a symlink beyond the host limit. The current regression covers excess `..` through the changed plain-path/AT_FDCWD route, while the real-directory-descriptor `*at` limitation remains explicitly listed as debt. macOS M1/M4 evidence exercises the actual long-path route, Windows evidence verifies unchanged behavior and the traversal regression, and every exact-head hosted check is terminal/successful (with the unrelated Linux/pipe-write jobs intentionally skipped). I found no remaining blocker on this exact head. AI-assisted: yes
ligmaSec commented 2026-12-03 15:03:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T15:03:18Z.

Review: COMMENTED


Built and ran guest_kernel_sys on Linux with this head integrated. It passed. I traced the macOS path conversion to the root-relative operation used for long guest paths. The actual macOS PATH_MAX behavior remains unverified here.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6172390675 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22932#pullrequestreview-6172390675). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T15:03:18Z. **Review:** COMMENTED --- Built and ran `guest_kernel_sys` on Linux with this head integrated. It passed. I traced the macOS path conversion to the root-relative operation used for long guest paths. The actual macOS `PATH_MAX` behavior remains unverified here. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/22932:upstream-pr/22932'
git switch 'upstream-pr/22932'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/22932'
git switch 'upstream-pr/22932'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/22932'
git switch 'upstream-pr/22932'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/22932'
git switch 'main'
git merge --squash 'upstream-pr/22932'
git switch 'main'
git merge --ff-only 'upstream-pr/22932'
git switch 'main'
git merge 'upstream-pr/22932'
git push origin 'main'
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!22932
No description provided.