When GEM_HOME is set to an empty value, GEM_PATH get's built wrong. #133

Closed
amerine opened this Issue Feb 24, 2010 · 7 comments

Projects

None yet

3 participants

@amerine
amerine commented Feb 24, 2010

An empty GEM_HOME should not be used to generate the GEM_PATH. When bundler creates the path it creates an invalid GEM_PATH=":/Users/User/.gem/ruby/1.8:/opt/local/lib/ruby/gems/1.8:". It should not have that leading ':'

Aridious on IRC suggests the issue lies in Bundler#configure_gem_home_and_path

@skippy
skippy commented Feb 24, 2010

I couldn't quite track it down, as to who was setting GEM_HOME incorrectly (rvm? rubygem update --system?).

in Bundler#configure_gem_home_and_path ln 122, the array [gem_home, gem_path] looked like this:
["", ["/Users/Adam/.gem/ruby/1.8", "/opt/local/lib/ruby/gems/1.8", ""]]

if the code is switched to:
[gem_home, gem_path].flatten.compact.delete_if{|v| v.strip.empty?}

you're set.

it is ugly; perhaps scrubbing elsewhere is more appropriate (so another error like this doesn't show up somewhere else).

thanks
btw, skippy == aridious

@amerine
amerine commented Feb 24, 2010

It's RVM setting incorrectly. Edit: I shouldn't say "incorrectly" but it would seem that RVM sets it to blank if it was blank before. A simple rvm reset seems to fix it, but a fix in bundler to handle a blank env variable makes sense.

@indirect
Member

Hey guys. Unfortunately, I haven't been able to reproduce this after trying a couple of times. Can someone give me steps to reproduce (or better yet write a failing test)? Thanks.

@amerine
amerine commented Feb 25, 2010

Sure thing. Here is a sample session where I set GEM_HOME to an empty value and it reproduces the error. https://gist.github.com/8f0f830f7b5a65190120

@skippy
skippy commented Feb 25, 2010

Same happens in Rails 2.3.5 (so it isn't a Rails 3.0 beta thing).

@indirect
Member

Thank you, that helped nail down the exact point of breakage. This is fixed in 55509f2, and will be part of the next release.

@amerine
amerine commented Feb 25, 2010

Excellent!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment