Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

ArgumentError in rubygems/dependency.rb, due to bug in Bundler::Resolver::SpecGroup.search() #1237

Closed
srmaxwell3 opened this issue Jun 14, 2011 · 2 comments

Comments

@srmaxwell3
Copy link

In the process of debugging the exception, below, I added some logging to rubygems/dependency.rb, which gave me the following, immediately prior to the exception:

Gem::Dependency.new(name="activesupport", version_requirements=">= 3.0.0", type=#<Gem::Version "3.0.8">)
/Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/resolver.rb:359:in `new'
/Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/resolver.rb:359:in `search'
/Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/resolver.rb:354:in `gems_size'
/Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/resolver.rb:179:in `resolve'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/source_index.rb:95:in `sort_by'
/Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/resolver.rb:175:in `each'
/Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/resolver.rb:175:in `sort_by'
/Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/resolver.rb:175:in `resolve'
/Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/resolver.rb:160:in `start'
/Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/resolver.rb:128:in `resolve'
/Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/resolver.rb:127:in `catch'
/Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/resolver.rb:127:in `resolve'
/Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/definition.rb:151:in `resolve'
/Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/definition.rb:90:in `specs'
/Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/definition.rb:135:in `specs_for'
/Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/definition.rb:124:in `requested_specs'
/Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/environment.rb:23:in `requested_specs'
/Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/runtime.rb:11:in `setup'
/Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler.rb:107:in `setup'
/Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/setup.rb:17

I made the following change to bundler-1.0.15/lib/bundler/resolver.rb, which I believe fixes the problem:

$ diff -c .rvm/rubies/ruby-1.8.7-p334/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/resolver.rb{~,}
*** .rvm/rubies/ruby-1.8.7-p334/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/resolver.rb~  2011-06-13 17:06:38.000000000 -0400
--- .rvm/rubies/ruby-1.8.7-p334/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/resolver.rb   2011-06-14 14:13:47.000000000 -0400
***************
*** 356,362 ****

      def search(dep)
        if base = @base[dep.name] and base.any?
!         d = Gem::Dependency.new(base.first.name, *[dep.requirement.as_list, base.first.version].flatten)
        else
          d = dep.dep
        end
--- 356,362 ----

      def search(dep)
        if base = @base[dep.name] and base.any?
!         d = Gem::Dependency.new(base.first.name, *[dep.requirement.as_list, base.first.version].flatten.first)
        else
          d = dep.dep
        end

The command you ran
bundle exec rdebug /Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/bin/spec spec/models/footage_handler2_spec.rb

Exception backtrace(s), if any

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/dependency.rb:52:in `initialize': Valid types are [:development, :runtime], not nil (ArgumentError)
    from /Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/resolver.rb:359:in `new'
    from /Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/resolver.rb:359:in `search'
    from /Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/resolver.rb:354:in `gems_size'
    from /Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/resolver.rb:179:in `resolve'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/source_index.rb:95:in `sort_by'
    from /Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/resolver.rb:175:in `each'
    from /Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/resolver.rb:175:in `sort_by'
    from /Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/resolver.rb:175:in `resolve'
    from /Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/resolver.rb:160:in `start'
    from /Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/resolver.rb:128:in `resolve'
    from /Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/resolver.rb:127:in `catch'
    from /Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/resolver.rb:127:in `resolve'
    from /Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/definition.rb:151:in `resolve'
    from /Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/definition.rb:90:in `specs'
    from /Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/definition.rb:135:in `specs_for'
    from /Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/definition.rb:124:in `requested_specs'
    from /Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/environment.rb:23:in `requested_specs'
    from /Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/runtime.rb:11:in `setup'
    from /Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler.rb:107:in `setup'
    from /Users/sidmaxwell/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.15/lib/bundler/setup.rb:17

Your Gemfile

source "http://rubygems.org"

source :rubygems
gem "activesupport", ">= 3.0.0"
gem "tzinfo" # NOTE: 2010-07-13 14:20:57: Needed for activesupport
gem "i18n" # NOTE: 2010-07-13 14:20:57: Needed for activesupport
gem "animoto_api_utils", :git => "git@github.com:animoto/animoto_api_utils.git"
gem 'capistrano-ext'
gem 'json', '>= 1.1.7'
gem "av_file", :git => "git@github.com:animoto/av_file.git"
gem 'merb-core'
gem 'ruby-mp3info', '= 0.6.9', :require => "mp3info"
gem 'oauth'
gem 'rdoc'
gem 'right_aws'
gem "rspec", "1.3.0", :require => "spec"

gem 'extensions'
gem 'RubyInline', '>=3.7.0'
gem 'webrat'

group :test do
  # gem "rspec", "1.3.0"
  # gem "factory_girl", "1.2.3"
  # gem "webrat", "0.7.0"
  # gem "rcov"
  # gem "webmock"
  # gem "cucumber", "0.6.4"
  # gem "database_cleaner", "0.5.0"
  # gem "jsonpath", :git => "git://github.com/lritter/jsonpath.git"
  # gem "pickle", "0.2.5", :git => "git://github.com/lritter/pickle.git"
  # gem "mocha"
  gem "ruby-debug"
end

Your Gemfile.lock

GIT
  remote: git@github.com:animoto/animoto_api_utils.git
  revision: 03f579222d5913e955e5bf3716b9246d228407f6
  specs:
    animoto_api_utils (0.0.15)
      activesupport (>= 2.3.5)
      i18n
      tzinfo

GIT
  remote: git@github.com:animoto/av_file.git
  revision: 3afb2bcbe721eb5276a8ae19261243d0dcf05522
  specs:
    av_file (0.8)
      activesupport (>= 3.0.0)
      animoto_api_utils (>= 0.0.13)

GEM
  remote: http://rubygems.org/
  remote: http://rubygems.org/
  specs:
    RubyInline (3.9.0)
      ZenTest (~> 4.3)
    ZenTest (4.5.0)
    activesupport (3.0.8)
    capistrano (2.6.0)
      highline
      net-scp (>= 1.0.0)
      net-sftp (>= 2.0.0)
      net-ssh (>= 2.0.14)
      net-ssh-gateway (>= 1.1.0)
    capistrano-ext (1.2.1)
      capistrano (>= 1.0.0)
    columnize (0.3.3)
    erubis (2.7.0)
    extensions (0.6.0)
    extlib (0.9.15)
    highline (1.6.2)
    i18n (0.6.0)
    json (1.5.1)
    linecache (0.45)
    merb-core (1.1.3)
      bundler
      erubis (>= 2.6.2)
      extlib (>= 0.9.13)
      mime-types (>= 1.16)
      rack
      rake
    mime-types (1.16)
    net-scp (1.0.4)
      net-ssh (>= 1.99.1)
    net-sftp (2.0.5)
      net-ssh (>= 2.0.9)
    net-ssh (2.1.4)
    net-ssh-gateway (1.1.0)
      net-ssh (>= 1.99.1)
    nokogiri (1.4.4)
    oauth (0.4.4)
    rack (1.3.0)
    rack-test (0.6.0)
      rack (>= 1.0)
    rake (0.9.2)
    rdoc (3.6.1)
    right_aws (2.1.0)
      right_http_connection (>= 1.2.5)
    right_http_connection (1.3.0)
    rspec (1.3.0)
    ruby-debug (0.10.4)
      columnize (>= 0.1)
      ruby-debug-base (~> 0.10.4.0)
    ruby-debug-base (0.10.4)
      linecache (>= 0.3)
    ruby-mp3info (0.6.9)
    tzinfo (0.3.27)
    webrat (0.7.3)
      nokogiri (>= 1.2.0)
      rack (>= 1.0)
      rack-test (>= 0.5.3)

PLATFORMS
  ruby

DEPENDENCIES
  RubyInline (>= 3.7.0)
  activesupport (>= 3.0.0)
  animoto_api_utils ()!
  av_file ()!
  capistrano-ext ()
  extensions ()
  i18n ()
  json (>= 1.1.7)
  merb-core ()
  oauth ()
  rdoc ()
  right_aws ()
  rspec (= 1.3.0)
  ruby-debug ()
  ruby-mp3info (= 0.6.9)
  tzinfo ()
  webrat ()

Your Bundler configuration settings (run bundle config)
Settings are listed in order of priority. The top value will be used.

What version of bundler you are using (run bundle -v)
Bundler version 1.0.15

What version of Ruby you are using (run ruby -v)
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10.7.4]

What version of Rubygems you are using (run gem -v)
1.6.2

Whether you are using RVM, and if so what version (run rvm -v)
No

Whether you have the rubygems-bundler gem, which can break gem binares
No

@indirect
Copy link
Member

Thanks for the debugging output, it was pretty helpful. My alternate solution was to make the type argument explicit, and ensure that the Gem::Version is always cast to a string. Do you perhaps have a distilled reproduction case that I could use to create a test?

@srmaxwell3
Copy link
Author

I wish I did; it's pretty buried in my code, and I haven't been able to
figure it out to-down, yet. If I manage to do so, I'll send it your way.

Thanks for the help!

On Wed, Jun 15, 2011 at 01:12, indirect <
reply@reply.github.com>wrote:

Thanks for the debugging output, it was pretty helpful. My alternate
solution was to make the type argument explicit, and ensure that the
Gem::Version is always cast to a string. Do you perhaps have a distilled
reproduction case that I could use to create a test?

Reply to this email directly or view it on GitHub:
#1237 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants