Skip to content

--dir does not work with non-absolute paths #10490

@folkertdev

Description

@folkertdev

I'm trying to write a runner in .cargo/config.toml that passes a subdirectory to wasmtime. I'd like that path to be relative, so it works anywhere, not just on my machine. However, I can't get this to work:

[target.wasm32-wasip2]
runner = "wasmtime --dir ./my-subdir"

this command works on the command line (but won't in the cargo/config.toml because the $PWD variable is not expanded)

wasmtime --dir "$PWD/test-libz-rs-sys" target/wasm32-wasip2/debug/deps/test_libz_rs_sys-b4a8595daba8c0ca.wasm

but this does not

wasmtime --dir "./test-libz-rs-sys" target/wasm32-wasip2/debug/deps/test_libz_rs_sys-b4a8595daba8c0ca.wasm

nor does this

wasmtime --dir "test-libz-rs-sys" target/wasm32-wasip2/debug/deps/test_libz_rs_sys-b4a8595daba8c0ca.wasm

I've seen that just "." is accepted, so I'm confused why "./test-libz-rs-sys" does not work. It would be really convenient if the path is expanded (though maybe there are security issues that I'm overlooking?). In any case the current behavior is unexpected (to me).

Versions and Environment

Wasmtime version or commit: wasmtime 31.0.0 (7a9be587f 2025-03-20)

Operating system: linux

Architecture: x86_64

Extra Info

Anything else you'd like to add?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIncorrect behavior in the current implementation that needs fixing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions