[DRE-commits] [ruby-backports] 02/06: Fix hash function collision

David Suárez deiv-guest at moszumanska.debian.org
Wed Dec 4 21:03:16 UTC 2013


This is an automated email from the git hooks/post-receive script.

deiv-guest pushed a commit to branch master
in repository ruby-backports.

commit 1420ef01901da51b6204af78e719167dfc0e57b5
Author: David Suárez <david.sephirot at gmail.com>
Date:   Wed Dec 4 20:30:49 2013 +0100

    Fix hash function collision
---
 debian/patches/fix-collision-with-hash-function | 36 +++++++++++++++++++++++++
 debian/patches/series                           |  1 +
 2 files changed, 37 insertions(+)

diff --git a/debian/patches/fix-collision-with-hash-function b/debian/patches/fix-collision-with-hash-function
new file mode 100644
index 0000000..1afa970
--- /dev/null
+++ b/debian/patches/fix-collision-with-hash-function
@@ -0,0 +1,36 @@
+Description: Fix hash function collision 
+ It seems that the hash function defined in the tests sources, collides with
+ the hash function provided by the library.
+
+Bug-Debian: http://bugs.debian.org/720249
+Author: David Suárez <david.sephirot at gmail.com>
+Last-Update: 2013-12-04
+
+--- ruby-backports-3.3.5.orig/test/_backport_guards_test.rb
++++ ruby-backports-3.3.5/test/_backport_guards_test.rb
+@@ -35,14 +35,14 @@ class AAA_TestBackportGuards < Test::Uni
+   EXCLUDE.map!(&:to_sym) if instance_methods.first.is_a?(Symbol)
+ 
+   # For some very strange reason, Hash[kvp.flatten] doesn't always work in 1.8.6??
+-  def hash(key_value_pairs)
++  def own_hash(key_value_pairs)
+     h = {}
+     key_value_pairs.each{|k,v| h[k] = v}
+     h
+   end
+ 
+   def class_signature(klass)
+-    hash(
++    own_hash(
+       (klass.instance_methods - EXCLUDE).map{|m| [m, klass.instance_method(m)] } +
+       (klass.methods - EXCLUDE).map{|m| [".#{m}", klass.method(m) ]}
+     )
+@@ -62,7 +62,7 @@ class AAA_TestBackportGuards < Test::Uni
+   end
+ 
+   def digest
+-    hash(
++    own_hash(
+       CLASSES.map { |klass| [klass, class_signature(klass)] }
+     )
+   end
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..69c63a9
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+fix-collision-with-hash-function

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-backports.git



More information about the Pkg-ruby-extras-commits mailing list