-
-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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
rbenv: use opt bin symlink in rehash script #75996
Conversation
Thanks, @steinybot. Am I understanding this correctly? This change is meant to fix |
Yes this is correct.
Yes in practice I think that is correct. The install will not fixing the paths directly, it fixes the rehash script which is what writes the paths. The user still has to run rehash to fix existing ruby installs (or if they install a new ruby version then those will have the correct paths). If this goes as a new revision then that is going to change the path from |
@@ -25,6 +26,8 @@ def install | |||
s.gsub! ":/usr/local/etc/rbenv.d", ":#{HOMEBREW_PREFIX}/etc/rbenv.d\\0" if HOMEBREW_PREFIX.to_s != "/usr/local" | |||
end | |||
|
|||
inreplace "libexec/rbenv-rehash", "$(command -v rbenv)", opt_bin/"rbenv" |
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.
This works, but it feels brittle. If the expression command -v rbenv
changes even slightly within rbenv source, this workaround silently breaks.
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.
There are two potential sources of breakage:
- The line we want to change stops using
$(command -v rbenv)
. libexec/rbenv-rehash
starts using$(command -v rbenv)
somewhere else we may not want to change.
Both seem sufficiently unlikely to me, but you'd know more about this than I do, of course. libexec/rbenv-rehash
hasn't changed in years, and the relevant line we want to change has been there for even longer.
I'm not sure 2 is such a problem either, as I think I'm comfortable with using opt_bin/"rbenv"
everywhere rbenv
wants to do command -v rbenv
.
1 should not be a problem as long as it doesn't happen simultaneously with 2, as the inreplace
will error out when it is unable to do a replacement. We can avoid that by tightening the inreplace
with more context from the line we actually want to replace.
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.
Thanks for elaborating. I'm not opposed to this being merged. But I do not feel like the fix is ideal in the long term. The main problem is that Homebrew aggressively prunes old versions of software after upgrades. This breaks not just rbenv, but also ruby gems linked to removed versions of Homebrew software that got updated in the meantime. I have fixed my own Ruby development environment with export HOMEBREW_NO_INSTALL_CLEANUP=true
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.
Hopefully such a change wouldn't break silently and would be picked up by the test.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Sorry for the delayed review on this -- I'm thinking we can drop the Making this change with the |
897a679
to
776f967
Compare
ping @carlocab, I've resolved the merge conflicts here and dropped the revision line. |
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.
Thanks @jonchang, @steinybot!
🤖 A scheduled task has triggered a merge. |
Thank you @steinybot @jonchang for fixing this and @carlocab for reviewing! ❤️ |
brew install --build-from-source <formula>
, where<formula>
is the name of the formula you're submitting?brew test <formula>
, where<formula>
is the name of the formula you're submitting?brew audit --strict <formula>
(after doingbrew install <formula>
)?rbenv equivalent to #75715