Skip to content
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

path_open ignores trailing slash when creating a file #4833

Closed
yagehu opened this issue Jun 11, 2024 · 0 comments · Fixed by #4834
Closed

path_open ignores trailing slash when creating a file #4833

yagehu opened this issue Jun 11, 2024 · 0 comments · Fixed by #4834

Comments

@yagehu
Copy link
Contributor

yagehu commented Jun 11, 2024

Describe the bug

This issue is an edge case of #4820. Specifically, path_open discards trailing slashes when path_open is creating a new file. This is a bug because trailing slash is semantically meaningful. Other runtimes like WasmEdge, Wazero, WAMR, Wasmtime, and Node correctly preserves the trailing slash.

Steps to reproduce

This test case can be added to tests/wasi-fyi/fs_open_trailing_slash.rs

        let errno = path_open(
            fd,
            0,
            path_bad_new_file.as_ptr() as i32,
            path_bad_new_file.len() as i32,
            OFLAGS_CREAT,
            RIGHTS_FD_READ | RIGHTS_FD_WRITE,
            0,
            0,
            1024,
        );
        assert_eq!(
            errno, ERRNO_ISDIR,
            "creating a regular file with a trailing slash should fail"
        );

Expected behavior

path_open should error with isdir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant