Bundler.setup does not respect RUBYLIB env var #328
Comments
Can you reproduce this bug on ruby 1.8.7 or ruby 1.9.2? |
I can reproduce this bug. Ruby 1.9.2 on Red Hat. I have RUBYLIB and GEM_PATH set to the non-standard /local. I get a LoadError for "set" as well. irb(main):001:0> require 'bundler' Unsetting RUBYLIB doesn't help, and unsetting GEM_PATH prevents me from even being able to load Bundler. I also have RUBYOPT="-rubygems", but unsetting that also has no effect. |
In one line: |
dtsadok, I'm having trouble reproducing this on my local machine. What do you get if you run |
Before I get into the code you asked for, I just wanted to mention that I'm not using rvm. I can repro on several different machines with exactly the same setup. RUBYLIB is /local/lib/ruby/site_ruby/1.9.1/x86_64-linux/ I have pretty much all my gems in /local, but ruby itself, as well as most built-in libraries, like "set", are in /usr/local (which is nfs-mounted read-only on my machine, and I can't access). Also, if I print $LOAD_PATH right before the "require 'set'" line in lib/bundler/resolver.rb, I get this: What other environment variables might be relevant? I listed all the Ruby ones (GEM_HOME doesn't seem to change anything). I can dump my whole env if you think that will help... Anyway, as you asked:
Last but not least: Looks to me that Bundler.setup is blowing away $: and/or $LOAD_PATH on my machine, at least. Hope this helps repro :-P Thanks for taking a look! |
Thanks, hopefully I can repro it now. One last question -- are you using Ruby 1.9.1 deliberately? It has so many bugs (many of which have affected Bundler users) that I am sorry to say we are unable to support it, and strongly suggest using 1.9.2 instead. |
I'm using Ruby 1.9.2. But the libraries as installed are 1.9.1 (I was confused too). |
I think I narrowed down the issue. It's in clean_load_path, with the following condition: which is inside a $LOAD_PATH.reject! block (sorry I don't know how to do inline code :-P) My Gem.path is ["/local"], and p is each of the $LOAD_PATH entries as above. So the result is: So the path is rejected. Maybe the reject condition can be a regex instead of simply include?(). I don't know enough about how Bundler works and what clean_load_path is for to fix it, but it's clearly over-zealous with its cleaning in my setup. I'll try monkey-patching it, I guess. Best, |
Thanks for tracking this down! It sounds like a regex is the way to go. |
p.include? is not a legitimate path comparison Closed by 7d0ec38 |
Platform: OSX Snow Leopard
Ruby: ruby 1.9.1p376 (2009-12-07 revision 26041)
Ruby is installed into ${HOME}/r3 folder. Both GEM_HOME and GEM_PATH points to ${HOME}/r3 folder.
Following code:
require 'rubygems'
require 'bundler'
Bundler.setup
Raises:
'/Users/jenya/r3/gems/bundler-0.9.25/lib/bundler/resolver.rb:1:in
require': no such file to load -- set (LoadError) from /Users/jenya/r3/gems/bundler-0.9.25/lib/bundler/resolver.rb:1:in
<top (required)>'from /Users/jenya/r3/gems/bundler-0.9.25/lib/bundler/environment.rb:55:in
resolve' from /Users/jenya/r3/gems/bundler-0.9.25/lib/bundler/environment.rb:59:in
resolve_locally'from /Users/jenya/r3/gems/bundler-0.9.25/lib/bundler/environment.rb:28:in
specs' from /Users/jenya/r3/gems/bundler-0.9.25/lib/bundler/runtime.rb:17:in
setup'from /Users/jenya/r3/gems/bundler-0.9.25/lib/bundler.rb:76:in
gem_setup' from /Users/jenya/projects/finance/config/boot.rb:4:in
The main issue IMHO is runtime.rb:14. It just removes all the load path's including ruby libraries itself. Code shared_helpers.rb:69 proves it. All the load path's are just removed since I have everything in ${HOME}/r3
The text was updated successfully, but these errors were encountered: