Repository navigation
fix(libc): keep a trailing slash on paths under a mount alias - #4681
Merged
oneandonlydean merged 1 commit intoOct 14, 2026
Merged
Conversation
10 tasks done
milescoviello
force-pushed
the
fix/alias-trailing-slash
branch
from
October 13, 2026 04:53
c4b70e0 to
516e90d
Compare
11 tasks done
This was referenced Oct 13, 2026
10 tasks done
Contributor
|
Windows build check. Setup: Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release, It builds, and the full suite passes 1074 of 1074, AI-assisted: yes (Claude Code) |
Collaborator
This was referenced Oct 13, 2026
Guest path resolution trimmed the trailing slash of a path under a
mount alias (/savedata0, /download0, /app0 and the others), so the host
saw "file" for "file/": unlink, remove, sceKernelUnlink and rename
removed or moved the file, open opened it, and chmod and access
succeeded on it. The same path outside an alias already failed with
ENOTDIR, because the host got the slash.
FreeBSD 11.4 rejects it in lookup() (sys/kern/vfs_lookup.c):
/*
* If we're processing a path with a trailing slash,
* check that the end result is a directory.
*/
if ((cnp->cn_flags & TRAILINGSLASH) && dp->v_type != VDIR) {
error = ENOTDIR;
goto bad2;
}
On Linux and macOS a path under an alias now keeps its trailing slash
on the host path, as paths outside an alias do, so the host fails with
ENOTDIR for a file and directories with a trailing slash still work.
Windows keeps the previous behaviour; TechnicalDebt records it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
milescoviello
force-pushed
the
fix/alias-trailing-slash
branch
from
October 14, 2026 01:33
516e90d to
ccfadfb
Compare
Contributor
Author
|
Rebased onto AI-assisted: yes |
11 tasks done
11 tasks done
10 tasks done
12 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
main1acfa7f.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
main3faa9cb. 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