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
Cannot require gem if BUNDLE_PATH is set #3298
Comments
Thanks so much for the clean report, and for finding out this. I'll investigate this and report back! 👍 |
This seems like a regression of rubygems/bundler#7163, and @indirect was right about rubygems/bundler#7163 (comment)... 😅 although probably not in the way we expected. In this case, it sounds like the intention is that bundler uses system gems. The way the current code expects people to do that is by setting So:
Another debate is whether this distinction makes sense and whether we need it or not. The relevant code is here: The ruby scope is only appended to the path if we're not using system gems. Maybe if we adapted the behavior to only append the ruby scope if it's not already present in the @indirect Thougths? |
The fix I suggest at the end of my previous message would be something like diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index 3888ac51d..945bac76f 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -219,7 +219,7 @@ module Bundler
Path = Struct.new(:explicit_path, :system_path, :default_install_uses_path) do
def path
path = base_path
- path = File.join(path, Bundler.ruby_scope) unless use_system_gems?
+ path = File.join(path, Bundler.ruby_scope) unless path.end_with?(Bundler.ruby_scope)
path
end
|
Thank you for investigation! Just FYI, I tried adding |
Thanks @pocke! In principle that error is also unexpected to me, so I'll have a look at that too 👍. |
I investigated why prepending Prepending We could add custom code to |
7501: Delay appending `ruby/<ABI_VERSION>` to `$BUNDLE_PATH` r=indirect a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was that #7163 broke several things regarding official docker ruby images. ### What was your diagnosis of the problem? My diagnosis was that appending `ruby/<ABI_VERSION>` to `$BUNDLE_PATH` break things there because gems nor executables are no longer installed at a location that `rubygems` now about. ### What is your fix for the problem, implemented in this PR? My fix is to revert the offending PR for the time being. ### Why did you choose this fix out of the possible options? I chose this fix because it's quick. I think the better fix would be to get `BUNDLE_PATH__SYSTEM=true` working as expected and upstream that change to the docker images, because I think that's exactly the use case for the docker images. But I need more time for that, and I want to restore working behavior. /cc @indirect Sorry, you were right about this being dangerous 😳 Closes #7197. Closes #7494. Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
@deivid-rodriguez , when You can see more about what I found at https://stackoverflow.com/a/64163511/520567 |
Hei, I lost track of this issue, but #3933 removed the special logic you point out in the stackoverflow thread, so it might've fixed this as a side effect. Could you try if this is reproducible on the latest default branch. |
I believe this particular issue has been fixed, but I opened #4025 for a separate problem discovered while investigating this. I'll close this now. |
I found the problem while developing RuboCop.
rubocop/rubocop#7124
Problem
Ruby does not find a gem that is installed by bundler with
BUNDLE_PATH
since ruby/ruby@8f37629 . This commit updated bundler code in ruby/ruby repository.Reproducing
I use a Dockerfile to reproduce.
It dispplays
cannot load such file -- pry
.The text was updated successfully, but these errors were encountered: