strerror based on ErrorKind is technically valid but surprising #3612
Labels
A-shims
Area: This affects the external function shims
C-enhancement
Category: a PR with an enhancement or an issue tracking an accepted enhancement
POSIX says precious little about what strerror does other than it produces a string. https://pubs.opengroup.org/onlinepubs/9699919799/functions/strerror.html
The current implementation we have for
strerror
is based on converting the error code to astd::io::ErrorKind
:https://github.com/rust-lang/miri/blob/e1099c653869d18d2590bc3366b74b96a70997b1/src/shims/unix/foreign_items.rs#L571C34-L576
This conversion is lossy. In particular, both
ENOTSUP
andENOSYS
map toErrorKind::Unsupported
, even though every libc will produce different error messages for those. It would be nice if we could mirror the behavior of a good libc. Error reporting is not the right place to follow only the letter of the law.The text was updated successfully, but these errors were encountered: