Repository navigation
fix(libc): keep the caller errno when localtime cannot represent a time - #4015
Conversation
|
What is the 84 based on for the console? FreeBSD's |
|
Windows test of head
Not checked: that the test fails without the change, Linux, a title run. AI-assisted (Claude Code). |
480382d to
23d5da2
Compare
|
You're right, thanks. I checked stable/11's
I've updated the PR title and description to match. @xXPBSXx, thanks for the Windows run. That run was of the previous head, so it doesn't cover this one. |
|
The new head removes the four |
23d5da2 to
f656da3
Compare
|
Restored the four |
|
Rebased onto current main (the merged Windows pre-1970/post-3000 localtime fix in |
f656da3 to
4aede94
Compare
|
Checked the diff, |
…lows Co-Authored-By: Claude <noreply@anthropic.com>
|
The full Windows run failed in Pushed a small commit that restores the caller's errno in that branch too ( |
4aede94 to
a37ee5f
Compare
What
When a time is outside the range
struct tmcan hold,localtimeandlocaltime_sreturnNULLand leave the host conversion's errno in the guest's errno. On Linux that is glibc'sEOVERFLOW, which is 75, and 75 isEPROGUNAVAILin the guest's FreeBSD numbering. On Windows it is the CRT'sEINVAL.The console's FreeBSD 11 tzcode (
contrib/tzcode/stdtime/localtime.con stable/11) returnsNULLfromtimesubon overflow without touching errno, asgmtimeandgmtime_salready do here.localtime_snow saves the caller's errno before the host conversion and restores it when the conversion fails.GuestTimeConversion.cppsets errno to a sentinel and checks thatgmtime,gmtime_s,localtimeandlocaltime_skeep it atINT64_MINandINT64_MAX. The existingctimecheck, which expectsEINVALfor an unrepresentable time, is unchanged and still passes.Tested
main43e3a70: full build passed.ctest -j2passed 994 of 994; the GPU and display tests skip on this headless machine.main'sTime.cpp,guest_time_conversionaborts with "localtime_s of an unrepresentable time changed errno". With the change it passes.localtime_sfailure branch.python3 tools/check_conventions.py --base upstream/mainandgit diff --checkpassed.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)