rust-lang / rust-lang/rust

[WASI] Consistency Issue with io::ErrorKind in wasm32-wasip1-threads

Open
#125,859 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug O-wasi O-wasip1-threads T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I have code in a wasm32-wasip1-threads environment that uses std::fs to check if a file exists.

If the file does not exist, as you can see in this code snippet: https://github.com/rust-lang/rust/blob/acaf0aeed0dfbfc4be9f996344e2c5f294cf5794/library/std/src/sys/pal/wasi/fs.rs#L713-L727, it returns io::ErrorKind::Uncategorized when it cannot find the file descriptor.

In other environments, it provides io::ErrorKind::NotFound. Therefore, I would like this to be consistent.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with library/std/src/sys/pal/wasi/fs.rs at lines 713-727 and trace how a missing file descriptor becomes an io::ErrorKind. Compare the wasm32-wasip1-threads behavior with the other environments described in the issue, then verify that a missing file produces NotFound consistently with a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.