Closed
Description
Problem
cargo clean -p foo
will remove the fingerprint files for all crates that start with foo-
due to this glob:
cargo/src/cargo/ops/cargo_clean.rs
Line 137 in e11cd81
Steps
#!/bin/bash
rm -rf clean-any-prefix
mkdir clean-any-prefix
cd clean-any-prefix
cargo new foo
cd foo
echo 'tracing-subscriber = { version = "*", default-features = false }' >> Cargo.toml
echo 'tracing = { version = "*", default-features = false }' >> Cargo.toml
cargo check
cp -r target target.old
cargo clean -p tracing
diff -qr target.old target | grep subscriber
Only in target.old/debug/.fingerprint: tracing-subscriber-4444b7d26073268f
Possible Solution(s)
This one is trickier to fix than #10068. The "best" option is likely to walk all the versions in the Resolve
and remove each one explicitly rather than relying on a glob
. This would also allow addressing this TODO:
cargo/src/cargo/ops/cargo_clean.rs
Lines 102 to 109 in e11cd81
Barring that, the removal could walk the results of the glob and then do filtering using something that checks for exactly {pkg.name()}-{semver-pattern}
(maybe with a regex).
Notes
No response
Version
cargo 1.56.0 (4ed5d137b 2021-10-04)
release: 1.56.0
commit-hash: 4ed5d137baff5eccf1bae5a7b2ae4b57efad4a7d
commit-date: 2021-10-04