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
dac53d8 to
3c0d7e4
Compare
af1c3ac to
60c433c
Compare
0677697 to
d5e6935
Compare
| // .. augmented with this SO answer | ||
| // https://stackoverflow.com/questions/10319526/understanding-a-self-deleting-program-in-c | ||
| pub(crate) fn clean_cargo_bin(process: &Process) -> Result<()> { | ||
| pub(crate) fn spawn_uninstall_gc(process: &Process) -> Result<()> { |
There was a problem hiding this comment.
Suggest moving this commit earlier in the series (maybe the very first) to make this more obvious during the changes made earlier.
| } | ||
|
|
||
| pub(crate) fn delete_rustup_and_cargo_home(process: &Process) -> Result<()> { | ||
| pub(crate) fn clean_cargo_bin(process: &Process) -> Result<()> { |
There was a problem hiding this comment.
I think this rename should be postponed until the commit where the change actually happens (from home to just bin).
There was a problem hiding this comment.
@djc For extra clarity for @Cloud0310, do you mean right before the commit X where the change happens, after X, or within X?
| /// 2. Remove other tools in $CARGO_HOME/bin, but skipping rustup binary file and links to rustup. | ||
| /// 3. If no `--no-modify-path` is passed $CARGO_HOME/bin, clean up $PATH. | ||
| /// 4. Remove $CARGO_HOME | ||
| /// 2. Remove rustup tool links. |
There was a problem hiding this comment.
In the commit "fix: preserve CARGO_HOME during uninstall", we are not deleting rustup tool links yet.
The comments should really reflect what the code is doing in that particular commit.
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.