Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-db/sqlite/, dev-db/sqlite/files/
Date: Mon, 28 Dec 2020 00:01:43
Message-Id: 1609113683.04746cf32c1cb9e984e6b0a47f85e1008aa62963.floppym@gentoo
1 commit: 04746cf32c1cb9e984e6b0a47f85e1008aa62963
2 Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
3 AuthorDate: Sun Dec 27 06:00:00 2020 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Mon Dec 28 00:01:23 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=04746cf3
7
8 dev-db/sqlite: Delete old version (3.32.3-r1).
9
10 Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache.Org>
11 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
12
13 dev-db/sqlite/Manifest | 2 -
14 .../files/sqlite-3.32.1-full_archive-build_1.patch | 670 ---------------------
15 .../files/sqlite-3.32.1-full_archive-build_2.patch | 640 --------------------
16 .../sqlite/files/sqlite-3.32.3-backports_1.patch | 361 -----------
17 .../sqlite/files/sqlite-3.32.3-backports_2.patch | 302 ----------
18 .../sqlite/files/sqlite-3.32.3-backports_3.patch | 220 -------
19 dev-db/sqlite/sqlite-3.32.3-r1.ebuild | 339 -----------
20 7 files changed, 2534 deletions(-)
21
22 diff --git a/dev-db/sqlite/Manifest b/dev-db/sqlite/Manifest
23 index 87df89ad6bb..b26fd917aad 100644
24 --- a/dev-db/sqlite/Manifest
25 +++ b/dev-db/sqlite/Manifest
26 @@ -1,6 +1,4 @@
27 -DIST sqlite-doc-3320300.zip 9772933 BLAKE2B efd72c18d0398c103e3f9c4cfeb03e7794fd69691b1bcea95b74a0c5d8af22aa13abc84ce8dc5864b5f4cb79be239433933b4daca34d1adfcc6f31ce2cde66bf SHA512 af9dca970b4c03c058d7d1cd55a3d11fa4b112dccac942b8660d82a7e9ba2956963fcb429eedfdc85915637c102e1f904ace98c8e0455c4120422bbd9f2f3cd0
28 DIST sqlite-doc-3330000.zip 9834159 BLAKE2B f67155a8ce8e46c2fbc0a4e35722d1fcad86e905a15230adc70732cee267b6b2002c7499883b938129aaa908b99634e4214360e9d1dbdae333b09060de24530e SHA512 14a3cccb4ff6af57738990eeadd37a1b827f89c9c1b16201c62ca5bb9301d39223d48677b9c269ce332210e5c9ae3f42aa0f9de7d79b38acb9809c732d038368
29 DIST sqlite-doc-3340000.zip 10069888 BLAKE2B 343df62bc8b75d57dffe69c779cceb856d9e94a5b2a77c3a972761eedd8b4b0f5f8849102ec271652c3aa4039df75d7f2e503fd04b0547be03e024fdfbd894ac SHA512 1bdf20030e656ec4ce38a264c8ef7a95c9f2731cd7d756a44b35b6c68827e8aba92018007139ee09d1c27b34bcd72bff1a201dc3f30aa13e96120af5d58e835e
30 -DIST sqlite-src-3320300.zip 12461750 BLAKE2B 59cce74d284191cfc69ac09b6014701ddd2b7b3d7ebaad5da4ad71cc200e70285b3b201ff174819aa8dde5f610589d7947f547450334f0f17149014078316185 SHA512 7e027c7163a760fb9b6dbfd2e4ccffb39d4972280583fb0d7f8390017101dfed3b12a36653b3130a548ae4d04c6abb11c0a1921b6f09c54c6ae1e72fbdcb2fd4
31 DIST sqlite-src-3330000.zip 12591089 BLAKE2B 14888bca229683e97c4666f8efb535be5bd3e322de0089f0175ba15e038016be3a3cc00b5bfa8c111538116914cf6d8439839ca5d1e20339b184e547ddf260a4 SHA512 3260e3e03ee2f6a4ff2bc4ea4bada5a1497afeca33878c155a8005824970c6c1eb8a2db58eb3023cab084af475fadb81d1c3c9892ae92c07f884881e6602e173
32 DIST sqlite-src-3340000.zip 12623425 BLAKE2B 548293cf0166407727cd068804eb5e1ce62f654533c88a87b71a6ff62da37eb2af21b89b8d63ee677777ca917e0d685ddcf9b8d5c3c8b2a2b787d71da8e5a161 SHA512 520fbca59da02452e2861a140bde891aedfc8254eafaa6894e8d845369d60d6a921595a411efb2611c0f7b0cadd69a713dcdaaeaad1e4254e9fd9a6efde07f91
33
34 diff --git a/dev-db/sqlite/files/sqlite-3.32.1-full_archive-build_1.patch b/dev-db/sqlite/files/sqlite-3.32.1-full_archive-build_1.patch
35 deleted file mode 100644
36 index aec90e4c07a..00000000000
37 --- a/dev-db/sqlite/files/sqlite-3.32.1-full_archive-build_1.patch
38 +++ /dev/null
39 @@ -1,670 +0,0 @@
40 -Add initialization functions for internal usage in libsqlite3.so.
41 -
42 ---- /ext/misc/carray.c
43 -+++ /ext/misc/carray.c
44 -@@ -383,16 +383,8 @@
45 -
46 - #endif /* SQLITE_OMIT_VIRTUALTABLE */
47 -
48 --#ifdef _WIN32
49 --__declspec(dllexport)
50 --#endif
51 --int sqlite3_carray_init(
52 -- sqlite3 *db,
53 -- char **pzErrMsg,
54 -- const sqlite3_api_routines *pApi
55 --){
56 -+int sqlite3CarrayInit(sqlite3 *db){
57 - int rc = SQLITE_OK;
58 -- SQLITE_EXTENSION_INIT2(pApi);
59 - #ifndef SQLITE_OMIT_VIRTUALTABLE
60 - rc = sqlite3_create_module(db, "carray", &carrayModule, 0);
61 - #ifdef SQLITE_TEST
62 -@@ -404,3 +396,18 @@
63 - #endif /* SQLITE_OMIT_VIRTUALTABLE */
64 - return rc;
65 - }
66 -+
67 -+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
68 -+#ifdef _WIN32
69 -+__declspec(dllexport)
70 -+#endif
71 -+int sqlite3_carray_init(
72 -+ sqlite3 *db,
73 -+ char **pzErrMsg,
74 -+ const sqlite3_api_routines *pApi
75 -+){
76 -+ SQLITE_EXTENSION_INIT2(pApi);
77 -+ (void)pzErrMsg; /* Unused parameter */
78 -+ return sqlite3CarrayInit(db);
79 -+}
80 -+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
81 ---- /ext/misc/completion.c
82 -+++ /ext/misc/completion.c
83 -@@ -483,12 +483,13 @@
84 - return rc;
85 - }
86 -
87 -+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
88 - #ifdef _WIN32
89 - __declspec(dllexport)
90 - #endif
91 - int sqlite3_completion_init(
92 -- sqlite3 *db,
93 -- char **pzErrMsg,
94 -+ sqlite3 *db,
95 -+ char **pzErrMsg,
96 - const sqlite3_api_routines *pApi
97 - ){
98 - int rc = SQLITE_OK;
99 -@@ -499,3 +500,4 @@
100 - #endif
101 - return rc;
102 - }
103 -+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
104 ---- /ext/misc/csv.c
105 -+++ /ext/misc/csv.c
106 -@@ -928,6 +928,22 @@
107 - #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) */
108 -
109 -
110 -+int sqlite3CsvInit(sqlite3 *db){
111 -+#ifndef SQLITE_OMIT_VIRTUALTABLE
112 -+ int rc;
113 -+ rc = sqlite3_create_module(db, "csv", &CsvModule, 0);
114 -+#ifdef SQLITE_TEST
115 -+ if( rc==SQLITE_OK ){
116 -+ rc = sqlite3_create_module(db, "csv_wr", &CsvModuleFauxWrite, 0);
117 -+ }
118 -+#endif
119 -+ return rc;
120 -+#else
121 -+ return SQLITE_OK;
122 -+#endif
123 -+}
124 -+
125 -+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
126 - #ifdef _WIN32
127 - __declspec(dllexport)
128 - #endif
129 -@@ -941,17 +957,8 @@
130 - char **pzErrMsg,
131 - const sqlite3_api_routines *pApi
132 - ){
133 --#ifndef SQLITE_OMIT_VIRTUALTABLE
134 -- int rc;
135 - SQLITE_EXTENSION_INIT2(pApi);
136 -- rc = sqlite3_create_module(db, "csv", &CsvModule, 0);
137 --#ifdef SQLITE_TEST
138 -- if( rc==SQLITE_OK ){
139 -- rc = sqlite3_create_module(db, "csv_wr", &CsvModuleFauxWrite, 0);
140 -- }
141 --#endif
142 -- return rc;
143 --#else
144 -- return SQLITE_OK;
145 --#endif
146 -+ (void)pzErrMsg; /* Unused parameter */
147 -+ return sqlite3CsvInit(db);
148 - }
149 -+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
150 ---- /ext/misc/dbdata.c
151 -+++ /ext/misc/dbdata.c
152 -@@ -803,7 +803,7 @@
153 - /*
154 - ** Invoke this routine to register the "sqlite_dbdata" virtual table module
155 - */
156 --static int sqlite3DbdataRegister(sqlite3 *db){
157 -+int sqlite3DbdataRegister(sqlite3 *db){
158 - static sqlite3_module dbdata_module = {
159 - 0, /* iVersion */
160 - 0, /* xCreate */
161 -@@ -838,6 +838,7 @@
162 - return rc;
163 - }
164 -
165 -+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
166 - #ifdef _WIN32
167 - __declspec(dllexport)
168 - #endif
169 -@@ -849,3 +850,4 @@
170 - SQLITE_EXTENSION_INIT2(pApi);
171 - return sqlite3DbdataRegister(db);
172 - }
173 -+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
174 ---- /ext/misc/eval.c
175 -+++ /ext/misc/eval.c
176 -@@ -102,6 +102,20 @@
177 - }
178 -
179 -
180 -+int sqlite3EvalInit(sqlite3 *db){
181 -+ int rc = SQLITE_OK;
182 -+ rc = sqlite3_create_function(db, "eval", 1,
183 -+ SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
184 -+ sqlEvalFunc, 0, 0);
185 -+ if( rc==SQLITE_OK ){
186 -+ rc = sqlite3_create_function(db, "eval", 2,
187 -+ SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
188 -+ sqlEvalFunc, 0, 0);
189 -+ }
190 -+ return rc;
191 -+}
192 -+
193 -+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
194 - #ifdef _WIN32
195 - __declspec(dllexport)
196 - #endif
197 -@@ -110,16 +124,8 @@
198 - char **pzErrMsg,
199 - const sqlite3_api_routines *pApi
200 - ){
201 -- int rc = SQLITE_OK;
202 - SQLITE_EXTENSION_INIT2(pApi);
203 - (void)pzErrMsg; /* Unused parameter */
204 -- rc = sqlite3_create_function(db, "eval", 1,
205 -- SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
206 -- sqlEvalFunc, 0, 0);
207 -- if( rc==SQLITE_OK ){
208 -- rc = sqlite3_create_function(db, "eval", 2,
209 -- SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
210 -- sqlEvalFunc, 0, 0);
211 -- }
212 -- return rc;
213 -+ return sqlite3EvalInit(db);
214 - }
215 -+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
216 ---- /ext/misc/fileio.c
217 -+++ /ext/misc/fileio.c
218 -@@ -340,7 +340,7 @@
219 - ** This function does the work for the writefile() UDF. Refer to
220 - ** header comments at the top of this file for details.
221 - */
222 --static int writeFile(
223 -+static int writeFileContents(
224 - sqlite3_context *pCtx, /* Context to return bytes written in */
225 - const char *zFile, /* File to write */
226 - sqlite3_value *pData, /* Data to write */
227 -@@ -480,10 +480,10 @@
228 - mtime = sqlite3_value_int64(argv[3]);
229 - }
230 -
231 -- res = writeFile(context, zFile, argv[1], mode, mtime);
232 -+ res = writeFileContents(context, zFile, argv[1], mode, mtime);
233 - if( res==1 && errno==ENOENT ){
234 - if( makeDirectory(zFile)==SQLITE_OK ){
235 -- res = writeFile(context, zFile, argv[1], mode, mtime);
236 -+ res = writeFileContents(context, zFile, argv[1], mode, mtime);
237 - }
238 - }
239 -
240 -@@ -970,18 +970,9 @@
241 - # define fsdirRegister(x) SQLITE_OK
242 - #endif
243 -
244 --#ifdef _WIN32
245 --__declspec(dllexport)
246 --#endif
247 --int sqlite3_fileio_init(
248 -- sqlite3 *db,
249 -- char **pzErrMsg,
250 -- const sqlite3_api_routines *pApi
251 --){
252 -+int sqlite3FileioInit(sqlite3 *db){
253 - int rc = SQLITE_OK;
254 -- SQLITE_EXTENSION_INIT2(pApi);
255 -- (void)pzErrMsg; /* Unused parameter */
256 -- rc = sqlite3_create_function(db, "readfile", 1,
257 -+ rc = sqlite3_create_function(db, "readfile", 1,
258 - SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
259 - readfileFunc, 0, 0);
260 - if( rc==SQLITE_OK ){
261 -@@ -998,3 +989,18 @@
262 - }
263 - return rc;
264 - }
265 -+
266 -+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
267 -+#ifdef _WIN32
268 -+__declspec(dllexport)
269 -+#endif
270 -+int sqlite3_fileio_init(
271 -+ sqlite3 *db,
272 -+ char **pzErrMsg,
273 -+ const sqlite3_api_routines *pApi
274 -+){
275 -+ SQLITE_EXTENSION_INIT2(pApi);
276 -+ (void)pzErrMsg; /* Unused parameter */
277 -+ return sqlite3FileioInit(db);
278 -+}
279 -+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
280 ---- /ext/misc/ieee754.c
281 -+++ /ext/misc/ieee754.c
282 -@@ -110,6 +110,20 @@
283 - }
284 -
285 -
286 -+int sqlite3IeeeInit(sqlite3 *db){
287 -+ int rc = SQLITE_OK;
288 -+ rc = sqlite3_create_function(db, "ieee754", 1,
289 -+ SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
290 -+ ieee754func, 0, 0);
291 -+ if( rc==SQLITE_OK ){
292 -+ rc = sqlite3_create_function(db, "ieee754", 2,
293 -+ SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
294 -+ ieee754func, 0, 0);
295 -+ }
296 -+ return rc;
297 -+}
298 -+
299 -+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
300 - #ifdef _WIN32
301 - __declspec(dllexport)
302 - #endif
303 -@@ -118,16 +132,8 @@
304 - char **pzErrMsg,
305 - const sqlite3_api_routines *pApi
306 - ){
307 -- int rc = SQLITE_OK;
308 - SQLITE_EXTENSION_INIT2(pApi);
309 - (void)pzErrMsg; /* Unused parameter */
310 -- rc = sqlite3_create_function(db, "ieee754", 1,
311 -- SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
312 -- ieee754func, 0, 0);
313 -- if( rc==SQLITE_OK ){
314 -- rc = sqlite3_create_function(db, "ieee754", 2,
315 -- SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
316 -- ieee754func, 0, 0);
317 -- }
318 -- return rc;
319 -+ return sqlite3IeeeInit(db);
320 - }
321 -+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
322 ---- /ext/misc/regexp.c
323 -+++ /ext/misc/regexp.c
324 -@@ -740,10 +740,18 @@
325 - }
326 - }
327 -
328 -+int sqlite3RegexpInit(sqlite3 *db){
329 -+ int rc = SQLITE_OK;
330 -+ rc = sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8|SQLITE_INNOCUOUS,
331 -+ 0, re_sql_func, 0, 0);
332 -+ return rc;
333 -+}
334 -+
335 - /*
336 - ** Invoke this routine to register the regexp() function with the
337 - ** SQLite database connection.
338 - */
339 -+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
340 - #ifdef _WIN32
341 - __declspec(dllexport)
342 - #endif
343 -@@ -752,9 +760,8 @@
344 - char **pzErrMsg,
345 - const sqlite3_api_routines *pApi
346 - ){
347 -- int rc = SQLITE_OK;
348 - SQLITE_EXTENSION_INIT2(pApi);
349 -- rc = sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8|SQLITE_INNOCUOUS,
350 -- 0, re_sql_func, 0, 0);
351 -- return rc;
352 -+ (void)pzErrMsg; /* Unused parameter */
353 -+ return sqlite3RegexpInit(db);
354 - }
355 -+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
356 ---- /ext/misc/sha1.c
357 -+++ /ext/misc/sha1.c
358 -@@ -175,7 +175,7 @@
359 - }
360 -
361 - /* Compute a string using sqlite3_vsnprintf() and hash it */
362 --static void hash_step_vformat(
363 -+static void sha1_hash_step_vformat(
364 - SHA1Context *p, /* Add content to this context */
365 - const char *zFormat,
366 - ...
367 -@@ -306,7 +306,7 @@
368 - nCol = sqlite3_column_count(pStmt);
369 - z = sqlite3_sql(pStmt);
370 - n = (int)strlen(z);
371 -- hash_step_vformat(&cx,"S%d:",n);
372 -+ sha1_hash_step_vformat(&cx,"S%d:",n);
373 - hash_step(&cx,(unsigned char*)z,n);
374 -
375 - /* Compute a hash over the result of the query */
376 -@@ -349,14 +349,14 @@
377 - case SQLITE_TEXT: {
378 - int n2 = sqlite3_column_bytes(pStmt, i);
379 - const unsigned char *z2 = sqlite3_column_text(pStmt, i);
380 -- hash_step_vformat(&cx,"T%d:",n2);
381 -+ sha1_hash_step_vformat(&cx,"T%d:",n2);
382 - hash_step(&cx, z2, n2);
383 - break;
384 - }
385 - case SQLITE_BLOB: {
386 - int n2 = sqlite3_column_bytes(pStmt, i);
387 - const unsigned char *z2 = sqlite3_column_blob(pStmt, i);
388 -- hash_step_vformat(&cx,"B%d:",n2);
389 -+ sha1_hash_step_vformat(&cx,"B%d:",n2);
390 - hash_step(&cx, z2, n2);
391 - break;
392 - }
393 -@@ -370,6 +370,20 @@
394 - }
395 -
396 -
397 -+int sqlite3ShaInit(sqlite3 *db){
398 -+ int rc = SQLITE_OK;
399 -+ rc = sqlite3_create_function(db, "sha1", 1,
400 -+ SQLITE_UTF8 | SQLITE_INNOCUOUS | SQLITE_DETERMINISTIC,
401 -+ 0, sha1Func, 0, 0);
402 -+ if( rc==SQLITE_OK ){
403 -+ rc = sqlite3_create_function(db, "sha1_query", 1,
404 -+ SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
405 -+ sha1QueryFunc, 0, 0);
406 -+ }
407 -+ return rc;
408 -+}
409 -+
410 -+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
411 - #ifdef _WIN32
412 - __declspec(dllexport)
413 - #endif
414 -@@ -378,16 +392,8 @@
415 - char **pzErrMsg,
416 - const sqlite3_api_routines *pApi
417 - ){
418 -- int rc = SQLITE_OK;
419 - SQLITE_EXTENSION_INIT2(pApi);
420 - (void)pzErrMsg; /* Unused parameter */
421 -- rc = sqlite3_create_function(db, "sha1", 1,
422 -- SQLITE_UTF8 | SQLITE_INNOCUOUS | SQLITE_DETERMINISTIC,
423 -- 0, sha1Func, 0, 0);
424 -- if( rc==SQLITE_OK ){
425 -- rc = sqlite3_create_function(db, "sha1_query", 1,
426 -- SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
427 -- sha1QueryFunc, 0, 0);
428 -- }
429 -- return rc;
430 -+ return sqlite3ShaInit(db);
431 - }
432 -+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
433 ---- /ext/misc/shathree.c
434 -+++ /ext/misc/shathree.c
435 -@@ -527,7 +527,7 @@
436 - /* Compute a string using sqlite3_vsnprintf() with a maximum length
437 - ** of 50 bytes and add it to the hash.
438 - */
439 --static void hash_step_vformat(
440 -+static void sha3_hash_step_vformat(
441 - SHA3Context *p, /* Add content to this context */
442 - const char *zFormat,
443 - ...
444 -@@ -622,7 +622,7 @@
445 - nCol = sqlite3_column_count(pStmt);
446 - z = sqlite3_sql(pStmt);
447 - n = (int)strlen(z);
448 -- hash_step_vformat(&cx,"S%d:",n);
449 -+ sha3_hash_step_vformat(&cx,"S%d:",n);
450 - SHA3Update(&cx,(unsigned char*)z,n);
451 -
452 - /* Compute a hash over the result of the query */
453 -@@ -665,14 +665,14 @@
454 - case SQLITE_TEXT: {
455 - int n2 = sqlite3_column_bytes(pStmt, i);
456 - const unsigned char *z2 = sqlite3_column_text(pStmt, i);
457 -- hash_step_vformat(&cx,"T%d:",n2);
458 -+ sha3_hash_step_vformat(&cx,"T%d:",n2);
459 - SHA3Update(&cx, z2, n2);
460 - break;
461 - }
462 - case SQLITE_BLOB: {
463 - int n2 = sqlite3_column_bytes(pStmt, i);
464 - const unsigned char *z2 = sqlite3_column_blob(pStmt, i);
465 -- hash_step_vformat(&cx,"B%d:",n2);
466 -+ sha3_hash_step_vformat(&cx,"B%d:",n2);
467 - SHA3Update(&cx, z2, n2);
468 - break;
469 - }
470 -@@ -685,17 +685,8 @@
471 - }
472 -
473 -
474 --#ifdef _WIN32
475 --__declspec(dllexport)
476 --#endif
477 --int sqlite3_shathree_init(
478 -- sqlite3 *db,
479 -- char **pzErrMsg,
480 -- const sqlite3_api_routines *pApi
481 --){
482 -+int sqlite3ShathreeInit(sqlite3 *db){
483 - int rc = SQLITE_OK;
484 -- SQLITE_EXTENSION_INIT2(pApi);
485 -- (void)pzErrMsg; /* Unused parameter */
486 - rc = sqlite3_create_function(db, "sha3", 1,
487 - SQLITE_UTF8 | SQLITE_INNOCUOUS | SQLITE_DETERMINISTIC,
488 - 0, sha3Func, 0, 0);
489 -@@ -716,3 +707,18 @@
490 - }
491 - return rc;
492 - }
493 -+
494 -+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
495 -+#ifdef _WIN32
496 -+__declspec(dllexport)
497 -+#endif
498 -+int sqlite3_shathree_init(
499 -+ sqlite3 *db,
500 -+ char **pzErrMsg,
501 -+ const sqlite3_api_routines *pApi
502 -+){
503 -+ SQLITE_EXTENSION_INIT2(pApi);
504 -+ (void)pzErrMsg; /* Unused parameter */
505 -+ return sqlite3ShathreeInit(db);
506 -+}
507 -+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
508 ---- /ext/misc/sqlar.c
509 -+++ /ext/misc/sqlar.c
510 -@@ -14,6 +14,8 @@
511 - ** for working with sqlar archives and used by the shell tool's built-in
512 - ** sqlar support.
513 - */
514 -+#ifdef SQLITE_HAVE_ZLIB
515 -+
516 - #include "sqlite3ext.h"
517 - SQLITE_EXTENSION_INIT1
518 - #include <zlib.h>
519 -@@ -101,6 +103,20 @@
520 - }
521 -
522 -
523 -+int sqlite3SqlarInit(sqlite3 *db){
524 -+ int rc = SQLITE_OK;
525 -+ rc = sqlite3_create_function(db, "sqlar_compress", 1,
526 -+ SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
527 -+ sqlarCompressFunc, 0, 0);
528 -+ if( rc==SQLITE_OK ){
529 -+ rc = sqlite3_create_function(db, "sqlar_uncompress", 2,
530 -+ SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
531 -+ sqlarUncompressFunc, 0, 0);
532 -+ }
533 -+ return rc;
534 -+}
535 -+
536 -+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
537 - #ifdef _WIN32
538 - __declspec(dllexport)
539 - #endif
540 -@@ -109,16 +125,10 @@
541 - char **pzErrMsg,
542 - const sqlite3_api_routines *pApi
543 - ){
544 -- int rc = SQLITE_OK;
545 - SQLITE_EXTENSION_INIT2(pApi);
546 - (void)pzErrMsg; /* Unused parameter */
547 -- rc = sqlite3_create_function(db, "sqlar_compress", 1,
548 -- SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
549 -- sqlarCompressFunc, 0, 0);
550 -- if( rc==SQLITE_OK ){
551 -- rc = sqlite3_create_function(db, "sqlar_uncompress", 2,
552 -- SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
553 -- sqlarUncompressFunc, 0, 0);
554 -- }
555 -- return rc;
556 -+ return sqlite3SqlarInit(db);
557 - }
558 -+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
559 -+
560 -+#endif /* SQLITE_HAVE_ZLIB */
561 ---- /ext/misc/totype.c
562 -+++ /ext/misc/totype.c
563 -@@ -491,17 +491,8 @@
564 - #pragma warning(default: 4748)
565 - #endif
566 -
567 --#ifdef _WIN32
568 --__declspec(dllexport)
569 --#endif
570 --int sqlite3_totype_init(
571 -- sqlite3 *db,
572 -- char **pzErrMsg,
573 -- const sqlite3_api_routines *pApi
574 --){
575 -+int sqlite3TotypeInit(sqlite3 *db){
576 - int rc = SQLITE_OK;
577 -- SQLITE_EXTENSION_INIT2(pApi);
578 -- (void)pzErrMsg; /* Unused parameter */
579 - rc = sqlite3_create_function(db, "tointeger", 1,
580 - SQLITE_UTF8 | SQLITE_DETERMINISTIC | SQLITE_INNOCUOUS, 0,
581 - tointegerFunc, 0, 0);
582 -@@ -512,3 +503,18 @@
583 - }
584 - return rc;
585 - }
586 -+
587 -+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
588 -+#ifdef _WIN32
589 -+__declspec(dllexport)
590 -+#endif
591 -+int sqlite3_totype_init(
592 -+ sqlite3 *db,
593 -+ char **pzErrMsg,
594 -+ const sqlite3_api_routines *pApi
595 -+){
596 -+ SQLITE_EXTENSION_INIT2(pApi);
597 -+ (void)pzErrMsg; /* Unused parameter */
598 -+ return sqlite3TotypeInit(db);
599 -+}
600 -+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
601 ---- /ext/misc/uint.c
602 -+++ /ext/misc/uint.c
603 -@@ -78,6 +78,11 @@
604 - return (nKey1 - i) - (nKey2 - j);
605 - }
606 -
607 -+int sqlite3UintInit(sqlite3 *db){
608 -+ return sqlite3_create_collation(db, "UINT", SQLITE_UTF8, 0, uintCollFunc);
609 -+}
610 -+
611 -+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
612 - #ifdef _WIN32
613 - __declspec(dllexport)
614 - #endif
615 -@@ -88,5 +93,6 @@
616 - ){
617 - SQLITE_EXTENSION_INIT2(pApi);
618 - (void)pzErrMsg; /* Unused parameter */
619 -- return sqlite3_create_collation(db, "uint", SQLITE_UTF8, 0, uintCollFunc);
620 -+ return sqlite3UintInit(db);
621 - }
622 -+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
623 ---- /ext/misc/uuid.c
624 -+++ /ext/misc/uuid.c
625 -@@ -206,21 +206,12 @@
626 - sqlite3_result_blob(context, pBlob, 16, SQLITE_TRANSIENT);
627 - }
628 -
629 --#ifdef _WIN32
630 --__declspec(dllexport)
631 --#endif
632 --int sqlite3_uuid_init(
633 -- sqlite3 *db,
634 -- char **pzErrMsg,
635 -- const sqlite3_api_routines *pApi
636 --){
637 -+int sqlite3UuidInit(sqlite3 *db){
638 - int rc = SQLITE_OK;
639 -- SQLITE_EXTENSION_INIT2(pApi);
640 -- (void)pzErrMsg; /* Unused parameter */
641 - rc = sqlite3_create_function(db, "uuid", 0, SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
642 - sqlite3UuidFunc, 0, 0);
643 - if( rc==SQLITE_OK ){
644 -- rc = sqlite3_create_function(db, "uuid_str", 1,
645 -+ rc = sqlite3_create_function(db, "uuid_str", 1,
646 - SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC,
647 - 0, sqlite3UuidStrFunc, 0, 0);
648 - }
649 -@@ -231,3 +222,18 @@
650 - }
651 - return rc;
652 - }
653 -+
654 -+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
655 -+#ifdef _WIN32
656 -+__declspec(dllexport)
657 -+#endif
658 -+int sqlite3_uuid_init(
659 -+ sqlite3 *db,
660 -+ char **pzErrMsg,
661 -+ const sqlite3_api_routines *pApi
662 -+){
663 -+ SQLITE_EXTENSION_INIT2(pApi);
664 -+ (void)pzErrMsg; /* Unused parameter */
665 -+ return sqlite3UuidInit(db);
666 -+}
667 -+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
668 ---- /ext/misc/zipfile.c
669 -+++ /ext/misc/zipfile.c
670 -@@ -24,6 +24,8 @@
671 - ** * No support for zip64 extensions
672 - ** * Only the "inflate/deflate" (zlib) compression method is supported
673 - */
674 -+#ifdef SQLITE_HAVE_ZLIB
675 -+
676 - #include "sqlite3ext.h"
677 - SQLITE_EXTENSION_INIT1
678 - #include <stdio.h>
679 -@@ -2137,7 +2139,7 @@
680 - /*
681 - ** Register the "zipfile" virtual table.
682 - */
683 --static int zipfileRegister(sqlite3 *db){
684 -+int sqlite3ZipfileInit(sqlite3 *db){
685 - static sqlite3_module zipfileModule = {
686 - 1, /* iVersion */
687 - zipfileConnect, /* xCreate */
688 -@@ -2171,9 +2173,10 @@
689 - return rc;
690 - }
691 - #else /* SQLITE_OMIT_VIRTUALTABLE */
692 --# define zipfileRegister(x) SQLITE_OK
693 -+# define sqlite3ZipfileInit(x) SQLITE_OK
694 - #endif
695 -
696 -+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
697 - #ifdef _WIN32
698 - __declspec(dllexport)
699 - #endif
700 -@@ -2184,5 +2187,8 @@
701 - ){
702 - SQLITE_EXTENSION_INIT2(pApi);
703 - (void)pzErrMsg; /* Unused parameter */
704 -- return zipfileRegister(db);
705 -+ return sqlite3ZipfileInit(db);
706 - }
707 -+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
708 -+
709 -+#endif /* SQLITE_HAVE_ZLIB */
710
711 diff --git a/dev-db/sqlite/files/sqlite-3.32.1-full_archive-build_2.patch b/dev-db/sqlite/files/sqlite-3.32.1-full_archive-build_2.patch
712 deleted file mode 100644
713 index f12c0b22a48..00000000000
714 --- a/dev-db/sqlite/files/sqlite-3.32.1-full_archive-build_2.patch
715 +++ /dev/null
716 @@ -1,640 +0,0 @@
717 -Enable some extensions in libsqlite3.so.
718 -Move some code to libsqlite3.so to avoid duplication.
719 -Link executables against libsqlite3.so.
720 -Increase timeout for fuzzcheck.
721 -Fix building with dlopen() not available.
722 -
723 ---- /Makefile.in
724 -+++ /Makefile.in
725 -@@ -313,6 +313,9 @@
726 - # Source code for extensions
727 - #
728 - SRC += \
729 -+ $(TOP)/ext/expert/sqlite3expert.c \
730 -+ $(TOP)/ext/expert/sqlite3expert.h
731 -+SRC += \
732 - $(TOP)/ext/fts1/fts1.c \
733 - $(TOP)/ext/fts1/fts1.h \
734 - $(TOP)/ext/fts1/fts1_hash.c \
735 -@@ -365,8 +368,24 @@
736 - $(TOP)/ext/rbu/sqlite3rbu.h \
737 - $(TOP)/ext/rbu/sqlite3rbu.c
738 - SRC += \
739 -+ $(TOP)/ext/misc/appendvfs.c \
740 -+ $(TOP)/ext/misc/carray.c \
741 -+ $(TOP)/ext/misc/completion.c \
742 -+ $(TOP)/ext/misc/csv.c \
743 -+ $(TOP)/ext/misc/dbdata.c \
744 -+ $(TOP)/ext/misc/eval.c \
745 -+ $(TOP)/ext/misc/fileio.c \
746 -+ $(TOP)/ext/misc/ieee754.c \
747 - $(TOP)/ext/misc/json1.c \
748 -- $(TOP)/ext/misc/stmt.c
749 -+ $(TOP)/ext/misc/regexp.c \
750 -+ $(TOP)/ext/misc/sha1.c \
751 -+ $(TOP)/ext/misc/shathree.c \
752 -+ $(TOP)/ext/misc/sqlar.c \
753 -+ $(TOP)/ext/misc/stmt.c \
754 -+ $(TOP)/ext/misc/totype.c \
755 -+ $(TOP)/ext/misc/uint.c \
756 -+ $(TOP)/ext/misc/uuid.c \
757 -+ $(TOP)/ext/misc/zipfile.c
758 -
759 - # Generated source code files
760 - #
761 -@@ -437,33 +456,24 @@
762 - # Statically linked extensions
763 - #
764 - TESTSRC += \
765 -- $(TOP)/ext/expert/sqlite3expert.c \
766 - $(TOP)/ext/expert/test_expert.c \
767 - $(TOP)/ext/misc/amatch.c \
768 -- $(TOP)/ext/misc/carray.c \
769 - $(TOP)/ext/misc/closure.c \
770 -- $(TOP)/ext/misc/csv.c \
771 -- $(TOP)/ext/misc/eval.c \
772 - $(TOP)/ext/misc/explain.c \
773 -- $(TOP)/ext/misc/fileio.c \
774 - $(TOP)/ext/misc/fuzzer.c \
775 - $(TOP)/ext/fts5/fts5_tcl.c \
776 - $(TOP)/ext/fts5/fts5_test_mi.c \
777 - $(TOP)/ext/fts5/fts5_test_tok.c \
778 -- $(TOP)/ext/misc/ieee754.c \
779 - $(TOP)/ext/misc/mmapwarm.c \
780 - $(TOP)/ext/misc/nextchar.c \
781 - $(TOP)/ext/misc/normalize.c \
782 - $(TOP)/ext/misc/percentile.c \
783 - $(TOP)/ext/misc/prefixes.c \
784 -- $(TOP)/ext/misc/regexp.c \
785 - $(TOP)/ext/misc/remember.c \
786 - $(TOP)/ext/misc/series.c \
787 - $(TOP)/ext/misc/spellfix.c \
788 -- $(TOP)/ext/misc/totype.c \
789 - $(TOP)/ext/misc/unionvtab.c \
790 - $(TOP)/ext/misc/wholenumber.c \
791 -- $(TOP)/ext/misc/zipfile.c \
792 - $(TOP)/ext/userauth/userauth.c
793 -
794 - # Source code to the library files needed by the test fixture
795 -@@ -645,25 +655,25 @@
796 -
797 - libtclsqlite3.la: tclsqlite.lo libsqlite3.la
798 - $(LTLINK) -no-undefined -o $@ tclsqlite.lo \
799 -- libsqlite3.la @TCL_STUB_LIB_SPEC@ $(TLIBS) \
800 -+ libsqlite3.la @TCL_STUB_LIB_SPEC@ \
801 - -rpath "$(TCLLIBDIR)" \
802 - -version-info "8:6:8" \
803 - -avoid-version
804 -
805 --sqlite3$(TEXE): shell.c sqlite3.c
806 -- $(LTLINK) $(READLINE_FLAGS) $(SHELL_OPT) -o $@ \
807 -- shell.c sqlite3.c \
808 -- $(LIBREADLINE) $(TLIBS) -rpath "$(libdir)"
809 -+sqlite3$(TEXE): shell.c libsqlite3.la
810 -+ $(LTLINK) $(READLINE_FLAGS) -o $@ \
811 -+ shell.c libsqlite3.la \
812 -+ $(LIBREADLINE)
813 -
814 --sqldiff$(TEXE): $(TOP)/tool/sqldiff.c sqlite3.lo sqlite3.h
815 -- $(LTLINK) -o $@ $(TOP)/tool/sqldiff.c sqlite3.lo $(TLIBS)
816 -+sqldiff$(TEXE): $(TOP)/tool/sqldiff.c libsqlite3.la
817 -+ $(LTLINK) -o $@ $(TOP)/tool/sqldiff.c libsqlite3.la
818 -
819 --dbhash$(TEXE): $(TOP)/tool/dbhash.c sqlite3.lo sqlite3.h
820 -- $(LTLINK) -o $@ $(TOP)/tool/dbhash.c sqlite3.lo $(TLIBS)
821 -+dbhash$(TEXE): $(TOP)/tool/dbhash.c libsqlite3.la
822 -+ $(LTLINK) -o $@ $(TOP)/tool/dbhash.c libsqlite3.la
823 -
824 --scrub$(TEXE): $(TOP)/ext/misc/scrub.c sqlite3.lo
825 -+scrub$(TEXE): $(TOP)/ext/misc/scrub.c libsqlite3.la
826 - $(LTLINK) -o $@ -I. -DSCRUB_STANDALONE \
827 -- $(TOP)/ext/misc/scrub.c sqlite3.lo $(TLIBS)
828 -+ $(TOP)/ext/misc/scrub.c libsqlite3.la
829 -
830 - srcck1$(BEXE): $(TOP)/tool/srcck1.c
831 - $(BCC) -o srcck1$(BEXE) $(TOP)/tool/srcck1.c
832 -@@ -774,7 +784,7 @@
833 - # Rule to build the amalgamation
834 - #
835 - sqlite3.lo: sqlite3.c
836 -- $(LTCOMPILE) $(TEMP_STORE) -c sqlite3.c
837 -+ $(LTCOMPILE) $(SHELL_OPT) $(TEMP_STORE) -c sqlite3.c
838 -
839 - # Rules to build the LEMON compiler generator
840 - #
841 -@@ -1074,15 +1084,6 @@
842 - # Source files that go into making shell.c
843 - SHELL_SRC = \
844 - $(TOP)/src/shell.c.in \
845 -- $(TOP)/ext/misc/appendvfs.c \
846 -- $(TOP)/ext/misc/shathree.c \
847 -- $(TOP)/ext/misc/fileio.c \
848 -- $(TOP)/ext/misc/completion.c \
849 -- $(TOP)/ext/misc/sqlar.c \
850 -- $(TOP)/ext/misc/uint.c \
851 -- $(TOP)/ext/expert/sqlite3expert.c \
852 -- $(TOP)/ext/expert/sqlite3expert.h \
853 -- $(TOP)/ext/misc/zipfile.c \
854 - $(TOP)/ext/misc/memtrace.c \
855 - $(TOP)/src/test_windirent.c
856 -
857 -@@ -1251,11 +1252,11 @@
858 -
859 - # Fuzz testing
860 - fuzztest: fuzzcheck$(TEXE) $(FUZZDATA) sessionfuzz$(TEXE) $(TOP)/test/sessionfuzz-data1.db
861 -- ./fuzzcheck$(TEXE) $(FUZZDATA)
862 -+ ./fuzzcheck$(TEXE) --timeout 3600 $(FUZZDATA)
863 - ./sessionfuzz$(TEXE) run $(TOP)/test/sessionfuzz-data1.db
864 -
865 - valgrindfuzz: fuzzcheck$(TEXT) $(FUZZDATA) sessionfuzz$(TEXE) $(TOP)/test/sessionfuzz-data1.db
866 -- valgrind ./fuzzcheck$(TEXE) --cell-size-check --limit-mem 10M --timeout 600 $(FUZZDATA)
867 -+ valgrind ./fuzzcheck$(TEXE) --cell-size-check --limit-mem 10M --timeout 3600 $(FUZZDATA)
868 - valgrind ./sessionfuzz$(TEXE) run $(TOP)/test/sessionfuzz-data1.db
869 -
870 - # The veryquick.test TCL tests.
871 -@@ -1286,24 +1287,23 @@
872 - smoketest: $(TESTPROGS) fuzzcheck$(TEXE)
873 - ./testfixture$(TEXE) $(TOP)/test/main.test $(TESTOPTS)
874 -
875 --sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in
876 -+sqlite3_analyzer.c: $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in
877 - $(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in >sqlite3_analyzer.c
878 -
879 --sqlite3_analyzer$(TEXE): sqlite3_analyzer.c
880 -- $(LTLINK) sqlite3_analyzer.c -o $@ $(LIBTCL) $(TLIBS)
881 -+sqlite3_analyzer$(TEXE): sqlite3_analyzer.c libsqlite3.la
882 -+ $(LTLINK) sqlite3_analyzer.c -o $@ libsqlite3.la $(LIBTCL)
883 -
884 --sqltclsh.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/sqltclsh.tcl $(TOP)/ext/misc/appendvfs.c $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in
885 -+sqltclsh.c: $(TOP)/src/tclsqlite.c $(TOP)/tool/sqltclsh.tcl $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in
886 - $(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in >sqltclsh.c
887 -
888 --sqltclsh$(TEXE): sqltclsh.c
889 -- $(LTLINK) sqltclsh.c -o $@ $(LIBTCL) $(TLIBS)
890 -+sqltclsh$(TEXE): sqltclsh.c libsqlite3.la
891 -+ $(LTLINK) sqltclsh.c -o $@ libsqlite3.la $(LIBTCL)
892 -
893 --sqlite3_expert$(TEXE): $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/sqlite3expert.c $(TOP)/ext/expert/expert.c sqlite3.c
894 -- $(LTLINK) $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/sqlite3expert.c $(TOP)/ext/expert/expert.c sqlite3.c -o sqlite3_expert $(TLIBS)
895 -+sqlite3_expert$(TEXE): $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/expert.c libsqlite3.la
896 -+ $(LTLINK) $(TOP)/ext/expert/expert.c -o sqlite3_expert libsqlite3.la
897 -
898 - CHECKER_DEPS =\
899 - $(TOP)/tool/mkccode.tcl \
900 -- sqlite3.c \
901 - $(TOP)/src/tclsqlite.c \
902 - $(TOP)/ext/repair/sqlite3_checker.tcl \
903 - $(TOP)/ext/repair/checkindex.c \
904 -@@ -1314,36 +1314,36 @@
905 - sqlite3_checker.c: $(CHECKER_DEPS)
906 - $(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/ext/repair/sqlite3_checker.c.in >$@
907 -
908 --sqlite3_checker$(TEXE): sqlite3_checker.c
909 -- $(LTLINK) sqlite3_checker.c -o $@ $(LIBTCL) $(TLIBS)
910 -+sqlite3_checker$(TEXE): sqlite3_checker.c libsqlite3.la
911 -+ $(LTLINK) sqlite3_checker.c -o $@ libsqlite3.la $(LIBTCL)
912 -
913 --dbdump$(TEXE): $(TOP)/ext/misc/dbdump.c sqlite3.lo
914 -+dbdump$(TEXE): $(TOP)/ext/misc/dbdump.c libsqlite3.la
915 - $(LTLINK) -DDBDUMP_STANDALONE -o $@ \
916 -- $(TOP)/ext/misc/dbdump.c sqlite3.lo $(TLIBS)
917 -+ $(TOP)/ext/misc/dbdump.c libsqlite3.la
918 -
919 --dbtotxt$(TEXE): $(TOP)/tool/dbtotxt.c
920 -- $(LTLINK)-o $@ $(TOP)/tool/dbtotxt.c
921 -+dbtotxt$(TEXE): $(TOP)/tool/dbtotxt.c
922 -+ $(LTLINK) -o $@ $(TOP)/tool/dbtotxt.c
923 -
924 --showdb$(TEXE): $(TOP)/tool/showdb.c sqlite3.lo
925 -- $(LTLINK) -o $@ $(TOP)/tool/showdb.c sqlite3.lo $(TLIBS)
926 -+showdb$(TEXE): $(TOP)/tool/showdb.c libsqlite3.la
927 -+ $(LTLINK) -o $@ $(TOP)/tool/showdb.c libsqlite3.la
928 -
929 --showstat4$(TEXE): $(TOP)/tool/showstat4.c sqlite3.lo
930 -- $(LTLINK) -o $@ $(TOP)/tool/showstat4.c sqlite3.lo $(TLIBS)
931 -+showstat4$(TEXE): $(TOP)/tool/showstat4.c libsqlite3.la
932 -+ $(LTLINK) -o $@ $(TOP)/tool/showstat4.c libsqlite3.la
933 -
934 --showjournal$(TEXE): $(TOP)/tool/showjournal.c sqlite3.lo
935 -- $(LTLINK) -o $@ $(TOP)/tool/showjournal.c sqlite3.lo $(TLIBS)
936 -+showjournal$(TEXE): $(TOP)/tool/showjournal.c
937 -+ $(LTLINK) -o $@ $(TOP)/tool/showjournal.c
938 -
939 --showwal$(TEXE): $(TOP)/tool/showwal.c sqlite3.lo
940 -- $(LTLINK) -o $@ $(TOP)/tool/showwal.c sqlite3.lo $(TLIBS)
941 -+showwal$(TEXE): $(TOP)/tool/showwal.c
942 -+ $(LTLINK) -o $@ $(TOP)/tool/showwal.c
943 -
944 - showshm$(TEXE): $(TOP)/tool/showshm.c
945 - $(LTLINK) -o $@ $(TOP)/tool/showshm.c
946 -
947 --index_usage$(TEXE): $(TOP)/tool/index_usage.c sqlite3.lo
948 -- $(LTLINK) $(SHELL_OPT) -o $@ $(TOP)/tool/index_usage.c sqlite3.lo $(TLIBS)
949 -+index_usage$(TEXE): $(TOP)/tool/index_usage.c libsqlite3.la
950 -+ $(LTLINK) -o $@ $(TOP)/tool/index_usage.c libsqlite3.la
951 -
952 --changeset$(TEXE): $(TOP)/ext/session/changeset.c sqlite3.lo
953 -- $(LTLINK) -o $@ $(TOP)/ext/session/changeset.c sqlite3.lo $(TLIBS)
954 -+changeset$(TEXE): $(TOP)/ext/session/changeset.c libsqlite3.la
955 -+ $(LTLINK) -o $@ $(TOP)/ext/session/changeset.c libsqlite3.la
956 -
957 - changesetfuzz$(TEXE): $(TOP)/ext/session/changesetfuzz.c sqlite3.lo
958 - $(LTLINK) -o $@ $(TOP)/ext/session/changesetfuzz.c sqlite3.lo $(TLIBS)
959 -@@ -1368,11 +1368,11 @@
960 - kvtest$(TEXE): $(TOP)/test/kvtest.c sqlite3.c
961 - $(LTLINK) $(KV_OPT) -o $@ $(TOP)/test/kvtest.c sqlite3.c $(TLIBS)
962 -
963 --rbu$(EXE): $(TOP)/ext/rbu/rbu.c $(TOP)/ext/rbu/sqlite3rbu.c sqlite3.lo
964 -- $(LTLINK) -I. -o $@ $(TOP)/ext/rbu/rbu.c sqlite3.lo $(TLIBS)
965 -+rbu$(EXE): $(TOP)/ext/rbu/rbu.c libsqlite3.la
966 -+ $(LTLINK) -I. -o $@ $(TOP)/ext/rbu/rbu.c libsqlite3.la
967 -
968 --loadfts$(EXE): $(TOP)/tool/loadfts.c libsqlite3.la
969 -- $(LTLINK) $(TOP)/tool/loadfts.c libsqlite3.la -o $@ $(TLIBS)
970 -+loadfts$(EXE): $(TOP)/tool/loadfts.c libsqlite3.la
971 -+ $(LTLINK) $(TOP)/tool/loadfts.c libsqlite3.la -o $@
972 -
973 - # This target will fail if the SQLite amalgamation contains any exported
974 - # symbols that do not begin with "sqlite3_". It is run as part of the
975 ---- /configure.ac
976 -+++ /configure.ac
977 -@@ -587,6 +587,9 @@
978 - if test "${enable_load_extension}" = "yes" ; then
979 - OPT_FEATURE_FLAGS=""
980 - AC_SEARCH_LIBS(dlopen, dl)
981 -+ if test "${ac_cv_search_dlopen}" = "no" ; then
982 -+ OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
983 -+ fi
984 - else
985 - OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
986 - fi
987 ---- /ext/repair/sqlite3_checker.c.in
988 -+++ /ext/repair/sqlite3_checker.c.in
989 -@@ -2,6 +2,7 @@
990 - ** Read an SQLite database file and analyze its space utilization. Generate
991 - ** text on standard output.
992 - */
993 -+#define SQLITE_CORE 1
994 - #define TCLSH_INIT_PROC sqlite3_checker_init_proc
995 - #define SQLITE_ENABLE_DBPAGE_VTAB 1
996 - #define SQLITE_ENABLE_JSON1 1
997 -@@ -14,7 +15,7 @@
998 - #define SQLITE_OMIT_SHARED_CACHE 1
999 - #define SQLITE_DEFAULT_MEMSTATUS 0
1000 - #define SQLITE_MAX_EXPR_DEPTH 0
1001 --INCLUDE sqlite3.c
1002 -+#include "sqlite3.h"
1003 - INCLUDE $ROOT/src/tclsqlite.c
1004 - INCLUDE $ROOT/ext/misc/btreeinfo.c
1005 - INCLUDE $ROOT/ext/repair/checkindex.c
1006 ---- /src/main.c
1007 -+++ /src/main.c
1008 -@@ -50,12 +50,31 @@
1009 - #ifdef SQLITE_ENABLE_FTS5
1010 - int sqlite3Fts5Init(sqlite3*);
1011 - #endif
1012 -+#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
1013 -+int sqlite3DbdataRegister(sqlite3*);
1014 -+#endif
1015 - #ifdef SQLITE_ENABLE_JSON1
1016 - int sqlite3Json1Init(sqlite3*);
1017 - #endif
1018 - #ifdef SQLITE_ENABLE_STMTVTAB
1019 - int sqlite3StmtVtabInit(sqlite3*);
1020 - #endif
1021 -+int sqlite3CarrayInit(sqlite3*);
1022 -+int sqlite3CompletionVtabInit(sqlite3*);
1023 -+int sqlite3CsvInit(sqlite3*);
1024 -+int sqlite3EvalInit(sqlite3*);
1025 -+int sqlite3FileioInit(sqlite3*);
1026 -+int sqlite3IeeeInit(sqlite3*);
1027 -+int sqlite3RegexpInit(sqlite3*);
1028 -+int sqlite3ShaInit(sqlite3*);
1029 -+int sqlite3ShathreeInit(sqlite3*);
1030 -+int sqlite3TotypeInit(sqlite3*);
1031 -+int sqlite3UintInit(sqlite3*);
1032 -+int sqlite3UuidInit(sqlite3*);
1033 -+#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB)
1034 -+int sqlite3ZipfileInit(sqlite3*);
1035 -+int sqlite3SqlarInit(sqlite3*);
1036 -+#endif
1037 -
1038 - /*
1039 - ** An array of pointers to extension initializer functions for
1040 -@@ -83,6 +102,9 @@
1041 - #ifdef SQLITE_ENABLE_DBPAGE_VTAB
1042 - sqlite3DbpageRegister,
1043 - #endif
1044 -+#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
1045 -+ sqlite3DbdataRegister,
1046 -+#endif
1047 - #ifdef SQLITE_ENABLE_DBSTAT_VTAB
1048 - sqlite3DbstatRegister,
1049 - #endif
1050 -@@ -96,6 +118,22 @@
1051 - #ifdef SQLITE_ENABLE_BYTECODE_VTAB
1052 - sqlite3VdbeBytecodeVtabInit,
1053 - #endif
1054 -+ sqlite3CarrayInit,
1055 -+ sqlite3CompletionVtabInit,
1056 -+ sqlite3CsvInit,
1057 -+ sqlite3EvalInit,
1058 -+ sqlite3FileioInit,
1059 -+ sqlite3IeeeInit,
1060 -+ sqlite3RegexpInit,
1061 -+ sqlite3ShaInit,
1062 -+ sqlite3ShathreeInit,
1063 -+ sqlite3TotypeInit,
1064 -+ sqlite3UintInit,
1065 -+ sqlite3UuidInit,
1066 -+#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB)
1067 -+ sqlite3ZipfileInit,
1068 -+ sqlite3SqlarInit,
1069 -+#endif
1070 - };
1071 -
1072 - #ifndef SQLITE_AMALGAMATION
1073 ---- /src/shell.c.in
1074 -+++ /src/shell.c.in
1075 -@@ -69,6 +69,7 @@
1076 - #include <stdio.h>
1077 - #include <assert.h>
1078 - #include "sqlite3.h"
1079 -+#include "ext/expert/sqlite3expert.h"
1080 - typedef sqlite3_int64 i64;
1081 - typedef sqlite3_uint64 u64;
1082 - typedef unsigned char u8;
1083 -@@ -135,6 +136,10 @@
1084 - # define SHELL_USE_LOCAL_GETLINE 1
1085 - #endif
1086 -
1087 -+#ifdef SQLITE_HAVE_ZLIB
1088 -+#include <zlib.h>
1089 -+#endif
1090 -+
1091 -
1092 - #if defined(_WIN32) || defined(WIN32)
1093 - # if SQLITE_OS_WINRT
1094 -@@ -1005,22 +1010,7 @@
1095 - INCLUDE test_windirent.c
1096 - #define dirent DIRENT
1097 - #endif
1098 --INCLUDE ../ext/misc/shathree.c
1099 --INCLUDE ../ext/misc/fileio.c
1100 --INCLUDE ../ext/misc/completion.c
1101 --INCLUDE ../ext/misc/appendvfs.c
1102 - INCLUDE ../ext/misc/memtrace.c
1103 --INCLUDE ../ext/misc/uint.c
1104 --#ifdef SQLITE_HAVE_ZLIB
1105 --INCLUDE ../ext/misc/zipfile.c
1106 --INCLUDE ../ext/misc/sqlar.c
1107 --#endif
1108 --INCLUDE ../ext/expert/sqlite3expert.h
1109 --INCLUDE ../ext/expert/sqlite3expert.c
1110 --
1111 --#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
1112 --INCLUDE ../ext/misc/dbdata.c
1113 --#endif
1114 -
1115 - #if defined(SQLITE_ENABLE_SESSION)
1116 - /*
1117 -@@ -4261,17 +4251,6 @@
1118 - #ifndef SQLITE_OMIT_LOAD_EXTENSION
1119 - sqlite3_enable_load_extension(p->db, 1);
1120 - #endif
1121 -- sqlite3_fileio_init(p->db, 0, 0);
1122 -- sqlite3_shathree_init(p->db, 0, 0);
1123 -- sqlite3_completion_init(p->db, 0, 0);
1124 -- sqlite3_uint_init(p->db, 0, 0);
1125 --#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
1126 -- sqlite3_dbdata_init(p->db, 0, 0);
1127 --#endif
1128 --#ifdef SQLITE_HAVE_ZLIB
1129 -- sqlite3_zipfile_init(p->db, 0, 0);
1130 -- sqlite3_sqlar_init(p->db, 0, 0);
1131 --#endif
1132 - sqlite3_create_function(p->db, "shell_add_schema", 3, SQLITE_UTF8, 0,
1133 - shellAddSchemaName, 0, 0);
1134 - sqlite3_create_function(p->db, "shell_module_schema", 1, SQLITE_UTF8, 0,
1135 -@@ -6281,8 +6260,6 @@
1136 - );
1137 - goto end_ar_command;
1138 - }
1139 -- sqlite3_fileio_init(cmd.db, 0, 0);
1140 -- sqlite3_sqlar_init(cmd.db, 0, 0);
1141 - sqlite3_create_function(cmd.db, "shell_putsnl", 1, SQLITE_UTF8, cmd.p,
1142 - shellPutsFunc, 0, 0);
1143 -
1144 -@@ -10621,6 +10598,7 @@
1145 - #endif
1146 - }
1147 - data.out = stdout;
1148 -+ extern int sqlite3_appendvfs_init(sqlite3 *, char **, const sqlite3_api_routines *);
1149 - sqlite3_appendvfs_init(0,0,0);
1150 -
1151 - /* Go ahead and open the database file if it already exists. If the
1152 ---- /src/test_config.c
1153 -+++ /src/test_config.c
1154 -@@ -540,6 +540,8 @@
1155 - Tcl_SetVar2(interp, "sqlite_options", "progress", "1", TCL_GLOBAL_ONLY);
1156 - #endif
1157 -
1158 -+ Tcl_SetVar2(interp, "sqlite_options", "regexp", "1", TCL_GLOBAL_ONLY);
1159 -+
1160 - #ifdef SQLITE_OMIT_REINDEX
1161 - Tcl_SetVar2(interp, "sqlite_options", "reindex", "0", TCL_GLOBAL_ONLY);
1162 - #else
1163 -@@ -662,6 +664,8 @@
1164 - Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "1", TCL_GLOBAL_ONLY);
1165 - #endif
1166 -
1167 -+ Tcl_SetVar2(interp, "sqlite_options", "uint", "1", TCL_GLOBAL_ONLY);
1168 -+
1169 - #ifdef SQLITE_OMIT_UTF16
1170 - Tcl_SetVar2(interp, "sqlite_options", "utf16", "0", TCL_GLOBAL_ONLY);
1171 - #else
1172 ---- /test/e_expr.test
1173 -+++ /test/e_expr.test
1174 -@@ -1078,7 +1078,7 @@
1175 - #
1176 - # There is a regexp function if ICU is enabled though.
1177 - #
1178 --ifcapable !icu {
1179 -+ifcapable !icu&&!regexp {
1180 - do_catchsql_test e_expr-18.1.1 {
1181 - SELECT regexp('abc', 'def')
1182 - } {1 {no such function: regexp}}
1183 ---- /test/icu.test
1184 -+++ /test/icu.test
1185 -@@ -41,7 +41,7 @@
1186 - #
1187 - test_expr icu-1.1 {i1='hello'} {i1 REGEXP 'hello'} 1
1188 - test_expr icu-1.2 {i1='hello'} {i1 REGEXP '.ello'} 1
1189 -- test_expr icu-1.3 {i1='hello'} {i1 REGEXP '.ell'} 0
1190 -+ test_expr icu-1.3 {i1='hello'} {i1 REGEXP '.ell$'} 0
1191 - test_expr icu-1.4 {i1='hello'} {i1 REGEXP '.ell.*'} 1
1192 - test_expr icu-1.5 {i1=NULL} {i1 REGEXP '.ell.*'} {}
1193 -
1194 ---- /test/pragma.test
1195 -+++ /test/pragma.test
1196 -@@ -1360,17 +1360,32 @@
1197 - } ;# ifcapable trigger
1198 -
1199 - ifcapable schema_pragmas {
1200 -- do_test pragma-11.1 {
1201 -- execsql2 {
1202 -- pragma collation_list;
1203 -- }
1204 -- } {seq 0 name RTRIM seq 1 name NOCASE seq 2 name BINARY}
1205 -- do_test pragma-11.2 {
1206 -- db collate New_Collation blah...
1207 -- execsql {
1208 -- pragma collation_list;
1209 -- }
1210 -- } {0 New_Collation 1 RTRIM 2 NOCASE 3 BINARY}
1211 -+ ifcapable uint {
1212 -+ do_test pragma-11.1 {
1213 -+ execsql2 {
1214 -+ pragma collation_list;
1215 -+ }
1216 -+ } {seq 0 name UINT seq 1 name RTRIM seq 2 name NOCASE seq 3 name BINARY}
1217 -+ do_test pragma-11.2 {
1218 -+ db collate New_Collation blah...
1219 -+ execsql {
1220 -+ pragma collation_list;
1221 -+ }
1222 -+ } {0 New_Collation 1 UINT 2 RTRIM 3 NOCASE 4 BINARY}
1223 -+ }
1224 -+ ifcapable !uint {
1225 -+ do_test pragma-11.1 {
1226 -+ execsql2 {
1227 -+ pragma collation_list;
1228 -+ }
1229 -+ } {seq 0 name RTRIM seq 1 name NOCASE seq 2 name BINARY}
1230 -+ do_test pragma-11.2 {
1231 -+ db collate New_Collation blah...
1232 -+ execsql {
1233 -+ pragma collation_list;
1234 -+ }
1235 -+ } {0 New_Collation 1 RTRIM 2 NOCASE 3 BINARY}
1236 -+ }
1237 - }
1238 -
1239 - ifcapable schema_pragmas&&tempdb {
1240 ---- /test/sessionfuzz.c
1241 -+++ /test/sessionfuzz.c
1242 -@@ -700,42 +700,6 @@
1243 - #include <assert.h>
1244 - #include "zlib.h"
1245 -
1246 --/*
1247 --** Implementation of the "sqlar_uncompress(X,SZ)" SQL function
1248 --**
1249 --** Parameter SZ is interpreted as an integer. If it is less than or
1250 --** equal to zero, then this function returns a copy of X. Or, if
1251 --** SZ is equal to the size of X when interpreted as a blob, also
1252 --** return a copy of X. Otherwise, decompress blob X using zlib
1253 --** utility function uncompress() and return the results (another
1254 --** blob).
1255 --*/
1256 --static void sqlarUncompressFunc(
1257 -- sqlite3_context *context,
1258 -- int argc,
1259 -- sqlite3_value **argv
1260 --){
1261 -- uLong nData;
1262 -- uLongf sz;
1263 --
1264 -- assert( argc==2 );
1265 -- sz = sqlite3_value_int(argv[1]);
1266 --
1267 -- if( sz<=0 || sz==(nData = sqlite3_value_bytes(argv[0])) ){
1268 -- sqlite3_result_value(context, argv[0]);
1269 -- }else{
1270 -- const Bytef *pData= sqlite3_value_blob(argv[0]);
1271 -- Bytef *pOut = sqlite3_malloc(sz);
1272 -- if( Z_OK!=uncompress(pOut, &sz, pData, nData) ){
1273 -- sqlite3_result_error(context, "error in uncompress()", -1);
1274 -- }else{
1275 -- sqlite3_result_blob(context, pOut, sz, SQLITE_TRANSIENT);
1276 -- }
1277 -- sqlite3_free(pOut);
1278 -- }
1279 --}
1280 --
1281 --
1282 - /* Run a chunk of SQL. If any errors happen, print an error message
1283 - ** and exit.
1284 - */
1285 ---- /tool/mksqlite3c.tcl
1286 -+++ /tool/mksqlite3c.tcl
1287 -@@ -117,6 +117,7 @@
1288 - rtree.h
1289 - sqlite3session.h
1290 - sqlite3.h
1291 -+ sqlite3expert.h
1292 - sqlite3ext.h
1293 - sqlite3rbu.h
1294 - sqliteicu.h
1295 -@@ -404,6 +405,23 @@
1296 - sqlite3session.c
1297 - fts5.c
1298 - stmt.c
1299 -+ appendvfs.c
1300 -+ carray.c
1301 -+ completion.c
1302 -+ csv.c
1303 -+ dbdata.c
1304 -+ eval.c
1305 -+ fileio.c
1306 -+ ieee754.c
1307 -+ regexp.c
1308 -+ sha1.c
1309 -+ shathree.c
1310 -+ sqlar.c
1311 -+ sqlite3expert.c
1312 -+ totype.c
1313 -+ uint.c
1314 -+ uuid.c
1315 -+ zipfile.c
1316 - } {
1317 - copy_file tsrc/$file
1318 - }
1319 ---- /tool/sqlite3_analyzer.c.in
1320 -+++ /tool/sqlite3_analyzer.c.in
1321 -@@ -14,9 +14,6 @@
1322 - #define SQLITE_DEFAULT_MEMSTATUS 0
1323 - #define SQLITE_MAX_EXPR_DEPTH 0
1324 - #define SQLITE_OMIT_LOAD_EXTENSION 1
1325 --#ifndef USE_EXTERNAL_SQLITE
1326 --INCLUDE sqlite3.c
1327 --#endif
1328 - INCLUDE $ROOT/src/tclsqlite.c
1329 -
1330 - const char *sqlite3_analyzer_init_proc(Tcl_Interp *interp){
1331 ---- /tool/sqltclsh.c.in
1332 -+++ /tool/sqltclsh.c.in
1333 -@@ -27,21 +27,13 @@
1334 - #define SQLITE_OMIT_SHARED_CACHE 1
1335 - #define SQLITE_DEFAULT_MEMSTATUS 0
1336 - #define SQLITE_MAX_EXPR_DEPTH 0
1337 --INCLUDE sqlite3.c
1338 --INCLUDE $ROOT/ext/misc/appendvfs.c
1339 --#ifdef SQLITE_HAVE_ZLIB
1340 --INCLUDE $ROOT/ext/misc/zipfile.c
1341 --INCLUDE $ROOT/ext/misc/sqlar.c
1342 --#endif
1343 -+#include "sqlite3.h"
1344 - INCLUDE $ROOT/src/tclsqlite.c
1345 -
1346 - const char *sqlite3_tclapp_init_proc(Tcl_Interp *interp){
1347 - (void)interp;
1348 -+ extern int sqlite3_appendvfs_init(sqlite3 *,char **, const sqlite3_api_routines *);
1349 - sqlite3_appendvfs_init(0,0,0);
1350 --#ifdef SQLITE_HAVE_ZLIB
1351 -- sqlite3_auto_extension((void(*)(void))sqlite3_sqlar_init);
1352 -- sqlite3_auto_extension((void(*)(void))sqlite3_zipfile_init);
1353 --#endif
1354 -
1355 - return
1356 - BEGIN_STRING
1357
1358 diff --git a/dev-db/sqlite/files/sqlite-3.32.3-backports_1.patch b/dev-db/sqlite/files/sqlite-3.32.3-backports_1.patch
1359 deleted file mode 100644
1360 index 256d18ee76f..00000000000
1361 --- a/dev-db/sqlite/files/sqlite-3.32.3-backports_1.patch
1362 +++ /dev/null
1363 @@ -1,361 +0,0 @@
1364 -https://sqlite.org/src/info/d48af4d2cfff3d5f
1365 -https://sqlite.org/src/info/cc888878ea8d5bc7
1366 -https://sqlite.org/src/info/be545f85a6ef09cc
1367 -https://sqlite.org/src/info/6e0ffa2053124168
1368 -https://sqlite.org/src/info/4d0cfb1236884349
1369 -https://sqlite.org/src/info/ccff8cb8267d4c56
1370 -https://sqlite.org/src/info/5124732370fd53c9
1371 -
1372 ---- /ext/fts3/fts3.c
1373 -+++ /ext/fts3/fts3.c
1374 -@@ -2068,7 +2068,7 @@
1375 - sqlite3_int64 *piPrev, /* IN/OUT: Previous value written to list */
1376 - sqlite3_int64 iVal /* Write this value to the list */
1377 - ){
1378 -- assert( iVal-*piPrev > 0 || (*piPrev==0 && iVal==0) );
1379 -+ assert_fts3_nc( iVal-*piPrev > 0 || (*piPrev==0 && iVal==0) );
1380 - *pp += sqlite3Fts3PutVarint(*pp, iVal-*piPrev);
1381 - *piPrev = iVal;
1382 - }
1383 -@@ -5208,10 +5208,12 @@
1384 - );
1385 - if( res ){
1386 - nNew = (int)(pOut - pPhrase->doclist.pList) - 1;
1387 -- assert( pPhrase->doclist.pList[nNew]=='\0' );
1388 -- assert( nNew<=pPhrase->doclist.nList && nNew>0 );
1389 -- memset(&pPhrase->doclist.pList[nNew], 0, pPhrase->doclist.nList - nNew);
1390 -- pPhrase->doclist.nList = nNew;
1391 -+ if( nNew>=0 ){
1392 -+ assert( pPhrase->doclist.pList[nNew]=='\0' );
1393 -+ assert( nNew<=pPhrase->doclist.nList && nNew>0 );
1394 -+ memset(&pPhrase->doclist.pList[nNew], 0, pPhrase->doclist.nList - nNew);
1395 -+ pPhrase->doclist.nList = nNew;
1396 -+ }
1397 - *paPoslist = pPhrase->doclist.pList;
1398 - *pnToken = pPhrase->nToken;
1399 - }
1400 -@@ -5563,7 +5565,10 @@
1401 - }else
1402 - #endif
1403 - {
1404 -- bHit = (pExpr->bEof==0 && pExpr->iDocid==pCsr->iPrevId);
1405 -+ bHit = (
1406 -+ pExpr->bEof==0 && pExpr->iDocid==pCsr->iPrevId
1407 -+ && pExpr->pPhrase->doclist.nList>0
1408 -+ );
1409 - }
1410 - break;
1411 - }
1412 ---- /ext/fts3/fts3_write.c
1413 -+++ /ext/fts3/fts3_write.c
1414 -@@ -341,7 +341,9 @@
1415 - ** created by merging the oldest :2 segments from absolute level :1. See
1416 - ** function sqlite3Fts3Incrmerge() for details. */
1417 - /* 29 */ "SELECT 2 * total(1 + leaves_end_block - start_block) "
1418 -- " FROM %Q.'%q_segdir' WHERE level = ? AND idx < ?",
1419 -+ " FROM (SELECT * FROM %Q.'%q_segdir' "
1420 -+ " WHERE level = ? ORDER BY idx ASC LIMIT ?"
1421 -+ " )",
1422 -
1423 - /* SQL_DELETE_SEGDIR_ENTRY
1424 - ** Delete the %_segdir entry on absolute level :1 with index :2. */
1425 -@@ -2853,6 +2855,19 @@
1426 - return SQLITE_OK;
1427 - }
1428 -
1429 -+static int fts3GrowSegReaderBuffer(Fts3MultiSegReader *pCsr, int nReq){
1430 -+ if( nReq>pCsr->nBuffer ){
1431 -+ char *aNew;
1432 -+ pCsr->nBuffer = nReq*2;
1433 -+ aNew = sqlite3_realloc(pCsr->aBuffer, pCsr->nBuffer);
1434 -+ if( !aNew ){
1435 -+ return SQLITE_NOMEM;
1436 -+ }
1437 -+ pCsr->aBuffer = aNew;
1438 -+ }
1439 -+ return SQLITE_OK;
1440 -+}
1441 -+
1442 -
1443 - int sqlite3Fts3SegReaderStep(
1444 - Fts3Table *p, /* Virtual table handle */
1445 -@@ -2987,15 +3002,9 @@
1446 - }
1447 -
1448 - nByte = sqlite3Fts3VarintLen(iDelta) + (isRequirePos?nList+1:0);
1449 -- if( nDoclist+nByte>pCsr->nBuffer ){
1450 -- char *aNew;
1451 -- pCsr->nBuffer = (nDoclist+nByte)*2;
1452 -- aNew = sqlite3_realloc(pCsr->aBuffer, pCsr->nBuffer);
1453 -- if( !aNew ){
1454 -- return SQLITE_NOMEM;
1455 -- }
1456 -- pCsr->aBuffer = aNew;
1457 -- }
1458 -+
1459 -+ rc = fts3GrowSegReaderBuffer(pCsr, nByte+nDoclist);
1460 -+ if( rc ) return rc;
1461 -
1462 - if( isFirst ){
1463 - char *a = &pCsr->aBuffer[nDoclist];
1464 -@@ -3020,6 +3029,9 @@
1465 - fts3SegReaderSort(apSegment, nMerge, j, xCmp);
1466 - }
1467 - if( nDoclist>0 ){
1468 -+ rc = fts3GrowSegReaderBuffer(pCsr, nDoclist+FTS3_NODE_PADDING);
1469 -+ if( rc ) return rc;
1470 -+ memset(&pCsr->aBuffer[nDoclist], 0, FTS3_NODE_PADDING);
1471 - pCsr->aDoclist = pCsr->aBuffer;
1472 - pCsr->nDoclist = nDoclist;
1473 - rc = SQLITE_ROW;
1474 -@@ -4288,7 +4300,7 @@
1475 - int i;
1476 - int nHeight = (int)aRoot[0];
1477 - NodeWriter *pNode;
1478 -- if( nHeight<1 || nHeight>FTS_MAX_APPENDABLE_HEIGHT ){
1479 -+ if( nHeight<1 || nHeight>=FTS_MAX_APPENDABLE_HEIGHT ){
1480 - sqlite3_reset(pSelect);
1481 - return FTS_CORRUPT_VTAB;
1482 - }
1483 ---- /src/expr.c
1484 -+++ /src/expr.c
1485 -@@ -4272,7 +4272,9 @@
1486 - int nCol;
1487 - testcase( op==TK_EXISTS );
1488 - testcase( op==TK_SELECT );
1489 -- if( op==TK_SELECT && (nCol = pExpr->x.pSelect->pEList->nExpr)!=1 ){
1490 -+ if( pParse->db->mallocFailed ){
1491 -+ return 0;
1492 -+ }else if( op==TK_SELECT && (nCol = pExpr->x.pSelect->pEList->nExpr)!=1 ){
1493 - sqlite3SubselectError(pParse, nCol, 1);
1494 - }else{
1495 - return sqlite3CodeSubselect(pParse, pExpr);
1496 ---- /test/fts3corrupt4.test
1497 -+++ /test/fts3corrupt4.test
1498 -@@ -6123,4 +6123,163 @@
1499 - SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'rtree ner "json1^enable"';
1500 - }
1501 -
1502 -+#-------------------------------------------------------------------------
1503 -+do_execsql_test 42.1 {
1504 -+ CREATE VIRTUAL TABLE f USING fts3(a, b);
1505 -+}
1506 -+do_execsql_test 42.2 {
1507 -+ INSERT INTO f_segdir VALUES(0,2,1111,0,0,X'00');
1508 -+ INSERT INTO f_segdir VALUES(0,3,0 ,0,0,X'00013003010200');
1509 -+}
1510 -+do_execsql_test 42.3 {
1511 -+ INSERT INTO f(f) VALUES ('merge=107,2');
1512 -+}
1513 -+
1514 -+#-------------------------------------------------------------------------
1515 -+reset_db
1516 -+set saved $sqlite_fts3_enable_parentheses
1517 -+set sqlite_fts3_enable_parentheses 1
1518 -+do_execsql_test 43.1 {
1519 -+ CREATE VIRTUAL TABLE def USING fts3(xyz);
1520 -+ INSERT INTO def_segdir VALUES(0,0,0,0,0, X'0001310301c9000103323334050d81');
1521 -+} {}
1522 -+
1523 -+do_execsql_test 43.2 {
1524 -+ SELECT rowid FROM def WHERE def MATCH '1 NEAR 1'
1525 -+} {1}
1526 -+
1527 -+set sqlite_fts3_enable_parentheses $saved
1528 -+
1529 -+#-------------------------------------------------------------------------
1530 -+reset_db
1531 -+do_execsql_test 44.1 {
1532 -+ CREATE VIRTUAL TABLE t0 USING fts3(col0 INTEGER PRIMARY KEY,col1 VARCHAR(8),col2 BINARY,col3 BINARY);
1533 -+ INSERT INTO t0_content VALUES(0,NULL,NULL,NULL,NULL);
1534 -+ INSERT INTO t0_segdir VALUES(0,0,0,0,'0 42',X'00013103010200010332333405010201ba00000461616161050101020200000462626262050101030200');
1535 -+}
1536 -+
1537 -+do_execsql_test 44.2 {
1538 -+ SELECT matchinfo(t0, t0) IS NULL FROM t0 WHERE t0 MATCH '1*'
1539 -+} {0}
1540 -+
1541 -+#-------------------------------------------------------------------------
1542 -+#
1543 -+reset_db
1544 -+do_test 45.0 {
1545 -+ sqlite3 db {}
1546 -+ db deserialize [decode_hexdb {
1547 -+.open --hexdb
1548 -+| size 24576 pagesize 4096 filename crash-65c98512cc9e49.db
1549 -+| page 1 offset 0
1550 -+| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3.
1551 -+| 16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 06 .....@ ........
1552 -+| 96: 00 00 00 00 0d 0e fc 00 06 0d bc 00 0f ca 0f 6c ...............l
1553 -+| 112: 0f 04 0e 13 0e c9 0d bc 00 00 00 00 00 00 00 00 ................
1554 -+| 3504: 00 00 00 00 00 00 00 00 00 00 00 00 55 06 07 17 ............U...
1555 -+| 3520: 1b 1b 01 81 01 74 61 62 6c 65 78 31 5f 73 74 61 .....tablex1_sta
1556 -+| 3536: 74 78 31 5f 73 74 61 74 06 43 52 45 41 54 45 20 tx1_stat.CREATE
1557 -+| 3552: 54 41 42 4c 45 20 27 78 31 5f 73 74 61 74 27 28 TABLE 'x1_stat'(
1558 -+| 3568: 69 64 20 49 4e 54 45 47 45 52 20 50 52 49 4d 41 id INTEGER PRIMA
1559 -+| 3584: 52 59 20 4b 45 59 2c 20 76 61 6c 75 65 20 42 4c RY KEY, value BL
1560 -+| 3600: 41 82 29 81 33 04 07 17 1f 1f 01 82 35 74 61 62 A.).3.......5tab
1561 -+| 3616: 6c 65 78 31 5f 73 65 67 64 69 72 78 31 5f 73 65 lex1_segdirx1_se
1562 -+| 3632: 67 64 69 72 04 43 52 45 41 54 45 20 54 41 42 4c gdir.CREATE TABL
1563 -+| 3648: 45 20 27 78 31 5f 73 65 67 64 69 72 27 28 6c 65 E 'x1_segdir'(le
1564 -+| 3664: 76 65 6c 20 49 4e 54 45 47 45 52 2c 69 64 78 20 vel INTEGER,idx
1565 -+| 3680: 49 4e 54 45 47 45 52 2c 73 74 61 72 74 5f 62 6c INTEGER,start_bl
1566 -+| 3696: 6f 63 6b 20 49 4e 54 45 47 45 52 2c 6c 65 61 76 ock INTEGER,leav
1567 -+| 3712: 65 73 5f 65 6e 64 5f 62 6c 6f 63 6b 20 49 4e 54 es_end_block INT
1568 -+| 3728: 45 47 45 52 2c 65 6e 64 5f 62 6c 6f 63 6b 20 49 EGER,end_block I
1569 -+| 3744: 4e 54 45 47 45 52 2c 72 6f 6f 74 20 42 4c 4f 42 NTEGER,root BLOB
1570 -+| 3760: 2c 50 52 49 4d 41 52 59 20 4b 45 59 28 6c 65 76 ,PRIMARY KEY(lev
1571 -+| 3776: 65 6c 2c 20 69 64 78 29 29 31 05 06 17 45 1f 01 el, idx))1...E..
1572 -+| 3792: 00 69 6e 64 65 78 73 71 6c 69 74 65 5f 61 75 74 .indexsqlite_aut
1573 -+| 3808: 6f 69 6e 64 65 78 5f 78 31 5f 73 65 67 64 69 72 oindex_x1_segdir
1574 -+| 3824: 5f 31 78 31 5f 73 65 67 64 69 72 05 00 00 00 08 _1x1_segdir.....
1575 -+| 3840: 60 00 00 00 66 03 07 17 23 23 01 81 13 74 61 62 `...f...##...tab
1576 -+| 3856: 6c 65 78 31 5f 73 65 67 6d 65 6e 74 73 78 31 5f lex1_segmentsx1_
1577 -+| 3872: 73 65 67 6d 65 6e 74 73 03 43 52 45 41 54 45 20 segments.CREATE
1578 -+| 3888: 54 41 42 4c 45 20 27 78 31 5f 73 65 67 6d 65 6e TABLE 'x1_segmen
1579 -+| 3904: 74 73 27 28 62 6c 6f 63 6b 69 64 20 49 4e 54 45 ts'(blockid INTE
1580 -+| 3920: 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 2c GER PRIMARY KEY,
1581 -+| 3936: 20 62 6c 6f 63 6b 20 42 4c 4f 42 29 5c 02 07 17 block BLOB)....
1582 -+| 3952: 21 21 01 81 03 74 61 62 6c 65 78 31 5f 63 6f 6e !!...tablex1_con
1583 -+| 3968: 74 65 6e 74 78 31 5f 63 6f 6e 74 65 6e 74 02 43 tentx1_content.C
1584 -+| 3984: 52 45 41 54 45 20 54 41 42 4c 45 20 27 78 31 5f REATE TABLE 'x1_
1585 -+| 4000: 63 6f 6e 74 65 6e 74 27 28 64 6f 63 69 64 20 49 content'(docid I
1586 -+| 4016: 4e 54 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b NTEGER PRIMARY K
1587 -+| 4032: 45 59 2c 20 27 63 30 78 27 29 34 01 06 17 11 11 EY, 'c0x')4.....
1588 -+| 4048: 08 57 74 61 62 6c 65 78 31 78 31 43 52 45 41 54 .Wtablex1x1CREAT
1589 -+| 4064: 45 20 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 E VIRTUAL TABLE
1590 -+| 4080: 78 31 20 55 53 49 4e 47 20 66 74 73 33 28 78 29 x1 USING fts3(x)
1591 -+| page 2 offset 4096
1592 -+| 0: 0d 00 00 00 11 0f 77 f0 0f f8 0f f0 0f e8 0f e0 ......w.........
1593 -+| 16: 0f d8 0f d0 0f c8 0f c0 00 00 00 00 00 00 00 00 ................
1594 -+| 3952: 00 00 00 00 00 00 00 00 06 11 03 00 13 77 78 79 .............wxy
1595 -+| 3968: 06 10 03 00 13 74 75 76 06 0f 03 00 13 71 33 73 .....tuv.....q3s
1596 -+| 3984: 06 0e 03 00 13 6e 6f 70 06 0d 03 00 13 6b 6c 6d .....nop.....klm
1597 -+| 4000: 06 0c 03 04 c3 68 69 6a 06 0b 03 00 13 65 66 67 .....hij.....efg
1598 -+| 4016: 06 0a 03 00 13 62 63 64 06 09 03 00 13 79 7a 61 .....bcd.....yza
1599 -+| 4032: 06 08 03 00 13 76 77 78 06 07 03 00 13 73 74 75 .....vwx.....stu
1600 -+| 4048: 06 06 03 00 13 70 71 72 06 05 03 00 13 6d 6e 6f .....pqr.....mno
1601 -+| 4064: 06 03 03 00 13 6a 6b 6c 06 03 03 00 13 67 68 69 .....jkl.....ghi
1602 -+| 4080: 06 02 02 00 03 64 65 66 06 01 03 00 13 61 52 63 .....def.....aRc
1603 -+| page 3 offset 8192
1604 -+| 0: 0d 00 00 00 03 0f a7 00 0f b5 0f a7 0f fa 01 00 ................
1605 -+| 4000: 00 00 00 00 00 00 00 0c 02 03 00 1e 00 03 6b 6c ..............kl
1606 -+| 4016: 6d 03 0d 02 00 43 01 04 00 81 0a 00 03 61 62 63 m....C.......abc
1607 -+| 4032: 03 0b 32 00 00 03 62 63 64 03 0a 02 00 00 03 64 ..2...bcd......d
1608 -+| 4048: 69 26 03 02 02 00 00 03 65 66 67 03 0b 02 00 00 i&......efg.....
1609 -+| 4064: 03 67 68 69 03 03 02 00 00 03 68 69 6a 03 0c 02 .ghi......hij...
1610 -+| 4080: 00 00 03 6a 6a 2c 03 04 02 00 03 81 00 03 00 00 ...jj,..........
1611 -+| page 4 offset 12288
1612 -+| 0: 0d 0f 3a 00 05 0f 25 00 0f 9e 0f 88 0f 43 0f 25 ..:...%......C.%
1613 -+| 16: 0f 72 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .r..............
1614 -+| 3856: 00 00 00 00 00 00 00 00 00 56 01 08 08 13 1e 03 .........V......
1615 -+| 3872: 30 20 39 00 03 13 05 07 08 08 18 08 13 1e 30 20 0 9...........0
1616 -+| 3888: 39 00 03 77 78 79 03 11 02 00 0f 6c 00 09 01 08 9..wxy.....l....
1617 -+| 3904: 08 15 54 27 04 07 09 01 08 08 15 42 02 30 20 33 ..T'.......B.0 3
1618 -+| 3920: 36 00 03 6e 6f 70 03 0e 02 00 00 03 71 72 73 03 6..nop......qrs.
1619 -+| 3936: 0f 02 00 00 03 74 75 76 03 10 02 00 0f cf b1 06 .....tuv........
1620 -+| 3952: 01 08 14 06 07 01 08 09 01 1b 14 02 02 31 32 38 .............128
1621 -+| 3968: 20 2d 37 32 10 01 01 6b 14 03 07 09 09 08 08 15 -72...k........
1622 -+| 3984: 1e 30 20 33 36 00 03 79 7a 61 03 09 02 00 2f 02 .0 36..yza..../.
1623 -+| 4000: 07 09 08 08 08 15 54 30 20 33 36 00 03 6d 6e 6f ......T0 36..mno
1624 -+| 4016: 03 05 02 00 00 03 70 71 72 03 06 02 00 00 03 73 ......pqr......s
1625 -+| 4032: 74 75 03 07 02 00 00 03 76 77 78 03 08 02 00 00 tu......vwx.....
1626 -+| 4048: 00 00 4a 08 08 08 15 54 30 20 33 36 00 03 61 62 ..J....T0 36..ab
1627 -+| 4064: 63 03 01 02 00 00 03 64 65 66 03 02 02 00 00 03 c......def......
1628 -+| 4080: 67 68 69 03 03 67 00 00 03 6a 6b 6c 03 04 02 00 ghi..g...jkl....
1629 -+| page 5 offset 16384
1630 -+| 0: 0a 0f e7 00 05 0f da 00 0f e1 0f fa 0f f4 0f ed ................
1631 -+| 16: 0f da 0f 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
1632 -+| 4048: 00 00 00 00 00 00 00 1a 01 03 06 04 01 08 01 02 ................
1633 -+| 4064: 06 05 04 08 08 01 05 00 00 00 06 01 03 06 04 09 ................
1634 -+| 4080: 02 01 02 04 05 04 09 09 01 03 05 04 09 08 01 02 ................
1635 -+| page 6 offset 20480
1636 -+| 0: 0d 00 10 00 01 0f f9 00 0f f9 00 00 00 00 00 00 ................
1637 -+| 4080: 00 00 00 00 00 00 00 00 00 05 01 03 00 10 01 03 ................
1638 -+| end crash-65c98512cc9e49.db
1639 -+}]} {}
1640 -+
1641 -+do_catchsql_test 45.2 {
1642 -+ INSERT INTO x1(x1) VALUES( 'merge=1' )
1643 -+} {1 {database disk image is malformed}}
1644 -+
1645 -+#-------------------------------------------------------------------------
1646 -+reset_db
1647 -+set saved $sqlite_fts3_enable_parentheses
1648 -+set sqlite_fts3_enable_parentheses 1
1649 -+do_execsql_test 46.1 {
1650 -+ CREATE VIRTUAL TABLE t0 USING fts3(a INTEGER PRIMARY KEY,b,c,d);
1651 -+ INSERT INTO t0_segdir VALUES(0,0,0,0,'0 42',X'0001310301c9000103323334050d8000f200000461616161050101020200000462626262050101030200');
1652 -+} {}
1653 -+
1654 -+do_catchsql_test 46.2 {
1655 -+ SELECT * FROM t0
1656 -+ WHERE t0 MATCH x'2b0a312b0a312a312a2a0b5d0a0b0b0a312a0a0b0b0a312a0b310a392a0b0a27312a2a0b5d0a312a0b310a31315d0b310a312a316d2a0b313b15bceaa50a312a0b0a27312a2a0b5d0a312a0b310a312b0b2a310a312a0b2a0b2a0b2e5d0a0bff313336e34a2a312a0b0a3c310b0a0b4b4b0b4b2a4bec40322b2a0b310a0a312a0a0a0a0a0a0a0a0a0b310a312a2a2a0b5d0a0b0b0a312a0b310a312a0b0a4e4541530b310a5df5ced70a0a0a0a0a4f520a0a0a0a0a0a0a312a0b0a4e4541520b310a5d616161610a0a0a0a4f520a0a0a0a0a0a312b0a312a312a0a0a0a0a0a0a004a0b0a310b220a0b0a310a4a22310a0b0a7e6fe0e0e030e0e0e0e0e01176e02000e0e0e0e0e01131320226310a0b0a310a4a22310a0b0a310a766f8b8b4ee0e0300ae0090909090909090909090909090909090909090909090909090909090909090947aaaa540b09090909090909090909090909090909090909090909090909090909090909fae0e0f2f22164e0e0f273e07fefefef7d6dfafafafa6d6d6d6d';
1657 -+} {1 {database disk image is malformed}}
1658 -+
1659 -+set sqlite_fts3_enable_parentheses $saved
1660 -+
1661 - finish_test
1662 ---- /test/fts3corrupt6.test
1663 -+++ /test/fts3corrupt6.test
1664 -@@ -0,0 +1,60 @@
1665 -+# 2020 June 8
1666 -+#
1667 -+# The author disclaims copyright to this source code. In place of
1668 -+# a legal notice, here is a blessing:
1669 -+#
1670 -+# May you do good and not evil.
1671 -+# May you find forgiveness for yourself and forgive others.
1672 -+# May you share freely, never taking more than you give.
1673 -+#
1674 -+#*************************************************************************
1675 -+# This file implements regression tests for SQLite library. The
1676 -+# focus of this script is testing the FTS3 module.
1677 -+#
1678 -+# $Id: fts3aa.test,v 1.1 2007/08/20 17:38:42 shess Exp $
1679 -+#
1680 -+
1681 -+set testdir [file dirname $argv0]
1682 -+source $testdir/tester.tcl
1683 -+source $testdir/fts3_common.tcl
1684 -+set testprefix fts3corrupt6
1685 -+
1686 -+# If SQLITE_ENABLE_FTS3 is defined, omit this file.
1687 -+ifcapable !fts3 {
1688 -+ finish_test
1689 -+ return
1690 -+}
1691 -+
1692 -+set ::saved_sqlite_fts3_enable_parentheses $::sqlite_fts3_enable_parentheses
1693 -+set sqlite_fts3_enable_parentheses 1
1694 -+sqlite3_fts3_may_be_corrupt 1
1695 -+database_may_be_corrupt
1696 -+
1697 -+do_execsql_test 1.0 {
1698 -+ BEGIN TRANSACTION;
1699 -+ CREATE TABLE t_content(col0 INTEGER);
1700 -+ PRAGMA writable_schema=ON;
1701 -+ CREATE VIRTUAL TABLE t0 USING fts3(col0 INTEGER PRIMARY KEY,col1 VARCHAR(8),col2 BINARY,col3 BINARY);
1702 -+ INSERT INTO t0_content VALUES(0,NULL,NULL,NULL,NULL);
1703 -+ INSERT INTO t0_segdir VALUES(0,0,0,0,'0 42',X'000131030102000103323334050101010200000461616161050101020200000462626262050101030200');
1704 -+ COMMIT;
1705 -+}
1706 -+
1707 -+do_execsql_test 1.1 {
1708 -+ SELECT 0+matchinfo(t0,'yxyyxy') FROM t0 WHERE t0 MATCH CAST( x'2b0a312b0a312a312a2a0b5d0a0b0b0a312a0a0b0b0a312a0b310a392a0b0a27312a2a0b5d0a312a0b310a31315d0b310a312a316d2a0b313b15bceaa50a312a0b0a27312a2a0b5d0a312a0b310a312b0b2a310a312a0b2a0b2a0b2e5d0a0bff313336e34a2a312a0b0a3c310b0a0b4b4b0b4b2a4bec40322b2a0b310a0a312a0a0a0a0a0a0a0a0a0b310a312a2a2a0b5d0a0b0b0a312a0b310a312a0b0a4e4541530b310a5df5ced70a0a0a0a0a4f520a0a0a0a0a0a0a312a0b0a4e4541520b310a5d616161610a0a0a0a4f520a0a0a0a0a0a312b0a312a312a0a0a0a0a0a0a004a0b0a310b220a0b0a310a4a22310a0b0a7e6fe0e0e030e0e0e0e0e01176e02000e0e0e0e0e01131320226310a0b0a310a4a22310a0b0a310a766f8b8b4ee0e0300ae0090909090909090909090909090909090909090909090909090909090909090947aaaa540b09090909090909090909090909090909090909090909090909090909090909fae0e0f2f22164e0e0f273e07fefefef7d6dfafafafa6d6d6d6d' AS TEXT);
1709 -+} {0}
1710 -+
1711 -+do_execsql_test 1.2 {
1712 -+ CREATE VIRTUAL TABLE t1 USING fts3(col0 INTEGER PRIMARY KEY,col1 VARCHAR(8),col2 BINARY,col3 BINARY);
1713 -+ INSERT INTO t1_content VALUES(0,NULL,NULL,NULL,NULL);
1714 -+ INSERT INTO t1_segdir VALUES(0,0,0,0,'0 42',X'000131030102000103323334050101010200000461616161050101020200000462626262050101030200');
1715 -+}
1716 -+
1717 -+do_execsql_test 1.3 {
1718 -+ SELECT 42+matchinfo(t1,'yxyyxy') FROM t1 WHERE t1 MATCH x'2b0a312b0a312a312a2a0b5d0a0b0b0a312a0a0b0b0a312a0b310a392a0b0a27312a2a0b5d0a312a0b310a31315d0b310a312a316d2a0b313b15bceaa50a312a0b0a27312a2a0b5d0a312a0b310a312b0b2a310a312a0b2a0b2a0b2e5d0a0bff313336e34a2a312a0b0a3c310b0a0b4b4b0b4b2a4bec40322b2a0b310a0a312a0a0a0a0a0a0a0a0a0b310a312a2a2a0b5d0a0b0b0a312a0b310a312a0b0a4e4541530b310a5df5ced70a0a0a0a0a4f520a0a0a0a0a0a0a312a0b0a4e4541520b310a5d616161610a0a0a0a4f520a0a0a0a0a0a312b0a312a312a0a0a0a0a0a0a004a0b0a310b220a0b0a310a4a22310a0b0a7e6fe0e0e030e0e0e0e0e01176e02000e0e0e0e0e01131320226310a0b0a310a4a22310a0b0a310a766f8b8b4ee0e0300ae0090909090909090909090909090909090909090909090909090909090909090947aaaa540b09090909090909090909090909090909090909090909090909090909090909fae0e0f2f22164e0e0f273e07fefefef7d6dfafafafa6d6d6d6d';
1719 -+} {42}
1720 -+
1721 -+set sqlite_fts3_enable_parentheses $saved_sqlite_fts3_enable_parentheses
1722 -+finish_test
1723 -+
1724 -+
1725
1726 diff --git a/dev-db/sqlite/files/sqlite-3.32.3-backports_2.patch b/dev-db/sqlite/files/sqlite-3.32.3-backports_2.patch
1727 deleted file mode 100644
1728 index 32b6f9b1624..00000000000
1729 --- a/dev-db/sqlite/files/sqlite-3.32.3-backports_2.patch
1730 +++ /dev/null
1731 @@ -1,302 +0,0 @@
1732 -https://sqlite.org/src/info/30735432bc33cb95
1733 -https://sqlite.org/src/info/1bd18ca35bdbf303
1734 -https://sqlite.org/src/info/49da8bdce17ced91
1735 -https://sqlite.org/src/info/f25a56c26e28abd4
1736 -
1737 ---- /ext/fts5/fts5_index.c
1738 -+++ /ext/fts5/fts5_index.c
1739 -@@ -2321,11 +2321,11 @@
1740 - }
1741 -
1742 - search_success:
1743 -- pIter->iLeafOffset = iOff + nNew;
1744 -- if( pIter->iLeafOffset>n || nNew<1 ){
1745 -+ if( (i64)iOff+nNew>n || nNew<1 ){
1746 - p->rc = FTS5_CORRUPT;
1747 - return;
1748 - }
1749 -+ pIter->iLeafOffset = iOff + nNew;
1750 - pIter->iTermLeafOffset = pIter->iLeafOffset;
1751 - pIter->iTermLeafPgno = pIter->iLeafPgno;
1752 -
1753 ---- /ext/fts5/test/fts5corrupt3.test
1754 -+++ /ext/fts5/test/fts5corrupt3.test
1755 -@@ -10108,6 +10108,221 @@
1756 - INSERT INTO t1(t1) SELECT x FROM t2;
1757 - } {1 {database disk image is malformed}}
1758 -
1759 -+#-------------------------------------------------------------------------
1760 -+reset_db
1761 -+do_test 69.0 {
1762 -+ sqlite3 db {}
1763 -+ db deserialize [decode_hexdb {
1764 -+.open --hexdb
1765 -+| size 32768 pagesize 4096 filename crash-31c462b8b665d0.db
1766 -+| page 1 offset 0
1767 -+| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3.
1768 -+| 16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 08 .....@ ........
1769 -+| 32: 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 ................
1770 -+| 96: 00 00 00 00 0d 0f c7 00 07 0d 92 00 0f 8d 0f 36 ...............6
1771 -+| 112: 0e cb 0e 6b 0e 0e 0d b6 0d 92 00 00 00 00 00 00 ...k............
1772 -+| 3472: 00 00 22 08 06 17 11 11 01 31 74 61 62 6c 65 74 .........1tablet
1773 -+| 3488: 32 74 32 08 43 52 45 41 54 45 20 54 41 42 4c 45 2t2.CREATE TABLE
1774 -+| 3504: 20 74 32 28 78 29 56 07 06 17 1f 1f 01 7d 74 61 t2(x)V.......ta
1775 -+| 3520: 62 6c 65 74 31 5f 63 6f 6e 66 69 67 74 31 5f 63 blet1_configt1_c
1776 -+| 3536: 6f 6e 66 69 67 07 43 52 45 41 54 45 20 54 41 42 onfig.CREATE TAB
1777 -+| 3552: 4c 45 20 27 74 31 5f 63 6f 6e 66 69 67 27 28 6b LE 't1_config'(k
1778 -+| 3568: 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 76 29 PRIMARY KEY, v)
1779 -+| 3584: 20 57 49 54 48 4f 55 54 20 52 4f 57 49 44 5b 06 WITHOUT ROWID[.
1780 -+| 3600: 07 17 21 21 01 81 01 74 61 62 6c 65 74 31 5f 64 ..!!...tablet1_d
1781 -+| 3616: 6f 63 73 69 7a 65 74 31 5f 64 6f 63 73 69 7a 65 ocsizet1_docsize
1782 -+| 3632: 06 43 52 45 41 54 45 20 54 41 42 4c 45 20 27 74 .CREATE TABLE 't
1783 -+| 3648: 31 5f 64 6f 63 73 69 7a 65 27 28 69 64 20 49 4e 1_docsize'(id IN
1784 -+| 3664: 54 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 TEGER PRIMARY KE
1785 -+| 3680: 59 2c 20 73 7a 20 42 4c 4f 42 29 5e 05 07 17 21 Y, sz BLOB)^...!
1786 -+| 3696: 21 01 81 07 74 61 62 6c 65 74 31 5f 63 6f 6e 74 !...tablet1_cont
1787 -+| 3712: 65 6e 74 74 31 5f 63 6f 6e 74 65 6e 74 05 43 52 entt1_content.CR
1788 -+| 3728: 45 41 54 45 20 54 41 42 4c 45 20 27 74 31 5f 63 EATE TABLE 't1_c
1789 -+| 3744: 6f 6e 74 65 6e 74 27 28 69 64 20 49 4e 54 45 47 ontent'(id INTEG
1790 -+| 3760: 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 ER PRIMARY KEY,
1791 -+| 3776: 63 39 2c 20 63 31 2c 20 63 32 29 69 04 07 17 19 c9, c1, c2)i....
1792 -+| 3792: 19 01 81 2d 74 61 62 6c 65 74 31 5f 69 64 78 74 ...-tablet1_idxt
1793 -+| 3808: 31 5f 69 64 78 04 43 52 45 41 54 45 20 54 41 42 1_idx.CREATE TAB
1794 -+| 3824: 4c 45 20 27 74 31 5f 69 64 78 27 28 73 65 67 69 LE 't1_idx'(segi
1795 -+| 3840: 64 2c 20 74 65 72 6d 2c 20 70 67 6e 6f 2c 20 50 d, term, pgno, P
1796 -+| 3856: 52 49 4d 41 52 59 20 4b 45 59 28 73 65 67 69 64 RIMARY KEY(segid
1797 -+| 3872: 2c 20 74 65 72 6d 29 29 20 57 49 54 48 4f 55 54 , term)) WITHOUT
1798 -+| 3888: 20 52 4f 57 49 44 55 03 07 17 1b 1b 01 81 01 74 ROWIDU........t
1799 -+| 3904: 61 62 6c 65 74 31 5f 64 61 74 61 74 31 5f 64 61 ablet1_datat1_da
1800 -+| 3920: 74 61 03 43 52 45 41 54 45 20 54 41 42 4c 45 20 ta.CREATE TABLE
1801 -+| 3936: 27 74 31 5f 64 61 74 61 27 28 69 64 20 49 4e 54 't1_data'(id INT
1802 -+| 3952: 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 EGER PRIMARY KEY
1803 -+| 3968: 2c 20 62 6c 6f 63 6b 20 42 4c 4f 42 29 38 02 06 , block BLOB)8..
1804 -+| 3984: 17 11 11 08 5f 74 61 62 6c 65 74 31 74 31 43 52 ...._tablet1t1CR
1805 -+| 4000: 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 EATE VIRTUAL TAB
1806 -+| 4016: 4c 45 20 74 31 20 55 53 49 4e 47 20 66 74 73 35 LE t1 USING fts5
1807 -+| 4032: 28 61 2c 62 2c 63 29 00 00 00 00 00 00 00 00 00 (a,b,c).........
1808 -+| page 3 offset 8192
1809 -+| 0: 0d 00 00 00 03 0c 94 00 0f e6 0f ef 0c 94 00 00 ................
1810 -+| 3216: 00 00 00 00 86 4a 84 80 80 80 80 01 04 00 8d 18 .....J..........
1811 -+| 3232: 00 00 03 2b 02 30 30 01 02 06 01 02 06 01 02 06 ...+.00.........
1812 -+| 3248: 1f 02 03 01 02 03 01 02 03 01 08 32 30 31 36 30 ...........20160
1813 -+| 3264: 36 30 39 01 02 07 01 02 07 01 02 07 01 01 34 01 609...........4.
1814 -+| 3280: 02 05 01 02 05 01 02 05 01 01 35 01 02 04 01 02 ..........5.....
1815 -+| 3296: 04 01 02 04 02 07 30 30 30 30 30 30 30 1c 02 04 ......0000000...
1816 -+| 3312: 01 02 04 01 02 04 01 06 62 69 6e 61 72 79 03 06 ........binary..
1817 -+| 3328: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................
1818 -+| 3344: 02 02 03 06 00 02 02 03 06 01 02 02 03 06 01 02 ................
1819 -+| 3360: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
1820 -+| 3376: 03 06 01 02 02 03 06 01 02 02 01 08 63 6f 6d 70 ............comp
1821 -+| 3392: 69 6c 65 72 01 02 02 01 02 02 01 02 02 01 06 64 iler...........d
1822 -+| 3408: 62 73 74 61 74 07 02 03 01 02 03 01 02 03 02 04 bstat...........
1823 -+| 3424: 65 62 75 67 04 02 02 01 02 02 01 02 02 01 06 65 ebug...........e
1824 -+| 3440: 6e 61 62 6c 65 07 02 02 01 02 02 01 02 02 01 02 nable...........
1825 -+| 3456: 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 ................
1826 -+| 3472: 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 ................
1827 -+| 3488: 01 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 ................
1828 -+| 3504: 02 01 02 02 02 08 78 74 65 6e 73 69 6f 6e 1f 02 ......xtension..
1829 -+| 3520: 04 01 02 04 01 02 04 01 04 66 74 73 34 1a 02 03 .........fts4...
1830 -+| 3536: 01 02 03 01 02 03 04 01 35 0d 02 03 01 02 03 01 ........5.......
1831 -+| 3552: 02 03 01 03 67 63 63 01 aa 03 01 02 03 01 02 03 ....gcc.........
1832 -+| 3568: 02 06 65 6f 70 6f 6c 79 10 02 03 02 02 03 01 02 ..eopoly........
1833 -+| 3584: 03 01 05 6a 73 6f 6e 31 13 02 03 01 02 03 01 02 ...json1........
1834 -+| 3600: 03 01 04 6c 6f 61 64 1f 02 03 01 02 03 01 02 03 ...load.........
1835 -+| 3616: 01 03 6d 61 78 1c 02 02 01 02 02 01 02 02 02 05 ..max...........
1836 -+| 3632: 65 6d 6f 72 79 1c 02 03 01 02 03 01 02 03 04 04 emory...........
1837 -+| 3648: 73 79 73 35 16 02 03 01 02 03 01 02 03 01 06 6e sys5...........n
1838 -+| 3664: 6f 63 61 73 65 02 06 01 02 02 03 06 01 02 02 03 ocase...........
1839 -+| 3680: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
1840 -+| 3696: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................
1841 -+| 3712: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 ................
1842 -+| 3728: 02 01 04 6f 6d 69 74 1f 02 02 01 02 02 01 02 01 ...omit.........
1843 -+| 3744: ff ff ff ff ff ff ff ff f0 00 00 00 00 00 01 02 ................
1844 -+| 3760: 58 81 96 4d 01 06 01 02 02 03 06 01 02 02 03 06 X..M............
1845 -+| 3776: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................
1846 -+| 3792: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 ................
1847 -+| 3808: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
1848 -+| 3824: 01 0a 74 68 72 65 61 64 73 61 66 65 22 02 02 01 ..threadsafe....
1849 -+| 3840: 02 02 01 02 02 01 04 76 74 61 62 07 02 04 01 02 .......vtab.....
1850 -+| 3856: 04 01 02 04 01 01 78 01 06 01 01 02 01 06 01 01 ......x.........
1851 -+| 3872: 02 01 06 01 1e 02 01 06 01 01 02 01 06 01 01 02 ................
1852 -+| 3888: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
1853 -+| 3904: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
1854 -+| 3920: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 ................
1855 -+| 3936: 00 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
1856 -+| 3952: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
1857 -+| 3968: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
1858 -+| 3984: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
1859 -+| 4000: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 ................
1860 -+| 4016: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
1861 -+| 4032: 02 01 06 01 01 02 01 06 01 01 02 04 15 13 0c 0c ................
1862 -+| 4048: 12 44 13 11 0f 47 13 0f 0b 0e 11 10 0f 0e 10 0f .D...G..........
1863 -+| 4064: 44 0f 10 40 15 0f 07 01 03 00 14 24 5a 24 24 0f D..@.......$Z$$.
1864 -+| 4080: 0a 03 00 24 00 00 00 00 01 01 01 00 01 01 01 01 ...$............
1865 -+| page 4 offset 12288
1866 -+| 0: 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
1867 -+| 4080: 00 00 00 00 00 00 00 00 00 00 05 04 09 0c 01 02 ................
1868 -+| page 5 offset 16384
1869 -+| 0: 0d 00 00 00 24 0c 0a 00 0f d8 0f af 0f 86 0f 74 ....$..........t
1870 -+| 16: 0f 61 0f 4e 0f 2f 0f 0f 0e ef 0e d7 0e be 0e a5 .a.N./..........
1871 -+| 32: 0e 8d 0e 74 0e 5b 0e 40 0e 24 0e 08 0d ef 0d d5 ...t.[.@.$......
1872 -+| 48: 0d bb 0d a0 0d 84 0d 68 0d 4f 0d 00 00 00 00 00 .......h.O......
1873 -+| 3072: 00 00 00 00 00 00 00 00 00 00 18 24 05 00 25 0f ...........$..%.
1874 -+| 3088: 19 54 48 52 45 41 44 53 41 46 45 3d 30 58 42 49 .THREADSAFE=0XBI
1875 -+| 3104: 4e 41 52 59 18 23 05 00 25 0f 19 54 48 52 45 41 NARY.#..%..THREA
1876 -+| 3120: 44 53 41 46 45 3d 30 58 4e 4f 43 41 53 45 17 22 DSAFE=0XNOCASE..
1877 -+| 3136: 05 00 25 0f 17 54 48 52 45 41 44 53 41 46 45 3d ..%..THREADSAFE=
1878 -+| 3152: 30 58 52 54 52 49 4d 1f 21 05 00 33 0f 19 4f 4d 0XRTRIM.!..3..OM
1879 -+| 3168: 49 54 20 4c 4f 41 44 20 45 58 54 45 4e 53 49 4f IT LOAD EXTENSIO
1880 -+| 3184: 4e 58 42 49 4e 41 52 59 1f 20 05 00 33 d3 19 4f NXBINARY. ..3..O
1881 -+| 3200: 4d 49 54 28 2c 4f 41 44 b2 04 55 85 44 54 e5 34 MIT(,OAD..U.DT.4
1882 -+| 3216: 94 f4 e5 84 e4 f4 34 15 34 51 e1 f0 50 03 30 f1 ......4.4Q..P.0.
1883 -+| 3232: 74 f4 d4 95 42 04 c4 f4 14 42 04 55 85 44 54 e5 t...B....B.U.DT.
1884 -+| 3248: 34 94 f4 e5 85 25 45 24 94 d1 f1 e0 50 03 30 f1 4....%E$....P.0.
1885 -+| 3264: 94 d4 15 82 04 d4 54 d4 f5 25 93 d3 53 03 03 03 ......T..%..S...
1886 -+| 3280: 03 03 03 05 84 24 94 e4 15 25 91 f1 d0 50 03 30 .....$...%...P.0
1887 -+| 3296: f1 94 d4 15 82 04 d4 54 d4 f5 25 93 d3 53 03 03 .......T..%..S..
1888 -+| 3312: 03 03 03 03 05 84 e4 f4 34 15 34 51 e1 c0 50 03 ........4.4Q..P.
1889 -+| 3328: 30 f1 74 d4 15 82 04 d4 54 d4 f5 25 93 d3 53 03 0.t.....T..%..S.
1890 -+| 3344: 03 03 03 03 03 05 85 25 45 24 94 d1 81 b0 50 02 .......%E$....P.
1891 -+| 3360: 50 f1 94 54 e4 14 24 c4 52 05 25 45 24 54 55 84 P..T..$.R.%E$TU.
1892 -+| 3376: 24 94 e4 15 25 91 81 a0 50 02 50 f1 94 54 e4 14 $...%...P.P..T..
1893 -+| 3392: 24 c4 52 05 25 45 24 54 55 84 e4 f4 34 15 34 51 $.R.%E$TU...4.4Q
1894 -+| 3408: 71 90 50 02 50 f1 74 54 e4 14 24 c4 52 05 25 45 q.P.P.tT..$.R.%E
1895 -+| 3424: 24 54 55 85 25 45 24 94 d1 a1 80 50 02 90 f1 94 $TU.%E$....P....
1896 -+| 3440: 54 e4 14 24 c4 52 04 d4 54 d5 35 95 33 55 84 24 T..$.R..T.5.3U.$
1897 -+| 3456: 94 e4 15 25 91 a1 70 50 02 90 f1 94 54 e4 14 24 ...%..pP....T..$
1898 -+| 3472: c4 52 04 d4 54 d5 35 95 33 55 84 e4 f4 34 15 34 .R..T.5.3U...4.4
1899 -+| 3488: 51 91 60 50 02 90 f1 74 54 e4 14 24 c4 52 04 d4 Q.`P...tT..$.R..
1900 -+| 3504: 54 d5 35 95 33 55 85 25 45 24 94 d1 81 50 50 02 T.5.3U.%E$...PP.
1901 -+| 3520: 50 f1 94 54 e4 14 24 c4 52 04 a5 34 f4 e3 15 84 P..T..$.R..4....
1902 -+| 3536: 24 94 e4 15 25 91 81 40 50 02 50 f1 94 54 e4 14 $...%..@P.P..T..
1903 -+| 3552: 24 c4 52 04 a5 34 f4 e3 15 84 e4 f4 34 15 34 51 $.R..4......4.4Q
1904 -+| 3568: 71 30 50 02 4f f1 74 54 e4 14 24 c4 52 04 a5 34 q0P.O.tT..$.R..4
1905 -+| 3584: f4 e3 15 85 25 45 24 94 d1 a1 20 50 02 90 f1 94 ....%E$... P....
1906 -+| 3600: 54 e4 14 24 c4 52 04 74 54 f5 04 f4 c5 95 84 24 T..$.R.tT......$
1907 -+| 3616: 94 e4 15 25 91 a1 10 50 02 90 f1 94 54 e4 14 24 ...%...P....T..$
1908 -+| 3632: c4 52 04 74 54 f5 04 f4 c5 95 84 e4 f4 34 15 34 .R.tT........4.4
1909 -+| 3648: 51 91 00 50 02 90 f1 74 54 e4 14 24 c4 51 f4 74 Q..P...tT..$.Q.t
1910 -+| 3664: 54 f5 04 f4 c5 95 85 25 45 24 94 d1 70 f0 50 02 T......%E$..p.P.
1911 -+| 3680: 30 f1 94 54 e4 14 24 c5 20 46 54 53 35 58 42 49 0..T..$. FTS5XBI
1912 -+| 3696: 4e 41 52 59 17 0e 05 00 23 0f 19 45 4e 41 42 4c NARY....#..ENABL
1913 -+| 3712: 45 20 46 54 53 35 58 4f 4f 43 41 53 45 16 0d 05 E FTS5XOOCASE...
1914 -+| 3728: 00 23 0f 17 45 4e 41 42 4c 45 20 46 54 53 35 58 .#..ENABLE FTS5X
1915 -+| 3744: 52 54 52 49 4d 17 0c 05 00 23 0f 19 45 4e 41 42 RTRIM....#..ENAB
1916 -+| 3760: 4c 45 20 46 54 53 34 58 42 49 4e 41 52 59 97 0b LE FTS4XBINARY..
1917 -+| 3776: 05 00 23 0f 19 45 4e 41 42 4c 45 20 46 54 53 34 ..#..ENABLE FTS4
1918 -+| 3792: 58 4e 4f 43 41 53 45 16 0a 05 00 23 0f 17 45 4e XNOCASE....#..EN
1919 -+| 3808: 41 42 4c 45 20 46 54 53 34 58 52 54 52 49 4d 1e ABLE FTS4XRTRIM.
1920 -+| 3824: 09 05 00 3e 5f 19 45 4e 41 42 4c 45 20 44 42 53 ...>_.ENABLE DBS
1921 -+| 3840: 44 41 54 20 56 54 41 42 58 42 49 4e 41 52 59 1e DAT VTABXBINARY.
1922 -+| 3856: 08 05 00 31 0f 19 45 4e 41 42 4c 45 20 44 42 53 ...1..ENABLE DBS
1923 -+| 3872: 54 41 54 20 56 54 41 42 58 4e 4f 43 4d e3 45 1d TAT VTABXNOCM.E.
1924 -+| 3888: 07 05 00 31 0f 17 45 4e 41 42 4c 45 20 44 42 53 ...1..ENABLE DBS
1925 -+| 3904: 54 41 54 20 56 54 41 42 58 52 54 52 49 4d 11 06 TAT VTABXRTRIM..
1926 -+| 3920: 05 00 17 0f 19 44 45 42 55 47 58 42 49 4e 41 52 .....DEBUGXBINAR
1927 -+| 3936: 59 11 05 05 00 17 0f 19 44 45 42 55 47 58 4e 4f Y.......DEBUGXNO
1928 -+| 3952: 43 41 53 45 10 02 02 50 08 5f 17 44 45 42 55 47 CASE...P._.DEBUG
1929 -+| 3968: 58 52 54 52 49 4d 27 03 05 00 44 0f 19 43 4f 4d XRTRIM'...D..COM
1930 -+| 3984: 50 49 4c 45 52 3d 67 63 63 2d 35 2e 34 2e 30 20 PILER=gcc-5.4.0
1931 -+| 4000: 32 30 31 36 30 36 30 39 58 42 49 4e 41 52 59 27 20160609XBINARY'
1932 -+| 4016: 02 05 00 43 0f 19 43 4f 4d 50 49 4c 45 52 3d 67 ...C..COMPILER=g
1933 -+| 4032: 63 63 2d 35 2e 34 2e 30 20 32 30 31 36 30 36 30 cc-5.4.0 2016060
1934 -+| 4048: 39 58 4e 4f 43 41 53 45 26 01 05 00 43 c9 17 43 9XNOCASE&...C..C
1935 -+| 4064: 4f 4d 50 49 4c 47 02 3d 67 63 63 2d 35 2e 34 2e OMPILG.=gcc-5.4.
1936 -+| 4080: 30 20 32 30 31 36 30 36 30 39 58 52 54 52 49 4d 0 20160609XRTRIM
1937 -+| page 6 offset 20480
1938 -+| 0: 0d 00 00 00 24 0e e0 00 0f f8 0f f0 0f e8 0f e0 ....$...........
1939 -+| 16: 0f d8 0f d0 0f c8 0f c0 0f b8 0f b0 0f a8 0f a0 ................
1940 -+| 32: 0f 98 0f 90 0f 88 0f 80 0f 78 0f 70 0f 68 0f 60 .........x.p.h.`
1941 -+| 48: 0f 58 0f 50 0f 48 0f 40 0f 38 00 00 00 00 00 00 .X.P.H.@.8......
1942 -+| 3808: 06 24 03 00 12 02 01 01 06 23 03 00 12 02 01 01 .$.......#......
1943 -+| 3824: 06 22 03 00 12 02 01 01 06 21 03 00 12 03 01 01 .........!......
1944 -+| 3840: 06 20 03 00 12 03 01 01 06 1f 03 00 12 03 01 01 . ..............
1945 -+| 3856: 06 1e 03 00 12 03 01 01 06 1d 03 00 12 03 01 01 ................
1946 -+| 3872: 06 1c 03 00 12 03 01 01 06 1b 03 00 12 02 01 01 ................
1947 -+| 3888: 06 1a 03 00 12 02 01 01 06 19 03 00 12 02 01 01 ................
1948 -+| 3904: 06 18 03 00 12 02 01 01 06 17 03 00 12 02 01 01 ................
1949 -+| 3920: 06 16 03 00 12 02 01 01 06 15 03 00 12 02 01 01 ................
1950 -+| 3936: 06 14 03 00 12 02 01 01 06 13 03 00 12 02 01 01 ................
1951 -+| 3952: 06 12 03 00 12 02 01 01 06 11 03 00 12 02 01 01 ................
1952 -+| 3968: 06 10 03 00 12 02 01 01 06 1f 03 00 12 02 01 01 ................
1953 -+| 3984: 06 0e 03 00 12 02 01 01 06 0d 03 00 12 02 01 01 ................
1954 -+| 4000: 06 0c 03 00 12 02 01 01 06 0b 03 00 12 02 01 01 ................
1955 -+| 4016: 06 0a 03 00 12 02 01 01 06 09 03 00 12 03 01 01 ................
1956 -+| 4032: 06 08 03 00 12 03 01 01 06 07 03 00 12 03 01 01 ................
1957 -+| 4048: 06 06 03 00 12 01 01 01 06 05 03 00 12 01 01 01 ................
1958 -+| 4064: 06 04 03 00 12 01 01 01 06 03 03 00 12 06 01 01 ................
1959 -+| 4080: 06 02 03 00 12 06 01 01 06 01 03 00 12 06 01 01 ................
1960 -+| page 7 offset 24576
1961 -+| 0: 0a 00 00 00 01 0f f4 00 0f f4 00 00 00 00 00 00 ................
1962 -+| 4080: 00 00 00 00 0b 03 1b 01 76 65 72 73 69 6f 6e 04 ........version.
1963 -+| page 8 offset 28672
1964 -+| 0: 0d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
1965 -+| 4048: 00 00 00 00 00 00 11 03 02 2b 69 6e 74 65 67 72 .........+integr
1966 -+| 4064: 69 74 79 2d 63 68 65 63 6b 09 00 00 00 00 00 00 ity-check.......
1967 -+| end crash-31c462b8b665d0.db
1968 -+}]} {}
1969 -+
1970 -+
1971 -+do_catchsql_test 69.2 {
1972 -+ SELECT * FROM t1 WHERE a MATCH 'fx*'
1973 -+} {1 {database disk image is malformed}}
1974 -
1975 - sqlite3_fts5_may_be_corrupt 0
1976 - finish_test
1977 ---- /src/btree.c
1978 -+++ /src/btree.c
1979 -@@ -3886,7 +3886,7 @@
1980 - Pgno nFree = get4byte(&pBt->pPage1->aData[36]);
1981 - Pgno nFin = finalDbSize(pBt, nOrig, nFree);
1982 -
1983 -- if( nOrig<nFin ){
1984 -+ if( nOrig<nFin || nFree>=nOrig ){
1985 - rc = SQLITE_CORRUPT_BKPT;
1986 - }else if( nFree>0 ){
1987 - rc = saveAllCursors(pBt, 0, 0);
1988 -@@ -8772,7 +8772,11 @@
1989 - assert( pPage->intKey || pX->nKey>=0 );
1990 - assert( pPage->leaf || !pPage->intKey );
1991 - if( pPage->nFree<0 ){
1992 -- rc = btreeComputeFreeSpace(pPage);
1993 -+ if( pCur->eState>CURSOR_INVALID ){
1994 -+ rc = SQLITE_CORRUPT_BKPT;
1995 -+ }else{
1996 -+ rc = btreeComputeFreeSpace(pPage);
1997 -+ }
1998 - if( rc ) return rc;
1999 - }
2000 -
2001 ---- /test/corruptL.test
2002 -+++ /test/corruptL.test
2003 -@@ -1266,5 +1266,30 @@
2004 - do_execsql_test 15.1 {
2005 - UPDATE c1 SET c= NOT EXISTS(SELECT 1 FROM c1 ORDER BY (SELECT 1 FROM c1 ORDER BY a)) +10 WHERE d BETWEEN 4 AND 7;
2006 - } {}
2007 -+
2008 -+#-------------------------------------------------------------------------
2009 -+reset_db
2010 -+do_execsql_test 16.0 {
2011 -+ CREATE TABLE t1(w, x, y, z, UNIQUE(w, x), UNIQUE(y, z));
2012 -+ INSERT INTO t1 VALUES(1, 1, 1, 1);
2013 -+
2014 -+ CREATE TABLE t1idx(x, y, i INTEGER, PRIMARY KEY(x)) WITHOUT ROWID;
2015 -+ INSERT INTO t1idx VALUES(10, NULL, 5);
2016 -+
2017 -+ PRAGMA writable_schema = 1;
2018 -+ UPDATE sqlite_master SET rootpage = (
2019 -+ SELECT rootpage FROM sqlite_master WHERE name='t1idx'
2020 -+ ) WHERE type = 'index';
2021 -+}
2022 -+
2023 -+db close
2024 -+sqlite3 db test.db
2025 -+
2026 -+do_catchsql_test 16.1 {
2027 -+ PRAGMA writable_schema = ON;
2028 -+ INSERT INTO t1(rowid, w, x, y, z) VALUES(5, 10, 11, 10, NULL);
2029 -+} {1 {database disk image is malformed}}
2030 -+
2031 - finish_test
2032 -
2033 -+
2034
2035 diff --git a/dev-db/sqlite/files/sqlite-3.32.3-backports_3.patch b/dev-db/sqlite/files/sqlite-3.32.3-backports_3.patch
2036 deleted file mode 100644
2037 index 07cb5d4a396..00000000000
2038 --- a/dev-db/sqlite/files/sqlite-3.32.3-backports_3.patch
2039 +++ /dev/null
2040 @@ -1,220 +0,0 @@
2041 -https://sqlite.org/src/info/14eed318aa9e6e16
2042 -https://sqlite.org/src/info/9679c0c61131f0e9
2043 -https://sqlite.org/src/info/28515bbbae4fbc26
2044 -https://sqlite.org/src/info/892e9191dc8f8056
2045 -https://sqlite.org/src/info/270ac1a0f232d755
2046 -
2047 ---- /ext/fts3/fts3.c
2048 -+++ /ext/fts3/fts3.c
2049 -@@ -5831,7 +5831,8 @@
2050 - fts3EvalRestart(pCsr, pRoot, &rc);
2051 - do {
2052 - fts3EvalNextRow(pCsr, pRoot, &rc);
2053 -- assert( pRoot->bEof==0 );
2054 -+ assert_fts3_nc( pRoot->bEof==0 );
2055 -+ if( pRoot->bEof ) rc = FTS_CORRUPT_VTAB;
2056 - }while( pRoot->iDocid!=iDocid && rc==SQLITE_OK );
2057 - }
2058 - }
2059 ---- /ext/misc/appendvfs.c
2060 -+++ /ext/misc/appendvfs.c
2061 -@@ -439,7 +439,7 @@
2062 - p = (ApndFile*)pFile;
2063 - memset(p, 0, sizeof(*p));
2064 - pSubFile = ORIGFILE(pFile);
2065 -- p->base.pMethods = &apnd_io_methods;
2066 -+ pFile->pMethods = &apnd_io_methods;
2067 - rc = pSubVfs->xOpen(pSubVfs, zName, pSubFile, flags, pOutFlags);
2068 - if( rc ) goto apnd_open_done;
2069 - rc = pSubFile->pMethods->xFileSize(pSubFile, &sz);
2070 ---- /ext/misc/cksumvfs.c
2071 -+++ /ext/misc/cksumvfs.c
2072 -@@ -634,7 +634,7 @@
2073 - p = (CksmFile*)pFile;
2074 - memset(p, 0, sizeof(*p));
2075 - pSubFile = ORIGFILE(pFile);
2076 -- p->base.pMethods = &cksm_io_methods;
2077 -+ pFile->pMethods = &cksm_io_methods;
2078 - rc = pSubVfs->xOpen(pSubVfs, zName, pSubFile, flags, pOutFlags);
2079 - if( rc ) goto cksm_open_done;
2080 - if( flags & SQLITE_OPEN_WAL ){
2081 ---- /src/date.c
2082 -+++ /src/date.c
2083 -@@ -1112,8 +1112,8 @@
2084 - case 'm': sqlite3_snprintf(3, &z[j],"%02d",x.M); j+=2; break;
2085 - case 'M': sqlite3_snprintf(3, &z[j],"%02d",x.m); j+=2; break;
2086 - case 's': {
2087 -- sqlite3_snprintf(30,&z[j],"%lld",
2088 -- (i64)(x.iJD/1000 - 21086676*(i64)10000));
2089 -+ i64 iS = (i64)(x.iJD/1000 - 21086676*(i64)10000);
2090 -+ sqlite3Int64ToText(iS, &z[j]);
2091 - j += sqlite3Strlen30(&z[j]);
2092 - break;
2093 - }
2094 ---- /src/memdb.c
2095 -+++ /src/memdb.c
2096 -@@ -339,7 +339,7 @@
2097 - p->mFlags = SQLITE_DESERIALIZE_RESIZEABLE | SQLITE_DESERIALIZE_FREEONCLOSE;
2098 - assert( pOutFlags!=0 ); /* True because flags==SQLITE_OPEN_MAIN_DB */
2099 - *pOutFlags = flags | SQLITE_OPEN_MEMORY;
2100 -- p->base.pMethods = &memdb_io_methods;
2101 -+ pFile->pMethods = &memdb_io_methods;
2102 - p->szMax = sqlite3GlobalConfig.mxMemdbSize;
2103 - return SQLITE_OK;
2104 - }
2105 ---- /src/memjournal.c
2106 -+++ /src/memjournal.c
2107 -@@ -366,7 +366,7 @@
2108 - assert( MEMJOURNAL_DFLT_FILECHUNKSIZE==fileChunkSize(p->nChunkSize) );
2109 - }
2110 -
2111 -- p->pMethod = (const sqlite3_io_methods*)&MemJournalMethods;
2112 -+ pJfd->pMethods = (const sqlite3_io_methods*)&MemJournalMethods;
2113 - p->nSpill = nSpill;
2114 - p->flags = flags;
2115 - p->zJournal = zName;
2116 -@@ -392,7 +392,7 @@
2117 - int sqlite3JournalCreate(sqlite3_file *pJfd){
2118 - int rc = SQLITE_OK;
2119 - MemJournal *p = (MemJournal*)pJfd;
2120 -- if( p->pMethod==&MemJournalMethods && (
2121 -+ if( pJfd->pMethods==&MemJournalMethods && (
2122 - #ifdef SQLITE_ENABLE_ATOMIC_WRITE
2123 - p->nSpill>0
2124 - #else
2125 ---- /src/os_unix.c
2126 -+++ /src/os_unix.c
2127 -@@ -5689,7 +5689,7 @@
2128 - if( rc!=SQLITE_OK ){
2129 - if( h>=0 ) robust_close(pNew, h, __LINE__);
2130 - }else{
2131 -- pNew->pMethod = pLockingStyle;
2132 -+ pId->pMethods = pLockingStyle;
2133 - OpenCounter(+1);
2134 - verifyDbFile(pNew);
2135 - }
2136 ---- /src/os_win.c
2137 -+++ /src/os_win.c
2138 -@@ -5266,7 +5266,7 @@
2139 - }
2140 -
2141 - sqlite3_free(zTmpname);
2142 -- pFile->pMethod = pAppData ? pAppData->pMethod : &winIoMethod;
2143 -+ id->pMethods = pAppData ? pAppData->pMethod : &winIoMethod;
2144 - pFile->pVfs = pVfs;
2145 - pFile->h = h;
2146 - if( isReadonly ){
2147 ---- /src/sqliteInt.h
2148 -+++ /src/sqliteInt.h
2149 -@@ -4437,6 +4437,7 @@
2150 - int sqlite3FixExprList(DbFixer*, ExprList*);
2151 - int sqlite3FixTriggerStep(DbFixer*, TriggerStep*);
2152 - int sqlite3RealSameAsInt(double,sqlite3_int64);
2153 -+void sqlite3Int64ToText(i64,char*);
2154 - int sqlite3AtoF(const char *z, double*, int, u8);
2155 - int sqlite3GetInt32(const char *, int*);
2156 - int sqlite3Atoi(const char*);
2157 ---- /src/test_multiplex.c
2158 -+++ /src/test_multiplex.c
2159 -@@ -591,9 +591,9 @@
2160 -
2161 - if( rc==SQLITE_OK ){
2162 - if( pSubOpen->pMethods->iVersion==1 ){
2163 -- pMultiplexOpen->base.pMethods = &gMultiplex.sIoMethodsV1;
2164 -+ pConn->pMethods = &gMultiplex.sIoMethodsV1;
2165 - }else{
2166 -- pMultiplexOpen->base.pMethods = &gMultiplex.sIoMethodsV2;
2167 -+ pConn->pMethods = &gMultiplex.sIoMethodsV2;
2168 - }
2169 - }else{
2170 - multiplexFreeComponents(pGroup);
2171 ---- /src/util.c
2172 -+++ /src/util.c
2173 -@@ -596,6 +596,30 @@
2174 - #endif
2175 -
2176 - /*
2177 -+** Render an signed 64-bit integer as text. Store the result in zOut[].
2178 -+**
2179 -+** The caller must ensure that zOut[] is at least 21 bytes in size.
2180 -+*/
2181 -+void sqlite3Int64ToText(i64 v, char *zOut){
2182 -+ int i;
2183 -+ u64 x;
2184 -+ char zTemp[22];
2185 -+ if( v<0 ){
2186 -+ x = (v==SMALLEST_INT64) ? ((u64)1)<<63 : -v;
2187 -+ }else{
2188 -+ x = v;
2189 -+ }
2190 -+ i = sizeof(zTemp)-2;
2191 -+ zTemp[sizeof(zTemp)-1] = 0;
2192 -+ do{
2193 -+ zTemp[i--] = (x%10) + '0';
2194 -+ x = x/10;
2195 -+ }while( x );
2196 -+ if( v<0 ) zTemp[i--] = '-';
2197 -+ memcpy(zOut, &zTemp[i+1], sizeof(zTemp)-1-i);
2198 -+}
2199 -+
2200 -+/*
2201 - ** Compare the 19-character string zNum against the text representation
2202 - ** value 2^63: 9223372036854775808. Return negative, zero, or positive
2203 - ** if zNum is less than, equal to, or greater than the string.
2204 ---- /src/vdbemem.c
2205 -+++ /src/vdbemem.c
2206 -@@ -104,16 +104,25 @@
2207 - static void vdbeMemRenderNum(int sz, char *zBuf, Mem *p){
2208 - StrAccum acc;
2209 - assert( p->flags & (MEM_Int|MEM_Real|MEM_IntReal) );
2210 -- sqlite3StrAccumInit(&acc, 0, zBuf, sz, 0);
2211 -+ assert( sz>22 );
2212 - if( p->flags & MEM_Int ){
2213 -- sqlite3_str_appendf(&acc, "%lld", p->u.i);
2214 -- }else if( p->flags & MEM_IntReal ){
2215 -- sqlite3_str_appendf(&acc, "%!.15g", (double)p->u.i);
2216 -+#if GCC_VERSION>=7000000
2217 -+ /* Work-around for GCC bug
2218 -+ ** https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96270 */
2219 -+ i64 x;
2220 -+ assert( (p->flags&MEM_Int)*2==sizeof(x) );
2221 -+ memcpy(&x, (char*)&p->u, (p->flags&MEM_Int)*2);
2222 -+ sqlite3Int64ToText(x, zBuf);
2223 -+#else
2224 -+ sqlite3Int64ToText(p->u.i, zBuf);
2225 -+#endif
2226 - }else{
2227 -- sqlite3_str_appendf(&acc, "%!.15g", p->u.r);
2228 -+ sqlite3StrAccumInit(&acc, 0, zBuf, sz, 0);
2229 -+ sqlite3_str_appendf(&acc, "%!.15g",
2230 -+ (p->flags & MEM_IntReal)!=0 ? (double)p->u.i : p->u.r);
2231 -+ assert( acc.zText==zBuf && acc.mxAlloc<=0 );
2232 -+ zBuf[acc.nChar] = 0; /* Fast version of sqlite3StrAccumFinish(&acc) */
2233 - }
2234 -- assert( acc.zText==zBuf && acc.mxAlloc<=0 );
2235 -- zBuf[acc.nChar] = 0; /* Fast version of sqlite3StrAccumFinish(&acc) */
2236 - }
2237 -
2238 - #ifdef SQLITE_DEBUG
2239 ---- /test/fts3corrupt4.test
2240 -+++ /test/fts3corrupt4.test
2241 -@@ -6282,4 +6282,19 @@
2242 -
2243 - set sqlite_fts3_enable_parentheses $saved
2244 -
2245 -+#-------------------------------------------------------------------------
2246 -+reset_db
2247 -+do_execsql_test 47.1 {
2248 -+ CREATE VIRTUAL TABLE t1 USING fts3(a,b,c);
2249 -+}
2250 -+do_execsql_test 47.2 {
2251 -+ INSERT INTO t1_segdir VALUES(0,0,0,0,0,X'000130120106000106000106001f030001030001030000083230313630363039090107000107000107000001340901050001050001050000013509010400010400010400010730303030303030091c0400010400010400000662696e6172793c0301020200030102020003010202000301020200030102020003010202000301020200030102020003010202000301020200030102020003010202000008636f6d70696c657209010200010200010200000664627374617409070300010300010300010465627567090402000102000102000006656e61626c653f07020001020001020001020001020001020001020001020001020001020001020001020001010001020001020001020001020001020001020001020001020001087874656e73696f6e091f0400010400010400000466747334090a0300010300010300030135090d03000103000103000003676363090103000103000103000106656f706f6c790910030001030001030000056a736f6e310913030001030001030000046c6f6164091f030001030001030000036d6178091c02000102000102000105656d6f7279091c03000103000103000304737973350916030001030001030000066e6f636173653c020102020003010202000301020200030102020003010
2252 20200030102020003010202000301020200030102020003010202000301020200030102020000046f6d6974091f020001020001020000057274726565091903000103000103000302696d3c01010202000301020200030102020003010202000301020200030102020003010202000301a202000301020200030102020003010202000301020200000a746872656164736166650922020001020001020000047674616209070400010400010400000178b401010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200');
2253 -+ INSERT INTO t1_segdir VALUES(0,1,0,0,0,X'0001300425061b000008323031363036303903250700000134032505000001350325040001073030303030303003251a000008636f6d70696c657203250200000664627374617403250a00010465627567032508000006656e61626c650925090504040404040001087874656e73696f6e03251d0000046674733403250d0003013503250f000003676363032503000106656f706f6c790325110000056a736f6e310325130000046c6f616403251c0000036d6178032518000105656d6f7279032519000304737973350325150000046f6d697403251b000005727472656503251700000a7468726561647361666503251e0000047674616333250b00');
2254 -+}
2255 -+
2256 -+do_catchsql_test 47.3 {
2257 -+ SELECT matchinfo(t1) FROM t1 WHERE t1 MATCH '"json1 enable"';
2258 -+} {1 {database disk image is malformed}}
2259 -+
2260 -+
2261 - finish_test
2262
2263 diff --git a/dev-db/sqlite/sqlite-3.32.3-r1.ebuild b/dev-db/sqlite/sqlite-3.32.3-r1.ebuild
2264 deleted file mode 100644
2265 index 2b9d4a13482..00000000000
2266 --- a/dev-db/sqlite/sqlite-3.32.3-r1.ebuild
2267 +++ /dev/null
2268 @@ -1,339 +0,0 @@
2269 -# Copyright 1999-2020 Gentoo Authors
2270 -# Distributed under the terms of the GNU General Public License v2
2271 -
2272 -EAPI="7"
2273 -
2274 -inherit autotools flag-o-matic multilib-minimal toolchain-funcs
2275 -
2276 -if [[ "${PV}" != "9999" ]]; then
2277 - SRC_PV="$(printf "%u%02u%02u%02u" $(ver_rs 1- " "))"
2278 - DOC_PV="${SRC_PV}"
2279 - # DOC_PV="$(printf "%u%02u%02u00" $(ver_rs 1-3 " "))"
2280 -fi
2281 -
2282 -DESCRIPTION="SQL database engine"
2283 -HOMEPAGE="https://sqlite.org/"
2284 -if [[ "${PV}" == "9999" ]]; then
2285 - SRC_URI=""
2286 -else
2287 - SRC_URI="https://sqlite.org/2020/${PN}-src-${SRC_PV}.zip
2288 - doc? ( https://sqlite.org/2020/${PN}-doc-${DOC_PV}.zip )"
2289 -fi
2290 -
2291 -LICENSE="public-domain"
2292 -SLOT="3"
2293 -KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
2294 -IUSE="debug doc icu +readline secure-delete static-libs tcl test tools"
2295 -if [[ "${PV}" == "9999" ]]; then
2296 - PROPERTIES="live"
2297 -fi
2298 -RESTRICT="!test? ( test )"
2299 -
2300 -if [[ "${PV}" == "9999" ]]; then
2301 - BDEPEND=">=dev-lang/tcl-8.6:0
2302 - dev-vcs/fossil"
2303 -else
2304 - BDEPEND="app-arch/unzip
2305 - >=dev-lang/tcl-8.6:0"
2306 -fi
2307 -RDEPEND="sys-libs/zlib:0=[${MULTILIB_USEDEP}]
2308 - icu? ( dev-libs/icu:0=[${MULTILIB_USEDEP}] )
2309 - readline? ( sys-libs/readline:0=[${MULTILIB_USEDEP}] )
2310 - tcl? ( dev-lang/tcl:0=[${MULTILIB_USEDEP}] )
2311 - tools? ( dev-lang/tcl:0=[${MULTILIB_USEDEP}] )"
2312 -DEPEND="${RDEPEND}
2313 - test? ( >=dev-lang/tcl-8.6:0[${MULTILIB_USEDEP}] )"
2314 -
2315 -if [[ "${PV}" == "9999" ]]; then
2316 - S="${WORKDIR}/${PN}"
2317 -else
2318 - S="${WORKDIR}/${PN}-src-${SRC_PV}"
2319 -fi
2320 -
2321 -src_unpack() {
2322 - if [[ "${PV}" == "9999" ]]; then
2323 - local distdir="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}"
2324 - addwrite "${distdir}"
2325 - mkdir -p "${distdir}/fossil-src/${PN}" || die
2326 -
2327 - mkdir "${WORKDIR}/${PN}" || die
2328 - pushd "${WORKDIR}/${PN}" > /dev/null || die
2329 - if [[ ! -f "${distdir}/fossil-src/${PN}/sqlite.fossil" ]]; then
2330 - einfo fossil clone --verbose https://sqlite.org/src sqlite.fossil
2331 - fossil clone --verbose https://sqlite.org/src sqlite.fossil || die
2332 - echo
2333 - else
2334 - cp -p "${distdir}/fossil-src/${PN}/sqlite.fossil" . || die
2335 - einfo fossil pull --repository sqlite.fossil --verbose https://sqlite.org/src
2336 - fossil pull --repository sqlite.fossil --verbose https://sqlite.org/src || die
2337 - echo
2338 - fi
2339 - cp -p sqlite.fossil "${distdir}/fossil-src/${PN}" || die
2340 - einfo fossil open --quiet sqlite.fossil
2341 - fossil open --quiet sqlite.fossil || die
2342 - echo
2343 - popd > /dev/null || die
2344 -
2345 - if use doc; then
2346 - mkdir "${WORKDIR}/${PN}-doc" || die
2347 - pushd "${WORKDIR}/${PN}-doc" > /dev/null || die
2348 - if [[ ! -f "${distdir}/fossil-src/${PN}/sqlite-doc.fossil" ]]; then
2349 - einfo fossil clone --verbose https://sqlite.org/docsrc sqlite-doc.fossil
2350 - fossil clone --verbose https://sqlite.org/docsrc sqlite-doc.fossil || die
2351 - echo
2352 - else
2353 - cp -p "${distdir}/fossil-src/${PN}/sqlite-doc.fossil" . || die
2354 - einfo fossil pull --repository sqlite-doc.fossil --verbose https://sqlite.org/docsrc
2355 - fossil pull --repository sqlite-doc.fossil --verbose https://sqlite.org/docsrc || die
2356 - echo
2357 - fi
2358 - cp -p sqlite-doc.fossil "${distdir}/fossil-src/${PN}" || die
2359 - einfo fossil open --quiet sqlite-doc.fossil
2360 - fossil open --quiet sqlite-doc.fossil || die
2361 - echo
2362 - popd > /dev/null || die
2363 - fi
2364 - else
2365 - default
2366 - fi
2367 -}
2368 -
2369 -src_prepare() {
2370 - eapply "${FILESDIR}/"${PN}-3.32.1-full_archive-build_{1,2}.patch
2371 - eapply "${FILESDIR}/"${PN}-3.32.3-backports_{1,2,3}.patch
2372 -
2373 - eapply_user
2374 -
2375 - # Fix AC_CHECK_FUNCS.
2376 - # https://mailinglists.sqlite.org/cgi-bin/mailman/private/sqlite-dev/2016-March/002762.html
2377 - sed -e "s/AC_CHECK_FUNCS(.*)/AC_CHECK_FUNCS([fdatasync fullfsync gmtime_r isnan localtime_r localtime_s malloc_usable_size posix_fallocate pread pread64 pwrite pwrite64 strchrnul usleep utime])/" -i configure.ac || die "sed failed"
2378 -
2379 - eautoreconf
2380 -
2381 - multilib_copy_sources
2382 -}
2383 -
2384 -multilib_src_configure() {
2385 - local -x CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}"
2386 - local options=()
2387 -
2388 - options+=(
2389 - --enable-load-extension
2390 - --enable-threadsafe
2391 - )
2392 -
2393 - # Support detection of misuse of SQLite API.
2394 - # https://sqlite.org/compile.html#enable_api_armor
2395 - append-cppflags -DSQLITE_ENABLE_API_ARMOR
2396 -
2397 - # Support bytecode and tables_used virtual tables.
2398 - # https://sqlite.org/bytecodevtab.html
2399 - append-cppflags -DSQLITE_ENABLE_BYTECODE_VTAB
2400 -
2401 - # Support column metadata functions.
2402 - # https://sqlite.org/c3ref/column_database_name.html
2403 - append-cppflags -DSQLITE_ENABLE_COLUMN_METADATA
2404 -
2405 - # Support sqlite_dbpage virtual table.
2406 - # https://sqlite.org/dbpage.html
2407 - append-cppflags -DSQLITE_ENABLE_DBPAGE_VTAB
2408 -
2409 - # Support dbstat virtual table.
2410 - # https://sqlite.org/dbstat.html
2411 - append-cppflags -DSQLITE_ENABLE_DBSTAT_VTAB
2412 -
2413 - # Support sqlite3_serialize() and sqlite3_deserialize() functions.
2414 - # https://sqlite.org/c3ref/serialize.html
2415 - # https://sqlite.org/c3ref/deserialize.html
2416 - append-cppflags -DSQLITE_ENABLE_DESERIALIZE
2417 -
2418 - # Support comments in output of EXPLAIN.
2419 - # https://sqlite.org/compile.html#enable_explain_comments
2420 - append-cppflags -DSQLITE_ENABLE_EXPLAIN_COMMENTS
2421 -
2422 - # Support Full-Text Search versions 3, 4 and 5.
2423 - # https://sqlite.org/fts3.html
2424 - # https://sqlite.org/fts5.html
2425 - append-cppflags -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4
2426 - options+=(--enable-fts5)
2427 -
2428 - # Support hidden columns.
2429 - append-cppflags -DSQLITE_ENABLE_HIDDEN_COLUMNS
2430 -
2431 - # Support JSON1 extension.
2432 - # https://sqlite.org/json1.html
2433 - append-cppflags -DSQLITE_ENABLE_JSON1
2434 -
2435 - # Support memsys5 memory allocator.
2436 - # https://sqlite.org/malloc.html#memsys5
2437 - append-cppflags -DSQLITE_ENABLE_MEMSYS5
2438 -
2439 - # Support sqlite3_normalized_sql() function.
2440 - # https://sqlite.org/c3ref/expanded_sql.html
2441 - append-cppflags -DSQLITE_ENABLE_NORMALIZE
2442 -
2443 - # Support sqlite_offset() function.
2444 - # https://sqlite.org/lang_corefunc.html#sqlite_offset
2445 - append-cppflags -DSQLITE_ENABLE_OFFSET_SQL_FUNC
2446 -
2447 - # Support pre-update hook functions.
2448 - # https://sqlite.org/c3ref/preupdate_count.html
2449 - append-cppflags -DSQLITE_ENABLE_PREUPDATE_HOOK
2450 -
2451 - # Support Resumable Bulk Update extension.
2452 - # https://sqlite.org/rbu.html
2453 - append-cppflags -DSQLITE_ENABLE_RBU
2454 -
2455 - # Support R*Trees.
2456 - # https://sqlite.org/rtree.html
2457 - # https://sqlite.org/geopoly.html
2458 - append-cppflags -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY
2459 -
2460 - # Support scan status functions.
2461 - # https://sqlite.org/c3ref/stmt_scanstatus.html
2462 - # https://sqlite.org/c3ref/stmt_scanstatus_reset.html
2463 - append-cppflags -DSQLITE_ENABLE_STMT_SCANSTATUS
2464 -
2465 - # Support sqlite_stmt virtual table.
2466 - # https://sqlite.org/stmt.html
2467 - append-cppflags -DSQLITE_ENABLE_STMTVTAB
2468 -
2469 - # Support Session extension.
2470 - # https://sqlite.org/sessionintro.html
2471 - options+=(--enable-session)
2472 -
2473 - # Support unknown() function.
2474 - # https://sqlite.org/compile.html#enable_unknown_sql_function
2475 - append-cppflags -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
2476 -
2477 - # Support unlock notification.
2478 - # https://sqlite.org/unlock_notify.html
2479 - append-cppflags -DSQLITE_ENABLE_UNLOCK_NOTIFY
2480 -
2481 - # Support LIMIT and ORDER BY clauses on DELETE and UPDATE statements.
2482 - # https://sqlite.org/lang_delete.html#optional_limit_and_order_by_clauses
2483 - # https://sqlite.org/lang_update.html#optional_limit_and_order_by_clauses
2484 - append-cppflags -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT
2485 -
2486 - # Support soundex() function.
2487 - # https://sqlite.org/lang_corefunc.html#soundex
2488 - append-cppflags -DSQLITE_SOUNDEX
2489 -
2490 - # Support URI filenames.
2491 - # https://sqlite.org/uri.html
2492 - append-cppflags -DSQLITE_USE_URI
2493 -
2494 - # debug USE flag.
2495 - options+=($(use_enable debug))
2496 -
2497 - # icu USE flag.
2498 - if use icu; then
2499 - # Support ICU extension.
2500 - # https://sqlite.org/compile.html#enable_icu
2501 - append-cppflags -DSQLITE_ENABLE_ICU
2502 - sed -e "s/^TLIBS = @LIBS@/& -licui18n -licuuc/" -i Makefile.in || die "sed failed"
2503 - fi
2504 -
2505 - # readline USE flag.
2506 - options+=(
2507 - --disable-editline
2508 - $(use_enable readline)
2509 - )
2510 - if use readline; then
2511 - options+=(--with-readline-inc="-I${ESYSROOT}/usr/include/readline")
2512 - fi
2513 -
2514 - # secure-delete USE flag.
2515 - if use secure-delete; then
2516 - # Enable secure_delete pragma by default.
2517 - # https://sqlite.org/pragma.html#pragma_secure_delete
2518 - append-cppflags -DSQLITE_SECURE_DELETE
2519 - fi
2520 -
2521 - # static-libs USE flag.
2522 - options+=($(use_enable static-libs static))
2523 -
2524 - # tcl, test, tools USE flags.
2525 - options+=(--enable-tcl)
2526 -
2527 - if [[ "${CHOST}" == *-mint* ]]; then
2528 - append-cppflags -DSQLITE_OMIT_WAL
2529 - fi
2530 -
2531 - if [[ "${ABI}" == "x86" ]]; then
2532 - if $(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P -dM - < /dev/null 2> /dev/null | grep -q "^#define __SSE__ 1$"; then
2533 - append-cflags -mfpmath=sse
2534 - else
2535 - append-cflags -ffloat-store
2536 - fi
2537 - fi
2538 -
2539 - econf "${options[@]}"
2540 -}
2541 -
2542 -multilib_src_compile() {
2543 - emake HAVE_TCL="$(usex tcl 1 "")" TCLLIBDIR="${EPREFIX}/usr/$(get_libdir)/${P}"
2544 -
2545 - if use tools && multilib_is_native_abi; then
2546 - emake changeset dbdump dbhash dbtotxt index_usage rbu scrub showdb showjournal showshm showstat4 showwal sqldiff sqlite3_analyzer sqlite3_checker sqlite3_expert sqltclsh
2547 - fi
2548 -}
2549 -
2550 -multilib_src_test() {
2551 - if [[ "${EUID}" -eq 0 ]]; then
2552 - ewarn "Skipping tests due to root permissions"
2553 - return
2554 - fi
2555 -
2556 - local -x SQLITE_HISTORY="${T}/sqlite_history_${ABI}"
2557 -
2558 - emake HAVE_TCL="$(usex tcl 1 "")" $(use debug && echo fulltest || echo test)
2559 -}
2560 -
2561 -multilib_src_install() {
2562 - emake DESTDIR="${D}" HAVE_TCL="$(usex tcl 1 "")" TCLLIBDIR="${EPREFIX}/usr/$(get_libdir)/${P}" install
2563 -
2564 - if use tools && multilib_is_native_abi; then
2565 - install_tool() {
2566 - if [[ -f ".libs/${1}" ]]; then
2567 - newbin ".libs/${1}" "${2}"
2568 - else
2569 - newbin "${1}" "${2}"
2570 - fi
2571 - }
2572 -
2573 - install_tool changeset sqlite3-changeset
2574 - install_tool dbdump sqlite3-db-dump
2575 - install_tool dbhash sqlite3-db-hash
2576 - install_tool dbtotxt sqlite3-db-to-txt
2577 - install_tool index_usage sqlite3-index-usage
2578 - install_tool rbu sqlite3-rbu
2579 - install_tool scrub sqlite3-scrub
2580 - install_tool showdb sqlite3-show-db
2581 - install_tool showjournal sqlite3-show-journal
2582 - install_tool showshm sqlite3-show-shm
2583 - install_tool showstat4 sqlite3-show-stat4
2584 - install_tool showwal sqlite3-show-wal
2585 - install_tool sqldiff sqlite3-diff
2586 - install_tool sqlite3_analyzer sqlite3-analyzer
2587 - install_tool sqlite3_checker sqlite3-checker
2588 - install_tool sqlite3_expert sqlite3-expert
2589 - install_tool sqltclsh sqlite3-tclsh
2590 -
2591 - unset -f install_tool
2592 - fi
2593 -}
2594 -
2595 -multilib_src_install_all() {
2596 - find "${D}" -name "*.la" -type f -delete || die
2597 -
2598 - doman sqlite3.1
2599 -
2600 - if use doc; then
2601 - rm "${WORKDIR}/${PN}-doc-${DOC_PV}/"*.{db,txt} || die
2602 - (
2603 - docinto html
2604 - dodoc -r "${WORKDIR}/${PN}-doc-${DOC_PV}/"*
2605 - )
2606 - fi
2607 -}