-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
The current installation instructions suggest to place the line
eval "$(pyenv init -)"
at the end of .bash_profile or .bashrc depending on the Linux flavor.
This suggestion may lead to the following scenario:
- The user puts it into .bashrc because that's where he is used to placing bash environment configuration.
- The corresponding Linux flavor has bash configured to execute .bashrc on each bash invocation (not sure about Ubuntus, but this seems to be normal behaviour for many Linux flavors).
- On login, the .bashrc is executed
- The code in .bashrc reaches "pyenv init"
- pyenv is an executable script which has #!/usr/bin/env bash specified as the interpreter
- Consequently, bash is fired up to execute the script.
- The new bash executes .bashrc
- GOTO 4
Obviously, the immediate fix for the problem is to put the initialization line into .bash_profile rather than .bashrc, however at the point in time, when the user encounters this error, this is far from obvious (in particular, this has been the reason for me to not start using pyenv the first time I tried it and had no time to debug the problem, and now it took quite some time to figure out what's happening).
It would be great to find some nice way to prevent this possibility for an infinite loop somehow. The options I'd see, in order of niceness:
- Get rid of the need to run a script on initialization completely. Once I'm adding the $PYENV_ROOT/bin to the path manually on installation, I could as well add the $PYENV_ROOT/shims there in the same command line.
- Have #!/usr/bin/env sh in the script header (this way bash won't load bashrc) and make sure nothing breaks.
- If nothing else, at least fix the current documentation to mention the possibility of this caveat in red blinking letters somewhere.