Skip to content

Bootstrap WASM interpreter doesn't implement flock #13589

@kprotty

Description

@kprotty

Zig Version

9f317bf

Steps to Reproduce and Observed Behavior

  • git checkout wasi-bootstrap
  • mkdir build && cd build && cmake .. [stuff]
  • make -j$N # where N > 1

Expected Behavior

The WASM interpreter should run normally.

Having make/ninja do parallel jobs runs the zig wasi interpreter simultaneously:

[ 84%] Interpreting zig1.wasm to produce /Users/king/ziglang/build/compiler_rt.c
[ 84%] Interpreting zig1.wasm to produce /Users/king/ziglang/build/zig2.c

Each build interacts with the zig cache which does flock() when working on build artifacts to wait for a winning process to build/write shared file. The flock() path is skipped on WASI so the zig wasi interpreter crashes with attempt to unwrap error: FileNotFoundunreachable reached.

The zig wasi interpreter should implement flock and that code path should be enabled again by checking builtin to know if being built as the WASM blob instead of targeting a standard wasi interpreter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions