Skip to content

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

Open
@namse

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:

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));
, 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.

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-wasiOperating system: Wasi, Webassembly System InterfaceT-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions