fix(libkernel): classify Windows directory links by app0 scope #8726
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8726"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by ArjenS-LA on 2026-10-20T22:33:56Z.
What
Windows directory enumeration classifies links by canonical app0 scope: live links inside that root report their target type, while dangling links and links outside it remain DT_LNK. Failed initial stat returns DT_UNKNOWN, and the directory snapshot is published only after collection succeeds. This follows the reviewed resolved-path scope.
The test correction in
c5229e510a4b463fd4f6d39f017793d753f7c86buses Windows backslashes for relative symbolic-link targets andRemoveDirectoryW/DeleteFileWfor cleanup of dangling and looping reparse points. Production code is unchanged from4fb4187bd327a33cb139959d596c46782c3ac08d.Tested
Windows x64, supported MinGW-w64 GCC 15.2.0: both the previous and corrected fixtures freshly compile and pass the junction cases against the same preserved libraries from
4fb4187. Both leave no test directories behind. Native symbolic-link cases skip because the user token lacks symbolic-link privilege, so the reviewer’s failure is not independently reproduced locally. JJenkx reported five failing runs followed by five passing runs with these exact test edits and symlink cases enabled. His offered rerun on this corrected head remains pending.The branch and current-main conventions checkers pass, as does whitespace validation. No full build, full CTest, homebrew or GPU run was repeated for this test-only correction. Full Linux/Windows CI still needs a collaborator-triggered run for the new head; the previous successful Build workflow skipped its platform test jobs.
Earlier implementation validation at
4fb4187remains applicable to the unchanged production code: full build and explicit libraries build passed; CTest reported 1,882 passes, 6 skips and 3 unresolved GPU sample-order failures. Released Prospero Explorer v1.0 (PPSA99109) execution, with disclosed host-added junction and removable-file fixtures, showed app0 junction type 4 and DT_UNKNOWN for the disappearing entry. Original package bytes were unchanged; decrypted inputs were converted separately. This established directory-response behavior under those accommodations, not gameplay or physical-console behavior.Current overlap check: main
c8d34aa8f4d8058d57169cc1e423ba6db00faaf0, corrected headc5229e510a4b463fd4f6d39f017793d753f7c86b, 1,288 open PRs with complete paginated changed-file lists. This PR merges cleanly with main. Tree-only comparisons of 129 shared-file peers yielded 89 clean pairs, 3 conflicts and 37 inconclusive pairs because the peer already conflicts with main. No other open PR changes the Windows link fixture. Source review was selective; combined runtime compatibility is unverified.0a64d23bdf502e32b1857009a5227634d4a53f16core/libs/prx/libkernel/File/src/DirectoryDescriptor.cppacac3b1c00a97443536b6697bb2f7ad46a0c57b5docs/dev/debt/libkernel.mde9b842569aaf59e5b1282b2637b10e94d589109bdocs/dev/debt/libkernel.md#8520 integration must preserve archive/disk enumeration, inode/cursor handling, canonical-app0 target typing, failed-stat DT_UNKNOWN and complete snapshot publication. Its ordering discussion remains pending. #9732’s author agreed to #8726 first, then rebase while retaining both debt entries. #10121 ordering remains pending; both adjacent debt entries must survive. The test correction does not alter these existing overlaps. The complementary Linux PR #9303 has merged.
Checklist
main; no other open PR implements the same functions — tested merge against the exact main above; overlapping implementation and integration limits are disclosed.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T22:52:47Z.
Review: APPROVED
Reviewed the current diff and test report. Deriving the
getdentsentry type from the same no-followFillLinkStatclassification used bylstatcorrectly distinguishes ordinary files/directories from normal, dangling, and self-loop junctions.Loadbuilds a temporary snapshot and only publishes it after every entry is classified, so an unsupported reparse type does not leave a partially loaded directory. The author reports the Windows junction regression failing on baseline and passing on the PR, plus the full CTest delta with only identical pre-existing failures. Hosted conventions/eligibility/intake/labels pass; platform build jobs are skipped. I did not run a local Windows build. AI-assisted review.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T23:34:02Z.
@ArjenS-LA Thanks. Deriving the type from
FillLinkStatis the right source, and publishing the snapshot only after classification is careful.One request about the new failure path.
EntryTypethrows whenFillLinkStatfails. That can happen for an entry that's deleted between the directory listing and the stat (another thread or process cleaning up a temp or save directory), or one the host refuses to stat.maingave such an entry a type and carried on, so the wholegetdentscall would now end the process instead. FreeBSD hasDT_UNKNOWN(0) for an entry whose type isn't known. Could a failed stat giveDT_UNKNOWN(or skip an entry that no longer exists) instead of throwing? KeepNotImplementedfor a type that really is unsupported.After that, the bar is a full CI run with
guest_directory_link_typesand the existing directory-entry tests passing on Linux and Windows.Imported from boykopovar/AnyPS5. Originally posted by ArjenS-LA on 2026-10-21T00:11:05Z.
I reproduced the stat race in Prospero Explorer 1.0 (PPSA99109) and prepared the narrow fix: failed
FillLinkStatreturnsDT_UNKNOWN(0), while unsupported types and reparse points still take the existingNotImplementedpath.Using the same shipped Explorer package and workload, a debugger breakpoint removes one added host fixture immediately before stat. Published head
b898b072bb9429390537d78cfd074a6d95349b1aaborts withdirectory entry type: No such file or directory; the rebuilt kernel returns that entry with type 0. No guest memory/register writes or injected guest calls were used. Original package bytes stay unchanged; the prior unwrapped copies/relinker and baseline library snapshot are reused, with only the rebuilt kernel substituted for the fixed run. This proves the observed directory-enumeration path under that disclosed race fixture, not general startup/gameplay or console behavior.Windows x64, MinGW-w64 GCC 15.2.0: the same six directory regression executables pass with both baseline and fixed libraries. Junction cases executed; optional symbolic-link subcases skipped because the host lacks that privilege. The explicit
libsbuild passes. The full build retains the previously recorded unrelatedImageArrayWindowPastLayerLimit.cpperror (65536-byte requested alignment exceeds the 8192-byte object limit). Native CTest: 1548 passed, 1 failed, 18 skipped; 221 script-driven or unavailable tests were excluded. Failed native tests:agc_driver_lookup_log_fits_build. The AGC failure passes on isolated reruns of both baseline and fixed builds; the original parallel-suite failure remains recorded, with its cause unresolved.guest_audio3d_portexceeded 30 seconds locally (49.31 s); no test timeout or unrelated source was changed. GPU used by broad native tests: NVIDIA GeForce RTX 4070 SUPER, Windows driver 32.0.16.1088. This is not a clean complete-suite result or a fresh full baseline comparison.The patch is still local and uncommitted (base above; tree
54371a619e665444cc3e0a0684feee40a2b57fdc). Four repository commits from today are visible, but the coordinator records do not certify the combined count including disposable test commits across sessions, so the daily commit rule prevents creating another commit. Full Linux/Windows CI also remains outstanding: this account has no upstream workflow-dispatch/write permission, so a collaborator will need to run it after an update is publishable. I have not pushed this fix. The patch and exact commands, hashes and logs are preserved in.codex/pr-maintainer/logs/pass-20261020T2338Z; the worktree is.codex/pr-maintainer/worktrees/pr-8726-20261020.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T13:04:16Z.
@ArjenS-LA thanks for this. For links the guest makes itself,
DT_LNKis what FreeBSD reports, so that part is right. The problem is/app0. A real app0 never contains links, so any link in it comes from how the host built the app0 directory, and a title enumerating it expects the target's type.We have a concrete case of this on Linux, where
main'sgetdentsalready passes the host type through. PPSA04263 crashes at about 0 s when its top-level app0 directories are symlinks into the dump, and it runs when they are real directories. The title lists/app0and only walks into entries typedDT_DIR. With the links typed 10, it never opens any of them, and it crashes on startup. Symlinked files are fine, because they're opened by name and open follows the link.Today Windows reports a junction to a directory as 4, so a junction-built app0 works there. After this change it would report 10, so the same title would see the same listing on Windows (we haven't run it there). Your Explorer row shows the switch on
/app0itself (junction-fixture: type=4→type=10).Could you keep the target's type inside the app0 tree? For an entry under
/app0whoseFillLinkStatmode is a link, resolve it (the following stat) and return 4 or 8 for the target. Keep 10 when the link dangles, and keep 10 everywhere outside app0 (/data,/download0), where the guest can create links. The fixture then needs its junction outside app0 to check 10, plus one junction inside app0 that must come back as 4.We're making the matching change to the Linux path, so both platforms will treat app0 the same way.
Imported from boykopovar/AnyPS5. Originally posted by ArjenS-LA on 2026-10-21T17:41:19Z.
@oneandonlydean I reproduced the Windows part with a focused native junction fixture on Windows x64 / MinGW-w64 GCC 15.2.0. Against the published
b898b072bb9429390537d78cfd074a6d95349b1akernel snapshot, enumeration through/datapasses with type 10, while enumeration through/app0fails withjunction: getdents type 10, expected 4. The existing localDT_UNKNOWNstat-race patch gives the same results, so it does not address this additional regression. These are synthetic native tests, not PPSA04263 or fresh Explorer execution; optional symbolic-link cases skipped for lack of Windows privilege, while junction cases executed.There is a path-tracking detail to coordinate:
Loadobtains the resolved host path withGetFinalPathNameByHandleW, andOpenInDirectory_nid_no_patchlikewise opens relative to that resolved path. A host-path prefix check alone can lose the/app0origin after entering a junction whose target is outside the mapped root. Can you link the matching Linux change so I can align the Windows directory-origin tracking with it? The/app0request remains unresolved and no updated kernel commit has been pushed.Imported from boykopovar/AnyPS5. Originally posted by ArjenS-LA on 2026-10-21T23:40:33Z.
@oneandonlydean I found the matching Linux change in #9303 at
58ad4eda77577412aab42a180a82fc164d1cfab1. Its resolved-descriptor-path check explicitly leaves nested links typedDT_LNKafter entering an app0 link whose target is outside the canonical app0 root.Should the Windows correction mirror that documented limitation, or must it preserve the guest
/app0origin across those directory opens? This determines whether a resolved-path check is sufficient or directory-origin tracking must change.Both PRs also add different implementations of
core/libs/tests/GuestDirectoryLinkTypes.cpp. I propose keeping the Windows fixture in a separate Windows-specific source file when integrating the correction. The published head remainsb898b072bb9429390537d78cfd074a6d95349b1a; this update is source/merge inspection only, with no new runtime result or pushed fix.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-22T03:13:46Z.
@ArjenS-LA Mirror the #9303 limitation; don't add directory-origin tracking in this PR.
#9303 decides "inside
/app0" from the resolved descriptor path (weakly_canonicalof/app0plus the directory's resolved path), as yourGetFinalPathNameByHandleWcheck would. With it, links that sit directly in/app0or in a directory below it, links to links, relative links and an/app0that is itself a link all report as directories. Entries inside a directory that an app0 link led outside the root stayDT_LNK. That nested case is documented in the debt doc and no title we have run needs it, while tracking the guest origin across every directory open adds state to each descriptor for a case nobody has hit. If a title does need it, that is a separate change for both platforms.So on Windows the
/app0junction enumeration should report type 4, like the Linux fixture, and a junction that leads outside the root and holds further links should stay type 10, with the limitation worded the same indocs/dev/debt/libkernel.md. I haven't run the Windows side myself, so your fixture is the evidence there.Keep the Windows fixture in its own source file. #9303's
GuestDirectoryLinkTypes.cppis the Linux test (skipped elsewhere), so two different files under one name would only collide.Imported from boykopovar/AnyPS5. Originally posted by ArjenS-LA on 2026-10-22T05:50:34Z.
@oneandonlydean The local correction now mirrors #9303's resolved-path limitation. It follows live links when the enumerated directory resolves inside canonical
/app0, retainsDT_LNKfor dangling links and nested links reached outside that root, and keeps the earlierDT_UNKNOWNstat-failure correction. The Windows fixture is nowGuestWindowsDirectoryLinkTypes.cpp, with its own test name.Windows x64 / MinGW-w64 GCC 15.2.0 results:
b898b072bb9429390537d78cfd074a6d95349b1a(app0 junction type 10 instead of 4) and passes against the draft. It covers outside-app0 links, chained junctions, dangling/loop junctions, nested external targets, a sibling-path boundary, and app0 itself being a junction. Optional symbolic-link subcases skip because this host lacks the privilege.This is still an uncommitted draft, tree
9899b6e7b8014a74a472725b97978bcfc26f4267, based on the published head; nothing has been pushed. Validation rebuilt the changed kernel object and relinked it with preserved same-base build objects, including the required Windows unwind processing. It is not a clean full build/CTest result. Full validation and collaborator-run Linux/Windows CI remain outstanding, and combined daily commit accounting is still uncertified.The draft merges textually with main
4a17c71757644170c6a0acfcc67fb17f81cff93fand #930358ad4eda77577412aab42a180a82fc164d1cfab1; those integrations have not been runtime tested. The wider audit retains a documentation conflict with #9239 and 22 inconclusive kernel comparisons because peers conflict with main. Patch, commands, binary/input hashes and logs:.codex/pr-maintainer/logs/pass-20261022T0534Z. AI-assisted.Imported from boykopovar/AnyPS5. Originally posted by ArjenS-LA on 2026-10-22T11:44:49Z.
@simonbronk I checked the #9732 overlap with Git's merge engine against main
8b3a6ba88d8fc74e768f1a7e8e9e36fb69842768, normalizing both PRs onto that same base. #8726 at4fb4187bd327a33cb139959d596c46782c3ac08dand #9732 ateb900c3d7a08388d9df34b9b1b4bd3799f8eade4each merge with main, but their combined tree conflicts indocs/dev/debt/libkernel.md.This is an adjacent documentation edit: the Windows directory-type entry is inserted immediately before your revised vector-I/O entry. Both entries should survive; the implementation files are separate.
I propose #8726 first, then rebasing #9732 while preserving both entries. Does that order work for you? Maintainers retain the final choice; no dependency has been declared before agreement. This check used source inspection and tree-only merges, with no new commits, builds or runtime tests.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T11:56:02Z.
Open #9732 changes the vector-I/O debt entry in
docs/dev/debt/libkernel.md; pairwise merge of the current heads conflicts in that file, though the implementation topics are independent. Please coordinate merge order with #9732 and preserve both documentation entries when rebasing. No duplicate implementation was found in the code paths.