fix: stop deleting $CARGO_HOME during uninstall#4861
Conversation
|
I think I may need more tests against this PR, this includes:
Should there be more tests? Please let me know @FranciscoTGouveia @rami3l . |
|
I've add more tests about the PR here. Please review. |
4a4880a to
971dffa
Compare
Avoid removing $CARGO_HOME when running uninstall cleanup. Combine all follow-up work for PR rust-lang#4861: - keep $CARGO_HOME/bin when it is non-empty - cover cargo bin cleanup behavior in uninstall tests - update uninstall cleanup comments and related docs - rename cleanup internals for clearer intent
Avoid removing $CARGO_HOME when running uninstall cleanup. Combine all follow-up work for PR rust-lang#4861: - keep $CARGO_HOME/bin when it is non-empty - cover cargo bin cleanup behavior in uninstall tests - update uninstall cleanup comments and related docs - rename cleanup internals for clearer intent
This comment has been minimized.
This comment has been minimized.
Avoid removing $CARGO_HOME when running uninstall cleanup. Combine all follow-up work for PR rust-lang#4861: - keep $CARGO_HOME/bin when it is non-empty - cover cargo bin cleanup behavior in uninstall tests - update uninstall cleanup comments and related docs - rename cleanup internals for clearer intent
Avoid removing $CARGO_HOME when running uninstall cleanup. Combine all follow-up work for PR rust-lang#4861: - keep $CARGO_HOME/bin when it is non-empty - cover cargo bin cleanup behavior in uninstall tests - update uninstall cleanup comments and related docs - rename cleanup internals for clearer intent
Avoid removing $CARGO_HOME when running uninstall cleanup. Combine all follow-up work for PR rust-lang#4861: - keep $CARGO_HOME/bin when it is non-empty - cover cargo bin cleanup behavior in uninstall tests - update uninstall cleanup comments and related docs - rename cleanup internals for clearer intent
|
@Cloud0310 Since your PR needs more work, I've marked this PR as draft. Please address or at least respond to all open threads before marking this PR as "ready for review" again, at which point the team will return for another round of review, thanks 🙏 |
2acb9ec to
1c41abe
Compare
781981d to
197f611
Compare
dac53d8 to
3c0d7e4
Compare
af1c3ac to
60c433c
Compare
| // the running executable and on Windows can't be unlinked until the process exits. | ||
| // see: windows::{complete_windows_uninstall,clean_cargo_bin} | ||
| #[cfg(windows)] | ||
| windows::clean_cargo_bin(no_modify_path, process)?; |
There was a problem hiding this comment.
I have the impression that we are first adding this line in a previous commit, then removing and re-adding it here?
| /// 2. Remove cargo home except $CARGO_HOME/bin | ||
| /// 3. Remove other tools in $CARGO_HOME/bin. | ||
| /// 4. Remove rustup binary file and links to rustup. | ||
| /// 5. Upon successfully removing $CARGO_HOME/bin, clean up $PATH. |
There was a problem hiding this comment.
You didn't mention the fact that it also removes $CARGO_HOME as the final step (in this commit).
| .filter_map(|entry| { | ||
| let path = entry.unwrap().path(); | ||
| let name = path.file_name()?.to_str()?; | ||
| // On Windows, this binary is cleaned up on exit |
There was a problem hiding this comment.
This part should also be absorbed to the commit where the next line is introduced.
fix #285
This PR fix the cargo bin nuke and the path removing possilble toutoc issue.
Here's the implementation details:
This prevents
rustup self uninstallfrom nuking out the$CARGO_HOME/binand possible toctou problem of removing up the path.