[DRE-commits] [ruby-sqlite3] 01/01: fix FTBFS on big endian architectures

Antonio Terceiro terceiro at moszumanska.debian.org
Tue May 6 20:51:20 UTC 2014


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

terceiro pushed a commit to branch master
in repository ruby-sqlite3.

commit e4c71b7566cca0ac18a382becf5e2a032d1048e3
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Tue May 6 17:47:06 2014 -0300

    fix FTBFS on big endian architectures
---
 debian/changelog                      |  9 +++++++
 debian/patches/handle-big-endian.diff | 49 +++++++++++++++++++++++++++++++++++
 debian/patches/series                 |  1 +
 3 files changed, 59 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 860604a..e35c5cb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+ruby-sqlite3 (1.3.9-2) unstable; urgency=medium
+
+  * Team upload.
+  * debian/patches/handle-big-endian.diff: don't assume the native byte order
+    is little endian. Based on initial patch suggested by David Suárez
+    (Closes: #745929)
+
+ -- Antonio Terceiro <terceiro at debian.org>  Tue, 06 May 2014 17:19:35 -0300
+
 ruby-sqlite3 (1.3.9-1) unstable; urgency=low
 
   * Team upload.
diff --git a/debian/patches/handle-big-endian.diff b/debian/patches/handle-big-endian.diff
new file mode 100644
index 0000000..99f3eba
--- /dev/null
+++ b/debian/patches/handle-big-endian.diff
@@ -0,0 +1,49 @@
+Description: handle big endian architectures
+Author: David Suárez <david.sephirot at gmail.com>
+Reviewed-By: Antonio Terceiro <terceiro at debian.org>
+Bug-Debian: http://bugs.debian.org/745929
+
+--- a/ext/sqlite3/statement.c
++++ b/ext/sqlite3/statement.c
+@@ -240,7 +240,7 @@ static VALUE bind_param(VALUE self, VALU
+ 
+ 
+ #ifdef HAVE_RUBY_ENCODING_H
+-        if (UTF16_LE_P(value)) {
++        if (UTF16_LE_P(value) || UTF16_BE_P(value)) {
+           status = sqlite3_bind_text16(
+               ctx->st,
+               index,
+--- a/test/test_encoding.rb
++++ b/test/test_encoding.rb
+@@ -13,12 +13,13 @@ module SQLite3
+ 
+     def test_select_encoding_on_utf_16
+       str = "foo"
+-      db = SQLite3::Database.new(':memory:'.encode('UTF-16LE'))
++      utf16 = ([1].pack("I") == [1].pack("N")) ? "UTF-16BE" : "UTF-16LE"
++      db = SQLite3::Database.new(':memory:'.encode(utf16))
+       db.execute @create
+       db.execute "insert into ex (id, data) values (1, \"#{str}\")"
+ 
+       stmt = db.prepare 'select * from ex where data = ?'
+-      ['US-ASCII', 'UTF-16LE', 'EUC-JP', 'UTF-8'].each do |enc|
++      ['US-ASCII', utf16, 'EUC-JP', 'UTF-8'].each do |enc|
+         stmt.bind_param 1, str.encode(enc)
+         assert_equal 1, stmt.to_a.length
+         stmt.reset!
+@@ -27,11 +28,12 @@ module SQLite3
+ 
+     def test_insert_encoding
+       str = "foo"
+-      db = SQLite3::Database.new(':memory:'.encode('UTF-16LE'))
++      utf16 = ([1].pack("I") == [1].pack("N")) ? "UTF-16BE" : "UTF-16LE"
++      db = SQLite3::Database.new(':memory:'.encode(utf16))
+       db.execute @create
+       stmt = db.prepare @insert
+ 
+-      ['US-ASCII', 'UTF-16LE', 'UTF-16BE', 'EUC-JP', 'UTF-8'].each_with_index do |enc,i|
++      ['US-ASCII', utf16, 'EUC-JP', 'UTF-8'].each_with_index do |enc,i|
+         stmt.bind_param 1, i
+         stmt.bind_param 2, str.encode(enc)
+         stmt.to_a
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..3a38c2e
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+handle-big-endian.diff

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



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