fix(crate_universe): resolve escaping relative path deps during splicing - #4262
Open
0xbeefd1ed wants to merge 1 commit into
Open
0xbeefd1ed wants to merge 1 commit into
0xbeefd1ed wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Splicing relocates the root Cargo manifest into a temporary workspace whose top-level entries are symlinks back into the source directory. Relative `path` dependencies that escape the manifest directory (e.g. `../sibling`) therefore resolve against the temporary directory and fail with `failed to read <tmp>/../sibling/Cargo.toml`. Anchor such dependencies to the original manifest directory before the spliced manifest is written: - `absolutize_escaping_path_deps` rewrites a manifest's dependency, dev-dependency, build-dependency, target, `workspace.dependencies` and `patch` tables, absolutizing only paths that lexically leave the workspace root and leaving in-tree paths (and the package ids `cargo metadata` reports) untouched. - `absolutize_escaping_member_path_deps` applies it to workspace members, which are reached through symlinks: for each member that needs a rewrite it materializes the symlinked ancestor directories into real directories (whose other entries link back to the source tree) and writes a rewritten copy of the member manifest, never modifying the source tree. Adds unit coverage for the path-rewriting predicate and an end-to-end `splice_workspace` test that resolves an escaping member dependency via `cargo metadata`. Assisted-by: Claude Opus 4.8 <noreply@anthropic.com>
0xbeefd1ed
force-pushed
the
crate-universe-absolutize-escaping-path-deps
branch
from
September 17, 2026 00:08
fe6248f to
afb05b5
Compare
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.
Splicing relocates the root Cargo manifest into a temporary workspace whose top-level entries are symlinks back into the source directory. Relative
pathdependencies that escape the manifest directory (e.g.../sibling) therefore resolve against the temporary directory and fail withfailed to read <tmp>/../sibling/Cargo.toml.Anchor such dependencies to the original manifest directory before the spliced manifest is written:
absolutize_escaping_path_depsrewrites a manifest's dependency, dev-dependency, build-dependency, target,workspace.dependenciesandpatchtables, absolutizing only paths that lexically leave the workspace root and leaving in-tree paths (and the package idscargo metadatareports) untouched.absolutize_escaping_member_path_depsapplies it to workspace members, which are reached through symlinks: for each member that needs a rewrite it materializes the symlinked ancestor directories into real directories (whose other entries link back to the source tree) and writes a rewritten copy of the member manifest, never modifying the source tree.Adds unit coverage for the path-rewriting predicate and an end-to-end
splice_workspacetest that resolves an escaping member dependency viacargo metadata.Assisted-by: Claude Opus 4.8