Open
Description
Problem
With multiple targets configured in .cargo/config.toml
, cargo tree -d
will show each duplicated dependency once per target per version. For instance, with two targets configured, cargo tree -d
will show each duplicated dependency twice per version of that dependency. It should show each version of the dependency only once.
Steps
- Make sure you have the
x86_64-unknown-linux-musl
andaarch64-unknown-linux-musl
targets installed. - Check out
rust-lang/cargo
at commit 64e46b0 . (Note that the reproducibility of this issue may change if new package versions become available, but the issue still exists.) - Run
cargo tree -d
; you should see this:
hex v0.3.2
└── crypto-hash v0.3.4
└── cargo-util v0.2.2 (/path/to/cargo/crates/cargo-util)
├── cargo v0.68.0 (/path/to/cargo)
└── cargo-test-support v0.1.0 (/path/to/cargo/crates/cargo-test-support)
[dev-dependencies]
└── cargo v0.68.0 (/path/to/cargo)
hex v0.4.3
├── cargo v0.68.0 (/path/to/cargo)
└── cargo-util v0.2.2 (/path/to/cargo/crates/cargo-util) (*)
- Run
cargo tree -d --target x86_64-unknown-linux-musl --target aarch64-unknown-linux-musl
. Or, as is more likely to occur in practice, put that in.cargo/config.toml
(mkdir .cargo && echo 'build.target = ["x86_64-unknown-linux-musl", "aarch64-unknown-linux-musl"]' > .cargo/config.toml
) and then runcargo tree -d
. You'll see this:
hex v0.3.2
└── crypto-hash v0.3.4
└── cargo-util v0.2.2 (/path/to/cargo/crates/cargo-util)
├── cargo v0.68.0 (/path/to/cargo)
└── cargo-test-support v0.1.0 (/path/to/cargo/crates/cargo-test-support)
[dev-dependencies]
└── cargo v0.68.0 (/path/to/cargo)
hex v0.3.2
└── crypto-hash v0.3.4
└── cargo-util v0.2.2 (/path/to/cargo/crates/cargo-util)
├── cargo v0.68.0 (/path/to/cargo)
└── cargo-test-support v0.1.0 (/path/to/cargo/crates/cargo-test-support)
[dev-dependencies]
└── cargo v0.68.0 (/path/to/cargo)
hex v0.4.3
├── cargo v0.68.0 (/path/to/cargo)
└── cargo-util v0.2.2 (/path/to/cargo/crates/cargo-util) (*)
hex v0.4.3
├── cargo v0.68.0 (/path/to/cargo)
└── cargo-util v0.2.2 (/path/to/cargo/crates/cargo-util) (*)
libz-sys v1.1.5
└── flate2 v1.0.22
[build-dependencies]
├── cargo v0.68.0 (/path/to/cargo)
└── cargo v0.68.0 (/path/to/cargo)
libz-sys v1.1.5
├── curl-sys v0.4.59+curl-7.86.0
│ ├── cargo v0.68.0 (/path/to/cargo)
│ └── curl v0.4.44
│ ├── cargo v0.68.0 (/path/to/cargo)
│ ├── crates-io v0.34.0 (/path/to/cargo/crates/crates-io)
│ │ ├── cargo v0.68.0 (/path/to/cargo)
│ │ └── cargo-test-support v0.1.0 (/path/to/cargo/crates/cargo-test-support) (*)
│ └── git2-curl v0.16.0
│ └── cargo v0.68.0 (/path/to/cargo)
├── flate2 v1.0.22
│ ├── cargo v0.68.0 (/path/to/cargo)
│ └── cargo-test-support v0.1.0 (/path/to/cargo/crates/cargo-test-support) (*)
├── libgit2-sys v0.14.0+1.5.0
│ ├── cargo v0.68.0 (/path/to/cargo)
│ └── git2 v0.15.0
│ ├── cargo v0.68.0 (/path/to/cargo)
│ ├── cargo-test-support v0.1.0 (/path/to/cargo/crates/cargo-test-support) (*)
│ └── git2-curl v0.16.0 (*)
└── libssh2-sys v0.2.23
└── libgit2-sys v0.14.0+1.5.0 (*)
libz-sys v1.1.5
├── curl-sys v0.4.59+curl-7.86.0
│ ├── cargo v0.68.0 (/path/to/cargo)
│ └── curl v0.4.44
│ ├── cargo v0.68.0 (/path/to/cargo)
│ ├── crates-io v0.34.0 (/path/to/cargo/crates/crates-io)
│ │ ├── cargo v0.68.0 (/path/to/cargo)
│ │ └── cargo-test-support v0.1.0 (/path/to/cargo/crates/cargo-test-support) (*)
│ └── git2-curl v0.16.0
│ └── cargo v0.68.0 (/path/to/cargo)
├── flate2 v1.0.22
│ ├── cargo v0.68.0 (/path/to/cargo)
│ └── cargo-test-support v0.1.0 (/path/to/cargo/crates/cargo-test-support) (*)
├── libgit2-sys v0.14.0+1.5.0
│ ├── cargo v0.68.0 (/path/to/cargo)
│ └── git2 v0.15.0
│ ├── cargo v0.68.0 (/path/to/cargo)
│ ├── cargo-test-support v0.1.0 (/path/to/cargo/crates/cargo-test-support) (*)
│ └── git2-curl v0.16.0 (*)
└── libssh2-sys v0.2.23
└── libgit2-sys v0.14.0+1.5.0 (*)
Possible Solution(s)
No response
Notes
No response
Version
cargo 1.65.0 (4bc8f24d3 2022-10-20)
release: 1.65.0
commit-hash: 4bc8f24d3e899462e43621aab981f6383a370365
commit-date: 2022-10-20
host: x86_64-unknown-linux-gnu
libgit2: 1.5.0 (sys:0.15.0 vendored)
libcurl: 7.83.1-DEV (sys:0.4.55+curl-7.83.1 vendored ssl:OpenSSL/1.1.1q)
os: Debian n/a (bookworm) [64-bit]