Skip to content

path_open does not respect trailing slashes #267

@yagehu

Description

@yagehu

Both these snippets should fail with notdir because the path contains a trailing slash. This behavior is consistent among Linux host, Wasmtime, WAMR, WasmEdge. Node however, successfully opens the file.

#include <fcntl.h>
#include <stdio.h>

int main() {
    int fd = open("file/", O_RDONLY);
    if (fd < 0) {
        perror("open");
        return 1;
    }

    return 0;
}
fn main() {
    unsafe {
        let base_fd = 3;
        let fd = wasi::path_open(base_fd, 0, "file/", 0, wasi::RIGHTS_FD_READ, 0, 0).unwrap();

        eprintln!("fd {fd}");
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions