fix(libkernel): clamp Windows birth time when setting earlier timestamps #8641
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8641"
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 Danigamer05 on 2026-10-20T19:53:17Z.
What
On Windows, setting an mtime before a file's creation time left
st_birthtimunchanged. FreeBSD 11.4'ssetutimeslowers birth time to the requested mtime in this case, including a current-time request when the existing birth time is in the future.Read creation time in the shared Windows timestamp setter and pass the earlier mtime to
SetFileTimeas creation time only when it is smaller. Request read/write attribute access on its path and descriptor handles. An equal or later mtime retains the existing native creation time and its 100 ns precision. Timestamp conversion and validation still happen before any birth-time update.Extend the existing runtime regression for
utimes,lutimes,futimes,sceKernelUtimesandsceKernelFutimes, on both regular files and directories with read-only descriptors. It checks earlier/equal/later times, a difference below one microsecond, invalid-input preservation, native metadata, guest stat/fstat and NULL/current-time requests. Document the remaining concurrent-host-update and console-verification limits.Tested
Windows 11, build 26200, AMD Ryzen 7 3700X, supported WinLibs MinGW-w64 GCC 15.2.0 r7; Release, bundled dependencies,
BUILD_TESTING=ON,ANYPS5_RELINKER_ONLY=OFF.Base:
2185dbf92e8d9013a1620d2dfc95de50494e19f8. Tested head:3f8f81e1752ae4c830296d8c78624b25ce2274eb.cmake --build build --target libs relinker guest_file_timestamp_tests guest_filesystem_tests guest_posix_filesystem_tests kernel_error_tests --parallel 12passed. This builds every production library and the relinker, plus the selected runtime executables.guest_file_timestampsregression fails at the native birth-time assertion with the original timestamp implementation. Rebuilding main with its original test then passes all four selected tests.ctest --test-dir build -R "^(guest_file_timestamps|guest_filesystem|guest_posix_filesystem|kernel_error)$" --repeat until-fail:3 -V: all four tests pass in all three runs (12 process runs, no skips).python tools/check_conventions.py --base origin/mainand whitespace checks pass. Ranpython tools/pr_overlap.py --branch fix/libkernel-windows-birthtime --repo boykopovar/AnyPS5: no confirmed overlap. Its 21 stale shared-file PRs were inspected separately; none adds this birth-time adjustment. #6044 relocates the test file; it is not a duplicate implementation. These stale branches are not claimed merge-clean.Not tested: Linux/macOS, a console, a title, GPU execution, coarse-resolution or network filesystems, host ACL denial and concurrent host timestamp writers. No compatibility or performance claim.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-20T22:38:41Z.
Independent Windows run of this PR (data only).
Environment: Windows 10 Pro 10.0.19045, Ryzen 7 5800X3D, WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release, BUILD_TESTING=ON. Merge-tree of the PR head against
main339217ebc9is clean. I built onlyguest_file_timestamp_tests;ctest -N -R guest_file_timestampslists exactly one test.Results (3 runs each):
guest_file_timestampspasses 3/3.core/libs/prx/libkernel/File/src/Stdio.cppwith the version from the PR's merge base (2185dbf92e); currentmaindoes not compile against the PR tree here (ReadDirectoryDescriptorarity differs), then rebuilt. The test fails 3/3. I restored the PR'sStdio.cppafterwards.Not run: other platforms, the other file tests, the full repository CTest, and any title or console run.
AI-assisted (Claude Code).