Package: ruby-sqlite3
Version: 1.4.2-3build1
Severity: normal
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu jammy

Dear Maintainer,

This bug report was also filed in Ubuntu and can be found at
https://launchpad.net/bugs/1956796
The description, from Dan Bungert, follows:

When built against sqlite 3.37 or newer, the build will fail in test. 
Examples:
https://autopkgtest.ubuntu.com/results/autopkgtest-jammy/jammy/amd64/r/ruby-sqlite3/20220107_075823_1a1f3@/log.gz
https://ci.debian.net/data/autopkgtest/unstable/amd64/r/ruby-sqlite3/17951708/log.gz

TC_ResultSet#test_types 
[/tmp/autopkgtest.J0NEKT/build.hEV/src/test/test_integration_resultset.rb:121]:
Expected: ["integer", "text"]
  Actual: ["INTEGER", "TEXT"]

+2 more failures of a similar nature.

As of sqlite 3.37.0, with FossilOrigin-Name:
d2da62a9df63036b02dadca3798de9e623c2680b3ef0c37d2b18bb88693afd7f,
type names for 5 common types BLOB, INT, INTEGER, REAL, and TEXT will be
treated as if they were created in all uppercase.

See attached for my proposed change for Ubuntu to address the test failures.

-Dan
diff -Nru ruby-sqlite3-1.4.2/debian/changelog 
ruby-sqlite3-1.4.2/debian/changelog
--- ruby-sqlite3-1.4.2/debian/changelog 2021-12-03 15:07:08.000000000 -0700
+++ ruby-sqlite3-1.4.2/debian/changelog 2022-01-07 14:15:57.000000000 -0700
@@ -1,3 +1,9 @@
+ruby-sqlite3 (1.4.2-3ubuntu1) jammy; urgency=medium
+
+  * Adjust tests for compatibility with sqlite 3.37.0 or newer (LP: #1956796)
+
+ -- Dan Bungert <daniel.bung...@canonical.com>  Fri, 07 Jan 2022 14:15:57 -0700
+
 ruby-sqlite3 (1.4.2-3build2) jammy; urgency=medium
 
   * No-change upload due to ruby3.0 transition, remove ruby2.7 support.
diff -Nru ruby-sqlite3-1.4.2/debian/control ruby-sqlite3-1.4.2/debian/control
--- ruby-sqlite3-1.4.2/debian/control   2021-02-09 15:26:09.000000000 -0700
+++ ruby-sqlite3-1.4.2/debian/control   2022-01-07 14:15:57.000000000 -0700
@@ -1,7 +1,8 @@
 Source: ruby-sqlite3
 Section: ruby
 Priority: optional
-Maintainer: Debian Ruby Team 
<pkg-ruby-extras-maintain...@lists.alioth.debian.org>
+Maintainer: Ubuntu Developers <ubuntu-devel-disc...@lists.ubuntu.com>
+XSBC-Original-Maintainer: Debian Ruby Team 
<pkg-ruby-extras-maintain...@lists.alioth.debian.org>
 Uploaders: Dmitry Borodaenko <angdr...@debian.org>
 Build-Depends: debhelper-compat (= 13),
                gem2deb (>= 1),
diff -Nru ruby-sqlite3-1.4.2/debian/patches/series 
ruby-sqlite3-1.4.2/debian/patches/series
--- ruby-sqlite3-1.4.2/debian/patches/series    2021-02-09 14:22:28.000000000 
-0700
+++ ruby-sqlite3-1.4.2/debian/patches/series    2022-01-06 17:05:49.000000000 
-0700
@@ -1,2 +1,3 @@
 use-slugs-in-faq.diff
 drop-vendorizing-tasks.patch
+type-case.patch
diff -Nru ruby-sqlite3-1.4.2/debian/patches/type-case.patch 
ruby-sqlite3-1.4.2/debian/patches/type-case.patch
--- ruby-sqlite3-1.4.2/debian/patches/type-case.patch   1969-12-31 
17:00:00.000000000 -0700
+++ ruby-sqlite3-1.4.2/debian/patches/type-case.patch   2022-01-07 
14:15:56.000000000 -0700
@@ -0,0 +1,77 @@
+Description: Use uppercase types for test
+ As of sqlite 3.37.0, with FossilOrigin-Name:
+ d2da62a9df63036b02dadca3798de9e623c2680b3ef0c37d2b18bb88693afd7f,
+ type names for 5 common types BLOB, INT, INTEGER, REAL, and TEXT will be
+ treated as if they were created in all uppercase.  This patch does two things
+ about this:
+ 1) Adjust expected types to upper case, as that will always be what newer
+ sqlite actually does for these 5 types
+ 2) adjust created tables to use upper case type names, so that pre-3.37 sqlite
+ uses the type name strings expected by the tests
+Author: Dan Bungert <daniel.bung...@canonical.com>
+Bug-Ubuntu: https://launchpad.net/bugs/1956796
+Forwarded: https://github.com/sparklemotion/sqlite3-ruby/pull/304 ; PR comment
+Last-Update: 2022-01-07
+--- a/test/test_database.rb
++++ b/test/test_database.rb
+@@ -268,12 +268,12 @@
+ 
+     def test_table_info
+       db = SQLite3::Database.new(':memory:', :results_as_hash => true)
+-      db.execute("create table foo ( a integer primary key, b text )")
++      db.execute("create table foo ( a INTEGER primary key, b TEXT )")
+       info = [{
+         "name"       => "a",
+         "pk"         => 1,
+         "notnull"    => 0,
+-        "type"       => "integer",
++        "type"       => "INTEGER",
+         "dflt_value" => nil,
+         "cid"        => 0
+       },
+@@ -281,7 +281,7 @@
+         "name"       => "b",
+         "pk"         => 0,
+         "notnull"    => 0,
+-        "type"       => "text",
++        "type"       => "TEXT",
+         "dflt_value" => nil,
+         "cid"        => 1
+       }]
+--- a/test/test_integration.rb
++++ b/test/test_integration.rb
+@@ -34,11 +34,11 @@
+ 
+   def test_table_info_without_defaults_for_version_3_3_8_and_higher
+     @db.transaction do
+-      @db.execute "create table no_defaults_test ( a integer default 1, b 
integer )"
++      @db.execute "create table no_defaults_test ( a INTEGER default 1, b 
INTEGER )"
+       data = @db.table_info( "no_defaults_test" )
+-      assert_equal({"name" => "a", "type" => "integer", "dflt_value" => "1", 
"notnull" => 0, "cid" => 0, "pk" => 0},
++      assert_equal({"name" => "a", "type" => "INTEGER", "dflt_value" => "1", 
"notnull" => 0, "cid" => 0, "pk" => 0},
+         data[0])
+-      assert_equal({"name" => "b", "type" => "integer", "dflt_value" => nil, 
"notnull" => 0, "cid" => 1, "pk" => 0},
++      assert_equal({"name" => "b", "type" => "INTEGER", "dflt_value" => nil, 
"notnull" => 0, "cid" => 1, "pk" => 0},
+         data[1])
+     end
+   end
+--- a/test/test_integration_resultset.rb
++++ b/test/test_integration_resultset.rb
+@@ -4,7 +4,7 @@
+   def setup
+     @db = SQLite3::Database.new(":memory:")
+     @db.transaction do
+-      @db.execute "create table foo ( a integer primary key, b text )"
++      @db.execute "create table foo ( a INTEGER primary key, b TEXT )"
+       @db.execute "insert into foo ( b ) values ( 'foo' )"
+       @db.execute "insert into foo ( b ) values ( 'bar' )"
+       @db.execute "insert into foo ( b ) values ( 'baz' )"
+@@ -118,7 +118,7 @@
+   end
+ 
+   def test_types
+-    assert_equal [ "integer", "text" ], @result.types
++    assert_equal [ "INTEGER", "TEXT" ], @result.types
+   end
+ 
+   def test_columns

Reply via email to