fix(libkernel): truncate Windows files opened read-only #5684
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5684"
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-14T06:27:36Z.
Fixes #5095.
What
On Windows,
CreateFileWrejectsTRUNCATE_EXISTINGwithGENERIC_READalone, soopen(path, O_RDONLY | O_TRUNC)fails instead of truncating. For that flag combination, open with the access needed to truncate, then narrow the resulting handle to read-only. This matches the FreeBSD/Linux behavior while keeping the guest descriptor read-only. The implementation records the remaining Windows host sharing difference in technical debt.The three commits carry David’s implementation, regression, and debt update with his original commit authorship preserved.
Tested
guest_filesystemandguest_kernel_fcntlpassed (2/2).tools/check_conventions.py --base upstream/mainpassed.Checklist
main; no other open PR implements the same functionsImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T06:32:19Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/tests/GuestFilesystem.cppL232, L235Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-14T06:33:05Z.
Closing this duplicate: it carries the same Windows O_RDONLY|O_TRUNC fix already reviewed in #5112. The maintainer closed #5112 because no title-specific failure was identified and asked contributors to hold generic PRs while the queue is high. I should have found that history before opening this PR.
Pull request closed