Repository navigation
fix(libc): map ENODATA, ENOSR, ENOSTR, EOTHER, and ETIME in GuestErrnoFromHost - #27924
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Change: Bug fix Merge Risk:
|
PrivacyOnion
left a comment
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 9ecd67a22e:
- Conventions:
tools/check_conventions.pypassed. - Build:
guest_atoi_testsbuilt cleanly. - CTest (
guest_atoi):1/1 Test #1482: guest_atoi ....................... Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 - Negative control: with
core/libs/prx/libc/src/HostErrno.cppreverted tomainand the new tests kept, the suite fails:Restoring the change makes it pass again.1/1 Test #1482: guest_atoi .......................***Failed 0.03 sec 0% tests passed, 1 tests failed out of 1 - Code reading:
- Verified HostErrnoMap mappings in core/libs/prx/libc/src/HostErrno.cpp: ENODATA -> 1040, ENOSR -> 1050, ENOSTR -> 1051, EOTHER -> 1062, ETIME -> 1074 match the guest error codes defined in Errors.cpp.
- Verified GuestErrnoFromHost_nid_no_patch linear search properly looks up the host errno and returns the mapped guest errno before the fallback bounds check error > 0 && error <= 34.
- Verified all macros ENODATA, ENOSR, ENOSTR, EOTHER, and ETIME are cleanly wrapped with #ifdef guards for portability across Linux, Windows UCRT, and macOS.
- Verified unit test core/libs/tests/GuestAtoi.cpp errnoCases[] adds valid regression cases exercising each newly mapped host error code against its expected guest integer value.
- Verified compliance with AGENTS.md rules: no prohibited comments added, no unhandled inputs or title-specific workarounds, no extra files or unauthorized submodule modifications.
Looks Good To Me
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The change maps the five guarded host errno values to the guest codes and adds matching cases to the existing errno test; both changed files were read at the pinned head.
What I ran
- Read the prepared description, commit list, manifest, diff, and full text of both changed files through
repo_read.pyat head9ecd67a22e8d56b35c56211455d8347f44c35f70. - No tests or build commands were run. No merged-preview check was run.
Results
| Check | Result | Note |
|---|---|---|
| Changed-file review | passed | Both changed files read |
| Tests | not run | Test additions inspected only |
| Build and merged preview | not run | Not checked |
Findings
Blocking
None.
Non-blocking
None.
Not verified
Runtime behavior and compilation on Windows UCRT, Linux, and macOS were not verified. Files listed in the manifest as reviewed: core/libs/prx/libc/src/HostErrno.cpp and core/libs/tests/GuestAtoi.cpp; both were read. No files were excluded by the manifest.
To get this to a good state
Nothing is required.
|
Windows at this head ( Setup:
Which new rows ran here: Each new row in the test is behind
AI-assisted: yes. |
Plyxen
left a comment
There was a problem hiding this comment.
Checked head 9ecd67a22e. All on Windows 11 with WinLibs GCC 15.2 (Release), applied to main a163d4b886 together with #27930, #27929, #27926, #27925, #27923, #27922, #27901, #27828, #27771, #27755, #27748, #27682, #27765. tools/check_conventions.py --head and tools/debt_fold.py --check passed and the full build succeeded. guest_atoi passes, and the five values match the guest codes in Errors.cpp (1040, 1050, 1051, 1062, 1074). guest_resolver_system_errors also builds HostErrno.cpp, but it is registered only on Linux, so it did not run here. In the full CPU suite (5,120 tests) the only failures are unrelated:
windows_read_trap_unknownfails onmaintoo (fixed in #28028).frame_capture_minimize,jpeg_external_toolchainandguest_pthread_mutex_contentionare timeouts under load; they pass when run on their own.guest_audio_in_capturepasses 20/20 onmainand with #27922.
AI-assisted: yes (Claude Code)
ligmaSec
left a comment
There was a problem hiding this comment.
The GuestAtoi fixture passed with the exact HostErrno.cpp change linked into the Linux test. I checked the conditional host errno mappings. The run exercises the values defined by Linux glibc, and the Windows-only branch was outside this run.
AI-assisted: yes.
What
#ifdef-guardedENODATA(1040),ENOSR(1050),ENOSTR(1051),EOTHER(1062), andETIME(1074) inHostErrnoMap[]insideGuestErrnoFromHost_nid_no_patch(core/libs/prx/libc/src/HostErrno.cpp), matching the extended guest error codes defined incore/libs/prx/libc/src/Errors.cpp(with1040,1050,1051, and1074also matchingSceV2SyserrorMessageincore/libs/prx/libc/src/exception/StandardExceptions.cpp, which does not define1062), while keepingENOTRECOVERABLE(95) andEOWNERDEAD(96) unchanged.GuestErrnoFromHost_nid_no_patch(called acrossFileAndHeap.cpp,StandardStreams.cpp,AllocatingStrings.cpp,FormattingWide.cpp,libSceLibcInternal/Spawn.cpp,libScePosixForWebKit/Resolver.cpp, andlibkernel/Time/Time.cpp) from falling througherror > 0 && error <= 34and returningGuestEio(5) for those host errnos on Windows UCRT, Linux, and macOS.Tested
guest_atoi(core/libs/tests/GuestAtoi.cpp,errnoCases[]): verifies#ifdef-guardedENODATA -> 1040,ENOSR -> 1050,ENOSTR -> 1051,EOTHER -> 1062, andETIME -> 1074(negative control returning5on unmodifiedmain) alongside existing mapped errnos,ENOENT/ERANGE, and0/-1/9999fallback to5.Checklist
main; no other open PR implements the same functionstools/check_conventions.pypasses)NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repositorymainand passes after fixSummary by CodeRabbit