Stream: git-wasmtime

Topic: wasmtime / issue #10577 Open directory with truncate flag...


view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2025 at 16:51):

yagehu added the bug label to Issue #10577.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2025 at 16:51):

yagehu opened issue #10577:

Test Case

Rust code with wasi v0.11 (for the preview1 API).

use wasi::{LOOKUPFLAGS_SYMLINK_FOLLOW, OFLAGS_TRUNC};

fn main() {
    let base_fd = 3;

    unsafe {
        wasi::path_open(
            base_fd,
            LOOKUPFLAGS_SYMLINK_FOLLOW,
            "a",
            OFLAGS_TRUNC,
            0,
            0,
            0,
        )
        .unwrap();
    }
}

Steps to Reproduce

On Windows, set up a directory:

mkdir dir
cargo build --target wasm32-wasip1

Run the compiled Wasm binary with Wasmtime:

wasmtime --dir . target\wasm32-wasip1\debug\repro.wasm

Expected Results

The path_open call should succeed or fail.

Actual Results

Wasmtime panics with a stacktrace.

Versions and Environment

Wasmtime version or commit: v31.0.0

Operating system: Windows 11

Architecture: amd64

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2025 at 17:09):

yagehu edited issue #10577:

Test Case

Rust code with wasi v0.11 (for the preview1 API).

use wasi::{LOOKUPFLAGS_SYMLINK_FOLLOW, OFLAGS_TRUNC};

fn main() {
    let base_fd = 3;

    unsafe {
        let _result = wasi::path_open(
            base_fd,
            LOOKUPFLAGS_SYMLINK_FOLLOW,
            "a",
            OFLAGS_TRUNC,
            0,
            0,
            0,
        );
    }
}

Steps to Reproduce

On Windows, set up a directory:

mkdir dir
cargo build --target wasm32-wasip1

Run the compiled Wasm binary with Wasmtime:

wasmtime --dir . target\wasm32-wasip1\debug\repro.wasm

Expected Results

The path_open call should succeed or fail.

Actual Results

Wasmtime panics with a stacktrace.

Versions and Environment

Wasmtime version or commit: v31.0.0

Operating system: Windows 11

Architecture: amd64

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2025 at 17:12):

yagehu edited issue #10577:

Test Case

Rust code with wasi v0.11 (for the preview1 API).

use wasi::{LOOKUPFLAGS_SYMLINK_FOLLOW, OFLAGS_TRUNC};

fn main() {
    let base_fd = 3;

    unsafe {
        let _result = wasi::path_open(
            base_fd,
            LOOKUPFLAGS_SYMLINK_FOLLOW,
            "dir",
            OFLAGS_TRUNC,
            0,
            0,
            0,
        );
    }
}

Steps to Reproduce

On Windows, set up a directory:

mkdir dir
cargo build --target wasm32-wasip1

Run the compiled Wasm binary with Wasmtime:

wasmtime --dir . target\wasm32-wasip1\debug\repro.wasm

Expected Results

The path_open call should succeed or fail.

Actual Results

Wasmtime panics with a stacktrace.

Versions and Environment

Wasmtime version or commit: v31.0.0

Operating system: Windows 11

Architecture: amd64

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2025 at 17:20):

alexcrichton commented on issue #10577:

Thanks for the report! I can reproduce this in wine which I suspect is similar enough to Windows in this regard. Can you confirm though @yagehu and post the full panic message you're seeing?

What I see is:

thread 'main' panicked at /home/alex/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cap-primitives-3.4.3/src/windows/fs/open_unchecked.rs:213:30:
called `Result::unwrap()` on an `Err` value: Os { code: 87, kind: InvalidInput, message: "Invalid parameter." }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

cc @sunfishcode it looks like this is panicking?

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2025 at 17:33):

yagehu commented on issue #10577:

This is the message I get on Windows:

thread 'main' panicked at C:\Users\runneradmin\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\cap-primitives-3.4.1\src\windows\fs\open_unchecked.rs:213:30:
called `Result::unwrap()` on an `Err` value: Os { code: 87, kind: InvalidInput, message: "The parameter is incorrect." }

It does seem like cap-primitives need to check if it's a directory before set_len(0).

view this post on Zulip Wasmtime GitHub notifications bot (Apr 21 2025 at 23:17):

sunfishcode closed issue #10577:

Test Case

Rust code with wasi v0.11 (for the preview1 API).

use wasi::{LOOKUPFLAGS_SYMLINK_FOLLOW, OFLAGS_TRUNC};

fn main() {
    let base_fd = 3;

    unsafe {
        let _result = wasi::path_open(
            base_fd,
            LOOKUPFLAGS_SYMLINK_FOLLOW,
            "dir",
            OFLAGS_TRUNC,
            0,
            0,
            0,
        );
    }
}

Steps to Reproduce

On Windows, set up a directory:

mkdir dir
cargo build --target wasm32-wasip1

Run the compiled Wasm binary with Wasmtime:

wasmtime --dir . target\wasm32-wasip1\debug\repro.wasm

Expected Results

The path_open call should succeed or fail.

Actual Results

Wasmtime panics with a stacktrace.

Versions and Environment

Wasmtime version or commit: v31.0.0

Operating system: Windows 11

Architecture: amd64


Last updated: Dec 06 2025 at 06:05 UTC