Skip to content
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

bash_completion appears to be already installed if PROFILE variable is set on a system PROFILE file #2568

Open
tcladet opened this issue Aug 27, 2021 · 2 comments
Labels
installing nvm: profile detection Issues with nvm's own install script, related to figuring out the right profile file. root / multiuser issues Anything related to using `sudo` or `su`, or using nvm across multiple user accounts.

Comments

@tcladet
Copy link

tcladet commented Aug 27, 2021

Operating system and version:

CentOS 7.6.1811

How did you install nvm?

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | NVM_DIR=/opt/nvm PROFILE=/etc/bashrc bash

What happened?

The output shows => bash_completion source string already in /etc/bashrc where this statement is wrong. This message pops just because the system PROFILE file case is not handled properly.

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 14926  100 14926    0     0  57412      0 --:--:-- --:--:-- --:--:-- 57629
=> Downloading nvm from git to '/opt/nvm'
=> Cloning into '/opt/nvm'...
remote: Enumerating objects: 347, done.
remote: Counting objects: 100% (347/347), done.
remote: Compressing objects: 100% (294/294), done.
remote: Total 347 (delta 38), reused 171 (delta 28), pack-reused 0
Receiving objects: 100% (347/347), 197.06 KiB | 3.86 MiB/s, done.
Resolving deltas: 100% (38/38), done.
* (HEAD detached at FETCH_HEAD)
  master
=> Compressing and cleaning up git repository

=> Appending nvm source string to /etc/bashrc
=> bash_completion source string already in /etc/bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="/opt/nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm

What did you expect to happen?

As the vision of nvm is focused "per-user only", the detection function (that decide if the file set in PROFILE variable is a bash or zsh profile file) should detect if the file provided is a user one. If it is a system one, the installation should stop, or a BIG WARNING should pe printed.

@ljharb
Copy link
Member

ljharb commented Aug 27, 2021

nvm is per-user - it should never go in the system bashrc file.

@ljharb ljharb added root / multiuser issues Anything related to using `sudo` or `su`, or using nvm across multiple user accounts. installing nvm: profile detection Issues with nvm's own install script, related to figuring out the right profile file. labels Aug 27, 2021
@tcladet tcladet changed the title bash_completion is not installed if PROFILE variable is set on /etc/bashrc (CentOS distribution) bash_completion appears to be already installed if PROFILE variable is set on a system PROFILE file Aug 28, 2021
@tcladet
Copy link
Author

tcladet commented Aug 28, 2021

Title and description edited as concluded in Pull Request #2569

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
installing nvm: profile detection Issues with nvm's own install script, related to figuring out the right profile file. root / multiuser issues Anything related to using `sudo` or `su`, or using nvm across multiple user accounts.
Projects
None yet
Development

No branches or pull requests

2 participants