Bugs item #29188, was opened at 2011-05-08 19:33
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=575&aid=29188&group_id=126

Category: other
Group: None
Status: Open
Resolution: Rejected
Priority: 3
Submitted By: Greg Hazel (ghazel)
Assigned to: Ryan Davis (zenspider)
Summary: rails 2.3.11 fails to load with rubygems 1.8.1

Initial Comment:
Upgraded from 1.7.2 to 1.8.1, then a Rails 2.3.11 app failed to load:


/usr/local/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/rails/gem_dependency.rb:277:in
 `==': undefined method `name' for "POpen4":String (NoMethodError)
        from 
/usr/local/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:217:in
 `==='
        from 
/usr/local/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:217:in
 `matching_specs'
        from 
/usr/local/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/specification.rb:539:in
 `find_all'
        from 
/usr/local/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/specification.rb:403:in
 `each'
        from 
/usr/local/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/specification.rb:402:in
 `each'
        from 
/usr/local/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:216:in
 `find_all'
        from 
/usr/local/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:216:in
 `matching_specs'
        from 
/usr/local/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:238:in
 `to_specs'
        from 
/usr/local/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:256:in
 `to_spec'
        from 
/usr/local/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems.rb:1182:in
 `gem'
        from 
/usr/local/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/rails/gem_dependency.rb:75:in
 `add_load_paths'
        from 
/usr/local/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:301:in
 `add_gem_load_paths'
        from 
/usr/local/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:301:in
 `each'
        from 
/usr/local/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:301:in
 `add_gem_load_paths'
        from 
/usr/local/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:132:in
 `process'
        from 
/usr/local/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:113:in
 `send'
        from 
/usr/local/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:113:in
 `run'


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

Comment By: Roger Pack (rogerdpack)
Date: 2011-05-13 21:01

Message:
Just ran into this, too.

http://betterlogic.com/roger/2011/05/undefined-method/

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

Comment By: Greg Hazel (ghazel)
Date: 2011-05-12 16:23

Message:
The first Rubygems commit where this error is reproducible is:
https://github.com/rubygems/rubygems/commit/97932d63efbd35704c1669ea281a4701fe2ecb60

Although before that a different error is encountered, which started with this 
commit:
https://github.com/rubygems/rubygems/commit/78a43480440f527c22452e1ae986206712959ef5

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

Comment By: Ryan Davis (zenspider)
Date: 2011-05-12 03:32

Message:
Cleaned up path that works in my rubygems checkout:

rails-2.3.11/lib/rails/gem_dependency.rb:277:in `==': undefined method `name' 
for "POpen4":String (NoMethodError)
from lib/rubygems/dependency.rb:217:in `==='
from lib/rubygems/dependency.rb:217:in `matching_specs'
from lib/rubygems/specification.rb:539:in `find_all'
from lib/rubygems/specification.rb:403:in `each'
from lib/rubygems/specification.rb:402:in `each'
from lib/rubygems/dependency.rb:216:in `find_all'
from lib/rubygems/dependency.rb:216:in `matching_specs'
from lib/rubygems/dependency.rb:238:in `to_specs'
from lib/rubygems/dependency.rb:256:in `to_spec'
from lib/rubygems.rb:1182:in `gem'
from rails-2.3.11/lib/rails/gem_dependency.rb:75:in `add_load_paths'
from rails-2.3.11/lib/initializer.rb:301:in `add_gem_load_paths'
from rails-2.3.11/lib/initializer.rb:301:in `each'
from rails-2.3.11/lib/initializer.rb:301:in `add_gem_load_paths'
from rails-2.3.11/lib/initializer.rb:132:in `process'
from rails-2.3.11/lib/initializer.rb:113:in `send'
from rails-2.3.11/lib/initializer.rb:113:in `run'

gem_dependency.rb:277 is a buggy impl of #==:

    def ==(other)
      self.name == other.name && self.requirement == other.requirement
    end

It's simply bad form to not check the class first. Not sure how that ever 
passed code review. That alone would probably fix the issue, but I'm not sure 
as I can't tell you why their call of #name returns another dep. Couple that 
with a very sketchy implementation:

    def add_load_paths
      self.class.add_frozen_gem_path
      return if @loaded || @load_paths_added
      if framework_gem?
        @load_paths_added = @loaded = @frozen = true
        return
      end
      gem self
      @spec = Gem.loaded_specs[name]
      @frozen = @spec.loaded_from.include?(self.class.unpacked_path) if @spec
      @load_paths_added = true
    rescue Gem::LoadError
    end

`gem self` where self is a GemDependency (a subclass of our Gem::Dependency) 
just doesn't make sense. I'm not sure how this ever worked and it is possible 
it never did given that completely blithe rescue at the bottom...

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

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=575&aid=29188&group_id=126
_______________________________________________
Rubygems-developers mailing list
http://rubyforge.org/projects/rubygems
Rubygems-developers@rubyforge.org
http://rubyforge.org/mailman/listinfo/rubygems-developers

Reply via email to