Repository navigation
fix(libkernel): keep the native open error when the Windows directory probe finds no directory - #8798
Conversation
… probe finds no directory When the native open failed with an error other than ENOENT, OpenNative probed whether the path is a directory with std::filesystem::is_directory. With the MinGW runtime that probe can set errno to ENOENT, and OpenNative then reported the probe's ENOENT instead of the open error. On Windows 11 22621 a symbolic link loop failed with ELOOP from the native open and sceKernelOpen returned 0x80020002, so guest_filesystem aborted at the ELOOP check added by boykopovar#8640. Keep the open error and restore it when the path is not a directory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed the exact head and its interaction with #8655. The directory metadata probe uses the error_code overload, but the C runtime may still alter errno; saving NativeOpen's failure before the probe and restoring it only when the path is not a directory preserves that original error. The directory-open branches still assign their established EEXIST/EISDIR behavior or return the directory descriptor. #8655's subsequent loop classification remains compatible when the restored native error is ELOOP. The reported Windows negative control and focused filesystem test set exercise the regression. Hosted eligibility, conventions, intake, labels, and report checks pass; platform build jobs are skipped, so I rely on the reported Windows run. No blocking issue found.
|
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.
|
|
Manual overlap check for the files the bot could not compare: of #5021, #6936, #7121, #7201, #7530, #8520 and #8658, only #8520 touches |
What
On
main57fdffd,guest_filesystemaborts on Windows 11 22621 (MinGW-w64 GCC 15.2 UCRT) at the check #8640 added:sceKernelOpenon the self-referencing link returns0x80020002(ENOENT). Probing the call in gdb:WindowsOpenError_nid_no_patchreturns ELOOP for the native open, as #8640 intended, so the error is lost afterwards. InOpenNative, an open that fails with anything but ENOENT is followed bystd::filesystem::is_directory(directory, error)to handle directory opens. With the MinGW runtime that probe can seterrnoto ENOENT, andOpenNativethen reports the probe's ENOENT (throughNotFoundError_nid_no_patch) instead of the open's error. #8640 was tested on Windows 11 26200, where the probe apparently leaveserrnoalone; the Windows CI job does not run for these pull requests.OpenNativenow keeps the open's error and restores it when the path is not a directory. The directory branch (EEXIST, EISDIR, directory descriptor) is unchanged. This affects every error other than ENOENT that the native open returns on Windows, not only ELOOP.#8655 (open, ELOOP below a symlink loop) changes the lines right after this block and does not conflict; this change does not depend on it.
Tested
Windows 11 22621, AMD Radeon RX 6700 XT (driver 26.8.1), WinLibs GCC 15.2 UCRT r7, Release,
BUILD_TESTING=ON, fresh build directory onmain57fdffd.guest_filesystemaborts (0xc0000409) at line 957; gdb on the failing open:WindowsOpenError_nid_no_patch -> 114(UCRT ELOOP),sceKernelOpen -> 0x80020002.guest_filesystempasses;ctest -R 'file|path|stream|open|stat|dir|fopen|libc|errno|symlink|link|filesystem'127/127.ctest -j 32: 1799 of 1801 pass. The other two fail the same way without this change:agc_driver_image_array_window_past_layer_limit(does not build on MinGW, test(agc): align the array window test's texels at run time #8310) andagc_driver_tessellation.tools/check_conventions.pypasses.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)🤖 Generated with Claude Code