fix(libkernel): chmod read-only files before unlink on Windows #2651
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2651"
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 sridhar777911 on 2026-10-10T09:59:44Z.
What
Fixes Issue #2601. Unlink and sceKernelUnlink previously failed with EACCES on read-only files natively on Windows due to strict POSIX vs WIN32 semantic differences.
Tested
check_conventions.pyctestsuiteChecklist
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)Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-10T10:19:21Z.
Additional platform validation on standalone PR head
e80f6982f5d303f2fe2abfd52939cb5057aa9bf5:Linux: blocked or failed — Arch Linux in WSL2 (kernel 6.6.87.2), GCC 16.2.1 20260810; CMake 4.3.1 / Ninja.
Release /
BUILD_TESTING=ON: the selected-target build failed before CTest could run. No passing runtime-test claim.Reproduce:
cmake --build <build> --target guest_filesystem_tests.Tests:
guest_filesystem.Blocker: Command exited 1: cmake.
GCC reports a conflicting declaration of readOnly in core/libs/tests/GuestFilesystem.cpp:288; the same variable is already declared at line 107 in main(). The PR adds the second declaration in the same scope, so guest_filesystem_tests does not compile. Rename or reuse the new variable before this test can run.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T10:29:57Z.
Follow-up on the current PR head
This updates my earlier review because the PR head changed to
f42420e7. The current diff needs another cleanup pass before it can be reviewed as a one-topic pull request:85d16bccwhile currentmainisb0cccf20. The title is only about Windows read-only unlink.mainand retain only the unlink change and its regression tests.GuestFilesystem.cppdeclaresreadOnlyat lines 108 and 310 inmain().guest_filesystem_tests.NativeUnlinkaddsowner_writebefore retrying_wunlink, then returns on a second failure without restoring the original permissions.The PR overlaps issue #2601, where Achraf has Windows 11 evidence for both successful unlink and restoring read-only state when an open handle prevents deletion. Please coordinate on one canonical implementation and preserve that test evidence.
The latest automatic check shown here is Conventions only; it does not validate this broad diff or compile the failing Linux target. The focused test and the collaborator-triggered Linux/Windows Build plus relinker matrix required by
CONTRIBUTING.mdremain outstanding.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T11:06:34Z.
Review: CHANGES_REQUESTED
I cannot approve the current head
f42420e7yet. The merge-base diff is far broader than the titled unlink change, and the focused files still have correctness and build blockers:85d16bcc, while the title is only about Windows read-only unlink.mainand keep only this topic's source and tests.GuestFilesystem.cppdeclaresreadOnlyat lines 108 and 310 in the samemain()scope.guest_filesystem_tests.NativeUnlinkaddsowner_writebefore the retry; if the retry also fails, it returns without restoring the prior permissions.This overlaps issue #2601. Please coordinate with Achraf so the canonical patch retains their Windows evidence for both successful deletion and restoring the read-only attribute when deletion fails. The current automatic checks show Conventions only; focused tests and the repository-required collaborator-triggered Linux/Windows Build and Linux/Windows/macOS relinker matrix are still outstanding.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T12:00:59Z.
Windows validation update from issue #2601
A new native Windows report is available on issue #2601. It tested Achraf's narrow
fix/unlink-readonlycommitfbf0ec0aonmainb5f5362d:guest_filesystemOpen.cppreverted0xc0000409This confirms the regression and implementation on that branch under Windows; it is not validation of this PR's head.
PR #2651 remains at
f42420e7with 70 commits, 234 changed files (+6,050/−448), and Conventions as its only passing check. Current upstreammainis197ffac9. The scope, same-scope redeclaration, retry permission restoration, and required Build/relinker checks from my prior review still need resolution. Please coordinate with Achraf on one narrow carrier and preserve the new Windows evidence there.Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-10T12:13:56Z.
Hi @sridhar777911, I reported this as #2601. It has a one-commit fix,
AchrafReyani:fix/unlink-readonly(fbf0ec0a, +19/−1 inOpen.cppandGuestFilesystem.cpp), which I can't open as a PR because of the intake check. Rather than have two versions, feel free to take that commit into this PR, or reset this branch onto it, so there's one scoped change.It already addresses the points from the review above:
_wunlink, the shape the maintainer asked for on #2342.lockedPosix,lockedKernel) don't clash withreadOnly.Validation so far on #2601:
b5f5362d.b5f5362d. The new checks fail without theOpen.cppchange and pass with it.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T19:17:54Z.
Please reset this branch onto fbf0ec0a from #2601. As it is, it carries 70 unrelated commits,
guest_filesystem_testsdoesn't build (readOnlyis declared twice inmain()), andNativeUnlinkretries_wunlinkafterEACCES, which isn't allowed (see #2342). Otherwise I'll close it.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T09:58:05Z.
Closing: the fix for #2601 has already landed via #2910 (single commit, rebased on
main).This branch also can't be merged as is:
main.guest_filesystem_testsdoesn't build (readOnlyis declared twice inmain()ofGuestFilesystem.cpp).NativeUnlinkretries_wunlinkafterEACCES, which was ruled out in #2342.@oneandonlydean asked for a reset onto fbf0ec0a and there was no update. Welcome to open a new PR from a clean branch for anything else.
Pull request closed