fix(filesystem): reject final dot removal paths #3436
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3436"
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 MarcZX10 on 2026-10-11T10:31:45Z.
What
On current
main, guest path resolution lexically normalizes the final.component away. As a result,rmdir("dir/."),sceKernelRmdir("dir/.")andremove("dir/.")can remove the directory. POSIX/FreeBSD requires these calls to fail withEINVAL.This checks the original final path component before removal. Missing paths still report
ENOENT, and a regular file used as the parent still reportsENOTDIR. The regression test covers all three APIs, a trailing separator after., and those existing error cases.Tested
Linux, GCC 12.2, Release build.
guest_filesystemfails on unmodifiedmainat the newrmdir("dir/.")assertion (returnsENOTDIRinstead ofEINVAL) and passes with this change.tools/check_conventions.py --base upstream/mainandgit diff --checkpass.No PS5 title or homebrew test was run. Windows was not tested.
Checklist
main(99c1c263); no other open PR implements these functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebtFixes #3116
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-11T10:33:39Z.
Thanks for picking up #3116, @MarcZX100. This builds on my branch
fix/rmdir-dot-component(9aaf6240, rebased ontomainthis morning and rechecked on Windows by @Silverash-i8 in #3116): the sameFinalPathComponentIsDot_nid_no_patchhelper and the same check insceKernelRmdir. Yourremovehandling is better than mine, though. It also givesENOTDIRforfile/., where my branch would still remove the file, and the test covers more.Would you mind adding
Co-authored-by: milescoviello <[email protected]>to the commit? Thanks either way.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T10:36:20Z.
Thanks for linking your branch and for the Windows validation. I added the requested
Co-authored-by: milescoviello <[email protected]>trailer to the updated commitb37ab31b1.The PR keeps the broader
removeerror handling and regression cases for missing paths andfile/.; your helper and the final-dot behavior are credited in the commit. The updated head will get a fresh CI run.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T11:42:53Z.
Checked on Linux (GCC, Release) with the PR merged onto current
main:guest_filesystempasses, and fails with the non-test changes reverted.rmdir,sceKernelRmdirandremovereturnEINVALfor a final.(also with a trailing separator), after theENOENT/ENOTDIRchecks, matching FreeBSDkern_rmdirat. Co-author credit is in place; merging once CI is green.