-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.O-wasiOperating system: Wasi, Webassembly System InterfaceOperating system: Wasi, Webassembly System InterfaceO-wasip1-threadsOperating system: *-wasmp1-threads, WASI Preview1 with atomics and threadsOperating system: *-wasmp1-threads, WASI Preview1 with atomics and threadsT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
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:
rust/library/std/src/sys/pal/wasi/fs.rs
Lines 713 to 727 in acaf0ae
| if fd == -1 { | |
| if io::Error::last_os_error().raw_os_error() == Some(libc::ENOMEM) { | |
| // Trigger the internal buffer resizing logic of `Vec` by requiring | |
| // more space than the current capacity. | |
| let cap = buf.capacity(); | |
| buf.set_len(cap); | |
| buf.reserve(1); | |
| continue; | |
| } | |
| let msg = format!( | |
| "failed to find a pre-opened file descriptor \ | |
| through which {:?} could be opened", | |
| p | |
| ); | |
| return Err(io::Error::new(io::ErrorKind::Uncategorized, msg)); |
In other environments, it provides io::ErrorKind::NotFound. Therefore, I would like this to be consistent.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.O-wasiOperating system: Wasi, Webassembly System InterfaceOperating system: Wasi, Webassembly System InterfaceO-wasip1-threadsOperating system: *-wasmp1-threads, WASI Preview1 with atomics and threadsOperating system: *-wasmp1-threads, WASI Preview1 with atomics and threadsT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.