fix(libc): fail chdir, remove, opendir and fopen through a regular file with ENOTDIR on Windows #8200

Merged
xXPBSXx merged 1 commit from upstream-pr/8200 into main 2026-10-20 06:50:10 +00:00
xXPBSXx commented 2026-10-20 02:24:40 +00:00 (Migrated from github.com)

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


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 chdir_nid_postfix, remove_nid_postfix, opendir_nid_postfix, fopen_nid_postfix and freopen_nid_postfix: ENOENT becomes ENOTDIR when the nearest existing ancestor of the host path is not a directory. No extra host call on success.
Part of #8194 (the same bug in more calls; #8195 closes the issue).
Overlap: the sibling PR for chmod, truncate, utimes and rename adds 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 Filesystem.cpp, Directory.cpp, General.cpp and FileAndHeap.cpp, passes with them; guest_working_directory, guest_directory, guest_path_case, guest_directory_buffer and guest_append_streams pass.
  • python tools/check_conventions.py --base upstream/main: passes.
  • Not tested: Linux/macOS (unchanged paths), a console, a title run. The trailing-slash form (file/) is 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:4930104028 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8200). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-20T02:24:40Z. --- ### 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 `chdir_nid_postfix`, `remove_nid_postfix`, `opendir_nid_postfix`, `fopen_nid_postfix` and `freopen_nid_postfix`: ENOENT becomes ENOTDIR when the nearest existing ancestor of the host path is not a directory. No extra host call on success. Part of #8194 (the same bug in more calls; #8195 closes the issue). Overlap: the sibling PR for chmod, truncate, utimes and rename adds 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 `Filesystem.cpp`, `Directory.cpp`, `General.cpp` and `FileAndHeap.cpp`, passes with them; `guest_working_directory`, `guest_directory`, `guest_path_case`, `guest_directory_buffer` and `guest_append_streams` pass. - `python tools/check_conventions.py --base upstream/main`: passes. - Not tested: Linux/macOS (unchanged paths), a console, a title run. The trailing-slash form (`file/`) is 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:12 +00:00 (Migrated from github.com)

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


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/General.cpp
PR 6044 core/libs/tests/GuestFilesystem.cpp
PR 6226 core/libs/prx/libc/src/General.cpp
PR 6879 core/libs/prx/libc/src/General.cpp
PR 7081 core/libs/prx/libc/src/FileAndHeap.cpp
PR 7201 core/libs/prx/libc/src/FileAndHeap.cpp
core/libs/prx/libc/src/General.cpp
PR 7202 core/libs/tests/GuestFilesystem.cpp
PR 7332 core/libs/prx/libc/src/FileAndHeap.cpp
core/libs/prx/libc/src/General.cpp
PR 7447 core/libs/prx/libc/src/FileAndHeap.cpp
core/libs/prx/libc/src/Filesystem.cpp
PR 7949 core/libs/tests/GuestFilesystem.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6281940308 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8200#issuecomment-6281940308). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T02:30:12Z. --- <!-- pr-overlap --> 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/General.cpp` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestFilesystem.cpp` | | [PR 6226](https://www.github.com/boykopovar/AnyPS5/pull/6226) | `core/libs/prx/libc/src/General.cpp` | | [PR 6879](https://www.github.com/boykopovar/AnyPS5/pull/6879) | `core/libs/prx/libc/src/General.cpp` | | [PR 7081](https://www.github.com/boykopovar/AnyPS5/pull/7081) | `core/libs/prx/libc/src/FileAndHeap.cpp` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libc/src/FileAndHeap.cpp`<br>`core/libs/prx/libc/src/General.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/FileAndHeap.cpp`<br>`core/libs/prx/libc/src/General.cpp` | | [PR 7447](https://www.github.com/boykopovar/AnyPS5/pull/7447) | `core/libs/prx/libc/src/FileAndHeap.cpp`<br>`core/libs/prx/libc/src/Filesystem.cpp` | | [PR 7949](https://www.github.com/boykopovar/AnyPS5/pull/7949) | `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!8200
No description provided.