Bugs item #27154, was opened at 2009-09-21 07:42
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=575&aid=27154&group_id=126
Category: `gem install` command
Group: None
>Status: Open
Resolution: None
Priority: 3
Submitted By: Ryan Riley (panesofglass)
>Assigned to: John Barnette (jbarnette)
Summary: Computed hash is sometimes too large.
Initial Comment:
The current hash algorithm in dependency.rb (line 138) and specification.rb
(line 658) can sometimes create a hash that is too large. This is also possible
with Array#hash in MRI, which can also misbehave if one of the array elements
returns a large hash value:
class C
def hash
100000000000000000000
end
end
[C.new].hash # => in `hash': bignum too big to convert into
`long' (RangeError)
REXML has a similar issue. http://redmine.ruby-
lang.org/issues/show/1883 tracks the issue, and MRI will be
fixing the issue.
Suggested fixes are:
edit: c:/ruby/libs/ruby/site_ruby/1.8/rubygems/dependency.rb;C840659
File: dependency.rb
===================================================================
--- c:/ruby/libs/ruby/site_ruby/1.8/rubygems/dependency.rb;C840659 (server)
6/23/2009 1:21 PM
+++ c:/ruby/libs/ruby/site_ruby/1.8/rubygems/dependency.rb
@@ -112,7 +112,7 @@
end
def hash # :nodoc:
- name.hash + type.hash + version_requirements.hash
+ name.hash ^ type.hash ^ version_requirements.hash
end
end
===================================================================
edit: c:/ruby/libs/ruby/site_ruby/1.8/rubygems/specification.rb;C908357
File: specification.rb
===================================================================
--- c:/ruby/libs/ruby/site_ruby/1.8/rubygems/specification.rb;C908357 (server)
6/23/2009 1:24 PM
+++ c:/ruby/libs/ruby/site_ruby/1.8/rubygems/specification.rb
@@ -661,9 +661,8 @@
private :same_attributes?
def hash # :nodoc:
- @@attributes.inject(0) { |hash_code, (name, default_value)|
- n = self.send(name).hash
- hash_code + n
+ @@attributes.inject(612553) { |hash_code, (name, default_value)|
+ hash_code ^ self.send(name).hash
}
end
===================================================================
----------------------------------------------------------------------
Comment By: George Mendoza (gsmendoza)
Date: 2010-11-30 19:52
Message:
Hello,
Appreciate if anybody can re-open this ticket. I am also getting the error when
I try to install the dmitryv-backup gem via bundle. Please let me know if I
need to provide any other information in order to fix this bug. Thanks!
Gemfile:
----------------------------------------
source :rubygems
source "http://gems.github.com"
#...
gem 'dmitryv-backup', '2.4.0', :require => "backup"
#...
----------------------------------------
Running:
----------------------------------------
bundle install --local
/usr/local/lib/site_ruby/1.8/rubygems/requirement.rb:109:in `hash': bignum too
big to convert into `long' (RangeError)
from /usr/local/lib/site_ruby/1.8/rubygems/requirement.rb:109:in `hash'
from /usr/local/lib/site_ruby/1.8/rubygems/specification.rb:675:in `hash'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/index.rb:36:in
`inject'
from /usr/local/lib/site_ruby/1.8/rubygems/specification.rb:674:in `each'
from /usr/local/lib/site_ruby/1.8/rubygems/specification.rb:674:in `inject'
from /usr/local/lib/site_ruby/1.8/rubygems/specification.rb:674:in `hash'
from /usr/lib/ruby/1.8/tsort.rb:204:in `include?'
from /usr/lib/ruby/1.8/tsort.rb:204:in
`each_strongly_connected_component_from'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:130:in
`tsort_each_child'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:130:in
`each'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:130:in
`tsort_each_child'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:128:in
`each'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:128:in
`tsort_each_child'
from /usr/lib/ruby/1.8/tsort.rb:203:in
`each_strongly_connected_component_from'
from /usr/lib/ruby/1.8/tsort.rb:209:in
`each_strongly_connected_component_from'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:130:in
`tsort_each_child'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:130:in
`each'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:130:in
`tsort_each_child'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:128:in
`each'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:128:in
`tsort_each_child'
from /usr/lib/ruby/1.8/tsort.rb:203:in
`each_strongly_connected_component_from'
from /usr/lib/ruby/1.8/tsort.rb:182:in `each_strongly_connected_component'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:124:in
`tsort_each_node'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:124:in
`each'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:124:in
`tsort_each_node'
from /usr/lib/ruby/1.8/tsort.rb:180:in `each_strongly_connected_component'
from /usr/lib/ruby/1.8/tsort.rb:148:in `tsort_each'
from /usr/lib/ruby/1.8/tsort.rb:135:in `tsort'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:107:in
`sorted'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in
`each'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:44:in
`run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:8:in
`install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/cli.rb:225:in
`install'
from
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in
`send'
from
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in
`run'
from
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/invocation.rb:118:in
`invoke_task'
from
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor.rb:246:in
`dispatch'
from
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/base.rb:389:in
`start'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/bin/bundle:13
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19
----------------------------------------
Thanks,
George Mendoza
Philippines
----------------------------------------------------------------------
Comment By: Ryan Davis (zenspider)
Date: 2010-11-12 14:46
Message:
This ticket has been deemed stale and we're closing it in order to catch up
with our ticket list. If you think it is still valid, please reopen.
----------------------------------------------------------------------
Comment By: Craig Cook (ccook)
Date: 2010-10-18 14:08
Message:
Hello,
I tried this patch, but I am still getting the error, at the same place in the
code. The error is the same with or without the patch to specification.rb;
dependency.rb was already like the patched part shown above. This happened
when installing using bundler, executed via capistrano.
We had been using hpricot, it wasn't needed, it was giving this error first.
I took it out, but then the same RangeError happened with mysql. I've seen it
before also with nokogiri. (Always with native gems, though).
Here's the relevant part of the log:
----------- begin log ----------------------------
** [out :: 192.168.10.63] Installing mysql (2.8.1)
** [out :: 192.168.10.63] with native extensions
** [out :: 192.168.10.62]
/usr/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:109:in `hash'
** [out :: 192.168.10.62] :
** [out :: 192.168.10.62] bignum too big to convert into `long'
** [out :: 192.168.10.62] (
** [out :: 192.168.10.62] RangeError
** [out :: 192.168.10.62] )
** [out :: 192.168.10.62] from
/usr/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:109:in `hash'
** [out :: 192.168.10.62] from
/usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb:675:in `hash'
** [out :: 192.168.10.62] from /usr/lib/ruby/1.8/fileutils.rb:243:in `inject'
** [out :: 192.168.10.62] from
/usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb:674:in `each'
** [out :: 192.168.10.62] from
/usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb:674:in `inject'
** [out :: 192.168.10.62] from
/usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb:674:in `hash'
** [out :: 192.168.10.62] from /usr/lib/ruby/1.8/tsort.rb:205:in `include?'
** [out :: 192.168.10.62] from /usr/lib/ruby/1.8/tsort.rb:205:in
`each_strongly_connected_component_from'
** [out :: 192.168.10.62] ... 22 levels...
** [out :: 192.168.10.62] from
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/vendor/thor/base.rb:389:in
`start'
** [out :: 192.168.10.62] from
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.2/bin/bundle:13
** [out :: 192.168.10.62] from /usr/bin/bundle:19:in `load'
** [out :: 192.168.10.62] from /usr/bin/bundle:19
----------- end cap output -------------------
running:
------------ system & ruby info ------------------
[cc...@ev2-stage ~]$ ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux]
[cc...@ev2-stage ~]$ gem -v
1.3.7
[cc...@ev2-stage ~]$ uname -a
Linux ev2-stage 2.6.18-194.11.4.el5xen #1 SMP Tue Sep 21 06:28:04 EDT 2010 i686
i686 i386 GNU/Linux
------ end system / ruby info ----------
Gemfile:
----------- begin Gemfile -----------------
source :gemcutter
gem 'rails', '2.3.8'
gem 'mysql', '2.8.1'
gem "geokit"
gem "geokit-rails"
gem "builder"
gem 'chronic'
gem 'whenever'
gem 'database_cleaner'
gem 'apn_on_rails'
gem 'factory_girl'
gem 'net-sftp'
gem 'will_paginate' # dependency for squirrel & jqgrid
gem 'nokogiri' # only for test/functional/auth_controller_test.rb
gem 'cucumber'
gem 'cucumber-rails'
gem 'webrat'
gem 'rspec'
---------- end Gemfile -----------------
So, is this the same issue? It sure looks like it to me. I hope not to have to
dive into the innards of rubygems if possible. But we need to be able to
deploy. The app is working and passing tests on development, but hard to say
on staging as we can't get it over there with cap. I suppose it could all be
done by hand once anyway, but we (other dev on my team and I ) need to be able
to do this over again.
Thanks for your time in this!
Cheers,
Craig
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=575&aid=27154&group_id=126
_______________________________________________
Rubygems-developers mailing list
http://rubyforge.org/projects/rubygems
[email protected]
http://rubyforge.org/mailman/listinfo/rubygems-developers