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/files/
Date: Mon, 30 Apr 2018 15:58:31
Message-Id: 1525102786.21b024cfc0d3b573f6cae50b1ac047eddcbc09aa.floppym@gentoo
1 commit: 21b024cfc0d3b573f6cae50b1ac047eddcbc09aa
2 Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
3 AuthorDate: Mon Apr 30 13:41:36 2018 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Mon Apr 30 15:39:46 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=21b024cf
7
8 dev-db/sqlite: Fix test fts3expr4-1.8 with C / POSIX locale (LC_MESSAGES).
9
10 Closes: https://bugs.gentoo.org/610666
11
12 .../files/sqlite-3.23.1-full_archive-tests.patch | 197 +++++++++++++++++++++
13 1 file changed, 197 insertions(+)
14
15 diff --git a/dev-db/sqlite/files/sqlite-3.23.1-full_archive-tests.patch b/dev-db/sqlite/files/sqlite-3.23.1-full_archive-tests.patch
16 index 7237fbfc0f3..ef813f67e74 100644
17 --- a/dev-db/sqlite/files/sqlite-3.23.1-full_archive-tests.patch
18 +++ b/dev-db/sqlite/files/sqlite-3.23.1-full_archive-tests.patch
19 @@ -1,5 +1,202 @@
20 https://sqlite.org/src/info/893e6089c875e947
21 +https://sqlite.org/src/info/576a8f69ae25883f
22 +https://sqlite.org/src/info/de508e831a43f02c
23
24 +--- /ext/fts3/fts3.c
25 ++++ /ext/fts3/fts3.c
26 +@@ -3963,7 +3963,7 @@
27 +
28 + #ifdef SQLITE_TEST
29 + if( rc==SQLITE_OK ){
30 +- rc = sqlite3Fts3ExprInitTestInterface(db);
31 ++ rc = sqlite3Fts3ExprInitTestInterface(db, pHash);
32 + }
33 + #endif
34 +
35 +--- /ext/fts3/fts3Int.h
36 ++++ /ext/fts3/fts3Int.h
37 +@@ -584,7 +584,7 @@
38 + );
39 + void sqlite3Fts3ExprFree(Fts3Expr *);
40 + #ifdef SQLITE_TEST
41 +-int sqlite3Fts3ExprInitTestInterface(sqlite3 *db);
42 ++int sqlite3Fts3ExprInitTestInterface(sqlite3 *db, Fts3Hash*);
43 + int sqlite3Fts3InitTerm(sqlite3 *db);
44 + #endif
45 +
46 +--- /ext/fts3/fts3_expr.c
47 ++++ /ext/fts3/fts3_expr.c
48 +@@ -1109,34 +1109,6 @@
49 + #include <stdio.h>
50 +
51 + /*
52 +-** Function to query the hash-table of tokenizers (see README.tokenizers).
53 +-*/
54 +-static int queryTestTokenizer(
55 +- sqlite3 *db,
56 +- const char *zName,
57 +- const sqlite3_tokenizer_module **pp
58 +-){
59 +- int rc;
60 +- sqlite3_stmt *pStmt;
61 +- const char zSql[] = "SELECT fts3_tokenizer(?)";
62 +-
63 +- *pp = 0;
64 +- rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
65 +- if( rc!=SQLITE_OK ){
66 +- return rc;
67 +- }
68 +-
69 +- sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC);
70 +- if( SQLITE_ROW==sqlite3_step(pStmt) ){
71 +- if( sqlite3_column_type(pStmt, 0)==SQLITE_BLOB ){
72 +- memcpy((void *)pp, sqlite3_column_blob(pStmt, 0), sizeof(*pp));
73 +- }
74 +- }
75 +-
76 +- return sqlite3_finalize(pStmt);
77 +-}
78 +-
79 +-/*
80 + ** Return a pointer to a buffer containing a text representation of the
81 + ** expression passed as the first argument. The buffer is obtained from
82 + ** sqlite3_malloc(). It is the responsibility of the caller to use
83 +@@ -1203,12 +1175,12 @@
84 + **
85 + ** SELECT fts3_exprtest('simple', 'Bill col2:Bloggs', 'col1', 'col2');
86 + */
87 +-static void fts3ExprTest(
88 ++static void fts3ExprTestCommon(
89 ++ int bRebalance,
90 + sqlite3_context *context,
91 + int argc,
92 + sqlite3_value **argv
93 + ){
94 +- sqlite3_tokenizer_module const *pModule = 0;
95 + sqlite3_tokenizer *pTokenizer = 0;
96 + int rc;
97 + char **azCol = 0;
98 +@@ -1218,7 +1190,9 @@
99 + int ii;
100 + Fts3Expr *pExpr;
101 + char *zBuf = 0;
102 +- sqlite3 *db = sqlite3_context_db_handle(context);
103 ++ Fts3Hash *pHash = (Fts3Hash*)sqlite3_user_data(context);
104 ++ const char *zTokenizer = 0;
105 ++ char *zErr = 0;
106 +
107 + if( argc<3 ){
108 + sqlite3_result_error(context,
109 +@@ -1227,23 +1201,17 @@
110 + return;
111 + }
112 +
113 +- rc = queryTestTokenizer(db,
114 +- (const char *)sqlite3_value_text(argv[0]), &pModule);
115 +- if( rc==SQLITE_NOMEM ){
116 +- sqlite3_result_error_nomem(context);
117 +- goto exprtest_out;
118 +- }else if( !pModule ){
119 +- sqlite3_result_error(context, "No such tokenizer module", -1);
120 +- goto exprtest_out;
121 +- }
122 +-
123 +- rc = pModule->xCreate(0, 0, &pTokenizer);
124 +- assert( rc==SQLITE_NOMEM || rc==SQLITE_OK );
125 +- if( rc==SQLITE_NOMEM ){
126 +- sqlite3_result_error_nomem(context);
127 +- goto exprtest_out;
128 ++ zTokenizer = (const char*)sqlite3_value_text(argv[0]);
129 ++ rc = sqlite3Fts3InitTokenizer(pHash, zTokenizer, &pTokenizer, &zErr);
130 ++ if( rc!=SQLITE_OK ){
131 ++ if( rc==SQLITE_NOMEM ){
132 ++ sqlite3_result_error_nomem(context);
133 ++ }else{
134 ++ sqlite3_result_error(context, zErr, -1);
135 ++ }
136 ++ sqlite3_free(zErr);
137 ++ return;
138 + }
139 +- pTokenizer->pModule = pModule;
140 +
141 + zExpr = (const char *)sqlite3_value_text(argv[1]);
142 + nExpr = sqlite3_value_bytes(argv[1]);
143 +@@ -1257,7 +1225,7 @@
144 + azCol[ii] = (char *)sqlite3_value_text(argv[ii+2]);
145 + }
146 +
147 +- if( sqlite3_user_data(context) ){
148 ++ if( bRebalance ){
149 + char *zDummy = 0;
150 + rc = sqlite3Fts3ExprParse(
151 + pTokenizer, 0, azCol, 0, nCol, nCol, zExpr, nExpr, &pExpr, &zDummy
152 +@@ -1283,23 +1251,38 @@
153 + sqlite3Fts3ExprFree(pExpr);
154 +
155 + exprtest_out:
156 +- if( pModule && pTokenizer ){
157 +- rc = pModule->xDestroy(pTokenizer);
158 ++ if( pTokenizer ){
159 ++ rc = pTokenizer->pModule->xDestroy(pTokenizer);
160 + }
161 + sqlite3_free(azCol);
162 + }
163 +
164 ++static void fts3ExprTest(
165 ++ sqlite3_context *context,
166 ++ int argc,
167 ++ sqlite3_value **argv
168 ++){
169 ++ fts3ExprTestCommon(0, context, argc, argv);
170 ++}
171 ++static void fts3ExprTestRebalance(
172 ++ sqlite3_context *context,
173 ++ int argc,
174 ++ sqlite3_value **argv
175 ++){
176 ++ fts3ExprTestCommon(1, context, argc, argv);
177 ++}
178 ++
179 + /*
180 + ** Register the query expression parser test function fts3_exprtest()
181 + ** with database connection db.
182 + */
183 +-int sqlite3Fts3ExprInitTestInterface(sqlite3* db){
184 ++int sqlite3Fts3ExprInitTestInterface(sqlite3 *db, Fts3Hash *pHash){
185 + int rc = sqlite3_create_function(
186 +- db, "fts3_exprtest", -1, SQLITE_UTF8, 0, fts3ExprTest, 0, 0
187 ++ db, "fts3_exprtest", -1, SQLITE_UTF8, (void*)pHash, fts3ExprTest, 0, 0
188 + );
189 + if( rc==SQLITE_OK ){
190 + rc = sqlite3_create_function(db, "fts3_exprtest_rebalance",
191 +- -1, SQLITE_UTF8, (void *)1, fts3ExprTest, 0, 0
192 ++ -1, SQLITE_UTF8, (void*)pHash, fts3ExprTestRebalance, 0, 0
193 + );
194 + }
195 + return rc;
196 +--- /test/fts3expr.test
197 ++++ /test/fts3expr.test
198 +@@ -409,7 +409,7 @@
199 + } {1 {Usage: fts3_exprtest(tokenizer, expr, col1, ...}}
200 + do_test fts3expr-5.2 {
201 + catchsql { SELECT fts3_exprtest('doesnotexist', 'a b', 'c') }
202 +-} {1 {No such tokenizer module}}
203 ++} {1 {unknown tokenizer: doesnotexist}}
204 + do_test fts3expr-5.3 {
205 + catchsql { SELECT fts3_exprtest('simple', 'a b OR', 'c') }
206 + } {1 {Error parsing expression}}
207 +--- /test/fts3expr4.test
208 ++++ /test/fts3expr4.test
209 +@@ -29,7 +29,8 @@
210 + }
211 +
212 + proc do_icu_expr_test {tn expr res} {
213 +- uplevel [list do_test $tn [list test_fts3expr icu $expr] [list {*}$res]]
214 ++ set res2 [list {*}$res]
215 ++ uplevel [list do_test $tn [list test_fts3expr "icu en_US" $expr] $res2]
216 + }
217 +
218 + proc do_simple_expr_test {tn expr res} {
219 --- /test/zipfile2.test
220 +++ /test/zipfile2.test
221 @@ -52,17 +52,15 @@