Skip to content

[Fix] install.sh: start a new line before appending to a profile that does not end with one - #3952

Merged
ljharb merged 1 commit into
nvm-sh:masterfrom
lazerg:fix/install-profile-missing-newline
Oct 9, 2026
Merged

ljharb merged 1 commit into
nvm-sh:masterfrom
lazerg:fix/install-profile-missing-newline

Conversation

@lazerg

@lazerg lazerg commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

If the profile already sources nvm.sh, the installer skips the source block and appends only the bash_completion line. That line has no leading newline, so when the profile doesn't end with one, it gets glued onto the user's last line.

The installer now writes a newline first when the profile's last byte isn't one. Added an install_script test that fails without the change.

Fixes #3951

@ljharb
ljharb force-pushed the fix/install-profile-missing-newline branch from d61c5b1 to e45c2df Compare October 9, 2026 03:56
@ljharb
ljharb merged commit e45c2df into nvm-sh:master Oct 9, 2026
326 of 327 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Install script breaks last line in .bashrc if it doesn't have trailing newline.

2 participants