Repository navigation
Conversation
Resolves a guest path the way FreeBSD 11's realpath does: a relative path starts from the guest working directory, "." and empty components are skipped, ".." drops the last component and never climbs above "/", every other component must exist, and one that is not a directory with anything after it is ENOTDIR. Backslashes separate components as in the rest of the path layer. The result is the guest path; the host is consulted only for existence and type, so host symlinks are followed but not reflected. A null buffer is PATH_MAX bytes from the application heap, a null path is EINVAL, an empty one ENOENT, and 1024 bytes or more in the input, the working directory or the result is ENAMETOOLONG. On failure the caller's buffer holds the path that failed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Windows run, since the description lists Linux only: Windows 11 Pro (26200), MinGW-w64 GCC 15.2.0 (WinLibs r7, the CI build), Release, configured like CI, Ryzen 9 5900X. This commit merged onto
I checked this one on Windows because Win32 path normalization drops trailing AI-assisted: yes (Claude Code). |
|
Thanks for the Windows run and the normalisation angle; the mutation check is the useful part. Added to the Tested section. |
|
Closing: |
|
Additional Windows validation of this proposal, without requesting reopening under the current first-stop rule. Tested PR head An additional host-symlink probe failed 5/5 runs. Under the guest filesystem root, create: Create the file and directory links with
Both marker files exist, so the second result is successful resolution through the wrong parent, rather than just a missing-file error. The proposal already mentions that host links are followed without reflecting their targets in the returned path; the second case demonstrates an additional behavioral consequence of that limitation. There is also a toolchain trap when guarding this case. On these native links, a standalone host-only probe reported: The native attributes include FILE_ATTRIBUTE_REPARSE_POINT, but this MinGW standard-library path reports the target's ordinary file/directory type. A local diagnostic guard using Windows reparse-point attributes, and In our PPSA99902 investigation, AI-assisted investigation and local changes: Codex. All claims above are from local builds, behavioral probes, and controlled startup logs; console behavior remains unverified. Fixture follow-up: the first diagnostic fixture used forward slashes in Windows reparse targets, which affected native lookup. I repeated the probe with native relative targets |
|
@SleglJan with |
|
@babyhuey thanks, reopened as #3147, rebased onto AI-assisted: yes (Claude Code) |
What
Adds
realpathto libc (imported fromlibSceLibcInternal), in a newsrc/RealPath.cpp. It follows FreeBSD 11'srealpath.con the guest side:EINVAL, an empty oneENOENT. A relative path starts from the guest working directory (getcwd); an absolute one from/..components are skipped;..drops the last resolved component and never climbs above/. Every other component must exist, and one that is not a directory with anything after it (file/x,file/,file/.,file/..) isENOTDIR. A missing component isENOENTeven when a later..would drop it. Backslashes are separators, as everywhere in the path layer.ENAMETOOLONGwhere FreeBSD gives it: 1024 bytes (PATH_MAX) or more in the input after the leading separator, in the working directory, in the result while a component remains, or in the result after appending one.ResolvePath_nid_no_patch, so a mount alias resolves and a blocked mount isENOENT; host symlinks are followed but not reflected in the result, since the guest filesystem exposes no symlinks.resolvedis aPATH_MAXbuffer from the application heap, which the title'sfreereleases (libcurl does,lib/vtls/vtls_scache.c). With a caller's buffer, a failure leaves the path that failed in it, as FreeBSD does.It does not depend on #1624 (
lstat) or #1627 (readlink): the resolution is lexical plus host existence checks, which is what the console's filesystem makes observable.Overlap: #1729 (
syslog) adds its source line to the same list inlibc/CMakeLists.txt; whichever merges second rebases one line.In the Linux audit of the homebrew catalog (#1578),
realpathwas absent for 17 of the 34 relinked titles. The callers are statically linked libraries: Mesa'sutil_dl_get_path_from_proc, libcurl's CA path keys and fontconfig'sFcStrRealPath; all of them accept a null return.Tested
BUILD_TESTING=ONandANYPS5_ENABLE_SPIRV_TOOLS=ONon this branch (based onmain4b005b2):ctest --repeat until-fail:3467/467;tools/check_test_registration.pyandtools/check_conventions.py --base upstream/mainpass.guest_realpathtest on a directory tree under the guest root:/, a directory with and without a trailing slash,..,., doubled slashes,..above the root, backslashes, an upper-cased directory name returned as typed, relative paths afterchdirincluding..back to/, a mount alias and a blocked mount, the allocated form freed withfree;EINVALfor null,ENOENTfor empty and for a missing component before..,ENOTDIRfor the four non-directory forms,ENAMETOOLONGfor an input of 1024 bytes and for/plus 1023 bytes (the append boundary),ENOENTfor a 1023-byte path of missing components, and the failing path left in the caller's buffer in each case. Written before the implementation; it failed on the unresolved export and passes with it.libc.prxexports the NID (vhtcIgZG-Lk).tools/import_audit.pyon five of the 17 catalog titles, absent imports before → after: PPSA59322 ccleste 50 → 49, PPSA99010 vkQuake 51 → 50, PPSA99505 Jelly5 30 → 29, PPSA99082 OpenNOW 36 → 35, PPSA99808 PICO-8 28 → 27. The before column is the Four open-source homebrew titles stop at start-up on unresolved imports (sysctl, pthread_set_name_np, isatty, mkstemp, signal sets, Opus decoders) #1578 audit (main4b005b2 + fix(relinker): keep Linux imports declared from host modules off guest exports #1529, which changes binding, not which NIDs the built libraries export); the after column is this branch onmain4b005b2. None of them loads yet; the remaining imports are listed in Four open-source homebrew titles stop at start-up on unresolved imports (sysctl, pthread_set_name_np, isatty, mkstemp, signal sets, Opus decoders) #1578.main6b56175), run 37822095572:guest_realpathpasses its three repeats, full suite 474/474. hikazey ran this commit merged ontomainb858fdc on Windows 11 with MinGW-w64 GCC 15.2.0:guest_realpath5/5, the full suite 478/478, and the test fails 5/5 with themoreFollows && !is_directorycheck disabled, so theENOTDIR, backslash, case-insensitive andENAMETOOLONGcases hold against Win32's path normalisation (comment). The code is platform-neutral (std::filesystemover the resolver's native paths) and the test is registered on both platforms likeguest_working_directory.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