fix(libc): keep a trailing slash on paths under a mount alias #4681
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4681"
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 milescoviello on 2026-10-12T18:56:31Z.
What
Guest path resolution trimmed the trailing slash of a path under a mount alias (
/savedata0,/download0,/app0and the others), so the host sawfileforfile/. Onmain, with a regular filefunder an alias:<alias>/f/mainunlink,remove,sceKernelUnlinkENOTDIRrename("f/", "g")ENOTDIRopen(O_RDONLY)ENOTDIRchmod,accessENOTDIRFreeBSD 11.4 rejects it in
lookup()(sys/kern/vfs_lookup.c):#2300 made
statfollow this; the other calls still acted on the file becauseResolveAliasdrops the slash before the host sees it, while a path outside an alias keeps it.On Linux and macOS a path under an alias now keeps its trailing slash on the host path, exactly as paths outside an alias already do, so the host fails with
ENOTDIRfor a file while directories with a trailing slash (stat,mkdir,rmdir) keep working. Windows keeps the previous behaviour, since its trailing-separator handling differs (#4513) and I could not test it; an entry indocs/dev/debt/libc.mdrecords that.Tested
Ubuntu 24.04, GCC 13.3 (CI's compiler), Release with CI's configure flags, on
main1acfa7f7.guest_filesystemgained checks under itsparent-test-mountalias:unlink,remove,rename,openandsceKernelUnlinkonfile/fail withENOTDIRand every file is still there,statofExisting/reports a directory, andmkdir/rmdirofslash-directory/work.main'sGeneral.cppthe test fails at the first new check (unlinkreturns 0 and deletes the file).guest_filesystempasses, also in 30 repeated runs; allguest_*tests exceptguest_video_out_*pass (310/310, two runs).Windows: @johnmaia built and ran it on Windows 11 with WinLibs GCC 15.2.0, merged into
main3faa9cb40. The full suite passes 1074 of 1074,guest_filesystemincluded. The new checks are skipped there, so this shows only that nothing else changes on Windows.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by johnmaia on 2026-10-13T13:37:00Z.
Windows build check. Setup: Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON,ctest -j4 --timeout 300, RTX 4080. Head 516e90d8d merged intomain3faa9cb40.It builds, and the full suite passes 1074 of 1074,
guest_filesystemincluded. The new trailing-slash checks are#ifndef _WIN32, so this only shows that nothing else changes on Windows.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T14:59:08Z.
Checked the build and scoped ctest on the PR merged onto main,
guest_filesystemrepeated 5 times, and that the new checks fail withResolveAliasreverted to main. The Windows runs by @johnmaia and @xXPBSXx confirm nothing else changes there. Merging after the full Build is green.Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-14T01:34:02Z.
Rebased onto
main34355eeea. The only conflict wasdocs/dev/debt/libc.md, next to the newtznameentry; both entries are kept. After the rebase, the build is clean,guest_filesystempasses 5/5 and all 354guest_*tests pass (Ubuntu 24.04, GCC 13.3, Release).AI-assisted: yes