-
Notifications
You must be signed in to change notification settings - Fork 13.3k
std::fs::File::read incorrectly mapps EOPNOTSUPP (95) to ErrorKind::Uncategorized #139803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
A-error-handling
Area: Error handling
A-io
Area: `std::io`, `std::fs`, `std::net` and `std::path`
C-bug
Category: This is a bug.
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
O-unix
Operating system: Unix-like
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
Comments
Minimized: use std::io::{self, ErrorKind};
fn main() {
assert_eq!(io::Error::from_raw_os_error(libc::EOPNOTSUPP /* 95 */).kind(), ErrorKind::Unsupported);
//^ currently `ErrorKind::Uncategorized`, should be `ErrorKind::Unsupported`
} rust/library/std/src/sys/pal/unix/mod.rs Lines 238 to 287 in c580c49
@rustbot label +T-libs +A-error-handling +E-easy +O-unix |
It is technically not incorrect, just incomplete. |
Zalathar
added a commit
to Zalathar/rust
that referenced
this issue
Apr 15, 2025
…tolnay Fix: Map EOPNOTSUPP to ErrorKind::Unsupported on Unix This change maps the EOPNOTSUPP errno value (95) to std::io::ErrorKind::Unsupported in the decode_error_kind function for Unix platforms. Previously, it was incorrectly mapped to ErrorKind::Uncategorized. Fixes rust-lang#139803
Zalathar
added a commit
to Zalathar/rust
that referenced
this issue
Apr 15, 2025
…tolnay Fix: Map EOPNOTSUPP to ErrorKind::Unsupported on Unix This change maps the EOPNOTSUPP errno value (95) to std::io::ErrorKind::Unsupported in the decode_error_kind function for Unix platforms. Previously, it was incorrectly mapped to ErrorKind::Uncategorized. Fixes rust-lang#139803
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Apr 15, 2025
Rollup merge of rust-lang#139822 - 0x79de:fix-eopnotsupp-mapping, r=dtolnay Fix: Map EOPNOTSUPP to ErrorKind::Unsupported on Unix This change maps the EOPNOTSUPP errno value (95) to std::io::ErrorKind::Unsupported in the decode_error_kind function for Unix platforms. Previously, it was incorrectly mapped to ErrorKind::Uncategorized. Fixes rust-lang#139803
github-actions bot
pushed a commit
to model-checking/verify-rust-std
that referenced
this issue
Apr 19, 2025
This change maps the EOPNOTSUPP errno value (95) to std::io::ErrorKind::Unsupported in the decode_error_kind function for Unix platforms. Previously, it was incorrectly mapped to ErrorKind::Uncategorized. Fixes rust-lang#139803
github-actions bot
pushed a commit
to model-checking/verify-rust-std
that referenced
this issue
Apr 19, 2025
…tolnay Fix: Map EOPNOTSUPP to ErrorKind::Unsupported on Unix This change maps the EOPNOTSUPP errno value (95) to std::io::ErrorKind::Unsupported in the decode_error_kind function for Unix platforms. Previously, it was incorrectly mapped to ErrorKind::Uncategorized. Fixes rust-lang#139803
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-error-handling
Area: Error handling
A-io
Area: `std::io`, `std::fs`, `std::net` and `std::path`
C-bug
Category: This is a bug.
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
O-unix
Operating system: Unix-like
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
Below is a lot of code because to replicate the bug you need to have an amdgpu that has at least one sensor not implemented. For me its RX 6700 XT and it has 7 unsupported sensors. You can probably also replicate it by using another kernel module that can return EOPNOTSUPP or write your own.
Replace <N> with your amdgpu number, probably 0
I tried this code:
I expected to see this happen: Nothing gets printed since I ran this program as root and catch expected errors. According to amdgpu kernel module source code EINV and EOPNOTSUPP are expected.
Instead, this happened:
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: