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

Use the new rbenv init to set up the user's shell #50

Merged
merged 3 commits into from
May 3, 2024

Conversation

mislav
Copy link
Member

@mislav mislav commented Apr 29, 2024

Depends on rbenv/rbenv#1568

mislav added 3 commits April 29, 2024 22:15
This is because entries in `/opt/rubies` are typically prefixed with "ruby-",
but rbenv does not use that prefix. Also, this is a feature of the installer
literally no one asked for.
@mislav mislav merged commit 826acc5 into main May 3, 2024
2 checks passed
@mislav mislav deleted the rbenv-init-overhaul branch May 3, 2024 15:02
mattbrictson added a commit to mattbrictson/tomo that referenced this pull request May 25, 2024
Recently, tomo's `rbenv:install` task has started failing with this
output:

```
Installing ruby 3.3.0 -- this may take several minutes
CFLAGS=-O3 rbenv install 3.3.0 --verbose
bash: line 1: rbenv: command not found
```

This is because rbenv was recently updated[^1] to to automatically add
the `rbenv init` script to the `.bashrc` file during installation.

However, rbenv adds it to the _bottom_ of the file after the early-exit
that skips most of the `.bashrc` when it is sourced in a non-interactive
shell (i.e. tomo via SSH).

That left rbenv in an installed but broken state; hence the error.

Fix by having `rbenv:install` detect this situation and prepend the
`rbenv init` script to the _top_ of the file, where it will get loaded
for non-interactive shells such as tomo's.

[^1]: rbenv/rbenv-installer#50
kodiakhq bot pushed a commit to mattbrictson/tomo that referenced this pull request May 25, 2024
Recently, tomo's `rbenv:install` task has started failing with this
output:

```
Installing ruby 3.3.0 -- this may take several minutes
CFLAGS=-O3 rbenv install 3.3.0 --verbose
bash: line 1: rbenv: command not found
```

This is because rbenv was recently updated[^1] to to automatically add
the `rbenv init` script to the `.bashrc` file during installation.

However, rbenv adds it to the _bottom_ of the file after the early-exit
that skips most of the `.bashrc` when it is sourced in a non-interactive
shell (i.e. tomo via SSH).

That left rbenv in an installed but broken state; hence the error.

Fix by having `rbenv:install` detect this situation and prepend the
`rbenv init` script to the _top_ of the file, where it will get loaded
for non-interactive shells such as tomo's.

[^1]: rbenv/rbenv-installer#50
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.

1 participant