Skip to content

Instantly share code, notes, and snippets.

@prahal
Last active December 28, 2015 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prahal/7571353 to your computer and use it in GitHub Desktop.
Save prahal/7571353 to your computer and use it in GitHub Desktop.
I get a collision of results for the hash method of arrays : ruby 1.9.3, arm A9, debian sid.
Bundler 1.3.5
Ruby 1.9.3 (2013-06-27 patchlevel 448) [arm-linux-eabihf]
Rubygems 1.8.23
GEM_HOME
rubygems-bundler (1.4.2)
Bundler settings
bin
Set for your local app (/home/prahal/Projects/Work/Wimake/KeyBox/alban/test2/.bundle/config): "bin"
Gemfile
# Update this Gemfile with any additional dependencies and run
# 'bundle install' to get them all installed. Daemon-kit's capistrano
# deployment will ensure that the bundle required by your daemon is properly
# installed.
#
# For more information on bundler, please visit http://gembundler.com
source 'https://rubygems.org'
gem 'serialport', "~> 1.2.1"
gem 'sqlite3'
gem 'sequel'
# Live on the edge instead: gem 'daemon-kit', :github => 'kennethkalmer/daemon-kit'
gem 'daemon-kit'
gem 'eventmachine'
#
# safely (http://github.com/kennethkalmer/safely)
gem 'safely' # Optional, but recommended.
# gem 'toadhopper' # For reporting exceptions to hoptoad
# gem 'mail' # For reporting exceptions via mail
gem 'amqp'
group :development, :test do
gem 'rake'
gem 'rspec'
# fake http
gem "fakeweb", "~> 1.3"
# Fixtures
gem 'sequel-fixture'
# fabrics
gem 'fabrication'
# BDD
gem 'aruba'
gem 'cucumber'
end
Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
activesupport (3.1.12)
multi_json (~> 1.0)
amq-protocol (1.8.0)
amqp (1.1.1)
amq-protocol (>= 1.8.0)
eventmachine
aruba (0.5.3)
childprocess (>= 0.3.6)
cucumber (>= 1.1.1)
rspec-expectations (>= 2.7.0)
axiom-types (0.0.5)
descendants_tracker (~> 0.0.1)
ice_nine (~> 0.9)
backports (3.3.5)
builder (3.2.2)
childprocess (0.3.9)
ffi (~> 1.0, >= 1.0.11)
coercible (0.2.0)
backports (~> 3.0, >= 3.1.0)
descendants_tracker (~> 0.0.1)
cucumber (1.3.10)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.12)
multi_json (>= 1.7.5, < 2.0)
multi_test (>= 0.0.2)
daemon-kit (0.2.3)
eventmachine (>= 0.12.10)
i18n
rubigen
safely (>= 0.3.1)
thor
descendants_tracker (0.0.3)
diff-lcs (1.2.5)
discoverer (0.0.2)
virtus
equalizer (0.0.7)
eventmachine (1.0.3)
fabrication (2.9.3)
fakeweb (1.3.0)
fast (0.1.4)
metafun (>= 0.2.0)
sub-setter (>= 0.0.2)
ffi (1.9.3)
gherkin (2.12.2)
multi_json (~> 1.3)
i18n (0.6.5)
ice_nine (0.10.0)
metafun (0.2.0)
multi_json (1.8.2)
multi_test (0.0.2)
rake (10.1.0)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.7)
rspec-expectations (2.14.4)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.4)
rubigen (1.5.8)
activesupport (>= 2.3.5, < 3.2.0)
safely (0.3.2)
sequel (4.4.0)
sequel-fixture (2.0.1)
fast
sequel
symbolmatrix
serialport (1.2.3)
sqlite3 (1.3.8)
sub-setter (0.0.2)
symbolmatrix (1.2.0)
discoverer
thor (0.18.1)
virtus (1.0.0)
axiom-types (~> 0.0.5)
coercible (~> 0.2)
descendants_tracker (~> 0.0.1)
equalizer (~> 0.0.7)
PLATFORMS
ruby
DEPENDENCIES
amqp
aruba
cucumber
daemon-kit
eventmachine
fabrication
fakeweb (~> 1.3)
rake
rspec
safely
sequel
sequel-fixture
serialport (~> 1.2.1)
sqlite3
# on arm (odroid u2)
#$ ruby ~/collision.rb
#708079652
#708079652
require 'rubygems'
p ["discoverer", Gem::Version.new("0.0.2"), "ruby"].hash
p ["sub-setter", Gem::Version.new("0.0.2"), "ruby"].hash
I am attempting to run rspec inside my project and even my own project but fails bundler. Backtrace is:
$ rspec
including Virtus module is deprecated. Use 'include Virtus.model' instead /var/lib/gems/1.9.1/gems/discoverer-0.0.2/lib/discoverer/model.rb:4:in `include'
/var/lib/gems/1.9.1/gems/backports-3.3.5/lib/backports/tools.rb:328:in `require': cannot load such file -- sub-setter (LoadError)
from /var/lib/gems/1.9.1/gems/backports-3.3.5/lib/backports/tools.rb:328:in `require_with_backports'
from /var/lib/gems/1.9.1/gems/fast-0.1.4/lib/fast.rb:2:in `<top (required)>'
from /var/lib/gems/1.9.1/gems/backports-3.3.5/lib/backports/tools.rb:328:in `require'
from /var/lib/gems/1.9.1/gems/backports-3.3.5/lib/backports/tools.rb:328:in `require_with_backports'
from /var/lib/gems/1.9.1/gems/sequel-fixture-2.0.1/lib/sequel-fixture.rb:3:in `<top (required)>'
from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:72:in `require'
from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:72:in `block (2 levels) in require'
from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:70:in `each'
from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:70:in `block in require'
from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:59:in `each'
from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:59:in `require'
from /usr/lib/ruby/vendor_ruby/bundler.rb:132:in `require'
from /home/prahal/Projects/Work/Wimake/KeyBox/alban/test2/config/environment.rb:10:in `<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/prahal/Projects/Work/Wimake/KeyBox/alban/test2/spec/spec_helper.rb:10:in `<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/prahal/Projects/Work/Wimake/KeyBox/alban/test2/spec/test2_spec.rb:1:in `<top (required)>'
from /var/lib/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `load'
from /var/lib/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
from /var/lib/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `each'
from /var/lib/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `load_spec_files'
from /var/lib/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/command_line.rb:22:in `run'
from /var/lib/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/runner.rb:80:in `run'
from /var/lib/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/runner.rb:17:in `block in autorun'
It turns out that the sub-setter is partially removed from the Gemfile.lock in the process ! That is it stays as a dependency
of fast, but is removed from the four spaces level (in the "GEM\n specs:" section).
Then one have to do anew "bundle update" to refresh the lock file and get it anew. This matter for to test the "patch" I came up with is working.
It turns out that as above above collision.rb showcase I get the same identifier for two different gems.
Patch in the lazy_specification.rb.diff sort out the issue (but only after a 'bundle update' to restore the Gemfile.lock into
a sane state). I append the gem name to the identifier.
Thus now the keys that are the LazySpecification identifier the LockfileParser @specs hash ought not to overlap (and a gem get discarded as not assignement happens to the specs if the key is already assigned to).
https://github.com/bundler/bundler/blob/master/lib/bundler/lockfile_parser.rb#L128, where identifier comes from https://github.com/bundler/bundler/blob/master/lib/bundler/lazy_specification.rb#L65
--- lazy_specification.rb.old 2013-11-21 00:34:10.071335635 +0100
+++ lazy_specification.rb 2013-11-21 00:33:29.426644500 +0100
@@ -61,7 +61,7 @@
end
def identifier
- @__identifier ||= [name, version, source, platform, dependencies].hash
+ @__identifier ||= [name, version, source, platform, dependencies].hash.to_s + name
end
private
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment