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

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
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tcladet
Copy link

@tcladet tcladet commented Aug 27, 2021

All is described in the Pull Request title. Linked issue: #2568

…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")
Copy link
Member

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?

Copy link
Author

@tcladet tcladet Aug 28, 2021

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 ? :)

Copy link
Member

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.

Copy link
Author

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 ? :)

Copy link
Member

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.

Copy link
Author

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 ?

Copy link
Member

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.

Copy link
Author

@tcladet tcladet Aug 28, 2021

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.

Copy link
Member

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?

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.

@ljharb ljharb assigned ljharb and unassigned ljharb Sep 2, 2021
@ljharb ljharb marked this pull request as draft September 2, 2021 23:35
@ljharb ljharb added the needs followup We need some info or action from whoever filed this issue/PR. label Sep 2, 2021
Tjolk072

This comment was marked as spam.

lolhexendixx

This comment was marked as spam.

@ljharb ljharb marked this pull request as ready for review February 18, 2023 15:55
@ljharb ljharb marked this pull request as draft February 18, 2023 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs followup We need some info or action from whoever filed this issue/PR.
7 participants