From 2cd6000f3259fe7882eef756627c5be9e8df873a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppi...@redhat.com>
Date: Thu, 18 Feb 2016 14:01:43 +0100
Subject: Adjust to sqlite-3.11.0

---
 ...rl-tokenizer-only-if-DBD-SQLite-is-compil.patch | 57 ++++++++++++++++++++++
 ...TE_ENABLE_FTS3_TOKENIZER-environmental-va.patch | 33 +++++++++++++
 ...3_tokenizer-is-disabled-by-default-for-se.patch | 32 ++++++++++++
 perl-DBD-SQLite.spec                               | 14 +++++-
 4 files changed, 135 insertions(+), 1 deletion(-)
 create mode 100644 
DBD-SQLite-1.50-register-perl-tokenizer-only-if-DBD-SQLite-is-compil.patch
 create mode 100644 
DBD-SQLite-1.50-see-if-SQLITE_ENABLE_FTS3_TOKENIZER-environmental-va.patch
 create mode 100644 
DBD-SQLite-1.50-two-arg-fts3_tokenizer-is-disabled-by-default-for-se.patch

diff --git 
a/DBD-SQLite-1.50-register-perl-tokenizer-only-if-DBD-SQLite-is-compil.patch 
b/DBD-SQLite-1.50-register-perl-tokenizer-only-if-DBD-SQLite-is-compil.patch
new file mode 100644
index 0000000..54cb17d
--- /dev/null
+++ b/DBD-SQLite-1.50-register-perl-tokenizer-only-if-DBD-SQLite-is-compil.patch
@@ -0,0 +1,57 @@
+From f6981127673b56265254b2891ac1539e036fe321 Mon Sep 17 00:00:00 2001
+From: Kenichi Ishigaki <ishig...@cpan.org>
+Date: Tue, 16 Feb 2016 12:55:38 +0900
+Subject: [PATCH] register perl tokenizer only if DBD::SQLite is compiled with
+ -DSQLITE_ENABLE_FTS3_TOKENIZER
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Petr Písař: Ported to 1.50.
+
+Signed-off-by: Petr Písař <ppi...@redhat.com>
+---
+ SQLite.xs | 4 ++++
+ dbdimp.c  | 3 ++-
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/SQLite.xs b/SQLite.xs
+index 5b51aef..f20e511 100644
+--- a/SQLite.xs
++++ b/SQLite.xs
+@@ -288,7 +288,11 @@ register_fts3_perl_tokenizer(dbh)
+     ALIAS:
+         DBD::SQLite::db::sqlite_register_fts3_perl_tokenizer = 1
+     CODE:
++#if SQLITE_ENABLE_FTS3_TOKENIZER
+         RETVAL = sqlite_db_register_fts3_perl_tokenizer(aTHX_ dbh);
++#else
++        RETVAL = 0;
++#endif
+     OUTPUT:
+         RETVAL
+ 
+diff --git a/dbdimp.c b/dbdimp.c
+index 6a6924b..b36bc67 100644
+--- a/dbdimp.c
++++ b/dbdimp.c
+@@ -2623,6 +2623,7 @@ sqlite_db_backup_to_file(pTHX_ SV *dbh, char *filename)
+ #endif
+ }
+ 
++#if SQLITE_VERSION_NUMBER < 3011000 || SQLITE_ENABLE_FTS3_TOKENIZER
+ typedef struct perl_tokenizer {
+     sqlite3_tokenizer base;
+     SV *coderef;                 /* the perl tokenizer is a coderef that takes
+@@ -2912,7 +2913,7 @@ int sqlite_db_register_fts3_perl_tokenizer(pTHX_ SV *dbh)
+ 
+     return sqlite3_finalize(pStmt);
+ }
+-
++#endif
+ 
+ 
+ /*********************************************************************** 
+-- 
+2.5.0
+
diff --git 
a/DBD-SQLite-1.50-see-if-SQLITE_ENABLE_FTS3_TOKENIZER-environmental-va.patch 
b/DBD-SQLite-1.50-see-if-SQLITE_ENABLE_FTS3_TOKENIZER-environmental-va.patch
new file mode 100644
index 0000000..7470b37
--- /dev/null
+++ b/DBD-SQLite-1.50-see-if-SQLITE_ENABLE_FTS3_TOKENIZER-environmental-va.patch
@@ -0,0 +1,33 @@
+From 58ba45f1797370e220eb627e6b7aec1d567db257 Mon Sep 17 00:00:00 2001
+From: Kenichi Ishigaki <ishig...@cpan.org>
+Date: Tue, 16 Feb 2016 13:06:51 +0900
+Subject: [PATCH] see if SQLITE_ENABLE_FTS3_TOKENIZER environmental variable is
+ set, for those who do need perl tokenizer
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Petr Písař <ppi...@redhat.com>
+---
+ Makefile.PL | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/Makefile.PL b/Makefile.PL
+index db5ddb5..dde27d9 100644
+--- a/Makefile.PL
++++ b/Makefile.PL
+@@ -230,6 +230,11 @@ my @CC_DEFINE = (
+       '-DNDEBUG=1',
+ );
+ 
++# for upstream security concern, this should be set only if requested
++if ($ENV{SQLITE_ENABLE_FTS3_TOKENIZER}) {
++      push @CC_DEFINE, '-DSQLITE_ENABLE_FTS3_TOKENIZER'; # for sqlite >= 
3.11.0
++}
++
+ if (DEVELOPER_ONLY) {
+       # for sqlite >= 3.8.8
+       push @CC_DEFINE, '-DSQLITE_ENABLE_API_ARMOR';
+-- 
+2.5.0
+
diff --git 
a/DBD-SQLite-1.50-two-arg-fts3_tokenizer-is-disabled-by-default-for-se.patch 
b/DBD-SQLite-1.50-two-arg-fts3_tokenizer-is-disabled-by-default-for-se.patch
new file mode 100644
index 0000000..1023f3b
--- /dev/null
+++ b/DBD-SQLite-1.50-two-arg-fts3_tokenizer-is-disabled-by-default-for-se.patch
@@ -0,0 +1,32 @@
+From abed684c431beab32d20da69e344bf3075102a1e Mon Sep 17 00:00:00 2001
+From: Kenichi Ishigaki <ishig...@cpan.org>
+Date: Tue, 16 Feb 2016 11:55:27 +0900
+Subject: [PATCH] two-arg fts3_tokenizer() is disabled by default for security
+ concerns as of SQLite 3.11.0, unless DBD::SQLite is compiled with
+ -DSQLITE_ENABLE_FTS3_TOKENIZER
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Petr Písař <ppi...@redhat.com>
+---
+ t/43_fts3.t | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/t/43_fts3.t b/t/43_fts3.t
+index 7af6c2e..64910ee 100644
+--- a/t/43_fts3.t
++++ b/t/43_fts3.t
+@@ -33,6 +33,9 @@ BEGIN {
+       if (!grep /ENABLE_FTS3/, DBD::SQLite::compile_options()) {
+               plan skip_all => 'FTS3 is disabled for this DBD::SQLite';
+       }
++      if ($DBD::SQLite::sqlite_version_number >= 3011000 and !grep 
/ENABLE_FTS3_TOKENIZER/, DBD::SQLite::compile_options()) {
++              plan skip_all => 'FTS3 tokenizer is disabled for this 
DBD::SQLite';
++      }
+ }
+ use Test::NoWarnings;
+ 
+-- 
+2.5.0
+
diff --git a/perl-DBD-SQLite.spec b/perl-DBD-SQLite.spec
index 2f816e3..5963691 100644
--- a/perl-DBD-SQLite.spec
+++ b/perl-DBD-SQLite.spec
@@ -1,6 +1,6 @@
 Name:           perl-DBD-SQLite
 Version:        1.50
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        SQLite DBI Driver
 Group:          Development/Libraries
 License:        (GPL+ or Artistic) and Public Domain
@@ -9,6 +9,12 @@ Source0:        
http://search.cpan.org/CPAN/authors/id/I/IS/ISHIGAKI/DBD-SQLite-
 Patch0:         perl-DBD-SQLite-bz543982.patch
 # Remove notes about bundled sqlite C source from man page and README
 Patch1:         DBD-SQLite-1.42-Remove-bundled-source-extentions.patch
+# Adjust to sqlite-3.11.0, bug #1309675, in upstream after 1.50
+Patch2:         
DBD-SQLite-1.50-two-arg-fts3_tokenizer-is-disabled-by-default-for-se.patch
+# Adjust to sqlite-3.11.0, bug #1309675, in upstream after 1.50
+Patch3:         
DBD-SQLite-1.50-register-perl-tokenizer-only-if-DBD-SQLite-is-compil.patch
+# Adjust to sqlite-3.11.0, bug #1309675, in upstream after 1.50
+Patch4:         
DBD-SQLite-1.50-see-if-SQLITE_ENABLE_FTS3_TOKENIZER-environmental-va.patch
 # if sqlite >= 3.1.3 then
 #   perl-DBD-SQLite uses the external library
 # else
@@ -61,6 +67,9 @@ libraries.
 %setup -q -n DBD-SQLite-%{version}
 %patch0 -p1 -b .bz543982
 %patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
 # Remove bundled sqlite libraries (BZ#1059154)
 # System libraries will be used
 rm sqlite*
@@ -86,6 +95,9 @@ make test
 %{_mandir}/man3/*.3pm*
 
 %changelog
+* Thu Feb 18 2016 Petr Pisar <ppi...@redhat.com> - 1.50-2
+- Adjust to sqlite-3.11.0 (bug #1309675)
+
 * Thu Feb 11 2016 Jitka Plesnikova <jples...@redhat.com> - 1.50-1
 - 1.50 bump
 
-- 
cgit v0.12


        
http://pkgs.fedoraproject.org/cgit/perl-DBD-SQLite.git/commit/?h=master&id=2cd6000f3259fe7882eef756627c5be9e8df873a
--
Fedora Extras Perl SIG
http://www.fedoraproject.org/wiki/Extras/SIGs/Perl
perl-devel mailing list
perl-devel@lists.fedoraproject.org
http://lists.fedoraproject.org/admin/lists/perl-devel@lists.fedoraproject.org

Reply via email to