Repository navigation
Map out-of-range raw OS errors to EINVAL on linux_raw - #1712
Open
stepancheg wants to merge 1 commit into
Open
stepancheg wants to merge 1 commit into
stepancheg wants to merge 1 commit into
Conversation
xtqqczze
suggested changes
Oct 18, 2026
stepancheg
force-pushed
the
st/errno-einval-1781
branch
from
October 18, 2026 23:09
c2b7eb3 to
67bbf08
Compare
`Errno::from_raw_os_error` asserted on values outside Linux's `1..4096` range. Return `Errno::INVAL` instead. This also matches the libc backend, whose `from_raw_os_error` does not panic. Error handling usually runs when something is already broken, and it is not the default code path, so it tends to be less exercised. A bad `errno` can come from various places: an incorrectly implemented syscall, or a syscall wrapper that returns a stray value. Mapping those to `EINVAL` keeps the error observable without taking the process down. Assisted-by: Cursor:auto
stepancheg
force-pushed
the
st/errno-einval-1781
branch
from
October 18, 2026 23:10
67bbf08 to
594e8c9
Compare
Author
|
Applied suggestions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Errno::from_raw_os_errorasserted on values outside Linux's1..4096range. ReturnErrno::INVALinstead. This also matches the libc backend, whosefrom_raw_os_errordoes not panic.Error handling usually runs when something is already broken, and it is not the default code path, so it tends to be less exercised. A bad
errnocan come from various places: an incorrectly implemented syscall, or a syscall wrapper that returns a stray value. Mapping those toEINVALkeeps the error observable without taking the process down.Assisted-by: Cursor:auto