[Rubygems-developers] [ rubygems-Bugs-29067 ] calling .dup on nil while installing a gem

noreply at rubyforge.org noreply at rubyforge.org
Thu Mar 10 16:28:40 EST 2011


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

Category: `gem install` command
Group: v1.6.x
Status: Open
Resolution: Rejected
Priority: 3
Submitted By: Elias Baixas (eliasbaixas)
Assigned to: Ryan Davis (zenspider)
Summary: calling .dup on nil while installing a gem

Initial Comment:
sudo gem env:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.6.1
  - RUBY VERSION: 1.8.7 (2010-12-23 patchlevel 330) [i686-darwin9]
  - INSTALLATION DIRECTORY: /opt/local/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: /opt/local/bin/ruby
  - EXECUTABLE DIRECTORY: /opt/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-darwin-9
  - GEM PATHS:
     - /opt/local/lib/ruby/gems/1.8
     - /Users/elias/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => ["http://gems.rubyforge.org", "http://gems.github.com", "http://gemcutter.org/"]
  - REMOTE SOURCES:
     - http://gems.rubyforge.org
     - http://gems.github.com
     - http://gemcutter.org/

sudo gem install --debug yfactorial-utility_scopes

ERROR:  While executing gem ... (TypeError)
    can't dup NilClass
	/opt/local/lib/ruby/site_ruby/1.8/rubygems/specification.rb:442:in `dup'
	/opt/local/lib/ruby/site_ruby/1.8/rubygems/specification.rb:442:in `initialize_copy'
	/opt/local/lib/ruby/site_ruby/1.8/rubygems/specification.rb:439:in `each'
	/opt/local/lib/ruby/site_ruby/1.8/rubygems/specification.rb:439:in `initialize_copy'
	/opt/local/lib/ruby/site_ruby/1.8/rubygems/specification.rb:832:in `dup'
	/opt/local/lib/ruby/site_ruby/1.8/rubygems/specification.rb:832:in `to_ruby_for_cache'
	/opt/local/lib/ruby/site_ruby/1.8/rubygems/installer.rb:234:in `write_spec'
	/opt/local/lib/ruby/site_ruby/1.8/rubygems/installer.rb:175:in `install'
	/opt/local/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:299:in `install'
	/opt/local/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:270:in `each'
	/opt/local/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:270:in `install'
	/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:120:in `execute'
	/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:115:in `each'
	/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:115:in `execute'
	/opt/local/lib/ruby/site_ruby/1.8/rubygems/command.rb:278:in `invoke'
	/opt/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:133:in `process_args'
	/opt/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:103:in `run'
	/opt/local/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:63:in `run'
	/opt/local/bin/gem:21



----

from the sources (/opt/local/lib/ruby/site_ruby/1.8/rubygems/specification.rb:442) I can see this:


440: self.class.array_attributes.each do |name|
441:      name = :"@#{name}"
442:      next unless other_ivars.include? name
442:      instance_variable_set name, other_spec.instance_variable_get(name).dup
443: end

so the trick would be to add an "if other_spec.instance_variable_get(name)" at line 442 (but then the 'name' variable would be unset, instad of nil, well, I'm not sure :P )

Elias

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

Comment By: Aníbal Rojas (anibalrojas)
Date: 2011-03-10 17:28

Message:
I had the same issue running Ruby Gems 1.6.1 (under RVM). Downgrading to 1.5.2 fixed it. Here are the details of the exception:

$ gem install rubyist-aasm -v2.1.1 --no-rdoc --no-ri --backtrace
ERROR:  While executing gem ... (TypeError)
    can't dup NilClass
	/home/anibal/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/specification.rb:442:in `dup'
	/home/anibal/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/specification.rb:442:in `initialize_copy'
	/home/anibal/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/specification.rb:439:in `each'
	/home/anibal/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/specification.rb:439:in `initialize_copy'
	/home/anibal/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/specification.rb:832:in `dup'
	/home/anibal/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/specification.rb:832:in `to_ruby_for_cache'
	/home/anibal/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/installer.rb:234:in `write_spec'
	/home/anibal/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/installer.rb:175:in `install'
	/home/anibal/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:299:in `install'
	/home/anibal/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:270:in `each'
	/home/anibal/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:270:in `install'
	/home/anibal/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:120:in `execute'
	/home/anibal/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:115:in `each'
	/home/anibal/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:115:in `execute'
	/home/anibal/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/command.rb:278:in `invoke'
	/home/anibal/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:133:in `process_args'
	/home/anibal/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:103:in `run'
	/home/anibal/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:63:in `run'
	/home/anibal/.rvm/rubies/ruby-1.8.7-p334/bin/gem:25


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

Comment By: Elias Baixas (eliasbaixas)
Date: 2011-03-07 18:47

Message:
it should be on http://gems.github.com

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

Comment By: Ryan Davis (zenspider)
Date: 2011-03-07 18:43

Message:
I can't reproduce this:


gem install -i xxx --backtrace yfactorial-utility_scopes
ERROR:  Could not find a valid gem 'yfactorial-utility_scopes' (>= 0) in any repository
ERROR:  Possible alternatives: utility_scopes


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

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


More information about the Rubygems-developers mailing list