-
Notifications
You must be signed in to change notification settings - Fork 884
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
installer produced an invalid .bash_profile #2967
Comments
Interestingly, it did much better with my .zshrc. The exact same line is in there: [ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env" but the installer left it alone (rather than truncating it as it did above with .bash_profile). This is the behavior I would expect. |
So the reason your The reason that we mess up that line is because we're not checking that there's nothing before the command we "remove" when we are executing cleanup on the rc files. We'd need to improve this function https://github.com/rust-lang/rustup/blob/master/src/cli/self_update/unix.rs#L55-L75 to fix this. |
@kinnison I noticed it defaults to .zshenv even on a Mac, which is known to have unexpected behavior that overrides the file. The zshenv file is more for putting personal configuration to run at the very start of shells (interactive and non-interactive). At least on a Mac, the 'env' in zshenv misleading and ~/.zprofile is a better place to do PATH initialization. |
Problem
Installing rustup via the bash command messed up my .bash_profile.
The installer truncated the line
[ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env"
to[ -f "$HOME/.cargo/env" ] &&
(which is now applying the conditional to some unrelated line) and then appended. "$HOME/.cargo/env"
to the end of the file.Here it is as a patch, my original file in red(-) and the rustup installer's modifications in green(+):
Steps
[ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source
line has been moved the end of the file.Possible Solution(s)
I wish the installer wouldn't try to modify lines it doesn't understand.
Notes
No response
Rustup version
Installed toolchains
The text was updated successfully, but these errors were encountered: