Repository navigation
fix(libkernel): preserve directory identity across Windows renames - #6228
Conversation
|
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.
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.
|
|
Cross-check on Windows: #6228 head Host: Windows 11 Pro 26220, Ryzen 7 5700X, RTX 4070 (driver 596.21), WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release.
Titles. Catalog releases, relinked once with
Prospero Explorer opens every mount as a directory descriptor at startup, with the same lines from both builds: The logged
One behaviour change, found with a small guest-API probe (
With the real handle, Windows refuses to rename an ancestor of an open directory, as it already does for an open file. FreeBSD would allow the rename. This could be one sentence in the Verdict: confirmed. The stale-path read is fixed, the test fails on AI-assisted (Claude Code). |
64eae5a to
29fc849
Compare
29fc849 to
02371ec
Compare
|
Rechecked on head Host: Windows 11 Pro 26220, Ryzen 7 5700X, RTX 4070 (driver 596.21), WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release. What changed since my run on
Probe with the guest API (
Overlap.
Titles. Catalog releases relinked once, so only the libraries differ; "main" is the same tree with only this PR's source files reverted. Each ran 60 s with the display on; other builds were running on the host, so frame counts are only indicative. I first looked for titles that rename a directory.
No run has a stop line. For RetroArch the logs have the same 971 Not checked: Linux, symbolic-link branches, UNC paths, removed-directory enumeration, GPU tests. Verdict: confirmed again. The test fails on Written with Claude Code assistance (validation by a subagent, reviewed in this session). |
02371ec to
739e451
Compare
What
I reproduced a wrong-file read on main
d92a8dad390af1807cc91622b924252141816a5a: open a directory, duplicate its descriptor, close the original descriptor, rename the directory, then create a replacement at its old path.openat(dirfd, "marker", ...)reads the replacement's content andgetdents(dirfd, ...)lists the replacement's entries. Windows directory descriptors held aNULdescriptor and the original pathname. POSIX openat resolves relative to the directory associated with the descriptor.Directory descriptors now hold a real Windows directory handle with read/write/delete sharing. The CRT owns and duplicates that handle through the existing descriptor lifecycle, following the _open_osfhandle ownership contract. Cursor snapshots remain shared across aliases. Metadata uses the handle, and path-based operations and snapshot reloads query its current name through the existing native-path helper. Directory classification no longer depends on a pathname lookup succeeding.
The shared path helper normalizes Windows DOS/UNC prefixes for filesystem consumers and preserves native lookup errors.
fchdiralso verifies an equivalent root ancestor when Windows returns different pathname casing, then retains the virtual root's spelling for subsequent relative paths andgetcwd.Rebased onto main
11acfdd84e801a2eff6e76555df80a2fd1a68f95. The only manual conflict was the adjacent technical-debt entries: main'ssceKernelWriteThrottlingStatusnull-pointerEFAULTdescription is preserved together with the directory-identity changes. All 10 files retain the original 184 added and 33 removed lines; the source and regression-test changes are unchanged.Tested
Validation at head
739e451332fbe284b5395993f9189354774be326on main11acfdd84e801a2eff6e76555df80a2fd1a68f95.Windows (native host): Windows 11 Pro 10.0.26300, AMD Ryzen 9 7900X, 32 GB RAM, NVIDIA GeForce RTX 4070 Ti SUPER; WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, bundled dependencies, ccache. Graphics: not exercised.
cmake --build build_tools/b6228-739e --parallel 4).Linux (VirtualBox): Ubuntu 24.04.5 LTS, kernel 7.0.0-38-generic, VirtualBox 7.2.20 r175154 on the Windows host above, 4 vCPU, 8 GiB VM RAM; GCC 13.3.0, Ninja, Release, bundled dependencies, ext4. Graphics: not exercised.
relinker libs) and every selected test executable built successfully with two build jobs, including compilation of the graphics components.The same filter was used on both platforms; platform-specific tests account for the counts. Windows used
--parallel 2; Linux (VirtualBox) used the serial command below:ctest --test-dir build --no-tests=error --timeout 30 --output-on-failure --parallel 1 -R '^(guest_kernel_sys|guest_file_vector|guest_directory.*|guest_fdopendir|guest_working_directory|guest_dup|guest_kernel_fcntl|guest_fstatfs|guest_fstat_fault|guest_file_timestamps|guest_filesystem|guest_posix_filesystem|guest_kernel_rename|guest_aio|guest_sendfile|guest_shm_open|guest_realpath|guest_path_case|guest_file_lock_.*|guest_savedata_.*|download_data_mount_.*|patched_libraries|relinked_module.*|guest_(kernel_)?app_archive_.*|guest_append_writes|guest_positioned_close|guest_truncate|guest_fopen_errors|guest_fopen_long_host_path|guest_record_lock_owners)$'The selection covers the directory identity regression, alias lifetime/cursor sharing, enumeration/rewind,
openat/mkdirat/unlinkat,fchdir, directory read errors, metadata after removal, vector and append I/O, close/truncate, and application archives. Conventions, whitespace and test-registration checks passed.Static review covered the original patch, upstream delta
ca82d7d882b0ac17d955f6e107fe2eb0cae244af..11acfdd84e801a2eff6e76555df80a2fd1a68f95, build/test inputs, and the complete rebased patch. Independent line comparison confirmed preservation of both the original changes and the upstream changes in the overlapping sources.Overlap review: #6302, #6525 and #6897 are complementary changes with textual conflicts; there is no functional dependency. A future combination must retain both the directory check and transfer lock in
NativeFtruncate, both independent test groups, and #6897's invalid-descriptor guard without restoring the pathname-based stat fallback. Combined runtime validation was not performed.Linux graphics/Vulkan tests: NOT RUN — intentionally excluded from VirtualBox validation. Native/bare-metal Linux was not tested. Native Linux GPU validation: not tested. Retail titles, SMB/UNC execution and removed-directory enumeration were not tested. Path-based
*atoperations and enumeration reloads remain non-atomic with a concurrent rename, as recorded in technical debt. The Windows ancestor-rename restriction reported in the PR cross-check remains unchanged. No title compatibility or performance claim.Windows symbolic-link success branches in
guest_kernel_sysreport links unavailable; those branches are not claimed as covered.Original negative controls before rebase
At main
d92a8dad390af1807cc91622b924252141816a5a, the public API probe read the replacement marker and listed the replacement entries after rename. With original fix64eae5ab55f7a9fa0fdd4f3d777de009dd48a370, it retained the original marker and entries. The expandedguest_kernel_sysfailed on main at the replacement-content assertion. Restoring only main'sGeneral.cppalso made the fixture fail atfchdirwith guest errno 45. These are historical controls, separate from the current-head validation above.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)