Skip to content

Cache hits even if wasm-bindgen binary is missing #508

Closed
@danwilhelm

Description

@danwilhelm

🐛 Bug description

This bug affects some v0.6.0 users who will upgrade to v0.6.1, including #497 and #503.

The wasm-bindgen cache falsely reports a hit when the cache directory exists, but the binary does not.

This causes wasm-pack to fail on all subsequent builds requiring a cargo install (at least until the next wasm-bindgen version is released!).

🤔 Expected Behavior

When the wasm-bindgen binary is missing, a new cache should be created that overwrites the old one.

👟 Steps to reproduce

Occurs when all four are present:

  1. wasm-bindgen is not in $PATH.
  2. A prebuilt binary is not available (e.g. no Internet, no Windows build).
  3. wasm-bindgen has been installed previously to the cache.
  4. The wasm-bindgen binary in the cache has been removed.

MAC reproduction (Linux is similar)

In any WASM project:

  1. cargo uninstall wasm-bindgen (removes wasm-bindgen from $PATH)
  2. cargo build (creates the lockfile)
  3. rm -rf ~/Library/Caches/.wasm_pack (removes existing cache)
  4. mkdir -p ~/Library/Caches/.wasm_pack/wasm-bindgen-cargo-install-0.2.32 (creates a fake cargo install without a binary)
  5. Disconnect from the Internet (makes the pre-built binary unavailable)
  6. wasm-pack build <-- Use master

Should fail with:

Error: /Users/<username>/Library/Caches/.wasm_pack/wasm-bindgen-cargo-install-0.2.32/wasm-bindgen binary does not exist


WINDOWS reproduction (easier!)

In any WASM project:

  1. cargo uninstall wasm-bindgen (removes wasm-bindgen from $PATH)
  2. rm -rf ~\AppData\Local\.wasm_pack (removes existing cache)
  3. wasm-pack build <-- Use v0.6.0 (should fail at end)
  4. wasm-pack build <-- Use master

Note: This is shorter because the current version of wasm-bindgen does not have pre-built Windows binaries. So, it always defaults to cargo install. In wasm-pack v0.6.0, the correct cache directory is created, yet the binaries are not copied from /bin.

Should fail with:

Error: C:\Users\<username>\Local\.wasm_pack\wasm-bindgen-cargo-install-0.2.32\wasm-bindgen.exe binary does not exist

🌍 Your environment

Include the relevant details of your environment.
wasm-pack version: master branch
rustc version: rustc 1.33.0-nightly (8e2063d02 2019-01-07)

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions