-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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
Draft
tcladet
wants to merge
1
commit into
nvm-sh:master
Choose a base branch
from
tcladet:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 nosudo
needed. Is there an undefinednvm
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.