How are people using GEM_HOME, in what situations  and when (if ever) should it 
be ignored.

I recently fixed a bug in JRuby that so far would only be exposed to a user 
when they install jruby-head using RVM.

    rvm install jruby-head rewrite's the current rakes hash-bang
    invocation to be: #!/usr/bin/env jruby

    http://jira.codehaus.org/browse/JRUBY-5791

The problem occurred because during the install rvm had already defined GEM_HOME and it referenced a specific MRI Ruby that was not JRuby. Part of the ant distribution install scripts for JRuby install specific gems. When JRuby was running this task Gem.ruby referenced the JRuby executable but Gem.bindir referenced the original GEM_HOME defined when the install invocation was made.

Before fixing this issue one of the results was that jruby installed it's gems 
into the MRI GEM_HOME.

I modified the specific ant task to unset GEM_HOME during the install so the JRuby uses a gem home based on the executing JRuby instance.

I realized also that if I have GEM_HOME defined and referencing a different Ruby VM and I just run JRuby directly it will also be running with Gem.ruby and Gem.bindir referencing resources in separate Ruby VMs.

I've entered an issue in the JRuby issue tracker here:

  http://jira.codehaus.org/browse/JRUBY-5795
  JRuby uses incorrect Gem.bindir when env var GEM_HOME points elsewhere

It's not clear to me what should happen when one Ruby VM is running (with GEM_HOME defined) and another Ruby VM starts up in the same environment. I suspect this occurs infrequently but might happen more often with JRuby.

Which leads me back to my initial question: how is GEM_HOME being used now?

_______________________________________________
Rubygems-developers mailing list
http://rubyforge.org/projects/rubygems
Rubygems-developers@rubyforge.org
http://rubyforge.org/mailman/listinfo/rubygems-developers

Reply via email to