fix(libkernel): stop O_NOFOLLOW from opening a Windows directory junction #7551
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7551"
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 mazen320 on 2026-10-18T13:23:48Z.
What
lstatreports a Windows directory junction as a symbolic link.openandsceKernelOpenwithO_NOFOLLOWstill opened the target and returned a descriptor. A symbolic link in that situation returnsEMLINK.O_NOFOLLOWnow returnsEMLINKfor a drive-absolute directory junction and does not open the target. An open without that flag still follows the junction. A volume mount is unchanged.Tested
Windows 11, WinLibs GCC 15.2.0, unelevated. Before the change, opening a junction with
O_NOFOLLOWreturned a descriptor. After the change,guest_filesystem(ctest #1200) passed:sceKernelOpenreturns0x8002001F,openreturns -1 with errno 31, and an open without the flag still returns a descriptor. Conventions passed againstupstream/main. GitHub Windows and Linux CI were not run.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T13:24:09Z.
I compared this with open #7530. The behavior is distinct: #7530 handles
rmdir/unlinkon drive-absolute junctions, while this PR handlesO_NOFOLLOWonopen/sceKernelOpen. Both includeWindowsSymbolicLink.hppinOpen.cppand extend the sameGuestFilesystem.cppfixture, so please coordinate the rebase/order and verify the combined fixture covers both no-follow rejection and removing the junction without touching its target. #7530 already has Windows evidence for the removal path; this PR reports the no-follow cases separately.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T13:25:03Z.
I fetched both PR heads and ran a local
git merge-treecomparison.Open.cppandGuestFilesystem.cppauto-merge;docs/dev/debt/libkernel.mdhas the sole content conflict, where both PRs edit the same Windows link behavior bullet. The combined branch is otherwise clean at the merge-tree level. This confirms the required rebase resolution is documentation-only; the combined Windows fixture should still run both behavior sets.Imported from boykopovar/AnyPS5. Originally posted by mazen320 on 2026-10-18T13:26:26Z.
They are separate. #7530 removes the junction. This one refuses to follow it when
O_NOFOLLOWis set.A local merge of the two heads keeps
Open.cppandGuestFilesystem.cppwithout a conflict. The filesystem test ends up with both checks:O_NOFOLLOWreturnsEMLINK, andrmdir/unlinkremove only the junction. The only conflict is the one debt sentence indocs/dev/debt/libkernel.md. Whichever lands second should keep both sentences.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T14:06:53Z.
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.
core/libs/prx/libkernel/File/src/Open.cppdocs/dev/debt/libkernel.mdcore/libs/tests/GuestFilesystem.cppdocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mdcore/libs/prx/libkernel/File/src/Open.cppcore/libs/prx/libkernel/File/src/Open.cppdocs/dev/debt/libkernel.mdcore/libs/prx/libkernel/File/src/Open.cppdocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mdImported from boykopovar/AnyPS5. Originally posted by TheTerr4 on 2026-10-18T14:59:34Z.
Windows runtime check. Windows 11 Pro 10.0.26200, Ryzen 7 7800X3D, WinLibs GCC 15.2.0 r7 (UCRT), Release.
This PR's head
e79cf0f75merged cleanly intomain385ed71f2; the full build andlibsboth exit 0.guest_filesystem,guest_posix_filesystemandguest_kernel_syspass, three repeated-j1runs.libkernel/File/src/Open.cpprestored tomain's version,guest_filesystemaborts (exit 0xc0000409) in the junction case (sceKernelOpenfollows the junction).guest_filesystemare skipped on this machine (Developer Mode is off); the junction cases ran.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-20T10:21:33Z.
Re-checked against current main (merges cleanly, junction path unchanged in logic), the new test and TheTerr4's Windows run with its negative control; merged.