Make manifest path absolute without resolving symlinks - #808
Merged
Shnatsel merged 2 commits intoMar 13, 2026
Conversation
sivizius
force-pushed
the
absolute-without-resolving-symlinks
branch
from
December 5, 2025 17:26
5cf6f40 to
18bcda0
Compare
Contributor
|
Sounds good, thank you! Since |
sivizius
force-pushed
the
absolute-without-resolving-symlinks
branch
from
March 11, 2026 12:46
18bcda0 to
7cdae60
Compare
Contributor
Author
Done, sorry for the late response. |
Signed-off-by: Sebastian Walz <sebastian.walz@secunet.com>
sivizius
force-pushed
the
absolute-without-resolving-symlinks
branch
from
March 11, 2026 12:47
7cdae60 to
39bc00f
Compare
Signed-off-by: Sergey "Shnatsel" Davidoff <shnatsel@gmail.com>
Shnatsel
approved these changes
Mar 13, 2026
Contributor
|
Matching Cargo behavior seems important enough for an MSRV bump. Thanks for the PR and sorry it took a while! |
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.
Cargo expects the file path to be absolute. However, symbolic links are allowed. It’s thus enough to call https://doc.rust-lang.org/std/path/fn.absolute.html instead of https://doc.rust-lang.org/std/path/struct.Path.html#method.canonicalize.
We have a large workspace with various crates and are using Nix/crane to build various binaries. To avoid rebuilding all components when unrelated code of a crate was altered, we want to graft a directory with symbolic links to generated workspace members (dummies, library-only, binary-only, library-with-tests, full, …). These directories are read-only.
canonicalize,cargo cyclonedxtries to find theCargo.lockin/nix/store/instead of/build/, where the generatedCargo.tomlis located./nix/store/<hash>-source/<member>/, with a lock file in/nix/store/<hash>-source/, runningcargo cyclonedxfails because it tries to output the SBOM to e.g./nix/store/<hash>-source/<member>/….cdx.json, which is a read-only directory.This works just fine for
cargo build, etc., just not forcargo cyclonedx.If this is PR is a breaking change because resolving symbolic links is expected now, perhaps some CLI flags should be implemented:
--output-dir, see e.g.cargo tarpaulin),Cargo.lock(--lockfile-path, see e.g.cargo build),However, I doubt resolving symbolic links is expected, as this differs from the behaviour of default
cargotools. On the other side: Even with my proposed change, these CLI options might be useful.