fix(libkernel): report lookup errors when creating through a trailing slash #10319
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10319"
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 MarrasFederico on 2026-10-23T17:34:25Z.
What
openandsceKernelOpenwithO_CREATon a missing final name followed by/reported the host error (EISDIRon Linux; the existing debt recordsEINVALon Windows). FreeBSD 11.4 lookup rejects this case withENOENT, because only a directory can be created through a trailing slash.After a native open fails with
EISDIRorEINVAL, a trailing-separator creation request now checks the path's status. A missing path reports guestENOENT; metadata errors are mapped explicitly, includingELOOP. Other requests and existing directories keep their original result. This applies to ordinary and aliased guest paths, with both plain and exclusive creation covered. Failed requests create no file. The resolved debt item is removed; a concise replacement records the non-atomic host lookup/open sequence and that this has not been measured on a PS5.#8544, which edited the neighbouring
fcntldebt line, is merged, and the branch is rebased onto currentmainas one commit. #8658 adds a macOS existing-directory check at the native-open call; this correction is placed after the Windows directory fallback to avoid the insertion conflict.Tested
Ubuntu 26.04.1, kernel 7.0.0-38, GCC 15.2.0, Release,
BUILD_TESTING=ON. Windows was not compiled here; BunnyFl's Windows run is below. No title was run.main(7b0f1b6809).ctest --test-dir build -R 'guest_(path|filesystem|app_archive)' --output-on-failure -j12.main'sOpen.cpp,guest_path_errorsandguest_filesystemfail (checked again on the rebased head). Removing the lookup correction fails again; losing explicit metadata-error propagation fails the symlink-loop regression. The restored implementation passes.mainc8d34aa8f4):guest_filesystempasses 3 of 3, and fails 3 of 3 at the new aliased check with only the test lines applied._wopen'sEINVALintoENOENTfor plain and aliased paths, with and withoutO_EXCL, and creates no file.main's results.guest_path_errorsis built only underif(UNIX)(it uses::symlink), and the symlink-loop case was not run on Windows: that account cannot create symlinks.python3 tools/check_conventions.py --base origin/mainand whitespace checks pass.pr_overlap --branchscan flagged only the adjacentfcntldebt line of #8544, now merged. It finds no code conflict. Its not-compared PRs were inspected manually: #4630, #5021, #6044, #6149, #6740, #6830, #6936, #7049, #7088, #7105, #7121, #7149, #7201, #7202, #7464, #7509, #7565, #7653, #8010, #8520, #8553, #9074, #9133, #9256, #9284, #9293, #9297, #9302, #9557, #9561, #9566, #9575, #9669 and #9693. The macOS patches concern existing directories, the otherOpen.cppedits concern notifications, archives, argument copying or seek/write, and the test edits cover other scenarios. The debt edits concern other behaviors; #9256/#9557/#9561/#9566 also edit the neighboring longfcntlparagraph and may need a documentation rebase after the declared order. #6044 deletes an obsolete whole test file and requires rebasing independently.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 harisibrar1 on 2026-10-24T01:05:21Z.
Review: COMMENTED
Checked against main
11d6efa06cand FreeBSD 11.4lookup()(vfs_lookup.c, theTRAILINGSLASH/WILLBEDIR→ENOENTblock and theTRAILINGSLASHon a non-directory →ENOTDIRblock):lookup(): a missing final name with a trailing slash givesENOENT, existing directories keepEISDIR/EEXIST, and an existing file with a trailing slash still takes the host'sENOTDIRpath. Open.cpp is unchanged on main since your base, so the fix is still needed.git merge-treeagainst current main now conflicts indocs/dev/debt/libkernel.md, where main rewrote the neighbouringfcntlline. #8544 is already merged (85f2f2d478), so the declared merge order is satisfied and only a rebase is needed./parent-test-mount/missing-create/check inGuestFilesystem.cppalso runs on Windows, and the PR says Windows wasn't compiled. A Windows CI or local run ofguest_filesystemwould confirm that_wopen'sEINVALis corrected there as intended; I couldn't run it myself.Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T21:11:38Z.
Review: CHANGES_REQUESTED
The Linux tests exercise the missing-name, exclusive-create, no-file-created, and symlink-loop cases, and the lookup correction is appropriately limited to
O_CREATafterEISDIR/EINVAL. Two integration checks remain before approval:main, as required by CONTRIBUTING.md. This branch is based onaeeaefa, 6,761 commits behind currentmain; the nearbyfcntldebt history and the existingGuestFilesystemtest code have since moved.guest_filesystemandguest_path_errorson Windows. The change specifically maps Windows_wopen'sEINVAL, but Windows was not compiled for the reported runs and the hosted Windows product job is skipped for this path. Confirm both aliased and plain paths, including the symlink-loop case where the platform permits it, on the rebased head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T08:39:06Z.
Review: APPROVED
Reviewed the updated head
182c8be21791edf8acac4dcb0868163e6eeb54a4. It now includes current base10bec5c322eb581b3e959e6c7e18bcf09e068e96, resolving the requested rebase/conflict. The Windows workflow passes on this exact head; the earlier Linux build and focused guest path/filesystem/archive tests passed on the immediately preceding rebased tree, and the latest merge is reported as main plus the debt-file conflict resolution. The Windows report also covers plain and aliased missing paths, both create modes, no-file-created behavior, and unchanged existing-path behavior.guest_path_errorsand the symlink-loop case were not run on Windows because the target requires Unix symlinks. I did not rerun Linux locally on the final merge commit.