rustup
rustup copied to clipboard
"rustup self uninstall" causes data loss, leaves behind only cargo binaries
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:
$ ls -l ~/bin
total 67740
-rwxrwxr-x 1 chrivers chrivers 10649744 Apr 17 22:41 cargo
-rwxr-xr-x 6 chrivers chrivers 9785208 Apr 17 22:13 rls
-rwxr-xr-x 6 chrivers chrivers 9785208 Apr 17 22:13 rustc
-rwxr-xr-x 6 chrivers chrivers 9785208 Apr 17 22:13 rustdoc
-rwxr-xr-x 6 chrivers chrivers 9785208 Apr 17 22:13 rust-gdb
-rwxr-xr-x 6 chrivers chrivers 9785208 Apr 17 22:13 rust-lldb
-rwxr-xr-x 6 chrivers chrivers 9785208 Apr 17 22:13 rustup
Whiskey Tango Foxtrot.
The dirs .cargo and .rustup are gone, as are all my binaries and shell scripts. This is a pretty catastrophic result.