-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Don't undo require decorations made by other gems #6308
Conversation
2f78105
to
2958677
Compare
The change itself looks ok to me. If I understand it well, instead of defining custom But I do struggle to follow the testing changes. Part of the I did quick testing locally, and tests are passing even when file is renamed back to be under @deivid-rodriguez would you mind to explain a little why this change is needed? Is |
Good point about standalone, I'll update to include it! The change is needed to play nicer with gems that decorate I should've commented on test changes before setting this as ready. The problem is that RubyGems test suite, as it works now, loads In this case, it's biting us again because during RubyGems test execution, Bundler is loaded and reverts the require monkeypatch and then depending on order, the tests checking the "automatic activation of gems on require" start failing since the behavior is no longer there. You can see the failures without test changes here: https://github.com/rubygems/rubygems/actions/runs/4007644021/jobs/6880765362. The solution is exactly what you observed: ensure that our main suite does not load Bundler at all by moving the specs that load Bundler to a separate file that does not get run by default. We still get the functionality that loads Bundler tested through I'm not sure why this didn't bite us with the previous approach, but I think this kind of isolation is helpful regardless so I'd rather not look deeper into that. I do not think it's worth mentioning this in CONTRIBUTING because these few tests exercise a very particular functionality (auto require of |
2958677
to
b5b5179
Compare
I added the change also to standalone! I believe this is ready, but I believe this is technically a new feature in RubyGems and a bug fix in Bundler that leverages the new feature. So let me split the PR so that each one get their proper entry in the respective changelogs. |
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.
Feel free to merge once ready.
I extracted #6319 and will leave this one for the fix in Bundler. |
Instead, let RubyGems require be aware of Bundler having taken over. Co-authored-by: Xavier Noria <fxn@hashref.com>
b5b5179
to
cce88c0
Compare
Don't undo require decorations made by other gems (cherry picked from commit 82024db)
What was the end-user or developer problem that led to this PR?
If a gem decorates require, depending on the order things are loaded, Bundler may end up not only removing
RubyGems
require decorations, but also those extra decorations.What is your fix for the problem, implemented in this PR?
My fix is, instead of overwriting
require
with the original version, let RubyGems require be aware of Bundler having taken over, and delegate to standard require in that case.Fixes #5263.
Make sure the following tasks are checked