fix(libkernel): fail chmod, truncate, utimes and rename through a regular file with ENOTDIR on Windows #8199

Merged
xXPBSXx merged 2 commits from upstream-pr/8199 into main 2026-10-20 05:31:36 +00:00
xXPBSXx commented 2026-10-20 02:24:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-20T02:24:35Z.


What

Uses NotFoundError_nid_no_patch from the previous change (Depends on #8195, which defines it; until that is merged this branch also carries its commit) on the not-found paths of chmod_nid_postfix, sceKernelTruncate_nid_postfix and sceKernelUtimes_nid_postfix, and in RenameGuestPath_nid_no_patch (libc rename and sceKernelRename): ENOENT becomes ENOTDIR when the nearest existing ancestor of the source is not a directory, or of the destination while the source exists. GuestFilesystem.cpp:735 expected ENOENT for truncate below a regular file; it now expects ENOTDIR.
Part of #8194 (the same bug in more calls; #8195 closes the issue).
Overlap: this branch and the -3 branch (chdir, remove, opendir, fopen) both add cases to the same loop of GuestFilesystem.cpp; whichever lands second rebases.

Tested

Windows 10 (19045), MinGW-w64 GCC 15.2.0, Release, on upstream/main + the previous change + this commit:

  • guest_filesystem: fails without the changes to Stdio.cpp and Rename.cpp, passes with them; guest_file_timestamp, guest_path_case, guest_directory pass.
  • python tools/check_conventions.py --base upstream/main: passes.
  • Not tested: Linux/macOS (unchanged paths), a console, a title run. chdir, remove, opendir, fopen and the trailing-slash form are not changed.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no silent stubs added
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: #8195
  • Unblocks: none
  • AI-assisted: yes

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4930103394 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8199). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-20T02:24:35Z. --- ### What Uses `NotFoundError_nid_no_patch` from the previous change (Depends on #8195, which defines it; until that is merged this branch also carries its commit) on the not-found paths of `chmod_nid_postfix`, `sceKernelTruncate_nid_postfix` and `sceKernelUtimes_nid_postfix`, and in `RenameGuestPath_nid_no_patch` (libc `rename` and `sceKernelRename`): ENOENT becomes ENOTDIR when the nearest existing ancestor of the source is not a directory, or of the destination while the source exists. `GuestFilesystem.cpp:735` expected ENOENT for `truncate` below a regular file; it now expects ENOTDIR. Part of #8194 (the same bug in more calls; #8195 closes the issue). Overlap: this branch and the `-3` branch (chdir, remove, opendir, fopen) both add cases to the same loop of `GuestFilesystem.cpp`; whichever lands second rebases. ### Tested Windows 10 (19045), MinGW-w64 GCC 15.2.0, Release, on upstream/main + the previous change + this commit: - `guest_filesystem`: fails without the changes to `Stdio.cpp` and `Rename.cpp`, passes with them; `guest_file_timestamp`, `guest_path_case`, `guest_directory` pass. - `python tools/check_conventions.py --base upstream/main`: passes. - Not tested: Linux/macOS (unchanged paths), a console, a title run. chdir, remove, opendir, fopen and the trailing-slash form are not changed. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; no silent stubs added - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: #8195 - [x] Unblocks: none - [x] AI-assisted: yes AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-20 02:30:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T02:30:11Z.


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.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 6942 core/libs/prx/libkernel/File/src/Stdio.cpp L1421-1422

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 core/libs/prx/libc/src/Rename.cpp
core/libs/prx/libkernel/File/src/Stdio.cpp
PR 6044 core/libs/tests/GuestFilesystem.cpp
PR 6879 core/libs/prx/libkernel/File/src/Stdio.cpp
PR 6977 core/libs/prx/libkernel/File/src/Stdio.cpp
PR 7121 core/libs/prx/libkernel/File/src/Stdio.cpp
PR 7201 core/libs/prx/libc/src/Rename.cpp
core/libs/prx/libkernel/File/src/Stdio.cpp
PR 7202 core/libs/tests/GuestFilesystem.cpp
PR 7332 core/libs/prx/libc/src/Rename.cpp
core/libs/prx/libkernel/File/src/Stdio.cpp
PR 7447 core/libs/prx/libkernel/File/src/Stdio.cpp
PR 7949 core/libs/prx/libkernel/File/src/Stdio.cpp
core/libs/tests/GuestFilesystem.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6281939956 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8199#issuecomment-6281939956). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T02:30:11Z. --- <!-- pr-overlap --> 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**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | [PR 6942](https://www.github.com/boykopovar/AnyPS5/pull/6942) | `core/libs/prx/libkernel/File/src/Stdio.cpp` [L1421-1422](https://github.com/boykopovar/AnyPS5/blob/d0ac490cb02974935d5aa3b9ba90d4a1c8d51375/core/libs/prx/libkernel/File/src/Stdio.cpp#L1421-L1422) | | | Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libc/src/Rename.cpp`<br>`core/libs/prx/libkernel/File/src/Stdio.cpp` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestFilesystem.cpp` | | [PR 6879](https://www.github.com/boykopovar/AnyPS5/pull/6879) | `core/libs/prx/libkernel/File/src/Stdio.cpp` | | [PR 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `core/libs/prx/libkernel/File/src/Stdio.cpp` | | [PR 7121](https://www.github.com/boykopovar/AnyPS5/pull/7121) | `core/libs/prx/libkernel/File/src/Stdio.cpp` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libc/src/Rename.cpp`<br>`core/libs/prx/libkernel/File/src/Stdio.cpp` | | [PR 7202](https://www.github.com/boykopovar/AnyPS5/pull/7202) | `core/libs/tests/GuestFilesystem.cpp` | | [PR 7332](https://www.github.com/boykopovar/AnyPS5/pull/7332) | `core/libs/prx/libc/src/Rename.cpp`<br>`core/libs/prx/libkernel/File/src/Stdio.cpp` | | [PR 7447](https://www.github.com/boykopovar/AnyPS5/pull/7447) | `core/libs/prx/libkernel/File/src/Stdio.cpp` | | [PR 7949](https://www.github.com/boykopovar/AnyPS5/pull/7949) | `core/libs/prx/libkernel/File/src/Stdio.cpp`<br>`core/libs/tests/GuestFilesystem.cpp` |
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!8199
No description provided.