`wasmtime compile --emit-clif` and `wasmtime hot-blocks` panic on components (NotFound when creating a CLIF file)

Aperta Adatta ai principianti
#15,536 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust, wasm

Direzione di ricerca

Inizia da crates/cranelift/src/compiler.rs, dalla costruzione del nome del file CLIF e dalla creazione del file menzionate nella segnalazione. Riproduci il problema con un componente wasm32-wasip2 usando wasmtime compile --emit-clif o wasmtime hot-blocks; confrontalo con un modulo core. Il lavoro è completato quando la compilazione dei componenti non va più in panic sui percorsi dei simboli e gli errori di creazione dei file vengono segnalati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

Thanks for filing a bug report! Please fill out the TODOs below.

Note: if you want to report a security issue, please read our security policy!

Test Case

Any component triggers it, so no file is attached. A default hello world is enough:

$ cargo new hello && cd hello
$ cargo build --target wasm32-wasip2
Steps to Reproduce
  • mkdir clif-out
  • wasmtime compile --emit-clif clif-out -o out.cwasm target/wasm32-wasip2/debug/hello.wasm
  • Or: wasmtime hot-blocks target/wasm32-wasip2/debug/hello.wasm
Expected Results

CLIF files are written for all functions and compilation succeeds, as it does for a core module. If a file cannot be written, an error is reported instead of a panic.

Actual Results

Both commands panic and the process aborts (exit code 134):

thread '<unnamed>' panicked at crates/cranelift/src/compiler.rs:1641:58:
called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

For the hello world, 18 CLIF files are written to clif-out before the panic. The same program built for wasm32-wasip1 (a core module) compiles fine with --emit-clif: 289 CLIF files, exit code 0.

Versions and Environment

Wasmtime version or commit: 47.0.3 (5554cc1a6 2026-07-31). The code involved is unchanged on main (checked 2026-12-03).

Operating system: Linux (Ubuntu 22.04)

Architecture: x86_64

Extra Info

Likely cause: in crates/cranelift/src/compiler.rs, the CLIF file name is derived from the function symbol by replacing only : (path.join(symbol.replace(":", "-"))), and the file is then created with std::fs::File::create(path).unwrap(). Component symbols can include interface names such as wasi:cli/[email protected], so a / remains and path.join points into a subdirectory that does not exist. Sanitizing path separators in the file name (or creating parent directories), and returning the I/O error instead of calling unwrap(), would avoid the panic.

Lingua principale
Rust
Stelle
18.9k
Fork
2k
Merge medio
1g 6h
PR unite (30g)
238

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di bytecodealliance/wasmtime

Tutte le issue di bytecodealliance/wasmtime

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.