fix(libkernel): stat a path with one host query #4938

Closed
fdfawef324 wants to merge 1 commit from upstream-pr/4938 into main
fdfawef324 commented 2026-10-13 05:40:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fdfawef324 on 2026-10-13T05:40:34Z.


What

On Windows, sceKernelStat (and stat, which calls it) queried each existing path four times:

  1. std::filesystem::exists in ResolveHostPath (General.cpp). This ran under the working-directory mutex, and also under the alias mutex for an aliased path.
  2. std::filesystem::status in sceKernelStat (Open.cpp).
  3. _wstat64 in DoStat (NativeStat.cpp).
  4. A second CreateFileW in DoStat.

lstat queried it three times. The queries could disagree. sceKernelStat threw FillFileStat: stat failed in these cases:

  • a file removed between status and DoStat;
  • a dangling link;
  • a directory symbolic link to a file, or a file symbolic link to a directory;
  • a file named with a trailing backslash, or with a last component . (file.txt/., file.txt\., fileLink/.).

The change:

  • Path resolution takes a probe (ResolvePathProbing_nid_no_patch) in place of the exists check on the exact host name.
    • ResolvePath_nid_no_patch and the two-argument ResolvePathError_nid_no_patch pass GuestPathExists_nid_no_patch, the former check, so other callers are unchanged.
    • The new three-argument ResolvePathError_nid_no_patch passes the probe it is given.
  • File::StatGuestPath passes a probe that does the whole stat:
    • one CreateFileW;
    • then GetFileType, GetFileInformationByHandle and GetFileInformationByHandleEx(FileBasicInfo) on that handle.
  • The probe's result is reused when resolution returns the probed path. Only a case-insensitive match or an explicit native path is opened a second time.
  • sceKernelStat and lstat use File::StatGuestPath. sceKernelStat tries the relinked .guest.prx name (File::PathOrRelinkedModule, from #4688) only when that query reports ENOENT, so a stat of an existing file stays one query.
  • FillFileStat(path) and fstat of a directory descriptor use the same single-open query. They therefore also throw when a handle query fails, and report ENOENT when the open fails.
  • A GetFileType result other than a disk file, character device or pipe now throws. The previous revision returned EBADF there, which sceKernelStat folded into ENOENT.
  • The working directory is copied under its mutex, and the matching alias under the alias mutex. Neither mutex is held while the file system is queried. chdir still resolves under the lock.
  • On Linux the stat is one stat(2) or lstat(2).

Paths that name a directory

A guest path that ends in / or \, or whose last component is . or .., names a directory, as in FreeBSD lookup():

  • stat and lstat follow a final link for it;
  • both report ENOTDIR when the result is not a directory.

The check uses the guest path, not the resolved host path. Resolution can drop the trailing separator, because it trims an aliased path. Path resolution itself is unchanged: it still turns file/.. into ENOTDIR and missing/.. into ENOENT, as main does.

I probed this with a scratch program outside the repository, on this machine. It ran against main's libraries, the previous revision of this PR, and this revision. stat agreed with sceKernelStat in every row.

path main: sceKernelStat / lstat previous revision this PR, stat and lstat
file.txt/., file.txt\., FILE.TXT/. throws FillFileStat / ENOENT 0100666, size 10 / ENOENT ENOTDIR
fileLink/., FILELINK/. throws FillFileStat / ENOENT 0100666, size 10 / ENOENT ENOTDIR
file.txt/./, file.txt/.//, file.txt/ ENOTDIR / ENOENT ENOTDIR ENOTDIR
file.txt/.., file.txt/../ ENOTDIR ENOTDIR ENOTDIR
missing/., missing/.., missing/./ ENOENT ENOENT ENOENT
Folder/., Folder/./, FOLDER/., Folder/.. the directory the directory the directory
dirLink/. the directory / throws "lstat of a Windows symbolic link not implemented" the directory / throws the directory
DIRLINK/./ the directory / throws the directory the directory

Where main threw, the new values follow FreeBSD. A component after a non-directory reports ENOTDIR, and a . component after a link follows the link. lstat of file.txt/ reported ENOENT on main. It now reports ENOTDIR, as FreeBSD does.

Mode and device fields

st_mode, st_rdev and the device and pipe fields keep the rules of the UCRT _wstat64 (Windows SDK 10.0.26100 ucrt/filesystem/stat.cpp):

  • read-only clears the write bits;
  • a name ending in .exe, .cmd, .bat or .com adds the execute bits;
  • the owner bits are copied to group and other;
  • st_rdev is the drive number;
  • character devices and pipes report S_IFCHR or S_IFIFO, with st_dev and st_rdev 0xffffffff.

Times, size, nlink, dev and ino come from the handle, as before. On Windows, st_blksize is the constant 512 and st_blocks is computed from the size, as before.

Links follow FreeBSD on purpose, not the system _wstat64. An earlier round of the same scratch probe compared the system _wstat64 (with both absolute and relative paths) against sceKernelStat, stat and lstat, on main and on this branch. Each case ran with no suffix, with / and with \.

path _wstat64 main this PR
file symlink to a 10-byte file 0100666, size 0 0100666, size 10 0100666, size 10
file symlink to a read-only file 0100666, size 0 0100666 0100444
read-only file symlink to a writable file 0100444, size 0 0100444 0100666
read-only directory symlink or junction to a writable directory 040555 040555 040777
link.exe to file.txt, plainLink to tool.exe 0100777, 0100666 same same
dangling file symlink, directory symlink or junction the link: 0100666, 040777 throws FillFileStat ENOENT
directory symlink to a file (Windows error 267) 040777 throws FillFileStat ENOENT
file symlink to a directory (Windows error 5) 0100666 throws FillFileStat ENOENT
fileLink/ ENOENT ENOTDIR ENOTDIR
fileLink\, file.txt\ ENOENT throws FillFileStat ENOTDIR
danglingFileLink/, dirAsFileLink/ ENOENT ENOTDIR ENOENT
roDirLink/, roJunction\ 040555 (the link) 040555 040777
Junction/Inner.txt/, dirLink/Inner.txt/ the file, 0100666 ENOTDIR; lstat reports the file ENOTDIR from stat and lstat
lstat("dirLink/"), lstat("Junction\") throws "lstat of a Windows symbolic link not implemented" the directory
lstat("file.txt/"), lstat("fileLink/") ENOENT ENOTDIR

How links are handled:

  • stat follows a final link. It opens a final symbolic link or junction without FILE_FLAG_OPEN_REPARSE_POINT, as FreeBSD stat(2) follows it. The file type, the read-only bit and every other field come from the target. Only the execute bits come from the name given, as in _wstat64.
  • _wstat64 reports the link itself. It takes the path through GetFileInformationByName (the GetFileInfoByName fast path in stat.cpp). That call reports a final link as itself, with or without a trailing separator: the link's own directory attribute and read-only bit, and size 0. Its CreateFileW fallback, taken only when that call fails, follows links as this code does.
  • A link that CreateFileW cannot follow reports ENOENT. This covers a dangling link, a directory symbolic link to a file, and a file symbolic link to a directory. _wstat64 reports the link in these cases.
  • lstat of a path that names a directory follows the final link, as described above.
  • lstat of a link without such a suffix still throws NotImplemented. #4691 changes the errno around that throw.

The other deviations from _wstat64:

  • A drive or UNC root that CreateFileW cannot open reports ENOENT. _wstat64 fabricates a directory dated 1980-01-01.
  • A file named with a trailing separator reports ENOTDIR. _wstat64 reports ENOENT, or the file itself when an earlier component is a link.
  • If GetFileType reports an unexpected type or either handle query fails, the call throws. _wstat64 returns the mapped error.
  • A path that cannot be opened for any reason reports ENOENT. FreeBSD reports the cause: EACCES, ENAMETOOLONG, ELOOP, or ENOTDIR for a path that continues past a file.

Each of these deviations is recorded in the "Windows file identity" entry of docs/dev/debt/libkernel.md. None of these values has been compared with a console.

No speed change is claimed: no title was run and no trace was captured.

  • #4688 (relinked .guest.prx names) is now in main. This PR is rebased onto it and keeps its TestRelinkedModuleNames, which passes.
  • #4691 (@ivica00, preserve errno when lstat rejects a Windows symbolic link)
    • Conflicts in Stdio.cpp (lstat_nid_postfix).
    • Proposed order: #4691 first, because it is small.
    • This PR then rebases and keeps #4691's errno save and restore around File::StatGuestPath.
  • #4565 (%VAR% mount tokens)
    • Conflicts only textually, in General.hpp and General.cpp.
    • Its ExpandPathSegment runs before the probe, so whichever PR lands second rebases.
  • #4379 (chflags)
    • Conflicts with main, and with this PR, in the same docs/dev/debt/libkernel.md hunk.
    • It does not change stat.

I last checked #4691, #4565 and #4379 for the previous revision. I have not contacted their authors yet, so the order is a proposal until they agree. This PR works without any of them.

Tested

OS: Windows Server 2025, GPU RTX 3060, GCC 15.2 (winlibs UCRT). Not tested with a title.

Linux was not built locally. The Linux branches of the change and of the test are reasoned only. A full Linux CI run needs a collaborator to start it.

guest_filesystem has three new tests:

  • TestStatFields compares sceKernelStat and stat against GetFileInformationByHandle and FILE_BASIC_INFO (stat(2) on Linux). It checks mode, size, nlink, ino, dev, rdev, blocks, blksize and all four times for:
    • a file, a case-mismatched name, a read-only file and an .EXE;
    • a directory, with and without a trailing /;
    • a junction (a directory symlink on Linux);
    • a read-only junction to a writable directory (040777);
    • a file reached through a junction;
    • symbolic links to a file and to a read-only file (0100444).
  • TestStatFields also checks lstat("Junction/") against the directory, and the junction lstat throw.
  • TestStatFields checks the error code and that the buffer is untouched for:
    • a missing file and a missing parent;
    • a dangling junction, with and without /;
    • the empty path;
    • a file, or a file link, with / or \ (ENOTDIR from all three calls);
    • a directory symbolic link to a file, and a file symbolic link to a directory.
  • TestStatDotComponents starts from the reviewer's reproduction and pins the first table above for sceKernelStat, stat and lstat:
    • file.txt with /., /./, \., /.//, /.. and /../, plus FILE.TXT/., FileLink/. and FILELINK/.: ENOTDIR, with the buffer untouched;
    • Missing with /., /.. and /./: ENOENT;
    • Folder/., Folder/./, FOLDER/., Junction/. and junction/./: the directory's fields, with lstat equal to sceKernelStat of Folder;
    • Folder/..: the parent's fields.
  • Some of these run through a path alias as well: file.txt with /, /., \. and /./, Missing/., Folder/. and Junction/.
  • Symbolic links are created with SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE. If that fails, the test prints that the file-link cases were not tested, as GuestKernelSys does. Here they ran.
  • TestStatDuringRemoval stats a file while another thread creates and removes it 300 times.

Red:

  • With the fix reverted (the previous revision's trailing-separator check restored) and the new test, guest_filesystem fails at the first file.txt/. check in 2 of 2 runs. sceKernelStat returns 0 there.
  • With main's libraries and the new test, TestStatDotComponents aborts on file.txt/. with FillFileStat: stat failed. In the committed order, TestStatFields aborts first, at lstat("Junction/") (lstat of a Windows symbolic link not implemented).
  • Earlier rounds showed the other main-only failures:
    • the read-only junction's st_mode (main reports 040555);
    • lstat("Data.bin/") (ENOENT);
    • Data.bin\ and the dangling junction;
    • the removal race (3 of 3 runs).

Green, after the rebase onto current main (88107b7de):

  • guest_filesystem passed 5 of 5 runs (0.5 s each).
  • ctest --test-dir build-dev/core/libs/prx/libkernel -j 4: 121/121 passed.
  • ctest --test-dir build-dev/core/libs/prx/libc -j 4: 82/83 passed. log_macros fails the same way on main.
  • tools/check_test_registration.py: 749 test executables, none new.

Not rerun this round: the other users of the resolver (AppContent, AvPlayer, Font, LibcInternal, Ngs2, PlayGo, SaveData). Relative to the previous revision, this one does not change libc. The previous review ran them, and they passed.

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 (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4838898558 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4938). Originally posted by [fdfawef324](https://github.com/fdfawef324) on 2026-10-13T05:40:34Z. --- ### What On Windows, `sceKernelStat` (and `stat`, which calls it) queried each existing path four times: 1. `std::filesystem::exists` in `ResolveHostPath` (General.cpp). This ran under the working-directory mutex, and also under the alias mutex for an aliased path. 2. `std::filesystem::status` in `sceKernelStat` (Open.cpp). 3. `_wstat64` in `DoStat` (NativeStat.cpp). 4. A second `CreateFileW` in `DoStat`. `lstat` queried it three times. The queries could disagree. `sceKernelStat` threw `FillFileStat: stat failed` in these cases: - a file removed between `status` and `DoStat`; - a dangling link; - a directory symbolic link to a file, or a file symbolic link to a directory; - a file named with a trailing backslash, or with a last component `.` (`file.txt/.`, `file.txt\.`, `fileLink/.`). The change: - Path resolution takes a probe (`ResolvePathProbing_nid_no_patch`) in place of the `exists` check on the exact host name. - `ResolvePath_nid_no_patch` and the two-argument `ResolvePathError_nid_no_patch` pass `GuestPathExists_nid_no_patch`, the former check, so other callers are unchanged. - The new three-argument `ResolvePathError_nid_no_patch` passes the probe it is given. - `File::StatGuestPath` passes a probe that does the whole stat: - one `CreateFileW`; - then `GetFileType`, `GetFileInformationByHandle` and `GetFileInformationByHandleEx(FileBasicInfo)` on that handle. - The probe's result is reused when resolution returns the probed path. Only a case-insensitive match or an explicit native path is opened a second time. - `sceKernelStat` and `lstat` use `File::StatGuestPath`. `sceKernelStat` tries the relinked `.guest.prx` name (`File::PathOrRelinkedModule`, from #4688) only when that query reports `ENOENT`, so a stat of an existing file stays one query. - `FillFileStat(path)` and `fstat` of a directory descriptor use the same single-open query. They therefore also throw when a handle query fails, and report `ENOENT` when the open fails. - A `GetFileType` result other than a disk file, character device or pipe now throws. The previous revision returned `EBADF` there, which `sceKernelStat` folded into `ENOENT`. - The working directory is copied under its mutex, and the matching alias under the alias mutex. Neither mutex is held while the file system is queried. `chdir` still resolves under the lock. - On Linux the stat is one `stat(2)` or `lstat(2)`. #### Paths that name a directory A guest path that ends in `/` or `\`, or whose last component is `.` or `..`, names a directory, as in FreeBSD `lookup()`: - `stat` and `lstat` follow a final link for it; - both report `ENOTDIR` when the result is not a directory. The check uses the guest path, not the resolved host path. Resolution can drop the trailing separator, because it trims an aliased path. Path resolution itself is unchanged: it still turns `file/..` into `ENOTDIR` and `missing/..` into `ENOENT`, as main does. I probed this with a scratch program outside the repository, on this machine. It ran against main's libraries, the previous revision of this PR, and this revision. `stat` agreed with `sceKernelStat` in every row. | path | main: `sceKernelStat` / `lstat` | previous revision | this PR, `stat` and `lstat` | |---|---|---|---| | `file.txt/.`, `file.txt\.`, `FILE.TXT/.` | throws `FillFileStat` / `ENOENT` | `0100666`, size 10 / `ENOENT` | `ENOTDIR` | | `fileLink/.`, `FILELINK/.` | throws `FillFileStat` / `ENOENT` | `0100666`, size 10 / `ENOENT` | `ENOTDIR` | | `file.txt/./`, `file.txt/.//`, `file.txt/` | `ENOTDIR` / `ENOENT` | `ENOTDIR` | `ENOTDIR` | | `file.txt/..`, `file.txt/../` | `ENOTDIR` | `ENOTDIR` | `ENOTDIR` | | `missing/.`, `missing/..`, `missing/./` | `ENOENT` | `ENOENT` | `ENOENT` | | `Folder/.`, `Folder/./`, `FOLDER/.`, `Folder/..` | the directory | the directory | the directory | | `dirLink/.` | the directory / throws "lstat of a Windows symbolic link not implemented" | the directory / throws | the directory | | `DIRLINK/./` | the directory / throws | the directory | the directory | Where main threw, the new values follow FreeBSD. A component after a non-directory reports `ENOTDIR`, and a `.` component after a link follows the link. `lstat` of `file.txt/` reported `ENOENT` on main. It now reports `ENOTDIR`, as FreeBSD does. #### Mode and device fields `st_mode`, `st_rdev` and the device and pipe fields keep the rules of the UCRT `_wstat64` (Windows SDK 10.0.26100 `ucrt/filesystem/stat.cpp`): - read-only clears the write bits; - a name ending in `.exe`, `.cmd`, `.bat` or `.com` adds the execute bits; - the owner bits are copied to group and other; - `st_rdev` is the drive number; - character devices and pipes report `S_IFCHR` or `S_IFIFO`, with `st_dev` and `st_rdev` 0xffffffff. Times, size, nlink, dev and ino come from the handle, as before. On Windows, `st_blksize` is the constant 512 and `st_blocks` is computed from the size, as before. #### Links, and where this differs from `_wstat64` Links follow FreeBSD on purpose, not the system `_wstat64`. An earlier round of the same scratch probe compared the system `_wstat64` (with both absolute and relative paths) against `sceKernelStat`, `stat` and `lstat`, on main and on this branch. Each case ran with no suffix, with `/` and with `\`. | path | `_wstat64` | main | this PR | |---|---|---|---| | file symlink to a 10-byte file | `0100666`, size 0 | `0100666`, size 10 | `0100666`, size 10 | | file symlink to a read-only file | `0100666`, size 0 | `0100666` | `0100444` | | read-only file symlink to a writable file | `0100444`, size 0 | `0100444` | `0100666` | | read-only directory symlink or junction to a writable directory | `040555` | `040555` | `040777` | | `link.exe` to `file.txt`, `plainLink` to `tool.exe` | `0100777`, `0100666` | same | same | | dangling file symlink, directory symlink or junction | the link: `0100666`, `040777` | throws `FillFileStat` | `ENOENT` | | directory symlink to a file (Windows error 267) | `040777` | throws `FillFileStat` | `ENOENT` | | file symlink to a directory (Windows error 5) | `0100666` | throws `FillFileStat` | `ENOENT` | | `fileLink/` | `ENOENT` | `ENOTDIR` | `ENOTDIR` | | `fileLink\`, `file.txt\` | `ENOENT` | throws `FillFileStat` | `ENOTDIR` | | `danglingFileLink/`, `dirAsFileLink/` | `ENOENT` | `ENOTDIR` | `ENOENT` | | `roDirLink/`, `roJunction\` | `040555` (the link) | `040555` | `040777` | | `Junction/Inner.txt/`, `dirLink/Inner.txt/` | the file, `0100666` | `ENOTDIR`; `lstat` reports the file | `ENOTDIR` from `stat` and `lstat` | | `lstat("dirLink/")`, `lstat("Junction\")` | | throws "lstat of a Windows symbolic link not implemented" | the directory | | `lstat("file.txt/")`, `lstat("fileLink/")` | | `ENOENT` | `ENOTDIR` | How links are handled: - **`stat` follows a final link.** It opens a final symbolic link or junction without `FILE_FLAG_OPEN_REPARSE_POINT`, as FreeBSD `stat(2)` follows it. The file type, the read-only bit and every other field come from the target. Only the execute bits come from the name given, as in `_wstat64`. - **`_wstat64` reports the link itself.** It takes the path through `GetFileInformationByName` (the `GetFileInfoByName` fast path in `stat.cpp`). That call reports a final link as itself, with or without a trailing separator: the link's own directory attribute and read-only bit, and size 0. Its `CreateFileW` fallback, taken only when that call fails, follows links as this code does. - **A link that `CreateFileW` cannot follow reports `ENOENT`.** This covers a dangling link, a directory symbolic link to a file, and a file symbolic link to a directory. `_wstat64` reports the link in these cases. - **`lstat` of a path that names a directory follows the final link,** as described above. - **`lstat` of a link without such a suffix still throws `NotImplemented`.** #4691 changes the errno around that throw. The other deviations from `_wstat64`: - A drive or UNC root that `CreateFileW` cannot open reports `ENOENT`. `_wstat64` fabricates a directory dated 1980-01-01. - A file named with a trailing separator reports `ENOTDIR`. `_wstat64` reports `ENOENT`, or the file itself when an earlier component is a link. - If `GetFileType` reports an unexpected type or either handle query fails, the call throws. `_wstat64` returns the mapped error. - A path that cannot be opened for any reason reports `ENOENT`. FreeBSD reports the cause: `EACCES`, `ENAMETOOLONG`, `ELOOP`, or `ENOTDIR` for a path that continues past a file. Each of these deviations is recorded in the "Windows file identity" entry of `docs/dev/debt/libkernel.md`. None of these values has been compared with a console. No speed change is claimed: no title was run and no trace was captured. #### Related pull requests - **#4688** (relinked `.guest.prx` names) is now in main. This PR is rebased onto it and keeps its `TestRelinkedModuleNames`, which passes. - **#4691** (@ivica00, preserve errno when `lstat` rejects a Windows symbolic link) - Conflicts in `Stdio.cpp` (`lstat_nid_postfix`). - Proposed order: #4691 first, because it is small. - This PR then rebases and keeps #4691's errno save and restore around `File::StatGuestPath`. - **#4565** (`%VAR%` mount tokens) - Conflicts only textually, in `General.hpp` and `General.cpp`. - Its `ExpandPathSegment` runs before the probe, so whichever PR lands second rebases. - **#4379** (chflags) - Conflicts with main, and with this PR, in the same `docs/dev/debt/libkernel.md` hunk. - It does not change stat. I last checked #4691, #4565 and #4379 for the previous revision. I have not contacted their authors yet, so the order is a proposal until they agree. This PR works without any of them. ### Tested OS: Windows Server 2025, GPU RTX 3060, GCC 15.2 (winlibs UCRT). Not tested with a title. Linux was not built locally. The Linux branches of the change and of the test are reasoned only. A full Linux CI run needs a collaborator to start it. `guest_filesystem` has three new tests: - `TestStatFields` compares `sceKernelStat` and `stat` against `GetFileInformationByHandle` and `FILE_BASIC_INFO` (`stat(2)` on Linux). It checks mode, size, nlink, ino, dev, rdev, blocks, blksize and all four times for: - a file, a case-mismatched name, a read-only file and an `.EXE`; - a directory, with and without a trailing `/`; - a junction (a directory symlink on Linux); - a read-only junction to a writable directory (`040777`); - a file reached through a junction; - symbolic links to a file and to a read-only file (`0100444`). - `TestStatFields` also checks `lstat("Junction/")` against the directory, and the junction `lstat` throw. - `TestStatFields` checks the error code and that the buffer is untouched for: - a missing file and a missing parent; - a dangling junction, with and without `/`; - the empty path; - a file, or a file link, with `/` or `\` (`ENOTDIR` from all three calls); - a directory symbolic link to a file, and a file symbolic link to a directory. - `TestStatDotComponents` starts from the reviewer's reproduction and pins the first table above for `sceKernelStat`, `stat` and `lstat`: - `file.txt` with `/.`, `/./`, `\.`, `/.//`, `/..` and `/../`, plus `FILE.TXT/.`, `FileLink/.` and `FILELINK/.`: `ENOTDIR`, with the buffer untouched; - `Missing` with `/.`, `/..` and `/./`: `ENOENT`; - `Folder/.`, `Folder/./`, `FOLDER/.`, `Junction/.` and `junction/./`: the directory's fields, with `lstat` equal to `sceKernelStat` of `Folder`; - `Folder/..`: the parent's fields. - Some of these run through a path alias as well: `file.txt` with `/`, `/.`, `\.` and `/./`, `Missing/.`, `Folder/.` and `Junction/`. - Symbolic links are created with `SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE`. If that fails, the test prints that the file-link cases were not tested, as `GuestKernelSys` does. Here they ran. - `TestStatDuringRemoval` stats a file while another thread creates and removes it 300 times. Red: - With the fix reverted (the previous revision's trailing-separator check restored) and the new test, `guest_filesystem` fails at the first `file.txt/.` check in 2 of 2 runs. `sceKernelStat` returns 0 there. - With main's libraries and the new test, `TestStatDotComponents` aborts on `file.txt/.` with `FillFileStat: stat failed`. In the committed order, `TestStatFields` aborts first, at `lstat("Junction/")` (`lstat of a Windows symbolic link not implemented`). - Earlier rounds showed the other main-only failures: - the read-only junction's `st_mode` (main reports `040555`); - `lstat("Data.bin/")` (`ENOENT`); - `Data.bin\` and the dangling junction; - the removal race (3 of 3 runs). Green, after the rebase onto current main (88107b7de): - `guest_filesystem` passed 5 of 5 runs (0.5 s each). - `ctest --test-dir build-dev/core/libs/prx/libkernel -j 4`: 121/121 passed. - `ctest --test-dir build-dev/core/libs/prx/libc -j 4`: 82/83 passed. `log_macros` fails the same way on main. - `tools/check_test_registration.py`: 749 test executables, none new. Not rerun this round: the other users of the resolver (AppContent, AvPlayer, Font, LibcInternal, Ngs2, PlayGo, SaveData). Relative to the previous revision, this one does not change libc. The previous review ran them, and they passed. ### 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](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
xXPBSXx commented 2026-10-13 08:20:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T08:20:57Z.


Windows test of this PR.

Environment: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, BUILD_TESTING=ON, -j2, libusb-cmake from a local checkout. Built from main c2565f014 with this PR and ten other open PRs (#4972, #4967, #4966, #4945, #4938, #4936, #4933, #4898, #4896, #4888) merged together; the merges had no conflict.

Result: guest_filesystem (1 of 1, 5.4 s) pass.

Not checked: whether the test fails without the change in the library code; the PR was not tested alone, only in the combined merge; no title run; Linux not tested.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6141390455 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4938#issuecomment-6141390455). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-13T08:20:57Z. --- Windows test of this PR. Environment: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, `BUILD_TESTING=ON`, `-j2`, `libusb-cmake` from a local checkout. Built from `main` `c2565f014` with this PR and ten other open PRs (#4972, #4967, #4966, #4945, #4938, #4936, #4933, #4898, #4896, #4888) merged together; the merges had no conflict. Result: guest_filesystem (1 of 1, 5.4 s) pass. Not checked: whether the test fails without the change in the library code; the PR was not tested alone, only in the combined merge; no title run; Linux not tested. AI-assisted (Claude Code).
oneandonlydean commented 2026-10-14 02:35:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T02:35:42Z.


Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6159620108 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4938#issuecomment-6159620108). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T02:35:42Z. --- Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.

Pull request closed

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!4938
No description provided.