From b8456c3029ae59b4d44e276ece326c7cda6ecbdf47600a1518e7d8c17bb8cd35 Mon Sep 17 00:00:00 2001
From: Reinhard Max <max@suse.com>
Date: Mon, 7 Oct 2019 07:50:05 +0000
Subject: [PATCH] Accepting request 735530 from
 home:AndreasStieger:branches:server:database

sqlite3 3.30.0

OBS-URL: https://build.opensuse.org/request/show/735530
OBS-URL: https://build.opensuse.org/package/show/server:database/sqlite3?expand=0&rev=233
---
 sqlite-doc-3290000.zip       |  3 ---
 sqlite-doc-3300000.zip       |  3 +++
 sqlite-src-3290000.zip       |  3 ---
 sqlite-src-3300000.zip       |  3 +++
 sqlite3-CVE-2019-16168.patch | 46 ------------------------------------
 sqlite3.changes              | 28 ++++++++++++++++++++++
 sqlite3.spec                 |  6 ++---
 7 files changed, 36 insertions(+), 56 deletions(-)
 delete mode 100644 sqlite-doc-3290000.zip
 create mode 100644 sqlite-doc-3300000.zip
 delete mode 100644 sqlite-src-3290000.zip
 create mode 100644 sqlite-src-3300000.zip
 delete mode 100644 sqlite3-CVE-2019-16168.patch

diff --git a/sqlite-doc-3290000.zip b/sqlite-doc-3290000.zip
deleted file mode 100644
index c5993cb..0000000
--- a/sqlite-doc-3290000.zip
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:4fb9cc6d1f29560300692029089ca1d2feb7c397df6f6eb4c2998856d3bc2929
-size 9415641
diff --git a/sqlite-doc-3300000.zip b/sqlite-doc-3300000.zip
new file mode 100644
index 0000000..6c4f6cb
--- /dev/null
+++ b/sqlite-doc-3300000.zip
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:cb4deed80e94c7c0d7ee4a5c76d9d91e4deec48e8b158b473b27253fbfc891d6
+size 9484386
diff --git a/sqlite-src-3290000.zip b/sqlite-src-3290000.zip
deleted file mode 100644
index 1ec07ba..0000000
--- a/sqlite-src-3290000.zip
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:a1533d97504e969ca766da8ff393e71edd70798564813fc2620b0708944c8817
-size 12557725
diff --git a/sqlite-src-3300000.zip b/sqlite-src-3300000.zip
new file mode 100644
index 0000000..dd13350
--- /dev/null
+++ b/sqlite-src-3300000.zip
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:cd9d9e0b7dd0c7359eea714b9e67e47ea17a7ac91574f572bd281807f0419134
+size 12647593
diff --git a/sqlite3-CVE-2019-16168.patch b/sqlite3-CVE-2019-16168.patch
deleted file mode 100644
index c584e2d..0000000
--- a/sqlite3-CVE-2019-16168.patch
+++ /dev/null
@@ -1,46 +0,0 @@
---- src/analyze.c.orig
-+++ src/analyze.c
-@@ -1497,7 +1497,9 @@ static void decodeIntArray(
-       if( sqlite3_strglob("unordered*", z)==0 ){
-         pIndex->bUnordered = 1;
-       }else if( sqlite3_strglob("sz=[0-9]*", z)==0 ){
--        pIndex->szIdxRow = sqlite3LogEst(sqlite3Atoi(z+3));
-+        int sz = sqlite3Atoi(z+3);
-+        if( sz<2 ) sz = 2;
-+        pIndex->szIdxRow = sqlite3LogEst(sz);
-       }else if( sqlite3_strglob("noskipscan*", z)==0 ){
-         pIndex->noSkipScan = 1;
-       }
---- src/where.c.orig
-+++ src/where.c
-@@ -2668,6 +2668,7 @@ static int whereLoopAddBtreeIndex(
-     ** it to pNew->rRun, which is currently set to the cost of the index
-     ** seek only. Then, if this is a non-covering index, add the cost of
-     ** visiting the rows in the main table.  */
-+    assert( pSrc->pTab->szTabRow>0 );
-     rCostIdx = pNew->nOut + 1 + (15*pProbe->szIdxRow)/pSrc->pTab->szTabRow;
-     pNew->rRun = sqlite3LogEstAdd(rLogSize, rCostIdx);
-     if( (pNew->wsFlags & (WHERE_IDX_ONLY|WHERE_IPK))==0 ){
---- test/analyzeC.test.orig
-+++ test/analyzeC.test
-@@ -132,6 +132,20 @@ do_execsql_test 4.3 {
-   SELECT count(a) FROM t1;
- } {/.*INDEX t1ca.*/}
- 
-+# 2019-08-15.
-+# Ticket https://www.sqlite.org/src/tktview/e4598ecbdd18bd82945f602901
-+# The sz=N parameter in the sqlite_stat1 table needs to have a value of
-+# 2 or more to avoid a division by zero in the query planner.
-+#
-+do_execsql_test 4.4 {
-+  DROP TABLE IF EXISTS t44;
-+  CREATE TABLE t44(a PRIMARY KEY);
-+  INSERT INTO sqlite_stat1 VALUES('t44',null,'sz=0');
-+  ANALYZE sqlite_master;
-+  SELECT 0 FROM t44 WHERE a IN(1,2,3);
-+} {}
-+
-+
- 
- # The sz=NNN parameter works even if there is other extraneous text
- # in the sqlite_stat1.stat column.
diff --git a/sqlite3.changes b/sqlite3.changes
index 60508fa..2d2d305 100644
--- a/sqlite3.changes
+++ b/sqlite3.changes
@@ -1,3 +1,31 @@
+-------------------------------------------------------------------
+Sun Oct  6 15:43:57 UTC 2019 - Andreas Stieger <andreas.stieger@gmx.de>
+
+- update to 3.30.0:
+  * Add support for the FILTER clause on aggregate functions
+  * Add support for the NULLS FIRST and NULLS LAST syntax in ORDER BY clauses
+  * The index_info and index_xinfo pragmas are enhanced to provide
+    information about the on-disk representation of WITHOUT ROWID tables
+  * Add the sqlite3_drop_modules() interface, allowing applications
+    to disable automatically loaded virtual tables that they do not need
+  * Improvements to the .recover dot-command in the CLI so that it
+    recovers more content from corrupt database files
+  * Enhance the RBU extension to support indexes on expressions
+  * Change the schema parser so that it will error out if any of
+    the type, name, and tbl_name columns of the sqlite_master table
+    have been corrupted and the database connection is not in
+    writable_schema mode.
+  * The PRAGMA function_list, PRAGMA module_list, and PRAGMA 
+    pragma_list commands are now enabled in all builds by default
+  * Add the SQLITE_DBCONFIG_ENABLE_VIEW option for sqlite3_db_config().
+  * Added the TCL Interface config method in order to be able to
+    disable SQLITE_DBCONFIG_ENABLE_VIEW as well as control other
+    sqlite3_db_config() options from TCL.
+  * Added the SQLITE_DIRECTONLY flag for application-defined SQL
+    functions to prevent those functions from being used inside
+    triggers and views   
+- drop sqlite3-CVE-2019-16168.patch, upstream
+
 -------------------------------------------------------------------
 Tue Sep 10 15:17:35 UTC 2019 - Reinhard Max <max@suse.com>
 
diff --git a/sqlite3.spec b/sqlite3.spec
index d062eb3..1a32251 100644
--- a/sqlite3.spec
+++ b/sqlite3.spec
@@ -17,9 +17,9 @@
 
 
 %define oname sqlite
-%define tarversion 3290000
+%define tarversion 3300000
 Name:           sqlite3
-Version:        3.29.0
+Version:        3.30.0
 Release:        0
 Summary:        Embeddable SQL Database Engine
 License:        SUSE-Public-Domain
@@ -28,7 +28,6 @@ URL:            http://www.sqlite.org/
 Source0:        http://www.sqlite.org/2019/sqlite-src-%{tarversion}.zip
 Source1:        baselibs.conf
 Source2:        http://www.sqlite.org/2019/sqlite-doc-%{tarversion}.zip
-Patch0:         sqlite3-CVE-2019-16168.patch
 BuildRequires:  automake
 BuildRequires:  libtool
 BuildRequires:  pkgconfig
@@ -104,7 +103,6 @@ other documentation found on sqlite.org. The files can be found in
 
 %prep
 %setup -q -n sqlite-src-%{tarversion} -a2
-%patch0
 rm -v sqlite-doc-%{tarversion}/releaselog/current.html
 ln -sv `echo %{version} | sed "s/\./_/g"`.html sqlite-doc-%{tarversion}/releaselog/current.html
 find -type f -name sqlite.css~ -delete