-
Notifications
You must be signed in to change notification settings - Fork 892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"rustup self uninstall" causes data loss, leaves behind only cargo binaries #1072
Comments
This is pretty much expected behaviour. Uninstall procedure is as follows:
In general, it's a really bad idea to symlink directories "owned" by other packages to ones you're going to store your own data in, and then to uninstall those packages. Data loss is pretty much guaranteed. At best, we can try to be more defensive, eg. check if |
Respectfully, unless I misunderstand what you are saying, this is crazy behaviour. From your description, step 3 is to delete ~/.cargo/bin, and step 4 is to delete ~/.cargo. Why not just delete ~/.cargo? I am very surprised about your claim that data loss is "pretty much guaranteed". While I completely agree that users should not feel free to poke and prod around in a programs semi-private data, this flies in the face of all reasonable expectation. But more importantly, it doesn't seem to make sense?
.. did I misunderstand something? Or it this really the expected result? |
|
Regarding the brutal deletion of all binaries there, I thought cargo maintained a list of the installed binaries - couldn't that be used to only uninstall what was installed previously? |
@gyscos That seems possible, we can parse the This issue can track the addition of that feature. |
@brson does this seem like a good solution to you? |
That would be a much better solution, yes. And as I said, I'd always argue for erring on the side of caution, when it comes to deleting files in the users home dir. Is the precaution about not following symlinks implemented in the meantime? I think that sounds like a good, simple safeguard. |
I just had a bizzare experience with rustup - unfortunately, one that lost me quite a few hours of work (which would have been many times more, without a backup).
Here's a rough sketch of what happened, as far as I can tell:
Install "stable" and "nightly" using rustup
rustup self update, to ensure newest
Update "stable" and "nightly" again, to ensure newest
I had a problem where ~/.cargo/bin was added to my ~/.zshrc, which gave me $PATH inclusion for the commands in interactive shells. However, I have some build scripts for various things that like to call cargo or rust as well, and these fail, since they're not running under interactive shells.
On my workstation, I have ~/bin in the default path, to allow users to install local binaries. This solves the problem, as long as cargo and rustc are symlinked to ~/bin.
To make it "just work", I symlinked ~/.cargo/bin to ~/bin, so rustup would effectively install in ~/bin.
Since I had some more problems, I finally decided to try the following commands:
$ rustup toolchain uninstall stable
$ rustup toolchain uninstall nightly
$ rustup self uninstall
To my shock, I see that my ~/bin folder has been all but completely destroyed. To provide some salt for the wound, the only files NOT removed, are the rustup ones:
Whiskey Tango Foxtrot.
The dirs .cargo and .rustup are gone, as are all my binaries and shell scripts. This is a pretty catastrophic result.
The text was updated successfully, but these errors were encountered: