-
-
Notifications
You must be signed in to change notification settings - Fork 8k
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
Bugfix: bash_completion configuration line is not append if the PROFILE variable is set to /etc/bashrc (which is a valid bashrc file). #2569
base: master
Are you sure you want to change the base?
Conversation
…LE variable is set to /etc/bashrc (which is a valid bashrc file).
@@ -34,7 +34,7 @@ nvm_profile_is_bash_or_zsh() { | |||
local TEST_PROFILE | |||
TEST_PROFILE="${1-}" | |||
case "${TEST_PROFILE-}" in | |||
*"/.bashrc" | *"/.bash_profile" | *"/.zshrc") | |||
*"/.bashrc" | *"/.bash_profile" | *"/.zshrc" | "/etc/bashrc") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that looks like a global profile file. nvm is strictly per-user - why would we want it in a non-user-specific bashrc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi ljharb, for example in a context of a Vagrant deployment: as we act as root during provision command, it is easy to deploy it like this if I want to use my company domain credentials instead of the basic vagrant user. I understand the per-user vision of nvm of course, but it is quite sad to restrict it like this no ? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure but in that environment you don’t need the install script - you can set it up manually in your vagrantfile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course I can install it manually, but there is an install script... Anyway, I don't insist. Maybe something you can put in your roadmap is to ensure the user is not providing a "system" PROFILE file, because it leads to bad behavior during installation. Last question before closing this thread: Why this tool is per-user only ? What prevent the tool to run correctly if it is installed in a global location ? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because if it’s global, then non-root users will be forced to try to use sudo to install global packages or alter installed node versions, and one of the primary benefits of nvm is that you never ever need sudo once installing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it only a question of permission ? Because I obviously got it that nvm configuration would be shared across multiple non-root users. But in my case, we are dealing with personal virtual machines creation only used by one user. And in my example, I deployed it inside a non-root writable directory /opt/nvm
so no sudo
needed. Is there an undefined nvm
behavior in a global configuration context ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, with all those caveats you'll be fine - in that case you're using it for a single user, it's just that that user happens to be root (altho, it's a better idea to have your main user in a vagrant/docker image not be root).
Given all the constraints though, I don't think it's a good idea to account for that in common code paths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Users are not root, just authorized to write things in the nvm directory ;) OK, let's cancel that Pull Request. To me there is still something to fix somewhere because the message shown during the installation: => bash_completion source string already in /etc/bashrc
(which is wrong) should not appear, or something should prevent to handle other than user PFOFILE files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I totally agree that seems wrong; maybe you could update this PR to improve the message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, the vision of keeping nvm per user is great, because some peoples has no sudo acces on their computers. I'm using nvm in my work computer and developers has not priviliges to use sudo in my company and no rights to write things to root directory for security purposes.
All is described in the Pull Request title. Linked issue: #2568