-
Notifications
You must be signed in to change notification settings - Fork 958
Installer modifies ~/.profile which is ignored for graphical terminals #2106
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
Comments
I agree that this isn't ideal. We actually modify any/all of:
I suppose in theory we should actually edit |
If someone wants to work on this, I'd suggest we ought to UNDO the change to Come along to the Discord and/or discuss here for further input. |
Am I correct in understanding that you are suggesting the installer actively removes the export line that adds the cargo bin directory to |
I guess if we're going to add it to |
If I remember correctly, terminal of mac os would be using |
Hi, this past winter I got sniped by the "incorrectly modifying the wrong .bashrc/.profile/whatever file" issue. It took a surprising amount of executive function to figure out what was up and fix it for myself, in spite of being "easy", so I'd like to work on fixing this for everyone... and for myself, in case I ever forget this. My understanding is currently: There are three main Unix environments of concern: as a one time thing for updating: we apply a similar logic, sniff around, and maybe ask the user if they'd like us to revert our previous I'll be on the Discord to ask further questions in a more sync manner. |
I think choosing the file to modify based on the platform is not the right approach. For example, in #2311 I was using CentOS, not a BSD, there's no way to tell that from the operating system alone. Instead I think rustup should read the SHELL environment variable which should work in all Unix like environments. |
I don't think existence of a .bashrc should be taken as an indication that the default shell is bash. In many cases this file is copied from /etc/skel when the user was first created, and just never deleted if the user changed their default shell. Reading SHELL is much simpler and more accurate. |
Note also that putting it in .bashrc alone will stop it from being seen by other shells such as |
Aha. Reading the SHELL env var as the main point of guidance works for me, but still have a bit of nervousness about that solution though due to Apple choosing to act Very Weird however and only read profile. |
Actually it looks like some apps will read .bashrc and some will read .bash_profile 🤦 https://scriptingosx.com/2017/04/about-bash_profile-and-bashrc-on-macos/ In that case there doesn't seem to be a good way to choose only a single file, since it's not even dependent on the shell but on the terminal emulator. IMO (as someone who isn't part of rustup and doesn't have to deal with angry users :P) this seems like too much of an edge case to support. Note also that this is a bit of an unbounded problem in that anyone can write a shell and ask you to support it, for example |
Yes, that is why I formulated an intention of detecting *_apple_darwin environment and doing something different there. And I am not a part of wg-rustup either! Yet I am working on fixing it, because no one else has, as wg-rustup effort has mostly been tied up in other tasks. Almost like it's some sort of community-project driven forward mostly by the effort of volunteers! 💦 |
I'd suggest that the best thing we could do would be to make |
OK, so apparently MacOS does something different now as of Catalina. I asked a MacOS Catalina user to go over their stuff and for their Terminal.app, their I was examining an offered example, another project (starship) handles a similar problem by having an init binary which is eval'd and returns appropriate shell commands. This is slightly spooky to me, but on the other hand it would allow |
Here's the results of my investigation of {rc,pro}file usage over the suite of shells that commonly come with Rust supported platforms. I will be including a further expansion of my reasoning in my actual commits, but I thought I would leave the notes here in case some other poor benighted soul trawls this issue. # POSIX, Non-Specified
/etc/profile
~/.profile
# Bash, Login
/etc/profile
~/.bash_profile || ~/.bash_login || ~/.profile
# Bash, Interactive Non-Login
~/.bashrc
# zsh, Always
/etc/zshenv
($ZDOTDIR | $HOME)/.zshenv
# zsh, On Interactive
($ZDOTDIR | $HOME)/.zshrc
# zsh appears to source .zshrc in interactive shells, even login shells.
# So .zprofile is irrelevant.
# tcsh, Always
/etc/csh.cshrc
~/.tcshrc || ~/.cshrc |
See also #975 (comment) |
We should probably figure out how to play nice with nushell at some point. |
ion shell is the shell for Redox which is a build target of Rust, so I would prioritize that over Nushell, tbh. I don't intend on handling either though (for this anyways). |
OK, should be finishing up here soon after Suddenly, Learning More About Modules while I was futzing with refactoring things, but for note to the future: reading |
Problem
When running installer using
curl https://sh.rustup.rs -sSf | sh
in Debian 10 "Buster", installer adds a line to modifyPATH
in~/.profile
. That file is not used at all in graphical terminals, so this is wrong. I would expect modifiedPATH
to be active in both login shells and graphical terminals.Steps
curl https://sh.rustup.rs -sSf | sh
accepting defaultsPATH
has not been modifiedPossible Solution(s)
The line to modify
PATH
needs to be added to~/.bashrc
instead of~/.profile
.Notes
Output of
rustup --version
: none, as rustup is not in PATHOutput of
rustup show
: none, as rustup is not in PATHThe text was updated successfully, but these errors were encountered: