Skip to content

wasm_optimize: LoomOptimize action cannot find a fetched/symlinked input (wasmtime --dir=. preopen) #490

Description

@avrabe

Thanks again for rules_wasm_component. Follow-up from #489 — a separate, concrete bug in wasm_optimize.

Symptom

wasm_optimize fails: the LoomOptimize action runs loom.wasm inside wasmtime with --dir=., and loom reports the input is missing:

ERROR: Optimizing WebAssembly component with LOOM: //:target failed: wasmtime failed:
error executing LoomOptimize command ... wasmtime run '--dir=.' .../loom.wasm optimize ...
Error: Input file not found: external/+http_file+falcon_flight_wasm/file/falcon-flight-v1.27.wasm
🔧 LOOM Optimizer v0.3.0
Input: external/+http_file+falcon_flight_wasm/file/falcon-flight-v1.27.wasm

Context / repro

  • A component target whose wasm_file comes from a fetched file (here an http_file-sourced falcon-flight-v1.27.wasm, adopted into WasmComponentInfo).
  • wasm_validate on the same target succeeds — so the file is a valid action input; only the loom-via-wasmtime path can't see it.

Likely cause

The LoomOptimize action passes the input's exec-root-relative path to loom.wasm, but wasmtime only preopens .; bazel stages the input as a symlink, and WASI preopen traversal to the symlinked external path fails inside the sandbox. So loom can't open it.

Impact

Downstream integrators (jess builds firmware from released wasm components) can validate hermetically but can't run wasm_optimize on a fetched/adopted component.

Suggested fix

Either copy the input into the action's working dir (so it's a real file under the preopen) before invoking loom, or preopen the input's parent dir explicitly, or pass loom a path relative to a preopened dir that contains the (de-symlinked) file. Happy to test against the falcon component.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions