|
1 |
| ---- orig/shell.c 2019-06-11 15:05:36.341739007 -0700 |
2 |
| -+++ shell.c 2019-06-11 15:05:36.401739332 -0700 |
3 |
| -@@ -87,6 +87,12 @@ |
| 1 | +diff --git a/dist/Android.patch b/dist/Android.patch |
| 2 | +index 7ecbecb..e69de29 100644 |
| 3 | +--- a/dist/Android.patch |
| 4 | ++++ b/dist/Android.patch |
| 5 | +@@ -1,141 +0,0 @@ |
| 6 | +---- orig/shell.c 2019-06-11 15:05:36.341739007 -0700 |
| 7 | +-+++ shell.c 2019-06-11 15:05:36.401739332 -0700 |
| 8 | +-@@ -87,6 +87,12 @@ |
| 9 | +- #endif |
| 10 | +- #include <ctype.h> |
| 11 | +- #include <stdarg.h> |
| 12 | +-+// Begin Android Add |
| 13 | +-+#ifndef NO_ANDROID_FUNCS |
| 14 | +-+#include <aicu/AIcu.h> |
| 15 | +-+#include <sqlite3_android.h> |
| 16 | +-+#endif |
| 17 | +-+// End Android Add |
| 18 | +- |
| 19 | +- #if !defined(_WIN32) && !defined(WIN32) |
| 20 | +- # include <signal.h> |
| 21 | +-@@ -11698,6 +11704,23 @@ |
| 22 | +- sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0, |
| 23 | +- editFunc, 0, 0); |
| 24 | +- #endif |
| 25 | +-+ |
| 26 | +-+// Begin Android Add |
| 27 | +-+#ifndef NO_ANDROID_FUNCS |
| 28 | +-+ AIcu_initializeIcuOrDie(); |
| 29 | +-+ int err = register_localized_collators(p->db, "en_US", 0); |
| 30 | +-+ if (err != SQLITE_OK) { |
| 31 | +-+ fprintf(stderr, "register_localized_collators() failed\n"); |
| 32 | +-+ exit(1); |
| 33 | +-+ } |
| 34 | +-+ err = register_android_functions(p->db, 0); |
| 35 | +-+ if (err != SQLITE_OK) { |
| 36 | +-+ fprintf(stderr, "register_android_functions() failed\n"); |
| 37 | +-+ exit(1); |
| 38 | +-+ } |
| 39 | +-+#endif |
| 40 | +-+// End Android Add |
| 41 | +-+ |
| 42 | +- if( p->openMode==SHELL_OPEN_ZIPFILE ){ |
| 43 | +- char *zSql = sqlite3_mprintf( |
| 44 | +- "CREATE VIRTUAL TABLE zip USING zipfile(%Q);", p->zDbFilename); |
| 45 | +---- orig/sqlite3.c 2019-06-11 15:05:36.393739289 -0700 |
| 46 | +-+++ sqlite3.c 2019-06-11 15:05:36.449739593 -0700 |
| 47 | +-@@ -32438,6 +32438,10 @@ |
| 48 | +- # include <sys/mount.h> |
| 49 | +- #endif |
| 50 | +- |
| 51 | +-+#if defined(__BIONIC__) |
| 52 | +-+# include <android/fdsan.h> |
| 53 | +-+#endif |
| 54 | +-+ |
| 55 | +- #ifdef HAVE_UTIME |
| 56 | +- # include <utime.h> |
| 57 | +- #endif |
| 58 | +-@@ -33197,6 +33201,12 @@ |
| 59 | +- #if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0) |
| 60 | +- osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC); |
| 61 | +- #endif |
| 62 | +-+ |
| 63 | +-+#if defined(__BIONIC__) && __ANDROID_API__ >= __ANDROID_API_Q__ |
| 64 | +-+ uint64_t tag = android_fdsan_create_owner_tag( |
| 65 | +-+ ANDROID_FDSAN_OWNER_TYPE_SQLITE, fd); |
| 66 | +-+ android_fdsan_exchange_owner_tag(fd, 0, tag); |
| 67 | +-+#endif |
| 68 | +- } |
| 69 | +- return fd; |
| 70 | +- } |
| 71 | +-@@ -33777,7 +33787,13 @@ |
| 72 | +- ** and move on. |
| 73 | +- */ |
| 74 | +- static void robust_close(unixFile *pFile, int h, int lineno){ |
| 75 | +-+#if defined(__BIONIC__) && __ANDROID_API__ >= __ANDROID_API_Q__ |
| 76 | +-+ uint64_t tag = android_fdsan_create_owner_tag( |
| 77 | +-+ ANDROID_FDSAN_OWNER_TYPE_SQLITE, h); |
| 78 | +-+ if( android_fdsan_close_with_tag(h, tag) ){ |
| 79 | +-+#else |
| 80 | +- if( osClose(h) ){ |
| 81 | +-+#endif |
| 82 | +- unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close", |
| 83 | +- pFile ? pFile->zPath : 0, lineno); |
| 84 | +- } |
| 85 | +-@@ -36310,7 +36326,7 @@ |
| 86 | +- SimulateIOError( rc=1 ); |
| 87 | +- if( rc!=0 ){ |
| 88 | +- storeLastErrno((unixFile*)id, errno); |
| 89 | +-- return SQLITE_IOERR_FSTAT; |
| 90 | +-+ return unixLogError(SQLITE_IOERR_FSTAT, "fstat", ((unixFile*)id)->zPath); |
| 91 | +- } |
| 92 | +- *pSize = buf.st_size; |
| 93 | +- |
| 94 | +-@@ -36346,7 +36362,7 @@ |
| 95 | +- struct stat buf; /* Used to hold return values of fstat() */ |
| 96 | +- |
| 97 | +- if( osFstat(pFile->h, &buf) ){ |
| 98 | +-- return SQLITE_IOERR_FSTAT; |
| 99 | +-+ return unixLogError(SQLITE_IOERR_FSTAT, "fstat", pFile->zPath); |
| 100 | +- } |
| 101 | +- |
| 102 | +- nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk; |
| 103 | +-@@ -37032,7 +37048,7 @@ |
| 104 | +- ** with the same permissions. |
| 105 | +- */ |
| 106 | +- if( osFstat(pDbFd->h, &sStat) ){ |
| 107 | +-- rc = SQLITE_IOERR_FSTAT; |
| 108 | +-+ rc = unixLogError(SQLITE_IOERR_FSTAT, "fstat", pDbFd->zPath); |
| 109 | +- goto shm_open_err; |
| 110 | +- } |
| 111 | +- |
| 112 | +-@@ -123984,7 +124000,7 @@ |
| 113 | +- } |
| 114 | +- if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){ |
| 115 | +- sqlite3SetString(pzErrMsg, db, "unsupported file format"); |
| 116 | +-- rc = SQLITE_ERROR; |
| 117 | +-+ rc = SQLITE_CORRUPT_BKPT; // Android Change from "rc = SQLITE_ERROR;"; |
| 118 | +- goto initone_error_out; |
| 119 | +- } |
| 120 | +- |
| 121 | +-@@ -164271,13 +164287,25 @@ |
| 122 | +- ** module with sqlite. |
| 123 | +- */ |
| 124 | +- if( SQLITE_OK==rc |
| 125 | +-+#ifndef ANDROID /* fts3_tokenizer disabled for security reasons */ |
| 126 | +- && SQLITE_OK==(rc = sqlite3Fts3InitHashTable(db, pHash, "fts3_tokenizer")) |
| 127 | +-+#endif |
| 128 | +- && SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1)) |
| 129 | +- && SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1)) |
| 130 | +- && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1)) |
| 131 | +- && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 2)) |
| 132 | +- && SQLITE_OK==(rc = sqlite3_overload_function(db, "optimize", 1)) |
| 133 | +- ){ |
| 134 | +-+#ifdef SQLITE_ENABLE_FTS3_BACKWARDS |
| 135 | +-+ rc = sqlite3_create_module_v2( |
| 136 | +-+ db, "fts1", &fts3Module, (void *)pHash, 0 |
| 137 | +-+ ); |
| 138 | +-+ if(rc) return rc; |
| 139 | +-+ rc = sqlite3_create_module_v2( |
| 140 | +-+ db, "fts2", &fts3Module, (void *)pHash, 0 |
| 141 | +-+ ); |
| 142 | +-+ if(rc) return rc; |
| 143 | +-+#endif |
| 144 | +- rc = sqlite3_create_module_v2( |
| 145 | +- db, "fts3", &fts3Module, (void *)pHash, hashDestroy |
| 146 | +- ); |
| 147 | +diff --git a/dist/shell.c b/dist/shell.c |
| 148 | +index 974f57a..d0fe5d5 100644 |
| 149 | +--- a/dist/shell.c |
| 150 | ++++ b/dist/shell.c |
| 151 | +@@ -95,6 +95,12 @@ typedef unsigned char u8; |
4 | 152 | #endif
|
5 | 153 | #include <ctype.h>
|
6 | 154 | #include <stdarg.h>
|
|
13 | 161 |
|
14 | 162 | #if !defined(_WIN32) && !defined(WIN32)
|
15 | 163 | # include <signal.h>
|
16 |
| -@@ -11698,6 +11704,23 @@ |
| 164 | +@@ -12957,6 +12963,23 @@ static void open_db(ShellState *p, int openFlags){ |
17 | 165 | sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0,
|
18 | 166 | editFunc, 0, 0);
|
19 | 167 | #endif
|
|
37 | 185 | if( p->openMode==SHELL_OPEN_ZIPFILE ){
|
38 | 186 | char *zSql = sqlite3_mprintf(
|
39 | 187 | "CREATE VIRTUAL TABLE zip USING zipfile(%Q);", p->zDbFilename);
|
40 |
| ---- orig/sqlite3.c 2019-06-11 15:05:36.393739289 -0700 |
41 |
| -+++ sqlite3.c 2019-06-11 15:05:36.449739593 -0700 |
42 |
| -@@ -32438,6 +32438,10 @@ |
| 188 | +diff --git a/dist/sqlite3.c b/dist/sqlite3.c |
| 189 | +index 19c8768..9061f13 100644 |
| 190 | +--- a/dist/sqlite3.c |
| 191 | ++++ b/dist/sqlite3.c |
| 192 | +@@ -33395,6 +33395,10 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){ |
43 | 193 | # include <sys/mount.h>
|
44 | 194 | #endif
|
45 | 195 |
|
|
50 | 200 | #ifdef HAVE_UTIME
|
51 | 201 | # include <utime.h>
|
52 | 202 | #endif
|
53 |
| -@@ -33197,6 +33201,12 @@ |
| 203 | +@@ -34155,6 +34159,12 @@ static int robust_open(const char *z, int f, mode_t m){ |
54 | 204 | #if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0)
|
55 | 205 | osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
|
56 | 206 | #endif
|
|
63 | 213 | }
|
64 | 214 | return fd;
|
65 | 215 | }
|
66 |
| -@@ -33777,7 +33787,13 @@ |
| 216 | +@@ -34735,7 +34745,13 @@ static int unixLogErrorAtLine( |
67 | 217 | ** and move on.
|
68 | 218 | */
|
69 | 219 | static void robust_close(unixFile *pFile, int h, int lineno){
|
|
77 | 227 | unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close",
|
78 | 228 | pFile ? pFile->zPath : 0, lineno);
|
79 | 229 | }
|
80 |
| -@@ -36310,7 +36326,7 @@ |
| 230 | +@@ -37269,7 +37285,7 @@ static int unixFileSize(sqlite3_file *id, i64 *pSize){ |
81 | 231 | SimulateIOError( rc=1 );
|
82 | 232 | if( rc!=0 ){
|
83 | 233 | storeLastErrno((unixFile*)id, errno);
|
|
86 | 236 | }
|
87 | 237 | *pSize = buf.st_size;
|
88 | 238 |
|
89 |
| -@@ -36346,7 +36362,7 @@ |
| 239 | +@@ -37305,7 +37321,7 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){ |
90 | 240 | struct stat buf; /* Used to hold return values of fstat() */
|
91 | 241 |
|
92 | 242 | if( osFstat(pFile->h, &buf) ){
|
|
95 | 245 | }
|
96 | 246 |
|
97 | 247 | nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
|
98 |
| -@@ -37032,7 +37048,7 @@ |
| 248 | +@@ -38000,7 +38016,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){ |
99 | 249 | ** with the same permissions.
|
100 | 250 | */
|
101 | 251 | if( osFstat(pDbFd->h, &sStat) ){
|
|
104 | 254 | goto shm_open_err;
|
105 | 255 | }
|
106 | 256 |
|
107 |
| -@@ -123984,7 +124000,7 @@ |
| 257 | +@@ -128216,7 +128232,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl |
108 | 258 | }
|
109 | 259 | if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
|
110 | 260 | sqlite3SetString(pzErrMsg, db, "unsupported file format");
|
|
113 | 263 | goto initone_error_out;
|
114 | 264 | }
|
115 | 265 |
|
116 |
| -@@ -164271,13 +164287,25 @@ |
| 266 | +@@ -170126,13 +170142,25 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){ |
117 | 267 | ** module with sqlite.
|
118 | 268 | */
|
119 | 269 | if( SQLITE_OK==rc
|
|
0 commit comments