Repository navigation
fix(worker-build): honour the root package's wasm-bindgen pin in Cargo.lock - #1102
Open
PedroRosalba wants to merge 1 commit into
Open
PedroRosalba wants to merge 1 commit into
PedroRosalba wants to merge 1 commit into
Conversation
…o.lock `get_package_version` meant to prefer the version the root package pins in its `dependencies` list when several packages share a name, but it checked for the space at `package.len() + 1` instead of `package.len()`, so the branch never matched and the first (lowest) `[[package]]` entry always won. Cargo also writes `name version (source)` when the same version is locked from two sources, which `Version::parse` rejects. Split the entry on spaces and parse the version token instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
get_package_versioninworker-build/src/lockfile.rsmeant to prefer the version the root package pins in itsdependencieslist when several packages share a name, but it checks for the space atpackage.len() + 1instead ofpackage.len(), so that branch never matches and the first (lowest)[[package]]entry always wins. Cargo also writesname version (source)when the same version is locked from two sources, whichVersion::parserejects.Fix
Split the entry on spaces and parse the version token. One behaviour change worth calling out: a root package that pins an unreleased path/git
wasm-bindgennow resolves that version, so such setups needWASM_BINDGEN_BINto point at a matching binary (before, the lowest locked release silently won).Tests
Four unit tests covering the duplicate-version case, the root pin, the source-suffix form, and the single-entry form.
Tested on macOS (Apple Silicon) only.