You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cargo clean -p fails to delete a number of files from target/ if the path to target contains glob characters. This is due to the use of rm_rf_glob used for cleaning, which does not escape glob characters in the path before adding the pattern:
#!/bin/bash
rm -rf glob-in-rm
mkdir glob-in-rm
cd glob-in-rm
fordin'[hello]''hello';do
mkdir "$d"pushd"$d"
cargo new foo
cd foo
cargo check
cargo clean -p foo
popddone
diff -qr '[hello]/foo/target''hello/foo/target'
Only in [hello]/foo/target/debug/.fingerprint: foo-8ca57bdc9f429d2a
Only in [hello]/foo/target/debug/deps: foo-8ca57bdc9f429d2a.d
Only in [hello]/foo/target/debug/deps: libfoo-8ca57bdc9f429d2a.rmeta
Only in [hello]/foo/target/debug/incremental: foo-1qp1vfygk93x
Possible Solution(s)
Escape any non-pattern part of the string passed to glob with glob::Pattern::escape.
Implement glob escaping for clean -p
Add pattern escape for glob matching cargo clean files
Implement correct solution for rust-lang#10068
Removed superfluous formatting changes
Update rm_rf_glob()'s error handling
Remove dir_glob reference for non-glob function
Added test
Satisfy clippy
Add MSVC support for test
Problem
cargo clean -p
fails to delete a number of files fromtarget/
if the path totarget
contains glob characters. This is due to the use ofrm_rf_glob
used for cleaning, which does not escape glob characters in the path before adding the pattern:cargo/src/cargo/ops/cargo_clean.rs
Lines 210 to 216 in e11cd81
Here for example:
cargo/src/cargo/ops/cargo_clean.rs
Lines 137 to 142 in e11cd81
Steps
Possible Solution(s)
Escape any non-pattern part of the string passed to
glob
withglob::Pattern::escape
.Notes
No response
Version
The text was updated successfully, but these errors were encountered: