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
Fix broken brew formula due to loading operating_system.rb
customizations too late
#5154
Fix broken brew formula due to loading operating_system.rb
customizations too late
#5154
Conversation
7314f43
to
717099a
Compare
3d9f18a
to
60a2ac1
Compare
9f760bd
to
c93bb1e
Compare
|
Just FTR, the test failure happened when I applied the patch to Ruby 3.0.3 and executed the test suite via |
And again, I am not happy about the symlink expansion. This is not right. This is not intuitive. Just for example, if you execute Ruby via If the symlink expansion would be so good idea, then this would be the shell behavior:
But in reality, the result is Just as an example this is place, where previously used |
Forgot to mention that I have reported this ticket yesterday to solve the issue: https://bugs.ruby-lang.org/issues/18401 The idea is to really make |
c93bb1e
to
c6a9c81
Compare
We have been expanding rubygems/bundler/lib/bundler/shared_helpers.rb Lines 315 to 331 in a969cf0
In general, I think avoiding runtime crashes or redefinition warnings is a higher priority than potentially causing confusion when symlinked rubies are used. I updated the test so that it hopefully works in your environment now. |
Yes, the test passes and it seems to fix also the issues #5156 👍 Going to apply this fix to Ruby in Fedora in a bit. |
This class does not use `rubygems/deprecate`. It uses `rubygems/version`, which in turn uses `rubygems/deprecate`. Make this explicit.
These files are loaded on startup unconditionally, so we can require them relatively when needed.
It's very common for packagers to configure gem paths in this file, for example, `Gem.default_dir`. Also, setting up default gems requires these paths to be set, so that we know which default gems need to be setup. If we setup default gems before loading `operatin_system.rb` customizations, the wrong default gems will be setup. Unfortunately, default gems loaded by `operating_system.rb` can't be upgraded if we do this, but it seems much of a smaller issue. I wasn't even fully sure it was the right thing to do when I added that, and it was not the culprit of the end user issue that led to making that change. So as part of this change we also need to: * Revert the changes that led to adding the above functionality. * Update some the version of fiddle installed by specs that need to customize `Gem.default_dir`. For completeness, the explanation of why we need to do the latter, it's because these specs were installing a version of fiddle to this customized default dir that no longer matches the default fiddle version on ruby 3.0.3. That means that while before this change, fiddle would required after the default dir had been changed (and whichever version installed there would be correctly picked up), now fiddle is required and activated as a gem _before_ this folder is customized, and then will fail to be found when eagerly resolving dependencies from bundler's binstub. So we now need to install a version exactly matching the highest default version in our support matrix to avoid that. This is still brittle, but I won't be further addressing that here.
Some double load issues were reported a while ago by OS packagers where if a gem has been required before rubygems, and then after, rubygems require would cause a double load. We avoid this issue by activating the corresponding gem if we detect that a file in the default LOAD_PATH that belongs to a default gem has already been required when rubygems registers default gems. However, the fix does not take into account that the default LOAD_PATH could potentially include symlinks. This change fixes the same double load issue described above but for situations where the default LOAD_PATH includes symlinks.
c6a9c81
to
5029f9d
Compare
…efault_dir_is_first_used Fix broken brew formula due to loading `operating_system.rb` customizations too late
…efault_dir_is_first_used Fix broken brew formula due to loading `operating_system.rb` customizations too late
What was the end-user or developer problem that led to this PR?
Hombrew ruby formula no longer works since #5044 .
What is your fix for the problem, implemented in this PR?
The problem is that setting up default gems needs
Gem.default_dir
, which is something commonly customized in this file. So if we setup default gems before loadingoperating_system.rb
customizations, we will setup the wrong default gems.Unfortunately fixing this requires reverting #5044, but I wasn't even sure that enhancement was the right thing to do, and the culprit ended up being something else, so we should fix the real culprit there instead.
Fixes #5151.
Fixes #5043.
Make sure the following tasks are checked