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

noreply at rubyforge.org noreply at rubyforge.org
Thu Mar 10 20:23:21 EST 2011


Bugs item #29067, was opened at 2011-03-07 04: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: Eric Hodel (drbrain)
Date: 2011-03-10 17:23

Message:
This appears to be a bug specific to github.

taf2-curb, rubyist-aasm and yfactorial-utility_scopes are all broken gems as they have a licenses field that is not an Array as required by the gem specification.  Silently ignoring broken gems is not a safe fix.

Please ask the author to repackage the gems properly and publish them on rubygems.org or move to a newer version:

taf2-curb on github is 15 months old (latest is 0.7.12)
utility_scopes on github is 3 months old (latest is 0.3.1)
rubyist-aasm on github is 16 months old (latest is 2.2.0)

I have opened an issue with github on these broken gems:

http://support.github.com/discussions/site/3134-some-gems-in-gemsgithubcom-are-broken

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

Comment By: Ryan Davis (zenspider)
Date: 2011-03-10 14:47

Message:
Soooo... are all these problems coming from gems served off of github?

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

Comment By: Elias Baixas (eliasbaixas)
Date: 2011-03-10 13:53

Message:
just changing 
/opt/local/lib/ruby/site_ruby/1.8/rubygems/specification.rb:442
line 442 for :
instance_variable_set name, other_spec.instance_variable_get(name).dup if 
other_spec.instance_variable_get(name)

fixed the thing for me, and didn't seem to break anything else.

hope it helps.

Elias

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

Comment By: Michael Hutchinson (shinzon)
Date: 2011-03-10 13:45

Message:
I'm having the same problem running RubyGems 1.6.2 under RVM:

○ gem install taf2-curb --backtrace 

Building native extensions.  This could take a while...
ERROR:  While executing gem ... (TypeError)
    can't dup NilClass
	/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:442:in `dup'
	/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:442:in `block in initialize_copy'
	/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:439:in `each'
	/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:439:in `initialize_copy'
	/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:832:in `initialize_dup'
	/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:832:in `dup'
	/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:832:in `to_ruby_for_cache'
	/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:234:in `write_spec'
	/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:175:in `install'
	/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:299:in `block in install'
	/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:270:in `each'
	/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:270:in `install'
	/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/commands/install_command.rb:120:in `block in execute'
	/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/commands/install_command.rb:115:in `each'
	/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/commands/install_command.rb:115:in `execute'
	/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/command.rb:278:in `invoke'
	/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/command_manager.rb:133:in `process_args'
	/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/command_manager.rb:103:in `run'
	/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:63:in `run'
	/usr/local/rvm/rubies/ruby-1.9.2-p180/bin/gem:21:in `<main>'


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

Comment By: Aníbal Rojas (anibalrojas)
Date: 2011-03-10 13: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 14:47

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

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

Comment By: Ryan Davis (zenspider)
Date: 2011-03-07 14: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