[Rubygems-developers] [ rubygems-Bugs-27699 ] possible to require the wrong version

noreply at rubyforge.org noreply at rubyforge.org
Mon Jan 18 21:49:04 EST 2010


Bugs item #27699, was opened at 2010-01-19 02:49
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=575&aid=27699&group_id=126

Category: #gem and #require methods
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Roger Pack (rogerdpack)
Assigned to: Nobody (None)
Summary: possible to require the wrong version

Initial Comment:
Currently this code fails (install test-unit gem v 2.0.6 and 1.2.3 first).

  gem 'rails', '= 2.3.5' 
  $LOAD_PATH.uniq! # active_support (?) does this internally all the time

  # now attempt to load a gem: 
  gem 'test-unit', '= 1.2.3' 
  require 'test/unit/version' 
  puts Test::Unit::VERSION # should be 1.2.3, but is 2.0.6

This reason for this is that $LOAD_PATH.uniq! is throwing out the "marker" path that has :@gem_prelude_index set, thus it is placing new gems at the end of the $LOAD_PATH, which causes it to always use the highest version of gems.

So my question is...is this a bug of rubygems (it should set :@gem_prelude_index on every path it every loads ever) or is rails in error?
Thanks.
-r


refs:

http://groups.google.com/group/rubyonrails-core/browse_thread/thread/4dad285825c52532
http://groups.google.com/group/rspec/browse_thread/thread/c5ba2311ca2b7d93#

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=575&aid=27699&group_id=126


More information about the Rubygems-developers mailing list