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 with an empty path should fail #2222

Closed
yagehu opened this issue May 28, 2024 · 0 comments · Fixed by #2223
Closed

path_open with an empty path should fail #2222

yagehu opened this issue May 28, 2024 · 0 comments · Fixed by #2223
Labels
bug Something isn't working

Comments

@yagehu
Copy link
Contributor

yagehu commented May 28, 2024

Describe the bug

Calling path_open on an empty path fails on host Linux as well as other runtimes (Wasmtime, Node, WAMR, WasmEdge, Wasmer). But Wazero succeeds and returns a fd.

As a reference, POSIX specifies that:

A null pathname shall not be successfully resolved.

A rust example that uses wasi crate 0.11.

fn main() {
    unsafe {
        let fd = wasi::path_open(
            3,
            0,
            "",
            0,
            wasi::RIGHTS_FD_READ | wasi::RIGHTS_FD_WRITE | wasi::RIGHTS_FD_SEEK,
            0,
            0,
        )
        .unwrap();

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

Expected behavior
Wazero should error and not return a fd.

Environment (please complete the relevant information):

  • Go version: go1.21.1 darwin/amd64
  • wazero Version: d4a4903
  • Host architecture: amd64
  • Runtime mode: [e.g. interpreter or compiler]
@yagehu yagehu added the bug Something isn't working label May 28, 2024
yagehu added a commit to yagehu/wazero that referenced this issue May 28, 2024
This commit makes `path_open` return `inval` when passed an empty path.
This behavior is consistent with other Wasm runtimes (Wasmtime, Wasmer,
Node, WAMR, WasmEdge).

fixes tetratelabs#2222
yagehu added a commit to yagehu/wazero that referenced this issue May 28, 2024
This commit makes `path_open` return `inval` when passed an empty path.
This behavior is consistent with other Wasm runtimes (Wasmtime, Wasmer,
Node, WAMR, WasmEdge).

fixes tetratelabs#2222

Signed-off-by: Yage Hu <me@huyage.dev>
yagehu added a commit to yagehu/wazero that referenced this issue May 28, 2024
This commit makes `path_open` return `inval` when passed an empty path.
This behavior is consistent with other Wasm runtimes (Wasmtime, Wasmer,
Node, WAMR, WasmEdge).

fixes tetratelabs#2222

Signed-off-by: Yage Hu <me@huyage.dev>
yagehu added a commit to yagehu/wazero that referenced this issue May 28, 2024
This commit makes `path_open` return `inval` when passed an empty path.
This behavior is consistent with other Wasm runtimes (Wasmtime, Wasmer,
Node, WAMR, WasmEdge).

fixes tetratelabs#2222

Signed-off-by: Yage Hu <me@huyage.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant