From 074544d181daa4c47f6699a5df78dd3f6d20d64d Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 9 Jun 2018 20:52:45 +0000 Subject: [PATCH 01/17] Fix a typo in the amalgamation autoconf file. FossilOrigin-Name: de0857f39620b7f5c921ddf8d11b11723b4ba3cfe52e43cf77e883697b7c1c4c --- autoconf/configure.ac | 2 +- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 8ba221891a..76579c0a55 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -153,7 +153,7 @@ AC_SUBST(SESSION_FLAGS) # AC_ARG_ENABLE(debug, [AS_HELP_STRING( [--enable-debug], [build with debugging features enabled [default=no]])], - [], [enable_session=no]) + [], [enable_debug=no]) if test x"$enable_debug" = "xyes"; then DEBUG_FLAGS="-DSQLITE_DEBUG -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE" fi diff --git a/manifest b/manifest index 3e06caf3c1..5757350e81 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Slightly\ssmaller\sand\sfaster\scode\sby\sencapsulating\swal-index\shash\stable\nlocation\sinformation\sin\sa\sseparate\sWalHashLoc\sobject\srather\sthan\spassing\naround\sthe\svarious\selements\sas\sseparate\svariables. -D 2018-06-09T16:49:00.305 +C Fix\sa\stypo\sin\sthe\samalgamation\sautoconf\sfile. +D 2018-06-09T20:52:45.165 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in bfc40f350586923e0419d2ea4b559c37ec10ee4b6e210e08c14401f8e340f0da @@ -17,7 +17,7 @@ F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a F autoconf/Makefile.msc 6a46d0659d6e4a25346102bcba40a7fb4b0b8b2dc4faabdf0187488c6dd580d6 F autoconf/README.first 6c4f34fe115ff55d4e8dbfa3cecf04a0188292f7 F autoconf/README.txt 4f04b0819303aabaa35fff5f7b257fb0c1ef95f1 -F autoconf/configure.ac 5f6cf281ae675685335ce7f43f8c2d59d3ac8ba4174a57b8e83097c5e10dcf4e +F autoconf/configure.ac ac680e441d5dd8a55b66fc73cfd7a3c5adb39729ea2af4811f023c3c516057e4 F autoconf/tea/Makefile.in b438a7020446c8a8156e8d97c8914a04833da6fd F autoconf/tea/README 3e9a3c060f29a44344ab50aec506f4db903fb873 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 @@ -1731,7 +1731,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 31e480f68dfd887cfd9114f9f9fec53d751d3ecc27e36f55c0166b51b2fbb08c -R 6ae6039dbf6c75d53dff2e4ab7fb3afb +P 538a365b7a32ab7fa84f59d7556242cfb59b76d287b6417eb3a823197a354e8e +R 77cf712c0701790fbea387864fe5a9e7 U drh -Z 6ec430bc7e585373e73f8d45e5d8a30b +Z 8a05b9e91fe6e55c1781e9d15c271cb0 diff --git a/manifest.uuid b/manifest.uuid index 15b5d5a674..78e429d619 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -538a365b7a32ab7fa84f59d7556242cfb59b76d287b6417eb3a823197a354e8e \ No newline at end of file +de0857f39620b7f5c921ddf8d11b11723b4ba3cfe52e43cf77e883697b7c1c4c \ No newline at end of file From 9c3549aa2ff44195e692601ab9e71f03e9481b82 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 11 Jun 2018 01:30:03 +0000 Subject: [PATCH 02/17] Always initialize the WhereClause.hasOr field that was added by check-in [292724ffc4]. Error detected by OSSFuzz. FossilOrigin-Name: 9faf41713e865f26485d9e90918d77c25be211384941eadda6a36237f52c25de --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/whereexpr.c | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 5757350e81..cba3248157 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\stypo\sin\sthe\samalgamation\sautoconf\sfile. -D 2018-06-09T20:52:45.165 +C Always\sinitialize\sthe\sWhereClause.hasOr\sfield\sthat\swas\sadded\sby\scheck-in\n[292724ffc4].\s\sError\sdetected\sby\sOSSFuzz. +D 2018-06-11T01:30:03.585 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in bfc40f350586923e0419d2ea4b559c37ec10ee4b6e210e08c14401f8e340f0da @@ -582,7 +582,7 @@ F src/walker.c da987a20d40145c0a03c07d8fefcb2ed363becc7680d0500d9c79915591f5b1f F src/where.c fe1a6f97c12cc9472ccce86166ba3f827cf61d6ae770c036a6396b63863baac4 F src/whereInt.h b90ef9b9707ef750eab2a7a080c48fb4900315033274689def32d0cf5a81ebe4 F src/wherecode.c 3317f2b083a66d3e65a03edf316ade4ccb0a99c9956273282ebb579b95d4ba96 -F src/whereexpr.c 6f022d6cc9daf56495f191b199352f783aff5cf268ba136b4d8cea3fb62d8c7d +F src/whereexpr.c 19cf35cdd9bf6d5589d8a5c960d99259761136187a2319a6e14d11cf1abe14c2 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/affinity2.test a6d901b436328bd67a79b41bb0ac2663918fe3bd F test/affinity3.test 6a101af2fc945ce2912f6fe54dd646018551710d @@ -1731,7 +1731,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 538a365b7a32ab7fa84f59d7556242cfb59b76d287b6417eb3a823197a354e8e -R 77cf712c0701790fbea387864fe5a9e7 +P de0857f39620b7f5c921ddf8d11b11723b4ba3cfe52e43cf77e883697b7c1c4c +R d9b050cc4bb9b1726f913fdb83de4b6b U drh -Z 8a05b9e91fe6e55c1781e9d15c271cb0 +Z 56f73bab2b8437d13f6f85f70d26e7dd diff --git a/manifest.uuid b/manifest.uuid index 78e429d619..2e3a89e74f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -de0857f39620b7f5c921ddf8d11b11723b4ba3cfe52e43cf77e883697b7c1c4c \ No newline at end of file +9faf41713e865f26485d9e90918d77c25be211384941eadda6a36237f52c25de \ No newline at end of file diff --git a/src/whereexpr.c b/src/whereexpr.c index 3f349134ba..c027481025 100644 --- a/src/whereexpr.c +++ b/src/whereexpr.c @@ -1409,6 +1409,7 @@ void sqlite3WhereClauseInit( WhereInfo *pWInfo /* The WHERE processing context */ ){ pWC->pWInfo = pWInfo; + pWC->hasOr = 0; pWC->pOuter = 0; pWC->nTerm = 0; pWC->nSlot = ArraySize(pWC->aStatic); From 8d7b212c4c6ef492c55ce9ea9de2ed4e8d738ef4 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 11 Jun 2018 13:10:45 +0000 Subject: [PATCH 03/17] Strengthen the sqlite3VdbeMemAboutToChange() run-time verification mechanism to better detect missed calls to AboutToChange(). FossilOrigin-Name: 793e942205a12eedb7ecc5ad8a27e3e52bbd4e1d50a0d1453d04a83ba728884e --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/vdbe.h | 1 + src/vdbeaux.c | 2 +- src/vdbemem.c | 16 +++++++++++++++- 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index cba3248157..6170904da3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Always\sinitialize\sthe\sWhereClause.hasOr\sfield\sthat\swas\sadded\sby\scheck-in\n[292724ffc4].\s\sError\sdetected\sby\sOSSFuzz. -D 2018-06-11T01:30:03.585 +C Strengthen\sthe\ssqlite3VdbeMemAboutToChange()\srun-time\sverification\smechanism\nto\sbetter\sdetect\smissed\scalls\sto\sAboutToChange(). +D 2018-06-11T13:10:45.872 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in bfc40f350586923e0419d2ea4b559c37ec10ee4b6e210e08c14401f8e340f0da @@ -566,12 +566,12 @@ F src/utf.c 810fbfebe12359f10bc2a011520a6e10879ab2a163bcb26c74768eab82ea62a5 F src/util.c d9eb0a6c4aae1b00a7369eadd7ca0bbe946cb4c953b6751aa20d357c2f482157 F src/vacuum.c 36e7d21a20c0bf6ef4ef7c399d192b5239410b7c4d3c1070fba4e30810d0b855 F src/vdbe.c d7a475cec51c83daf0d348301a1aec77f535832ea946632b5738ff9f087c0edb -F src/vdbe.h e3f43bcc27ff30b0f25a6104d0cb5657e1c4b5e1b5cd2dd2216d5bcc2156a746 +F src/vdbe.h c58fa2d8fff2a235a685687340ee555269f5421e4ec2ee758a5550961d3b25a4 F src/vdbeInt.h d299d7a19853463dac418de0d97f2dd9cb4ddb495a45c93364e2daee109ba0ef F src/vdbeapi.c 765a0bbe01311626417de6cb743f7f25f9f98435c98a9df4bb0714d11014633d -F src/vdbeaux.c daecbbefaf0adfc428cddbfa5164c1d744496ba5dd19f840845ecac652913802 +F src/vdbeaux.c ea0b7821dd74068cb8b232d1ba3dc457ecaca302d2cf67e1f24ff3bcc7d94c52 F src/vdbeblob.c f5c70f973ea3a9e915d1693278a5f890dc78594300cf4d54e64f2b0917c94191 -F src/vdbemem.c 803323406d8623a7619ea5d5f74016697eeaed19c02b98ce9c3013e77dbe1c38 +F src/vdbemem.c 8f5cd24151c87294c2fb31c9e9353b074786c10cb9e7ef74d93c2e1ec85d1ee1 F src/vdbesort.c 731a09e5cb9e96b70c394c1b7cf3860fbe84acca7682e178615eb941a3a0ef2f F src/vdbetrace.c 79d6dbbc479267b255a7de8080eee6e729928a0ef93ed9b0bfa5618875b48392 F src/vtab.c 10ea07dec111de6fb0a4fc87a7ffa4c65fdc088a19dbfaf7d6f2b128f2e8eb7b @@ -1731,7 +1731,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P de0857f39620b7f5c921ddf8d11b11723b4ba3cfe52e43cf77e883697b7c1c4c -R d9b050cc4bb9b1726f913fdb83de4b6b +P 9faf41713e865f26485d9e90918d77c25be211384941eadda6a36237f52c25de +R 846e9acb3549bc01ad42c2408534b9d1 U drh -Z 56f73bab2b8437d13f6f85f70d26e7dd +Z 5f45d155d5f89ae268c81c641f0e97a0 diff --git a/manifest.uuid b/manifest.uuid index 2e3a89e74f..5504e2c63e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9faf41713e865f26485d9e90918d77c25be211384941eadda6a36237f52c25de \ No newline at end of file +793e942205a12eedb7ecc5ad8a27e3e52bbd4e1d50a0d1453d04a83ba728884e \ No newline at end of file diff --git a/src/vdbe.h b/src/vdbe.h index 51bbdf96cc..b7f960f766 100644 --- a/src/vdbe.h +++ b/src/vdbe.h @@ -261,6 +261,7 @@ void sqlite3VdbeSetVarmask(Vdbe*, int); char *sqlite3VdbeExpandSql(Vdbe*, const char*); #endif int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*); +int sqlite3BlobCompare(const Mem*, const Mem*); void sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,UnpackedRecord*); int sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*); diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 7f0448ec1f..c0984317b9 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -3912,7 +3912,7 @@ static int isAllZero(const char *z, int n){ ** is less than, equal to, or greater than the second, respectively. ** If one blob is a prefix of the other, then the shorter is the lessor. */ -static SQLITE_NOINLINE int sqlite3BlobCompare(const Mem *pB1, const Mem *pB2){ +SQLITE_NOINLINE int sqlite3BlobCompare(const Mem *pB1, const Mem *pB2){ int c; int n1 = pB1->n; int n2 = pB2->n; diff --git a/src/vdbemem.c b/src/vdbemem.c index 933eee0b53..4759823417 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -886,7 +886,21 @@ void sqlite3VdbeMemAboutToChange(Vdbe *pVdbe, Mem *pMem){ Mem *pX; for(i=0, pX=pVdbe->aMem; inMem; i++, pX++){ if( pX->pScopyFrom==pMem ){ - pX->flags |= MEM_Undefined; + /* If pX is marked as a shallow copy of pMem, then verify that + ** no significant changes have been made to pX since the OP_SCopy. + ** A significant change would indicated a missed call to this + ** function for pX. Minor changes, such as adding or removing a + ** dual type, are allowed, as long as the underlying value is the + ** same. */ + u16 mFlags = pMem->flags & pX->flags; + assert( (mFlags&MEM_Int)==0 || pMem->u.i==pX->u.i ); + assert( (mFlags&MEM_Real)==0 || pMem->u.r==pX->u.r ); + assert( (mFlags&MEM_Str)==0 || (pMem->n==pX->n && pMem->z==pX->z) ); + assert( (mFlags&MEM_Blob)==0 || sqlite3BlobCompare(pMem,pX)==0 ); + + /* pMem is the register that is changing. But also mark pX as + ** undefined so that we can quickly detect the shallow-copy error */ + pX->flags = MEM_Undefined; pX->pScopyFrom = 0; } } From 299bf7c2f0193e2d39dd96ad4ccbe673ae9e21be Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 11 Jun 2018 17:35:02 +0000 Subject: [PATCH 04/17] Add the OP_SetTabCol and OP_VerifyTabCol opcodes, only when compiling with SQLITE_DEBUG, to do run-time verification of the column cache. FossilOrigin-Name: b37614a3670770919a7c7f8157c5fd6578d736447998640b52e5cef8174cadc2 --- manifest | 26 +++++++++++++------------- manifest.uuid | 2 +- src/expr.c | 10 ++++++++++ src/sqliteInt.h | 11 +++++++++++ src/vdbe.c | 40 ++++++++++++++++++++++++++++++++++++++++ src/vdbe.h | 4 ++++ src/vdbeInt.h | 6 +++--- src/vdbeaux.c | 2 +- src/vdbemem.c | 9 +++++++++ src/where.c | 31 +++++++++++++++++++++++++++++++ 10 files changed, 123 insertions(+), 18 deletions(-) diff --git a/manifest b/manifest index 6170904da3..3228fbdad9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Strengthen\sthe\ssqlite3VdbeMemAboutToChange()\srun-time\sverification\smechanism\nto\sbetter\sdetect\smissed\scalls\sto\sAboutToChange(). -D 2018-06-11T13:10:45.872 +C Add\sthe\sOP_SetTabCol\sand\sOP_VerifyTabCol\sopcodes,\sonly\swhen\scompiling\swith\nSQLITE_DEBUG,\sto\sdo\srun-time\sverification\sof\sthe\scolumn\scache. +D 2018-06-11T17:35:02.447 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in bfc40f350586923e0419d2ea4b559c37ec10ee4b6e210e08c14401f8e340f0da @@ -447,7 +447,7 @@ F src/date.c ebe1dc7c8a347117bb02570f1a931c62dd78f4a2b1b516f4837d45b7d6426957 F src/dbpage.c 4aa7f26198934dbd002e69418220eae3dbc71b010bbac32bd78faf86b52ce6c3 F src/dbstat.c edabb82611143727511a45ca0859b8cd037851ebe756ae3db289859dd18b6f91 F src/delete.c 4c8c7604277a2041647f96b78f4b9a47858e9217e4fb333d35e7b5ab32c5b57f -F src/expr.c 16f90ae2af2a100bc430a89184afde54878d82f18267e8d00bc4f33e695a7c57 +F src/expr.c 3ab855fb882d8758220edaf261d8d56ad2cb3736f92c818f4ae250ac4a2752a4 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c b1da9ef8dc834603bb0d28972378a7ce65897847f9a1e89ab800bbdf24c788ee F src/func.c e2e3c02621a528a472933fd4733a5da635676f1461be73293f6e9f62f18d4eaa @@ -500,7 +500,7 @@ F src/shell.c.in 4d0ddf10c403710d241bf920163dcf032c21119aebb61e70840942c0eafecdf F src/sqlite.h.in 63b07f76731f2b1e55c48fdb9f0508dcc6fbe3971010b8612ffd847c3c56d9a1 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 9887b27e69c01e79c2cbe74ef73bf01af5b5703d6a7f0a4371e386d7249cb1c7 -F src/sqliteInt.h 9332b820382288dde7d6ea712bbcd34380bbbeb44f6f7032710bd5240fd4067d +F src/sqliteInt.h c8d304712b6b4e2150cbb5355b1a80427eee7b3ea1a6b5827afadf557360d7fe F src/sqliteLimit.h 1513bfb7b20378aa0041e7022d04acb73525de35b80b252f1b83fedb4de6a76b F src/status.c 46e7aec11f79dad50965a5ca5fa9de009f7d6bde08be2156f1538a0a296d4d0e F src/table.c b46ad567748f24a326d9de40e5b9659f96ffff34 @@ -565,13 +565,13 @@ F src/upsert.c 47edd408cc73f8d3c00a140550d1ad180b407c146285947969dd09874802bf88 F src/utf.c 810fbfebe12359f10bc2a011520a6e10879ab2a163bcb26c74768eab82ea62a5 F src/util.c d9eb0a6c4aae1b00a7369eadd7ca0bbe946cb4c953b6751aa20d357c2f482157 F src/vacuum.c 36e7d21a20c0bf6ef4ef7c399d192b5239410b7c4d3c1070fba4e30810d0b855 -F src/vdbe.c d7a475cec51c83daf0d348301a1aec77f535832ea946632b5738ff9f087c0edb -F src/vdbe.h c58fa2d8fff2a235a685687340ee555269f5421e4ec2ee758a5550961d3b25a4 -F src/vdbeInt.h d299d7a19853463dac418de0d97f2dd9cb4ddb495a45c93364e2daee109ba0ef +F src/vdbe.c e0ac1d7cff72b4e8b250c5e698f0fc43f0c8b5a8f35654716d8ab1fa89db669e +F src/vdbe.h 9c8c245fa3785266c269ab02c135c836ff49a307612186686bcdae500f409945 +F src/vdbeInt.h 8ebc37ead2cfde92a63d74e3940fe0a94d456078c77e6cefbc2ecf15630f9fda F src/vdbeapi.c 765a0bbe01311626417de6cb743f7f25f9f98435c98a9df4bb0714d11014633d -F src/vdbeaux.c ea0b7821dd74068cb8b232d1ba3dc457ecaca302d2cf67e1f24ff3bcc7d94c52 +F src/vdbeaux.c 0e7af8614c87dd25bc2395d22c847deba96ff87d19758d5cd7f459a466f14cbb F src/vdbeblob.c f5c70f973ea3a9e915d1693278a5f890dc78594300cf4d54e64f2b0917c94191 -F src/vdbemem.c 8f5cd24151c87294c2fb31c9e9353b074786c10cb9e7ef74d93c2e1ec85d1ee1 +F src/vdbemem.c 613cbbcca8d21c66df311fc17f9460180abcf7a909e12493618fd570f9858036 F src/vdbesort.c 731a09e5cb9e96b70c394c1b7cf3860fbe84acca7682e178615eb941a3a0ef2f F src/vdbetrace.c 79d6dbbc479267b255a7de8080eee6e729928a0ef93ed9b0bfa5618875b48392 F src/vtab.c 10ea07dec111de6fb0a4fc87a7ffa4c65fdc088a19dbfaf7d6f2b128f2e8eb7b @@ -579,7 +579,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/wal.c d44a0811afd2155b1157c38b33141d4ac028fda6232485bed664015bb05819ca F src/wal.h 8de5d2d3de0956d6f6cb48c83a4012d5f227b8fe940f3a349a4b7e85ebcb492a F src/walker.c da987a20d40145c0a03c07d8fefcb2ed363becc7680d0500d9c79915591f5b1f -F src/where.c fe1a6f97c12cc9472ccce86166ba3f827cf61d6ae770c036a6396b63863baac4 +F src/where.c 0bcbf9e191ca07f9ea2008aa80e70ded46bcdffd26560c83397da501f00aece6 F src/whereInt.h b90ef9b9707ef750eab2a7a080c48fb4900315033274689def32d0cf5a81ebe4 F src/wherecode.c 3317f2b083a66d3e65a03edf316ade4ccb0a99c9956273282ebb579b95d4ba96 F src/whereexpr.c 19cf35cdd9bf6d5589d8a5c960d99259761136187a2319a6e14d11cf1abe14c2 @@ -1731,7 +1731,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 9faf41713e865f26485d9e90918d77c25be211384941eadda6a36237f52c25de -R 846e9acb3549bc01ad42c2408534b9d1 +P 793e942205a12eedb7ecc5ad8a27e3e52bbd4e1d50a0d1453d04a83ba728884e +R e32799ffc139aea23a34579bcd80eade U drh -Z 5f45d155d5f89ae268c81c641f0e97a0 +Z 5651f63d60929e8aa5ef5f44ca04cc41 diff --git a/manifest.uuid b/manifest.uuid index 5504e2c63e..b1328ceffb 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -793e942205a12eedb7ecc5ad8a27e3e52bbd4e1d50a0d1453d04a83ba728884e \ No newline at end of file +b37614a3670770919a7c7f8157c5fd6578d736447998640b52e5cef8174cadc2 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index 91eb44b8eb..1ddcca819f 100644 --- a/src/expr.c +++ b/src/expr.c @@ -3200,6 +3200,13 @@ void sqlite3ExprCacheStore(Parse *pParse, int iTab, int iCol, int iReg){ } #endif +#ifdef SQLITE_DEBUG_COLUMNCACHE + /* Add a SetTabCol opcode for run-time verification that the column + ** cache is working correctly. + */ + sqlite3VdbeAddOp3(pParse->pVdbe, OP_SetTabCol, iTab, iCol, iReg); +#endif + /* If the cache is already full, delete the least recently used entry */ if( pParse->nColCache>=SQLITE_N_COLCACHE ){ minLru = 0x7fffffff; @@ -3373,6 +3380,9 @@ int sqlite3ExprCodeGetColumn( if( p->iTable==iTable && p->iColumn==iColumn ){ p->lru = pParse->iCacheCnt++; sqlite3ExprCachePinRegister(pParse, p->iReg); +#ifdef SQLITE_DEBUG_COLUMNCACHE + sqlite3VdbeAddOp3(v, OP_VerifyTabCol, iTable, iColumn, p->iReg); +#endif return p->iReg; } } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 98bd7e4079..6180467005 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -367,6 +367,17 @@ # undef NDEBUG #endif +/* SQLITE_DEBUG_COLUMNCACHE is synomous with SQLITE_DEBUG. The +** SQLITE_DEBUG_COLUMNCACHE symbol only exists to provide a convenient +** way to search for all code that deals with verifying correct behavior +** of the column cache. +*/ +#ifdef SQLITE_DEBUG +# define SQLITE_DEBUG_COLUMNCACHE 1 +#else +# undef SQLIT_DEBUG_COLUMNCACHE +#endif + /* ** Enable SQLITE_ENABLE_EXPLAIN_COMMENTS if SQLITE_DEBUG is turned on. */ diff --git a/src/vdbe.c b/src/vdbe.c index 243e4fe70a..f65068672c 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -36,6 +36,18 @@ # define memAboutToChange(P,M) #endif +/* +** Given a cursor number and a column for a table or index, compute a +** hash value for use in the Mem.iTabColHash value. The iTabColHash +** column is only used for verification - it is omitted from production +** builds. Collisions are harmless in the sense that the correct answer +** still results. The only harm of collisions is that they can potential +** reduce column-cache error detection during SQLITE_DEBUG builds. +** +** No valid hash should be 0. +*/ +#define TableColumnHash(T,C) (((u32)(T)<<16)^(u32)(C+2)) + /* ** The following global variable is incremented every time a cursor ** moves, either by the OP_SeekXX, OP_Next, or OP_Prev opcodes. The test @@ -7318,6 +7330,34 @@ case OP_Abortable: { } #endif +#ifdef SQLITE_DEBUG_COLUMNCACHE +/* Opcode: SetTabCol P1 P2 P3 * * +** +** Set a flag in register REG[P3] indicating that it holds the value +** of column P2 from the table on cursor P1. This flag is checked +** by a subsequent VerifyTabCol opcode. +** +** This opcode only appears SQLITE_DEBUG builds. It is used to verify +** that the expression table column cache is working correctly. +*/ +case OP_SetTabCol: { + aMem[pOp->p3].iTabColHash = TableColumnHash(pOp->p1,pOp->p2); + break; +} +/* Opcode: VerifyTabCol P1 P2 P3 * * +** +** Verify that register REG[P3] contains the value of column P2 from +** cursor P1. Assert() if this is not the case. +** +** This opcode only appears SQLITE_DEBUG builds. It is used to verify +** that the expression table column cache is working correctly. +*/ +case OP_VerifyTabCol: { + assert( aMem[pOp->p3].iTabColHash == TableColumnHash(pOp->p1,pOp->p2) ); + break; +} +#endif + /* Opcode: Noop * * * * * ** ** Do nothing. This instruction is often useful as a jump diff --git a/src/vdbe.h b/src/vdbe.h index b7f960f766..51995e384c 100644 --- a/src/vdbe.h +++ b/src/vdbe.h @@ -343,4 +343,8 @@ void sqlite3VdbeScanStatus(Vdbe*, int, int, int, LogEst, const char*); # define sqlite3VdbeScanStatus(a,b,c,d,e) #endif +#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE) +void sqlite3VdbePrintOp(FILE*, int, VdbeOp*); +#endif + #endif /* SQLITE_VDBE_H */ diff --git a/src/vdbeInt.h b/src/vdbeInt.h index dd8e29108a..c883ce8b50 100644 --- a/src/vdbeInt.h +++ b/src/vdbeInt.h @@ -211,6 +211,9 @@ struct sqlite3_value { Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */ void *pFiller; /* So that sizeof(Mem) is a multiple of 8 */ #endif +#ifdef SQLITE_DEBUG_COLUMNCACHE + u32 iTabColHash; /* Hash of table.column that is origin of this value */ +#endif }; /* @@ -449,9 +452,6 @@ void sqlite3VdbeFreeCursor(Vdbe *, VdbeCursor*); void sqliteVdbePopStack(Vdbe*,int); int sqlite3VdbeCursorMoveto(VdbeCursor**, int*); int sqlite3VdbeCursorRestore(VdbeCursor*); -#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE) -void sqlite3VdbePrintOp(FILE*, int, Op*); -#endif u32 sqlite3VdbeSerialTypeLen(u32); u8 sqlite3VdbeOneByteSerialTypeLen(u8); u32 sqlite3VdbeSerialType(Mem*, int, u32*); diff --git a/src/vdbeaux.c b/src/vdbeaux.c index c0984317b9..856cad7649 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -1613,7 +1613,7 @@ void sqlite3VdbeLeave(Vdbe *p){ /* ** Print a single opcode. This routine is used for debugging only. */ -void sqlite3VdbePrintOp(FILE *pOut, int pc, Op *pOp){ +void sqlite3VdbePrintOp(FILE *pOut, int pc, VdbeOp *pOp){ char *zP4; char zPtr[50]; char zCom[100]; diff --git a/src/vdbemem.c b/src/vdbemem.c index 4759823417..5ce4bca79d 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -905,6 +905,9 @@ void sqlite3VdbeMemAboutToChange(Vdbe *pVdbe, Mem *pMem){ } } pMem->pScopyFrom = 0; +#ifdef SQLITE_DEBUG_COLUMN_CACHE + pMem->iTabColHash = 0; +#endif } #endif /* SQLITE_DEBUG */ @@ -925,6 +928,9 @@ void sqlite3VdbeMemShallowCopy(Mem *pTo, const Mem *pFrom, int srcType){ assert( pTo->db==pFrom->db ); if( VdbeMemDynamic(pTo) ){ vdbeClrCopy(pTo,pFrom,srcType); return; } memcpy(pTo, pFrom, MEMCELLSIZE); +#ifdef SQLITE_DEBUG_COLUMNCACHE + pTo->iTabColHash = pFrom->iTabColHash; +#endif if( (pFrom->flags&MEM_Static)==0 ){ pTo->flags &= ~(MEM_Dyn|MEM_Static|MEM_Ephem); assert( srcType==MEM_Ephem || srcType==MEM_Static ); @@ -942,6 +948,9 @@ int sqlite3VdbeMemCopy(Mem *pTo, const Mem *pFrom){ assert( (pFrom->flags & MEM_RowSet)==0 ); if( VdbeMemDynamic(pTo) ) vdbeMemClearExternAndSetNull(pTo); memcpy(pTo, pFrom, MEMCELLSIZE); +#ifdef SQLITE_DEBUG_COLUMNCACHE + pTo->iTabColHash = pFrom->iTabColHash; +#endif pTo->flags &= ~MEM_Dyn; if( pTo->flags&(MEM_Str|MEM_Blob) ){ if( 0==(pFrom->flags&MEM_Static) ){ diff --git a/src/where.c b/src/where.c index 0e47dbf7ee..7d53715923 100644 --- a/src/where.c +++ b/src/where.c @@ -5033,6 +5033,26 @@ whereBeginError: return 0; } +/* +** Part of sqlite3WhereEnd() will rewrite opcodes to reference the +** index rather than the main table. In SQLITE_DEBUG mode, we want +** to trace those changes if PRAGMA vdbe_addoptrace=on. This routine +** does that. +*/ +#ifndef SQLITE_DEBUG +# define OpcodeRewriteTrace(D,K,P) /* no-op */ +#else +# define OpcodeRewriteTrace(D,K,P) sqlite3WhereOpcodeRewriteTrace(D,K,P) + static void sqlite3WhereOpcodeRewriteTrace( + sqlite3 *db, + int pc, + VdbeOp *pOp + ){ + if( (db->flags & SQLITE_VdbeAddopTrace)==0 ) return; + sqlite3VdbePrintOp(0, pc, pOp); + } +#endif + /* ** Generate the end of the WHERE loop. See comments on ** sqlite3WhereBegin() for additional information. @@ -5201,6 +5221,11 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){ ){ last = sqlite3VdbeCurrentAddr(v); k = pLevel->addrBody; +#ifdef SQLITE_DEBUG + if( db->flags & SQLITE_VdbeAddopTrace ){ + printf("TRANSLATE opcodes in range %d..%d\n", k, last-1); + } +#endif pOp = sqlite3VdbeGetOp(v, k); for(; kp1!=pLevel->iTabCur ) continue; @@ -5220,16 +5245,22 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){ if( x>=0 ){ pOp->p2 = x; pOp->p1 = pLevel->iIdxCur; + OpcodeRewriteTrace(db, k, pOp); } assert( (pLoop->wsFlags & WHERE_IDX_ONLY)==0 || x>=0 || pWInfo->eOnePass ); }else if( pOp->opcode==OP_Rowid ){ pOp->p1 = pLevel->iIdxCur; pOp->opcode = OP_IdxRowid; + OpcodeRewriteTrace(db, k, pOp); }else if( pOp->opcode==OP_IfNullRow ){ pOp->p1 = pLevel->iIdxCur; + OpcodeRewriteTrace(db, k, pOp); } } +#ifdef SQLITE_DEBUG + if( db->flags & SQLITE_VdbeAddopTrace ) printf("TRANSLATE complete\n"); +#endif } } From ea64715976cfe3a047e5ae9d0b990faf7076e99c Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 11 Jun 2018 18:06:48 +0000 Subject: [PATCH 05/17] Fix the column cache invalidation logic in the code for ROWID uniqueness constraint checking in the INSERT command. This fixes ticket [c2432ef9089ee73bd]. FossilOrigin-Name: 0b485a571c805a5bc431a231a196ff6034342c6548d92b09c52814dd57c89c75 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/insert.c | 2 ++ test/insert.test | 13 +++++++++++++ 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 3228fbdad9..6e78cae8c2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\sOP_SetTabCol\sand\sOP_VerifyTabCol\sopcodes,\sonly\swhen\scompiling\swith\nSQLITE_DEBUG,\sto\sdo\srun-time\sverification\sof\sthe\scolumn\scache. -D 2018-06-11T17:35:02.447 +C Fix\sthe\scolumn\scache\sinvalidation\slogic\sin\sthe\scode\sfor\sROWID\suniqueness\nconstraint\schecking\sin\sthe\sINSERT\scommand.\s\sThis\sfixes\sticket\n[c2432ef9089ee73bd]. +D 2018-06-11T18:06:48.831 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in bfc40f350586923e0419d2ea4b559c37ec10ee4b6e210e08c14401f8e340f0da @@ -456,7 +456,7 @@ F src/hash.c a12580e143f10301ed5166ea4964ae2853d3905a511d4e0c44497245c7ce1f7a F src/hash.h ab34c5c54a9e9de2e790b24349ba5aab3dbb4fd4 F src/hwtime.h 747c1bbe9df21a92e9c50f3bbec1de841dc5e5da F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 -F src/insert.c 76b1dc902e4c3930d9a17a40cd8ee2e94b1fd8cce766672caef164a6d5d4df1d +F src/insert.c bcacf6a0d277f8fa0e4f9ffecda544a2330ca4478f904cd89564c2dd86d0b16b F src/legacy.c 134ab3e3fae00a0f67a5187981d6935b24b337bcf0f4b3e5c9fa5763da95bf4e F src/loadext.c 6aae5739198d96c51ae6eb97c4a5b1744c22ed7a5a565a5399a717780d48a36b F src/main.c a086ab7d6e4e3f07bd5789d16f977d425f9482e7b3baeeb2f17bde0e6bfb2bc1 @@ -993,7 +993,7 @@ F test/indexexpr1.test 635261197bcdc19b9b2c59bbfa7227d525c00e9587faddb2d293c44d2 F test/indexexpr2.test 08551aa8956a91582979e17b6d369f321a5cb6ed6d3e952925a3e54e9e7de216 F test/indexfault.test 31d4ab9a7d2f6e9616933eb079722362a883eb1d F test/init.test 15c823093fdabbf7b531fe22cf037134d09587a7 -F test/insert.test 38742b5e9601c8f8d76e9b7555f7270288c2d371 +F test/insert.test 5604b1ff5675cc84c34a5b315792b958f48c32edccc0dafcc81d3b776270b70a F test/insert2.test 4d14b8f1b810a41995f6286b64a6943215d52208 F test/insert3.test 1b7db95a03ad9c5013fdf7d6722b6cd66ee55e30 F test/insert4.test 46bead5f39e181850ee56adcf49d3a3157c460c52249211714612ac89fe34835 @@ -1731,7 +1731,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 793e942205a12eedb7ecc5ad8a27e3e52bbd4e1d50a0d1453d04a83ba728884e -R e32799ffc139aea23a34579bcd80eade +P b37614a3670770919a7c7f8157c5fd6578d736447998640b52e5cef8174cadc2 +R 43b6e2e7bff8d43b71b0521d42db382b U drh -Z 5651f63d60929e8aa5ef5f44ca04cc41 +Z ba39774432820fe8ba51d6921586d213 diff --git a/manifest.uuid b/manifest.uuid index b1328ceffb..1d589ef851 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b37614a3670770919a7c7f8157c5fd6578d736447998640b52e5cef8174cadc2 \ No newline at end of file +0b485a571c805a5bc431a231a196ff6034342c6548d92b09c52814dd57c89c75 \ No newline at end of file diff --git a/src/insert.c b/src/insert.c index 3d51642834..78b07a025c 100644 --- a/src/insert.c +++ b/src/insert.c @@ -1533,6 +1533,7 @@ void sqlite3GenerateConstraintChecks( sqlite3VdbeVerifyAbortable(v, onError); sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, addrRowidOk, regNewData); VdbeCoverage(v); + sqlite3ExprCachePush(pParse); switch( onError ){ default: { @@ -1609,6 +1610,7 @@ void sqlite3GenerateConstraintChecks( break; } } + sqlite3ExprCachePop(pParse); sqlite3VdbeResolveLabel(v, addrRowidOk); if( sAddr.ipkTop ){ sAddr.ipkBtm = sqlite3VdbeAddOp0(v, OP_Goto); diff --git a/test/insert.test b/test/insert.test index cb675b90d1..1337105e25 100644 --- a/test/insert.test +++ b/test/insert.test @@ -435,6 +435,19 @@ do_execsql_test insert-12.3 { SELECT * FROM t12c; } {one xyzzy two} +# 2018-06-11. From OSSFuzz. A column cache malfunction in +# the constraint checking on an index of expressions causes +# an assertion fault in a REPLACE. Ticket +# https://www.sqlite.org/src/info/c2432ef9089ee73b +# +do_execsql_test insert-13.1 { + DROP TABLE IF EXISTS t13; + CREATE TABLE t13(a INTEGER PRIMARY KEY,b UNIQUE); + CREATE INDEX t13x1 ON t13(-b=b); + INSERT INTO t13 VALUES(1,5),(6,2); + REPLACE INTO t13 SELECT b,0 FROM t13; + SELECT * FROM t13 ORDER BY +b; +} {2 0 6 2 1 5} integrity_check insert-99.0 From 8fa622d62bd98ebff5871ff8af271e2b48177e89 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 11 Jun 2018 19:47:14 +0000 Subject: [PATCH 06/17] Fix various --enable and --disable options on the top-level configure script. FossilOrigin-Name: 6fd7e8ceb96981cff023653a54b85bea0e1da3d706cd9f4383f5c5533213ef4d --- configure | 60 +++++++++++++++------------------------------------ configure.ac | 48 +++++++++++++++-------------------------- manifest | 14 ++++++------ manifest.uuid | 2 +- 4 files changed, 42 insertions(+), 82 deletions(-) diff --git a/configure b/configure index aa18ccb622..8844bb768a 100755 --- a/configure +++ b/configure @@ -10455,8 +10455,6 @@ fi # Check whether --enable-threadsafe was given. if test "${enable_threadsafe+set}" = set; then : enableval=$enable_threadsafe; -else - enable_threadsafe=yes fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support threadsafe operation" >&5 @@ -11249,12 +11247,10 @@ fi # check for debug enabled # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : - enableval=$enable_debug; use_debug=$enableval -else - use_debug=no + enableval=$enable_debug; fi -if test "${use_debug}" = "yes" ; then +if test "${enable_debug}" = "yes" ; then TARGET_DEBUG="-DSQLITE_DEBUG=1 -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE -O0" else TARGET_DEBUG="-DNDEBUG" @@ -11265,12 +11261,10 @@ fi # See whether we should use the amalgamation to build # Check whether --enable-amalgamation was given. if test "${enable_amalgamation+set}" = set; then : - enableval=$enable_amalgamation; use_amalgamation=$enableval -else - use_amalgamation=yes + enableval=$enable_amalgamation; fi -if test "${use_amalgamation}" != "yes" ; then +if test "${enable_amalgamation}" == "no" ; then USE_AMALGAMATION=0 fi @@ -11353,12 +11347,12 @@ fi # See whether we should allow loadable extensions # Check whether --enable-load-extension was given. if test "${enable_load_extension+set}" = set; then : - enableval=$enable_load_extension; use_loadextension=$enableval + enableval=$enable_load_extension; else - use_loadextension=yes + enable_load_extension=yes fi -if test "${use_loadextension}" = "yes" ; then +if test "${enable_load_extension}" = "yes" ; then OPT_FEATURE_FLAGS="" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 $as_echo_n "checking for library containing dlopen... " >&6; } @@ -11425,9 +11419,7 @@ fi # # Check whether --enable-memsys5 was given. if test "${enable_memsys5+set}" = set; then : - enableval=$enable_memsys5; enable_memsys5=yes -else - enable_memsys5=no + enableval=$enable_memsys5; fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support MEMSYS5" >&5 @@ -11442,9 +11434,7 @@ $as_echo "no" >&6; } fi # Check whether --enable-memsys3 was given. if test "${enable_memsys3+set}" = set; then : - enableval=$enable_memsys3; enable_memsys3=yes -else - enable_memsys3=no + enableval=$enable_memsys3; fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support MEMSYS3" >&5 @@ -11462,9 +11452,7 @@ fi # See whether we should enable Full Text Search extensions # Check whether --enable-fts3 was given. if test "${enable_fts3+set}" = set; then : - enableval=$enable_fts3; enable_fts3=yes -else - enable_fts3=no + enableval=$enable_fts3; fi if test "${enable_fts3}" = "yes" ; then @@ -11472,9 +11460,7 @@ if test "${enable_fts3}" = "yes" ; then fi # Check whether --enable-fts4 was given. if test "${enable_fts4+set}" = set; then : - enableval=$enable_fts4; enable_fts4=yes -else - enable_fts4=no + enableval=$enable_fts4; fi if test "${enable_fts4}" = "yes" ; then @@ -11538,9 +11524,7 @@ fi fi # Check whether --enable-fts5 was given. if test "${enable_fts5+set}" = set; then : - enableval=$enable_fts5; enable_fts5=yes -else - enable_fts5=no + enableval=$enable_fts5; fi if test "${enable_fts5}" = "yes" ; then @@ -11607,9 +11591,7 @@ fi # See whether we should enable JSON1 # Check whether --enable-json1 was given. if test "${enable_json1+set}" = set; then : - enableval=$enable_json1; enable_json1=yes -else - enable_json1=no + enableval=$enable_json1; fi if test "${enable_json1}" = "yes" ; then @@ -11621,9 +11603,7 @@ fi # statements. # Check whether --enable-update-limit was given. if test "${enable_update_limit+set}" = set; then : - enableval=$enable_update_limit; enable_udlimit=yes -else - enable_udlimit=no + enableval=$enable_update_limit; fi if test "${enable_udlimit}" = "yes" ; then @@ -11634,9 +11614,7 @@ fi # See whether we should enable RTREE # Check whether --enable-rtree was given. if test "${enable_rtree+set}" = set; then : - enableval=$enable_rtree; enable_rtree=yes -else - enable_rtree=no + enableval=$enable_rtree; fi if test "${enable_rtree}" = "yes" ; then @@ -11647,9 +11625,7 @@ fi # See whether we should enable the SESSION extension # Check whether --enable-session was given. if test "${enable_session+set}" = set; then : - enableval=$enable_session; enable_session=yes -else - enable_session=no + enableval=$enable_session; fi if test "${enable_session}" = "yes" ; then @@ -11712,9 +11688,7 @@ BUILD_CFLAGS=$ac_temp_BUILD_CFLAGS # See whether we should use GCOV # Check whether --enable-gcov was given. if test "${enable_gcov+set}" = set; then : - enableval=$enable_gcov; use_gcov=$enableval -else - use_gcov=no + enableval=$enable_gcov; fi if test "${use_gcov}" = "yes" ; then diff --git a/configure.ac b/configure.ac index 7089772d19..18b4796909 100644 --- a/configure.ac +++ b/configure.ac @@ -182,7 +182,7 @@ AC_SUBST(BUILD_CC) # Do we want to support multithreaded use of sqlite # AC_ARG_ENABLE(threadsafe, -AC_HELP_STRING([--disable-threadsafe],[Disable mutexing]),,enable_threadsafe=yes) +AC_HELP_STRING([--disable-threadsafe],[Disable mutexing])) AC_MSG_CHECKING([whether to support threadsafe operation]) if test "$enable_threadsafe" = "no"; then SQLITE_THREADSAFE=0 @@ -557,9 +557,8 @@ AC_SEARCH_LIBS(fdatasync, [rt]) ######### # check for debug enabled -AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]), - [use_debug=$enableval],[use_debug=no]) -if test "${use_debug}" = "yes" ; then +AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain])) +if test "${enable_debug}" = "yes" ; then TARGET_DEBUG="-DSQLITE_DEBUG=1 -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE -O0" else TARGET_DEBUG="-DNDEBUG" @@ -569,9 +568,8 @@ AC_SUBST(TARGET_DEBUG) ######### # See whether we should use the amalgamation to build AC_ARG_ENABLE(amalgamation, AC_HELP_STRING([--disable-amalgamation], - [Disable the amalgamation and instead build all files separately]), - [use_amalgamation=$enableval],[use_amalgamation=yes]) -if test "${use_amalgamation}" != "yes" ; then + [Disable the amalgamation and instead build all files separately])) +if test "${enable_amalgamation}" == "no" ; then USE_AMALGAMATION=0 fi AC_SUBST(USE_AMALGAMATION) @@ -585,9 +583,8 @@ AC_SUBST(HAVE_ZLIB) ######### # See whether we should allow loadable extensions AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--disable-load-extension], - [Disable loading of external extensions]), - [use_loadextension=$enableval],[use_loadextension=yes]) -if test "${use_loadextension}" = "yes" ; then + [Disable loading of external extensions]),,[enable_load_extension=yes]) +if test "${enable_load_extension}" = "yes" ; then OPT_FEATURE_FLAGS="" AC_SEARCH_LIBS(dlopen, dl) else @@ -598,8 +595,7 @@ fi # Do we want to support memsys3 and/or memsys5 # AC_ARG_ENABLE(memsys5, - AC_HELP_STRING([--enable-memsys5],[Enable MEMSYS5]), - [enable_memsys5=yes],[enable_memsys5=no]) + AC_HELP_STRING([--enable-memsys5],[Enable MEMSYS5])) AC_MSG_CHECKING([whether to support MEMSYS5]) if test "${enable_memsys5}" = "yes"; then OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_MEMSYS5" @@ -608,8 +604,7 @@ else AC_MSG_RESULT([no]) fi AC_ARG_ENABLE(memsys3, - AC_HELP_STRING([--enable-memsys3],[Enable MEMSYS3]), - [enable_memsys3=yes],[enable_memsys3=no]) + AC_HELP_STRING([--enable-memsys3],[Enable MEMSYS3])) AC_MSG_CHECKING([whether to support MEMSYS3]) if test "${enable_memsys3}" = "yes" -a "${enable_memsys5}" = "no"; then OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_MEMSYS3" @@ -621,21 +616,18 @@ fi ######### # See whether we should enable Full Text Search extensions AC_ARG_ENABLE(fts3, AC_HELP_STRING([--enable-fts3], - [Enable the FTS3 extension]), - [enable_fts3=yes],[enable_fts3=no]) + [Enable the FTS3 extension])) if test "${enable_fts3}" = "yes" ; then OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_FTS3" fi AC_ARG_ENABLE(fts4, AC_HELP_STRING([--enable-fts4], - [Enable the FTS4 extension]), - [enable_fts4=yes],[enable_fts4=no]) + [Enable the FTS4 extension])) if test "${enable_fts4}" = "yes" ; then OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_FTS4" AC_SEARCH_LIBS([log],[m]) fi AC_ARG_ENABLE(fts5, AC_HELP_STRING([--enable-fts5], - [Enable the FTS5 extension]), - [enable_fts5=yes],[enable_fts5=no]) + [Enable the FTS5 extension])) if test "${enable_fts5}" = "yes" ; then OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_FTS5" AC_SEARCH_LIBS([log],[m]) @@ -643,9 +635,7 @@ fi ######### # See whether we should enable JSON1 -AC_ARG_ENABLE(json1, AC_HELP_STRING([--enable-json1], - [Enable the JSON1 extension]), - [enable_json1=yes],[enable_json1=no]) +AC_ARG_ENABLE(json1, AC_HELP_STRING([--enable-json1],[Enable the JSON1 extension])) if test "${enable_json1}" = "yes" ; then OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_JSON1" fi @@ -654,8 +644,7 @@ fi # See whether we should enable the LIMIT clause on UPDATE and DELETE # statements. AC_ARG_ENABLE(update-limit, AC_HELP_STRING([--enable-update-limit], - [Enable the UPDATE/DELETE LIMIT clause]), - [enable_udlimit=yes],[enable_udlimit=no]) + [Enable the UPDATE/DELETE LIMIT clause])) if test "${enable_udlimit}" = "yes" ; then OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT" fi @@ -663,8 +652,7 @@ fi ######### # See whether we should enable RTREE AC_ARG_ENABLE(rtree, AC_HELP_STRING([--enable-rtree], - [Enable the RTREE extension]), - [enable_rtree=yes],[enable_rtree=no]) + [Enable the RTREE extension])) if test "${enable_rtree}" = "yes" ; then OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_RTREE" fi @@ -672,8 +660,7 @@ fi ######### # See whether we should enable the SESSION extension AC_ARG_ENABLE(session, AC_HELP_STRING([--enable-session], - [Enable the SESSION extension]), - [enable_session=yes],[enable_session=no]) + [Enable the SESSION extension])) if test "${enable_session}" = "yes" ; then OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_SESSION" OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_PREUPDATE_HOOK" @@ -733,8 +720,7 @@ BUILD_CFLAGS=$ac_temp_BUILD_CFLAGS ######### # See whether we should use GCOV AC_ARG_ENABLE(gcov, AC_HELP_STRING([--enable-gcov], - [Enable coverage testing using gcov]), - [use_gcov=$enableval],[use_gcov=no]) + [Enable coverage testing using gcov])) if test "${use_gcov}" = "yes" ; then USE_GCOV=1 else diff --git a/manifest b/manifest index 6e78cae8c2..cf800859f4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\scolumn\scache\sinvalidation\slogic\sin\sthe\scode\sfor\sROWID\suniqueness\nconstraint\schecking\sin\sthe\sINSERT\scommand.\s\sThis\sfixes\sticket\n[c2432ef9089ee73bd]. -D 2018-06-11T18:06:48.831 +C Fix\svarious\s--enable\sand\s--disable\soptions\son\sthe\stop-level\sconfigure\nscript. +D 2018-06-11T19:47:14.809 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in bfc40f350586923e0419d2ea4b559c37ec10ee4b6e210e08c14401f8e340f0da @@ -33,8 +33,8 @@ F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63 F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977 F config.h.in 6376abec766e9a0785178b1823b5a587e9f1ccbc F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55 -F configure 481df2c668b5c8cd5723dbcda88df8e6796a23884877109d1fe558667a0474bf x -F configure.ac d4529ebb26ae046269334f1dac65f2b1d6927c2efe22b2ec24dce24dfe4f83dd +F configure a46cba271ae08d635a1f331384c04563bdd37adb3d63cbdcffb1d91babfb64f5 x +F configure.ac 18c93e8bbeec8254832c4ea90eb06e7187fd150ef098baed02467eeb374afb17 F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad F doc/lemon.html ac63db056bce24b7368e29319cd1a7eb5f1798cc85922d96a80b6c3a4ff9f51b F doc/pager-invariants.txt 27fed9a70ddad2088750c4a2b493b63853da2710 @@ -1731,7 +1731,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b37614a3670770919a7c7f8157c5fd6578d736447998640b52e5cef8174cadc2 -R 43b6e2e7bff8d43b71b0521d42db382b +P 0b485a571c805a5bc431a231a196ff6034342c6548d92b09c52814dd57c89c75 +R 5eaa6e915a0db5dfed9f95ded349d602 U drh -Z ba39774432820fe8ba51d6921586d213 +Z e9b1aa32b7571b8f9809363bacf9d1ed diff --git a/manifest.uuid b/manifest.uuid index 1d589ef851..92acaca48a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0b485a571c805a5bc431a231a196ff6034342c6548d92b09c52814dd57c89c75 \ No newline at end of file +6fd7e8ceb96981cff023653a54b85bea0e1da3d706cd9f4383f5c5533213ef4d \ No newline at end of file From dd2a8f5ee91a746114b41f0f39672a9e3cb2adc1 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 11 Jun 2018 21:33:08 +0000 Subject: [PATCH 07/17] Improvements to the --enable and --disable options for the amalgamation tarball. FossilOrigin-Name: 02e337e0808947c7ef376b5a300cd3c461f1a368c9fe7ffd7ca5744f102641c2 --- autoconf/Makefile.am | 3 +-- autoconf/configure.ac | 63 ++++++++++++++++++++++++++++++------------- manifest | 14 +++++----- manifest.uuid | 2 +- 4 files changed, 54 insertions(+), 28 deletions(-) diff --git a/autoconf/Makefile.am b/autoconf/Makefile.am index a9a8d803dc..20af7433be 100644 --- a/autoconf/Makefile.am +++ b/autoconf/Makefile.am @@ -1,6 +1,5 @@ -AM_CFLAGS = @THREADSAFE_FLAGS@ @DYNAMIC_EXTENSION_FLAGS@ @FTS5_FLAGS@ @JSON1_FLAGS@ @ZLIB_FLAGS@ @SESSION_FLAGS@ -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE @DEBUG_FLAGS@ - +AM_CFLAGS = @BUILD_CFLAGS@ lib_LTLIBRARIES = libsqlite3.la libsqlite3_la_SOURCES = sqlite3.c libsqlite3_la_LDFLAGS = -no-undefined -version-info 8:6:8 diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 76579c0a55..9c23492f95 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -29,6 +29,7 @@ AC_CHECK_FUNCS([fdatasync usleep fullfsync localtime_r gmtime_r]) AC_FUNC_STRERROR_R AC_CONFIG_FILES([Makefile sqlite3.pc]) +BUILD_CFLAGS= AC_SUBST(BUILD_CFLAGS) #------------------------------------------------------------------------- @@ -86,13 +87,11 @@ AC_SUBST(READLINE_LIBS) AC_ARG_ENABLE(threadsafe, [AS_HELP_STRING( [--enable-threadsafe], [build a thread-safe library [default=yes]])], [], [enable_threadsafe=yes]) -THREADSAFE_FLAGS=-DSQLITE_THREADSAFE=0 if test x"$enable_threadsafe" != "xno"; then - THREADSAFE_FLAGS="-D_REENTRANT=1 -DSQLITE_THREADSAFE=1" + BUILD_CFLAGS="$BUILD_CFLAGS -D_REENTRANT=1 -DSQLITE_THREADSAFE=1" AC_SEARCH_LIBS(pthread_create, pthread) AC_SEARCH_LIBS(pthread_mutexattr_init, pthread) fi -AC_SUBST(THREADSAFE_FLAGS) #----------------------------------------------------------------------- #----------------------------------------------------------------------- @@ -104,11 +103,32 @@ AC_ARG_ENABLE(dynamic-extensions, [AS_HELP_STRING( if test x"$enable_dynamic_extensions" != "xno"; then AC_SEARCH_LIBS(dlopen, dl) else - DYNAMIC_EXTENSION_FLAGS=-DSQLITE_OMIT_LOAD_EXTENSION=1 + BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_OMIT_LOAD_EXTENSION=1" fi AC_MSG_CHECKING([for whether to support dynamic extensions]) AC_MSG_RESULT($enable_dynamic_extensions) -AC_SUBST(DYNAMIC_EXTENSION_FLAGS) +#----------------------------------------------------------------------- + +#----------------------------------------------------------------------- +# --enable-fts4 +# +AC_ARG_ENABLE(fts4, [AS_HELP_STRING( + [--enable-fts4], [include fts4 support [default=yes]])], + [], [enable_fts4=yes]) +if test x"$enable_fts4" = "xyes"; then + BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_FTS4" +fi +#----------------------------------------------------------------------- + +#----------------------------------------------------------------------- +# --enable-fts3 +# +AC_ARG_ENABLE(fts3, [AS_HELP_STRING( + [--enable-fts3], [include fts3 support [default=no]])], + [], []) +if test x"$enable_fts3" = "xyes" -a x"$enable_fts4" = "xno"; then + BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_FTS3" +fi #----------------------------------------------------------------------- #----------------------------------------------------------------------- @@ -119,9 +139,8 @@ AC_ARG_ENABLE(fts5, [AS_HELP_STRING( [], [enable_fts5=yes]) if test x"$enable_fts5" = "xyes"; then AC_SEARCH_LIBS(log, m) - FTS5_FLAGS=-DSQLITE_ENABLE_FTS5 + BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_FTS5" fi -AC_SUBST(FTS5_FLAGS) #----------------------------------------------------------------------- #----------------------------------------------------------------------- @@ -129,11 +148,21 @@ AC_SUBST(FTS5_FLAGS) # AC_ARG_ENABLE(json1, [AS_HELP_STRING( [--enable-json1], [include json1 support [default=yes]])], - [], [enable_json1=yes]) + [],[enable_json1=yes]) if test x"$enable_json1" = "xyes"; then - JSON1_FLAGS=-DSQLITE_ENABLE_JSON1 + BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_JSON1" +fi +#----------------------------------------------------------------------- + +#----------------------------------------------------------------------- +# --enable-rtree +# +AC_ARG_ENABLE(rtree, [AS_HELP_STRING( + [--enable-rtree], [include rtree support [default=yes]])], + [], [enable_rtree=yes]) +if test x"$enable_rtree" = "xyes"; then + BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_RTREE" fi -AC_SUBST(JSON1_FLAGS) #----------------------------------------------------------------------- #----------------------------------------------------------------------- @@ -141,11 +170,10 @@ AC_SUBST(JSON1_FLAGS) # AC_ARG_ENABLE(session, [AS_HELP_STRING( [--enable-session], [enable the session extension [default=no]])], - [], [enable_session=no]) + [], []) if test x"$enable_session" = "xyes"; then - SESSION_FLAGS="-DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK" + BUILD_CFLAGS="$BUILD_CFLAGS-DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK" fi -AC_SUBST(SESSION_FLAGS) #----------------------------------------------------------------------- #----------------------------------------------------------------------- @@ -153,11 +181,11 @@ AC_SUBST(SESSION_FLAGS) # AC_ARG_ENABLE(debug, [AS_HELP_STRING( [--enable-debug], [build with debugging features enabled [default=no]])], - [], [enable_debug=no]) + [], []) if test x"$enable_debug" = "xyes"; then - DEBUG_FLAGS="-DSQLITE_DEBUG -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE" + BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_DEBUG -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE" + CFLAGS="-g -O0" fi -AC_SUBST(DEBUG_FLAGS) #----------------------------------------------------------------------- #----------------------------------------------------------------------- @@ -177,9 +205,8 @@ AC_SUBST(EXTRA_SHELL_OBJ) AC_CHECK_FUNCS(posix_fallocate) AC_CHECK_HEADERS(zlib.h,[ - AC_SEARCH_LIBS(deflate,z,[ZLIB_FLAGS="-DSQLITE_HAVE_ZLIB"]) + AC_SEARCH_LIBS(deflate,z,[BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_HAVE_ZLIB"]) ]) -AC_SUBST(ZLIB_FLAGS) AC_SEARCH_LIBS(system,,,[SHELL_CFLAGS="-DSQLITE_NOHAVE_SYSTEM"]) AC_SUBST(SHELL_CFLAGS) diff --git a/manifest b/manifest index cf800859f4..9176c582c2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\svarious\s--enable\sand\s--disable\soptions\son\sthe\stop-level\sconfigure\nscript. -D 2018-06-11T19:47:14.809 +C Improvements\sto\sthe\s--enable\sand\s--disable\soptions\sfor\sthe\namalgamation\starball. +D 2018-06-11T21:33:08.080 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in bfc40f350586923e0419d2ea4b559c37ec10ee4b6e210e08c14401f8e340f0da @@ -12,12 +12,12 @@ F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 -F autoconf/Makefile.am 465fb475ee5a4b8a63d26c889cb36a4edbff0325b6859eb29a13cdf5c91b005c +F autoconf/Makefile.am e14b629addaa1ce372b72043f28f40de2e32b7e211b6e0fc18dbb87989197e40 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac F autoconf/Makefile.msc 6a46d0659d6e4a25346102bcba40a7fb4b0b8b2dc4faabdf0187488c6dd580d6 F autoconf/README.first 6c4f34fe115ff55d4e8dbfa3cecf04a0188292f7 F autoconf/README.txt 4f04b0819303aabaa35fff5f7b257fb0c1ef95f1 -F autoconf/configure.ac ac680e441d5dd8a55b66fc73cfd7a3c5adb39729ea2af4811f023c3c516057e4 +F autoconf/configure.ac 573b98629d6963e6d9bf2897c3f4708fb94ce49897822526ad268181875e1736 F autoconf/tea/Makefile.in b438a7020446c8a8156e8d97c8914a04833da6fd F autoconf/tea/README 3e9a3c060f29a44344ab50aec506f4db903fb873 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 @@ -1731,7 +1731,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 0b485a571c805a5bc431a231a196ff6034342c6548d92b09c52814dd57c89c75 -R 5eaa6e915a0db5dfed9f95ded349d602 +P 6fd7e8ceb96981cff023653a54b85bea0e1da3d706cd9f4383f5c5533213ef4d +R 414ca9989648294f080d634663eec938 U drh -Z e9b1aa32b7571b8f9809363bacf9d1ed +Z a4f0ce66e9a0dbb0022d99959c8bd004 diff --git a/manifest.uuid b/manifest.uuid index 92acaca48a..a4be908981 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6fd7e8ceb96981cff023653a54b85bea0e1da3d706cd9f4383f5c5533213ef4d \ No newline at end of file +02e337e0808947c7ef376b5a300cd3c461f1a368c9fe7ffd7ca5744f102641c2 \ No newline at end of file From cd9e01427d1c0c2cf8126504389ed81a50e179fe Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 12 Jun 2018 13:16:57 +0000 Subject: [PATCH 08/17] Fix the "Synopsis" on the OP_BitNot opcode. FossilOrigin-Name: acd78df61188591d33ddb9b1b8c16bcc015f4dffac66314529caa747d4395c70 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/vdbe.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 9176c582c2..080168b890 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improvements\sto\sthe\s--enable\sand\s--disable\soptions\sfor\sthe\namalgamation\starball. -D 2018-06-11T21:33:08.080 +C Fix\sthe\s"Synopsis"\son\sthe\sOP_BitNot\sopcode. +D 2018-06-12T13:16:57.062 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in bfc40f350586923e0419d2ea4b559c37ec10ee4b6e210e08c14401f8e340f0da @@ -565,7 +565,7 @@ F src/upsert.c 47edd408cc73f8d3c00a140550d1ad180b407c146285947969dd09874802bf88 F src/utf.c 810fbfebe12359f10bc2a011520a6e10879ab2a163bcb26c74768eab82ea62a5 F src/util.c d9eb0a6c4aae1b00a7369eadd7ca0bbe946cb4c953b6751aa20d357c2f482157 F src/vacuum.c 36e7d21a20c0bf6ef4ef7c399d192b5239410b7c4d3c1070fba4e30810d0b855 -F src/vdbe.c e0ac1d7cff72b4e8b250c5e698f0fc43f0c8b5a8f35654716d8ab1fa89db669e +F src/vdbe.c eb9588981fdab2c5a3ac3aaccf6d0289d49c23efb67e01791abf870841b76a3a F src/vdbe.h 9c8c245fa3785266c269ab02c135c836ff49a307612186686bcdae500f409945 F src/vdbeInt.h 8ebc37ead2cfde92a63d74e3940fe0a94d456078c77e6cefbc2ecf15630f9fda F src/vdbeapi.c 765a0bbe01311626417de6cb743f7f25f9f98435c98a9df4bb0714d11014633d @@ -1731,7 +1731,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 6fd7e8ceb96981cff023653a54b85bea0e1da3d706cd9f4383f5c5533213ef4d -R 414ca9989648294f080d634663eec938 +P 02e337e0808947c7ef376b5a300cd3c461f1a368c9fe7ffd7ca5744f102641c2 +R 2591c22cb15e250fcbdde34025ae1c5c U drh -Z a4f0ce66e9a0dbb0022d99959c8bd004 +Z ff6163391180b8bdeebeb47ffcfc1ba4 diff --git a/manifest.uuid b/manifest.uuid index a4be908981..f62837562a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -02e337e0808947c7ef376b5a300cd3c461f1a368c9fe7ffd7ca5744f102641c2 \ No newline at end of file +acd78df61188591d33ddb9b1b8c16bcc015f4dffac66314529caa747d4395c70 \ No newline at end of file diff --git a/src/vdbe.c b/src/vdbe.c index f65068672c..13d9e9c9a9 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -2257,7 +2257,7 @@ case OP_Not: { /* same as TK_NOT, in1, out2 */ } /* Opcode: BitNot P1 P2 * * * -** Synopsis: r[P1]= ~r[P1] +** Synopsis: r[P2]= ~r[P1] ** ** Interpret the content of register P1 as an integer. Store the ** ones-complement of the P1 value into register P2. If P1 holds From 58773a533c2b49c1897a6ef4239f0ed8f340a7ca Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 12 Jun 2018 13:52:23 +0000 Subject: [PATCH 09/17] Improvements to SCopy correctness tracking when SQLITE_DEBUG is enabled. FossilOrigin-Name: b2973f2357a2c5e22e0d612c970adbc6d51cbc5e4ff7ac6d2b678722e553e8ec --- manifest | 20 ++++++++++---------- manifest.uuid | 2 +- src/vdbe.c | 5 ++++- src/vdbeInt.h | 2 +- src/vdbeapi.c | 5 ++++- src/vdbeaux.c | 3 +++ src/vdbemem.c | 2 +- 7 files changed, 24 insertions(+), 15 deletions(-) diff --git a/manifest b/manifest index 080168b890..10c89ed3bd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\s"Synopsis"\son\sthe\sOP_BitNot\sopcode. -D 2018-06-12T13:16:57.062 +C Improvements\sto\sSCopy\scorrectness\stracking\swhen\sSQLITE_DEBUG\sis\senabled. +D 2018-06-12T13:52:23.858 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in bfc40f350586923e0419d2ea4b559c37ec10ee4b6e210e08c14401f8e340f0da @@ -565,13 +565,13 @@ F src/upsert.c 47edd408cc73f8d3c00a140550d1ad180b407c146285947969dd09874802bf88 F src/utf.c 810fbfebe12359f10bc2a011520a6e10879ab2a163bcb26c74768eab82ea62a5 F src/util.c d9eb0a6c4aae1b00a7369eadd7ca0bbe946cb4c953b6751aa20d357c2f482157 F src/vacuum.c 36e7d21a20c0bf6ef4ef7c399d192b5239410b7c4d3c1070fba4e30810d0b855 -F src/vdbe.c eb9588981fdab2c5a3ac3aaccf6d0289d49c23efb67e01791abf870841b76a3a +F src/vdbe.c 7509cbdad75624ed397e581210db27cb2c99882a40cd1c3c2948641220a14a48 F src/vdbe.h 9c8c245fa3785266c269ab02c135c836ff49a307612186686bcdae500f409945 -F src/vdbeInt.h 8ebc37ead2cfde92a63d74e3940fe0a94d456078c77e6cefbc2ecf15630f9fda -F src/vdbeapi.c 765a0bbe01311626417de6cb743f7f25f9f98435c98a9df4bb0714d11014633d -F src/vdbeaux.c 0e7af8614c87dd25bc2395d22c847deba96ff87d19758d5cd7f459a466f14cbb +F src/vdbeInt.h 4531c172f8a51f90e3dcb8f49531ab64b17ad3aef85d19a6e8c925c2ddf59c66 +F src/vdbeapi.c af4a3de00d1851bcbc55b85dfbe52849aa2b1e17b4a5a1f3d9c257df7af361ff +F src/vdbeaux.c c2d65c763b0811afe409e02e9d0d1f300c6e97892474fc94eec3da71955cd418 F src/vdbeblob.c f5c70f973ea3a9e915d1693278a5f890dc78594300cf4d54e64f2b0917c94191 -F src/vdbemem.c 613cbbcca8d21c66df311fc17f9460180abcf7a909e12493618fd570f9858036 +F src/vdbemem.c e042161c85e1ce03ca9237e67e59c8381bc585ac6eaeae272f096f59ba4ec4be F src/vdbesort.c 731a09e5cb9e96b70c394c1b7cf3860fbe84acca7682e178615eb941a3a0ef2f F src/vdbetrace.c 79d6dbbc479267b255a7de8080eee6e729928a0ef93ed9b0bfa5618875b48392 F src/vtab.c 10ea07dec111de6fb0a4fc87a7ffa4c65fdc088a19dbfaf7d6f2b128f2e8eb7b @@ -1731,7 +1731,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 02e337e0808947c7ef376b5a300cd3c461f1a368c9fe7ffd7ca5744f102641c2 -R 2591c22cb15e250fcbdde34025ae1c5c +P acd78df61188591d33ddb9b1b8c16bcc015f4dffac66314529caa747d4395c70 +R 93c40cd2c3858b20bb206e515693fb00 U drh -Z ff6163391180b8bdeebeb47ffcfc1ba4 +Z 26ce7d0e08fb2667e584724fb5000334 diff --git a/manifest.uuid b/manifest.uuid index f62837562a..826912931d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -acd78df61188591d33ddb9b1b8c16bcc015f4dffac66314529caa747d4395c70 \ No newline at end of file +b2973f2357a2c5e22e0d612c970adbc6d51cbc5e4ff7ac6d2b678722e553e8ec \ No newline at end of file diff --git a/src/vdbe.c b/src/vdbe.c index 13d9e9c9a9..6cdfadb563 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -1276,10 +1276,12 @@ case OP_Copy: { pOut = &aMem[pOp->p2]; assert( pOut!=pIn1 ); while( 1 ){ + memAboutToChange(p, pOut); sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem); Deephemeralize(pOut); #ifdef SQLITE_DEBUG pOut->pScopyFrom = 0; + pOut->iTabColHash = 0; #endif REGISTER_TRACE(pOp->p2+pOp->p3-n, pOut); if( (n--)==0 ) break; @@ -1308,7 +1310,8 @@ case OP_SCopy: { /* out2 */ assert( pOut!=pIn1 ); sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem); #ifdef SQLITE_DEBUG - if( pOut->pScopyFrom==0 ) pOut->pScopyFrom = pIn1; + pOut->pScopyFrom = pIn1; + pOut->mScopyFlags = pIn1->flags; #endif break; } diff --git a/src/vdbeInt.h b/src/vdbeInt.h index c883ce8b50..7bc56c0e39 100644 --- a/src/vdbeInt.h +++ b/src/vdbeInt.h @@ -209,7 +209,7 @@ struct sqlite3_value { void (*xDel)(void*);/* Destructor for Mem.z - only valid if MEM_Dyn */ #ifdef SQLITE_DEBUG Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */ - void *pFiller; /* So that sizeof(Mem) is a multiple of 8 */ + u16 mScopyFlags; /* flags value immediately after the shallow copy */ #endif #ifdef SQLITE_DEBUG_COLUMNCACHE u32 iTabColHash; /* Hash of table.column that is origin of this value */ diff --git a/src/vdbeapi.c b/src/vdbeapi.c index ced3e90144..fcc315bc65 100644 --- a/src/vdbeapi.c +++ b/src/vdbeapi.c @@ -970,7 +970,10 @@ static const Mem *columnNullValue(void){ /* .xDel = */ (void(*)(void*))0, #ifdef SQLITE_DEBUG /* .pScopyFrom = */ (Mem*)0, - /* .pFiller = */ (void*)0, + /* .mScopyFlags= */ 0, +#endif +#ifdef SQLITE_DEBUG_COLUMNCACHE + /* .iTabColHash= */ 0, #endif }; return &nullMem; diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 856cad7649..d6efead321 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -1646,6 +1646,9 @@ static void initMemArray(Mem *p, int N, sqlite3 *db, u16 flags){ p->szMalloc = 0; #ifdef SQLITE_DEBUG p->pScopyFrom = 0; +#endif +#ifdef SQLITE_DEBUG_COLUMNCACHE + p->iTabColHash = 0; #endif p++; } diff --git a/src/vdbemem.c b/src/vdbemem.c index 5ce4bca79d..06dc28eacb 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -892,7 +892,7 @@ void sqlite3VdbeMemAboutToChange(Vdbe *pVdbe, Mem *pMem){ ** function for pX. Minor changes, such as adding or removing a ** dual type, are allowed, as long as the underlying value is the ** same. */ - u16 mFlags = pMem->flags & pX->flags; + u16 mFlags = pMem->flags & pX->flags & pX->mScopyFlags; assert( (mFlags&MEM_Int)==0 || pMem->u.i==pX->u.i ); assert( (mFlags&MEM_Real)==0 || pMem->u.r==pX->u.r ); assert( (mFlags&MEM_Str)==0 || (pMem->n==pX->n && pMem->z==pX->z) ); From 3086529f7c4b59e0f868aae01c302a3c81e4683c Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 12 Jun 2018 19:22:30 +0000 Subject: [PATCH 10/17] Documentation updates: clarify the behavior of sqlite3_column and sqlite3_value interfaces following an OOM error. FossilOrigin-Name: 428c581e4bed1d140cfb670633c9c61b36be7bb30a862d2e1ae7eaee26dccb4f --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/sqlite.h.in | 46 +++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 48 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 10c89ed3bd..86f566af13 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improvements\sto\sSCopy\scorrectness\stracking\swhen\sSQLITE_DEBUG\sis\senabled. -D 2018-06-12T13:52:23.858 +C Documentation\supdates:\sclarify\sthe\sbehavior\sof\ssqlite3_column\sand\nsqlite3_value\sinterfaces\sfollowing\san\sOOM\serror. +D 2018-06-12T19:22:30.391 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in bfc40f350586923e0419d2ea4b559c37ec10ee4b6e210e08c14401f8e340f0da @@ -497,7 +497,7 @@ F src/resolve.c 14602f46800ba182ea6a490e0f304127d29ac1f724bdadcc639e25d3223fcf6e F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac F src/select.c 8d3176c5258cc83942815ebe75b4c1f8dcf62b5e0f4d37373a14ebf23c046f9f F src/shell.c.in 4d0ddf10c403710d241bf920163dcf032c21119aebb61e70840942c0eafecdf9 -F src/sqlite.h.in 63b07f76731f2b1e55c48fdb9f0508dcc6fbe3971010b8612ffd847c3c56d9a1 +F src/sqlite.h.in fd614975549a6b5904de35af89fd2d55fe35b4c170d0b355980d7e5872a2d30d F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 9887b27e69c01e79c2cbe74ef73bf01af5b5703d6a7f0a4371e386d7249cb1c7 F src/sqliteInt.h c8d304712b6b4e2150cbb5355b1a80427eee7b3ea1a6b5827afadf557360d7fe @@ -1731,7 +1731,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P acd78df61188591d33ddb9b1b8c16bcc015f4dffac66314529caa747d4395c70 -R 93c40cd2c3858b20bb206e515693fb00 +P b2973f2357a2c5e22e0d612c970adbc6d51cbc5e4ff7ac6d2b678722e553e8ec +R 96ea65e1b8fd0c732cdc45dee2871747 U drh -Z 26ce7d0e08fb2667e584724fb5000334 +Z 40fdbbb1f5ad70e2a7a00adf1e075458 diff --git a/manifest.uuid b/manifest.uuid index 826912931d..9bf43ac027 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b2973f2357a2c5e22e0d612c970adbc6d51cbc5e4ff7ac6d2b678722e553e8ec \ No newline at end of file +428c581e4bed1d140cfb670633c9c61b36be7bb30a862d2e1ae7eaee26dccb4f \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 3d2effa5b7..ce27c99077 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -4514,11 +4514,25 @@ int sqlite3_data_count(sqlite3_stmt *pStmt); ** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into ** [sqlite3_free()]. ** -** ^(If a memory allocation error occurs during the evaluation of any -** of these routines, a default value is returned. The default value -** is either the integer 0, the floating point number 0.0, or a NULL -** pointer. Subsequent calls to [sqlite3_errcode()] will return -** [SQLITE_NOMEM].)^ +** As long as the input parameters are correct, these routines will only +** fail if an out-of-memory error occurs during a format conversion. +** Only the following subset of interfaces are subject to out-of-memory +** errors: +** +**
    +**
  • sqlite3_column_blob() +**
  • sqlite3_column_text() +**
  • sqlite3_column_text16() +**
  • sqlite3_column_bytes() +**
  • sqlite3_column_bytes16() +**
+** +** If an out-of-memory error occurs, then the return value from these +** routines is the same as if the column had contained an SQL NULL value. +** Valid SQL NULL returns can be distinguished from out-of-memory errors +** by invoking the [sqlite3_errcode()] immediately after the suspect +** return value is obtained and before any +** other SQLite interface is called on the same [database connection]. */ const void *sqlite3_column_blob(sqlite3_stmt*, int iCol); double sqlite3_column_double(sqlite3_stmt*, int iCol); @@ -4857,6 +4871,28 @@ SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int), ** ** These routines must be called from the same thread as ** the SQL function that supplied the [sqlite3_value*] parameters. +** +** As long as the input parameter is correct, these routines can only +** fail if an out-of-memory error occurs during a format conversion. +** Only the following subset of interfaces are subject to out-of-memory +** errors: +** +**
    +**
  • sqlite3_value_blob() +**
  • sqlite3_value_text() +**
  • sqlite3_value_text16() +**
  • sqlite3_value_text16le() +**
  • sqlite3_value_text16be() +**
  • sqlite3_value_bytes() +**
  • sqlite3_value_bytes16() +**
+** +** If an out-of-memory error occurs, then the return value from these +** routines is the same as if the column had contained an SQL NULL value. +** Valid SQL NULL returns can be distinguished from out-of-memory errors +** by invoking the [sqlite3_errcode()] immediately after the suspect +** return value is obtained and before any +** other SQLite interface is called on the same [database connection]. */ const void *sqlite3_value_blob(sqlite3_value*); double sqlite3_value_double(sqlite3_value*); From 5174f1748585e6821609d77cc5b7e9417a12683f Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 12 Jun 2018 19:35:51 +0000 Subject: [PATCH 11/17] Documentation update: clarify that sqlite3_errcode() and related interfaces do not themselves modify the error code. FossilOrigin-Name: 858fc52b237702b5e0381eebf5c158bffd7371ff0053a8583b8c175f8f691c82 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/sqlite.h.in | 15 +++++++++++++-- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 86f566af13..f0f9b3da66 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Documentation\supdates:\sclarify\sthe\sbehavior\sof\ssqlite3_column\sand\nsqlite3_value\sinterfaces\sfollowing\san\sOOM\serror. -D 2018-06-12T19:22:30.391 +C Documentation\supdate:\sclarify\sthat\ssqlite3_errcode()\sand\srelated\sinterfaces\ndo\snot\sthemselves\smodify\sthe\serror\scode. +D 2018-06-12T19:35:51.264 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in bfc40f350586923e0419d2ea4b559c37ec10ee4b6e210e08c14401f8e340f0da @@ -497,7 +497,7 @@ F src/resolve.c 14602f46800ba182ea6a490e0f304127d29ac1f724bdadcc639e25d3223fcf6e F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac F src/select.c 8d3176c5258cc83942815ebe75b4c1f8dcf62b5e0f4d37373a14ebf23c046f9f F src/shell.c.in 4d0ddf10c403710d241bf920163dcf032c21119aebb61e70840942c0eafecdf9 -F src/sqlite.h.in fd614975549a6b5904de35af89fd2d55fe35b4c170d0b355980d7e5872a2d30d +F src/sqlite.h.in 010a4df00a7bd39df8370c7201c4a703c90993459c1f3034502943f2a7756934 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 9887b27e69c01e79c2cbe74ef73bf01af5b5703d6a7f0a4371e386d7249cb1c7 F src/sqliteInt.h c8d304712b6b4e2150cbb5355b1a80427eee7b3ea1a6b5827afadf557360d7fe @@ -1731,7 +1731,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b2973f2357a2c5e22e0d612c970adbc6d51cbc5e4ff7ac6d2b678722e553e8ec -R 96ea65e1b8fd0c732cdc45dee2871747 +P 428c581e4bed1d140cfb670633c9c61b36be7bb30a862d2e1ae7eaee26dccb4f +R 3a85648f90f541ed681102c766f78d61 U drh -Z 40fdbbb1f5ad70e2a7a00adf1e075458 +Z 6d709d086e0bb2aa350c2050a2d0ad34 diff --git a/manifest.uuid b/manifest.uuid index 9bf43ac027..b575e1fa32 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -428c581e4bed1d140cfb670633c9c61b36be7bb30a862d2e1ae7eaee26dccb4f \ No newline at end of file +858fc52b237702b5e0381eebf5c158bffd7371ff0053a8583b8c175f8f691c82 \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index ce27c99077..7869b9d75e 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -3354,13 +3354,24 @@ sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64); ** [database connection] D failed, then the sqlite3_errcode(D) interface ** returns the numeric [result code] or [extended result code] for that ** API call. -** If the most recent API call was successful, -** then the return value from sqlite3_errcode() is undefined. ** ^The sqlite3_extended_errcode() ** interface is the same except that it always returns the ** [extended result code] even when extended result codes are ** disabled. ** +** The values returned by sqlite3_errcode() and/or +** sqlite3_extended_errcode() might change with each API call. +** Except, there are some interfaces that are guaranteed to never +** change the value of the error code. The error-code preserving +** interfaces are: +** +**
    +**
  • sqlite3_errcode() +**
  • sqlite3_extended_errcode() +**
  • sqlite3_errmsg() +**
  • sqlite3_errmsg16() +**
+** ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language ** text that describes the error, as either UTF-8 or UTF-16 respectively. ** ^(Memory to hold the error message string is managed internally. From ea74c1db6450d3a016f01d5c744addf671daf48f Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 13 Jun 2018 02:20:34 +0000 Subject: [PATCH 12/17] Add the unused SQLITE_CANTOPEN_DIRTYWAL result code. This code was used in some historical versions on the apple-osx branch but was removed by check-in [27e20d699872b2b8]. Restore it so that old code that actually references that result code will still compile. FossilOrigin-Name: 9f40383eed936a6921ef8dc94775eb55d03a761f36eda7be1b9cdd0a0d30fa80 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/sqlite.h.in | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index f0f9b3da66..f89b5ce859 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Documentation\supdate:\sclarify\sthat\ssqlite3_errcode()\sand\srelated\sinterfaces\ndo\snot\sthemselves\smodify\sthe\serror\scode. -D 2018-06-12T19:35:51.264 +C Add\sthe\sunused\sSQLITE_CANTOPEN_DIRTYWAL\sresult\scode.\s\sThis\scode\swas\sused\nin\ssome\shistorical\sversions\son\sthe\sapple-osx\sbranch\sbut\swas\sremoved\nby\scheck-in\s[27e20d699872b2b8].\s\sRestore\sit\sso\sthat\sold\scode\sthat\sactually\nreferences\sthat\sresult\scode\swill\sstill\scompile. +D 2018-06-13T02:20:34.202 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in bfc40f350586923e0419d2ea4b559c37ec10ee4b6e210e08c14401f8e340f0da @@ -497,7 +497,7 @@ F src/resolve.c 14602f46800ba182ea6a490e0f304127d29ac1f724bdadcc639e25d3223fcf6e F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac F src/select.c 8d3176c5258cc83942815ebe75b4c1f8dcf62b5e0f4d37373a14ebf23c046f9f F src/shell.c.in 4d0ddf10c403710d241bf920163dcf032c21119aebb61e70840942c0eafecdf9 -F src/sqlite.h.in 010a4df00a7bd39df8370c7201c4a703c90993459c1f3034502943f2a7756934 +F src/sqlite.h.in 19de593baa0667854730e7b8bc2e3039c20ee80a4d537e9b5ec2038947fe3daf F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 9887b27e69c01e79c2cbe74ef73bf01af5b5703d6a7f0a4371e386d7249cb1c7 F src/sqliteInt.h c8d304712b6b4e2150cbb5355b1a80427eee7b3ea1a6b5827afadf557360d7fe @@ -1731,7 +1731,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 428c581e4bed1d140cfb670633c9c61b36be7bb30a862d2e1ae7eaee26dccb4f -R 3a85648f90f541ed681102c766f78d61 +P 858fc52b237702b5e0381eebf5c158bffd7371ff0053a8583b8c175f8f691c82 +R 6ceedb097c0849604ae5e518ced6ab8b U drh -Z 6d709d086e0bb2aa350c2050a2d0ad34 +Z cf184defe88fa33ab23b824c945dcab2 diff --git a/manifest.uuid b/manifest.uuid index b575e1fa32..4f58cf42e5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -858fc52b237702b5e0381eebf5c158bffd7371ff0053a8583b8c175f8f691c82 \ No newline at end of file +9f40383eed936a6921ef8dc94775eb55d03a761f36eda7be1b9cdd0a0d30fa80 \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 7869b9d75e..7d664177e4 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -511,6 +511,7 @@ int sqlite3_exec( #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) #define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8)) #define SQLITE_CANTOPEN_CONVPATH (SQLITE_CANTOPEN | (4<<8)) +#define SQLITE_CANTOPEN_DIRTYWAL (SQLITE_CANTOPEN | (5<<8)) /* Not Used */ #define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8)) #define SQLITE_CORRUPT_SEQUENCE (SQLITE_CORRUPT | (2<<8)) #define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) From 466ea9b1e20d38b1893612707bc0470316c4e56c Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 13 Jun 2018 11:11:13 +0000 Subject: [PATCH 13/17] Check that malloc() has not already failed when invoking the xUpdate() method of a virtual table implementation. This fixes an assert() failure in FTS5 that could occur following an OOM condition. FossilOrigin-Name: e9a7e4d58f3716991309ca0e3f080717e473c7c231685954aceee36172f19cf2 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/vdbe.c | 1 + test/releasetest.tcl | 1 + 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index f89b5ce859..a23bb3a5a5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\sunused\sSQLITE_CANTOPEN_DIRTYWAL\sresult\scode.\s\sThis\scode\swas\sused\nin\ssome\shistorical\sversions\son\sthe\sapple-osx\sbranch\sbut\swas\sremoved\nby\scheck-in\s[27e20d699872b2b8].\s\sRestore\sit\sso\sthat\sold\scode\sthat\sactually\nreferences\sthat\sresult\scode\swill\sstill\scompile. -D 2018-06-13T02:20:34.202 +C Check\sthat\smalloc()\shas\snot\salready\sfailed\swhen\sinvoking\sthe\sxUpdate()\smethod\nof\sa\svirtual\stable\simplementation.\sThis\sfixes\san\sassert()\sfailure\sin\sFTS5\sthat\ncould\soccur\sfollowing\san\sOOM\scondition. +D 2018-06-13T11:11:13.092 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in bfc40f350586923e0419d2ea4b559c37ec10ee4b6e210e08c14401f8e340f0da @@ -565,7 +565,7 @@ F src/upsert.c 47edd408cc73f8d3c00a140550d1ad180b407c146285947969dd09874802bf88 F src/utf.c 810fbfebe12359f10bc2a011520a6e10879ab2a163bcb26c74768eab82ea62a5 F src/util.c d9eb0a6c4aae1b00a7369eadd7ca0bbe946cb4c953b6751aa20d357c2f482157 F src/vacuum.c 36e7d21a20c0bf6ef4ef7c399d192b5239410b7c4d3c1070fba4e30810d0b855 -F src/vdbe.c 7509cbdad75624ed397e581210db27cb2c99882a40cd1c3c2948641220a14a48 +F src/vdbe.c f1bf4e51bcbea0f63174bee5da822d112970a547c06bf6cfb45f77fe6ebd6541 F src/vdbe.h 9c8c245fa3785266c269ab02c135c836ff49a307612186686bcdae500f409945 F src/vdbeInt.h 4531c172f8a51f90e3dcb8f49531ab64b17ad3aef85d19a6e8c925c2ddf59c66 F src/vdbeapi.c af4a3de00d1851bcbc55b85dfbe52849aa2b1e17b4a5a1f3d9c257df7af361ff @@ -1173,7 +1173,7 @@ F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8 F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/regexp2.test 40e894223b3d6672655481493f1be12012f2b33c F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 5f15ab8056799e9a6e26a310d49236d2e774d6a30d0ec74601e18d4ce146b79c x +F test/releasetest.tcl 769892f81050b3f59c66f274d478d855159b474ea27019dec82f1215c0b91ef7 x F test/resetdb.test 2107b34a8c437183f48eb833905df43818160a55f4ac69bbaf54f356fb2b27bd F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb F test/rollback.test 06680159bc6746d0f26276e339e3ae2f951c64812468308838e0a3362d911eaa @@ -1731,7 +1731,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 858fc52b237702b5e0381eebf5c158bffd7371ff0053a8583b8c175f8f691c82 -R 6ceedb097c0849604ae5e518ced6ab8b -U drh -Z cf184defe88fa33ab23b824c945dcab2 +P 9f40383eed936a6921ef8dc94775eb55d03a761f36eda7be1b9cdd0a0d30fa80 +R 4bafe6447638b15993b3f38fe7f8476f +U dan +Z 8be96dc0a0ca0b6fd2e41a312298600e diff --git a/manifest.uuid b/manifest.uuid index 4f58cf42e5..e5613edab7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9f40383eed936a6921ef8dc94775eb55d03a761f36eda7be1b9cdd0a0d30fa80 \ No newline at end of file +e9a7e4d58f3716991309ca0e3f080717e473c7c231685954aceee36172f19cf2 \ No newline at end of file diff --git a/src/vdbe.c b/src/vdbe.c index 6cdfadb563..823b034815 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -6999,6 +6999,7 @@ case OP_VUpdate: { || pOp->p5==OE_Abort || pOp->p5==OE_Ignore || pOp->p5==OE_Replace ); assert( p->readOnly==0 ); + if( db->mallocFailed ) goto no_mem; sqlite3VdbeIncrWriteCounter(p, 0); pVtab = pOp->p4.pVtab->pVtab; if( pVtab==0 || NEVER(pVtab->pModule==0) ){ diff --git a/test/releasetest.tcl b/test/releasetest.tcl index 01a0795bfa..65f6dadad9 100755 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -127,6 +127,7 @@ array set ::Configs [strip_comments { -DSQLITE_ENABLE_HIDDEN_COLUMNS -DSQLITE_MAX_ATTACHED=125 -DSQLITE_MUTATION_TEST + --enable-fts5 --enable-json1 } "Fast-One" { -O6 From 45f318275e32d40458a04ce7abe2220d891af744 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 13 Jun 2018 11:41:54 +0000 Subject: [PATCH 14/17] Unless SQLITE_OMIT_AUTOINIT is defined, allow sqlite3_vfs_unregister() to be called before sqlite3_initialize(). FossilOrigin-Name: ab6c1ae46d992f91ce0995274f48d545eb02ba92544aee89b188f2fc92b66f2a --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/os.c | 7 +++++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index a23bb3a5a5..74ce18fc90 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Check\sthat\smalloc()\shas\snot\salready\sfailed\swhen\sinvoking\sthe\sxUpdate()\smethod\nof\sa\svirtual\stable\simplementation.\sThis\sfixes\san\sassert()\sfailure\sin\sFTS5\sthat\ncould\soccur\sfollowing\san\sOOM\scondition. -D 2018-06-13T11:11:13.092 +C Unless\sSQLITE_OMIT_AUTOINIT\sis\sdefined,\sallow\ssqlite3_vfs_unregister()\sto\sbe\scalled\sbefore\ssqlite3_initialize(). +D 2018-06-13T11:41:54.985 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in bfc40f350586923e0419d2ea4b559c37ec10ee4b6e210e08c14401f8e340f0da @@ -475,7 +475,7 @@ F src/mutex_noop.c 9d4309c075ba9cc7249e19412d3d62f7f94839c4 F src/mutex_unix.c aaf9ebc3f89df28483c52208497a99a02cc3650011422fc9d4c57e4392f7fe58 F src/mutex_w32.c 7670d770c94bbfe8289bec9d7f1394c5a00a57c37f892aab6b6612d085255235 F src/notify.c 9711a7575036f0d3040ba61bc6e217f13a9888e7 -F src/os.c 1cb0d1d1b3a4267966dee6e292d2b2cdf88e47c0c59cebff27ecafac052dd165 +F src/os.c 8aeb0b0f40f8f5b0da03fe49706695adaf42d2f516ab95abc72e86c245e119de F src/os.h 48388821692e87da174ea198bf96b1b2d9d83be5dfc908f673ee21fafbe0d432 F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85 F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586 @@ -1731,7 +1731,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 9f40383eed936a6921ef8dc94775eb55d03a761f36eda7be1b9cdd0a0d30fa80 -R 4bafe6447638b15993b3f38fe7f8476f +P e9a7e4d58f3716991309ca0e3f080717e473c7c231685954aceee36172f19cf2 +R d7dfa92470fc9df634760f7f9970a415 U dan -Z 8be96dc0a0ca0b6fd2e41a312298600e +Z 362a89dcaaa9c414c5f78831d4181046 diff --git a/manifest.uuid b/manifest.uuid index e5613edab7..69bbb501ce 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e9a7e4d58f3716991309ca0e3f080717e473c7c231685954aceee36172f19cf2 \ No newline at end of file +ab6c1ae46d992f91ce0995274f48d545eb02ba92544aee89b188f2fc92b66f2a \ No newline at end of file diff --git a/src/os.c b/src/os.c index 997f97121f..54b7fcfb29 100644 --- a/src/os.c +++ b/src/os.c @@ -410,9 +410,12 @@ int sqlite3_vfs_register(sqlite3_vfs *pVfs, int makeDflt){ ** Unregister a VFS so that it is no longer accessible. */ int sqlite3_vfs_unregister(sqlite3_vfs *pVfs){ -#if SQLITE_THREADSAFE - sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); + MUTEX_LOGIC(sqlite3_mutex *mutex;) +#ifndef SQLITE_OMIT_AUTOINIT + int rc = sqlite3_initialize(); + if( rc ) return rc; #endif + MUTEX_LOGIC( mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); ) sqlite3_mutex_enter(mutex); vfsUnlink(pVfs); sqlite3_mutex_leave(mutex); From c5861ce88f39182f9e5325b137c5b574cd68ca0f Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 13 Jun 2018 16:08:22 +0000 Subject: [PATCH 15/17] Fix some test case numbers in expert1.test. FossilOrigin-Name: b90c3c16c04589583d2d1619320bb45a0b012c5960f23bd4e3f9dbe7c84b2eae --- ext/expert/expert1.test | 8 ++++---- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ext/expert/expert1.test b/ext/expert/expert1.test index d1564c513f..2b4668340d 100644 --- a/ext/expert/expert1.test +++ b/ext/expert/expert1.test @@ -332,7 +332,7 @@ proc do_candidates_test {tn sql res} { reset_db -do_execsql_test 3.0 { +do_execsql_test 4.0 { CREATE TABLE t1(a, b); CREATE TABLE t2(c, d); @@ -342,7 +342,7 @@ do_execsql_test 3.0 { WITH s(i) AS ( VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<100) INSERT INTO t2 SELECT (i-1)/20, (i-1)/5 FROM s; } -do_candidates_test 3.1 { +do_candidates_test 4.1 { SELECT * FROM t1,t2 WHERE (b=? OR a=?) AND (c=? OR d=?) } { CREATE INDEX t1_idx_00000062 ON t1(b); -- stat1: 100 20 @@ -351,14 +351,14 @@ do_candidates_test 3.1 { CREATE INDEX t2_idx_00000064 ON t2(d); -- stat1: 100 5 } -do_candidates_test 3.2 { +do_candidates_test 4.2 { SELECT * FROM t1,t2 WHERE a=? AND b=? AND c=? AND d=? } { CREATE INDEX t1_idx_000123a7 ON t1(a, b); -- stat1: 100 50 17 CREATE INDEX t2_idx_0001295b ON t2(c, d); -- stat1: 100 20 5 } -do_execsql_test 3.2 { +do_execsql_test 4.3 { CREATE INDEX t1_idx_00000061 ON t1(a); -- stat1: 100 50 CREATE INDEX t1_idx_00000062 ON t1(b); -- stat1: 100 20 CREATE INDEX t1_idx_000123a7 ON t1(a, b); -- stat1: 100 50 16 diff --git a/manifest b/manifest index 74ce18fc90..34c451f54a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Unless\sSQLITE_OMIT_AUTOINIT\sis\sdefined,\sallow\ssqlite3_vfs_unregister()\sto\sbe\scalled\sbefore\ssqlite3_initialize(). -D 2018-06-13T11:41:54.985 +C Fix\ssome\stest\scase\snumbers\sin\sexpert1.test. +D 2018-06-13T16:08:22.822 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in bfc40f350586923e0419d2ea4b559c37ec10ee4b6e210e08c14401f8e340f0da @@ -45,7 +45,7 @@ F ext/async/sqlite3async.c 0f3070cc3f5ede78f2b9361fb3b629ce200d7d74 F ext/async/sqlite3async.h f489b080af7e72aec0e1ee6f1d98ab6cf2e4dcef F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3 F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4 -F ext/expert/expert1.test baa05800dc1c569faa7ce6232cead0fcedc07fea038b3a2489eaaf710831d546 +F ext/expert/expert1.test 333d037021c901322f9afc4a5687648ea23d56f1a0a079358a390664babf01be F ext/expert/sqlite3expert.c 89b7b59be610b929958db02416539a46ac088fd84f81623c4190aff62e92c3c4 F ext/expert/sqlite3expert.h af6354f8ee5c9e025024e63fec3bd640a802afcc3099a44d804752cf0791d811 F ext/expert/test_expert.c d56c194b769bdc90cf829a14c9ecbc1edca9c850b837a4d0b13be14095c32a72 @@ -1731,7 +1731,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P e9a7e4d58f3716991309ca0e3f080717e473c7c231685954aceee36172f19cf2 -R d7dfa92470fc9df634760f7f9970a415 +P ab6c1ae46d992f91ce0995274f48d545eb02ba92544aee89b188f2fc92b66f2a +R 85658149b94ca61c586faa481cd99372 U dan -Z 362a89dcaaa9c414c5f78831d4181046 +Z 64438bc2ecaee7ab6a78fcd985e0d141 diff --git a/manifest.uuid b/manifest.uuid index 69bbb501ce..383f264d9d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ab6c1ae46d992f91ce0995274f48d545eb02ba92544aee89b188f2fc92b66f2a \ No newline at end of file +b90c3c16c04589583d2d1619320bb45a0b012c5960f23bd4e3f9dbe7c84b2eae \ No newline at end of file From 4449437b56f1000339628bff41dee0a38dfc865d Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 13 Jun 2018 16:52:38 +0000 Subject: [PATCH 16/17] Pad out the sqlite3_value structure to be a multiple of 8 bytes. FossilOrigin-Name: f76dc33bde4b2180b935d1261492d9535772ed37e54489c1a33e9f11c7c90433 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/vdbeInt.h | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 34c451f54a..004045a518 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\ssome\stest\scase\snumbers\sin\sexpert1.test. -D 2018-06-13T16:08:22.822 +C Pad\sout\sthe\ssqlite3_value\sstructure\sto\sbe\sa\smultiple\sof\s8\sbytes. +D 2018-06-13T16:52:38.060 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in bfc40f350586923e0419d2ea4b559c37ec10ee4b6e210e08c14401f8e340f0da @@ -567,7 +567,7 @@ F src/util.c d9eb0a6c4aae1b00a7369eadd7ca0bbe946cb4c953b6751aa20d357c2f482157 F src/vacuum.c 36e7d21a20c0bf6ef4ef7c399d192b5239410b7c4d3c1070fba4e30810d0b855 F src/vdbe.c f1bf4e51bcbea0f63174bee5da822d112970a547c06bf6cfb45f77fe6ebd6541 F src/vdbe.h 9c8c245fa3785266c269ab02c135c836ff49a307612186686bcdae500f409945 -F src/vdbeInt.h 4531c172f8a51f90e3dcb8f49531ab64b17ad3aef85d19a6e8c925c2ddf59c66 +F src/vdbeInt.h 5d6f9294e91b59cb961be2d31aacf7a2e76d18f4ad1277134c69bddf98c60510 F src/vdbeapi.c af4a3de00d1851bcbc55b85dfbe52849aa2b1e17b4a5a1f3d9c257df7af361ff F src/vdbeaux.c c2d65c763b0811afe409e02e9d0d1f300c6e97892474fc94eec3da71955cd418 F src/vdbeblob.c f5c70f973ea3a9e915d1693278a5f890dc78594300cf4d54e64f2b0917c94191 @@ -1731,7 +1731,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P ab6c1ae46d992f91ce0995274f48d545eb02ba92544aee89b188f2fc92b66f2a -R 85658149b94ca61c586faa481cd99372 -U dan -Z 64438bc2ecaee7ab6a78fcd985e0d141 +P b90c3c16c04589583d2d1619320bb45a0b012c5960f23bd4e3f9dbe7c84b2eae +R 26221cffdd1bdfa4d4238fbd0becde05 +U drh +Z 89bccdbe64906d0697d05ec9703d5907 diff --git a/manifest.uuid b/manifest.uuid index 383f264d9d..272693a03d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b90c3c16c04589583d2d1619320bb45a0b012c5960f23bd4e3f9dbe7c84b2eae \ No newline at end of file +f76dc33bde4b2180b935d1261492d9535772ed37e54489c1a33e9f11c7c90433 \ No newline at end of file diff --git a/src/vdbeInt.h b/src/vdbeInt.h index 7bc56c0e39..0b568098aa 100644 --- a/src/vdbeInt.h +++ b/src/vdbeInt.h @@ -213,6 +213,7 @@ struct sqlite3_value { #endif #ifdef SQLITE_DEBUG_COLUMNCACHE u32 iTabColHash; /* Hash of table.column that is origin of this value */ + u32 iPadding; /* sqlite3_value objects must be 8-byte aligned */ #endif }; From 2f1f8801ed7d3708de6fc4d669bc1aef43b3f524 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 13 Jun 2018 17:19:20 +0000 Subject: [PATCH 17/17] Output infinity as 1e999 in the ".dump" command of the command-line shell. FossilOrigin-Name: ee431d55eba618cfba414c3946b3162bc205a70dd4e43d74a7623be332b94c92 --- ext/misc/dbdump.c | 10 +++++++++- manifest | 14 +++++++------- manifest.uuid | 2 +- src/shell.c.in | 12 ++++++++++-- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/ext/misc/dbdump.c b/ext/misc/dbdump.c index 2ca34a1128..0b4b4bfafa 100644 --- a/ext/misc/dbdump.c +++ b/ext/misc/dbdump.c @@ -485,7 +485,15 @@ static int dump_callback(void *pArg, int nArg, char **azArg, char **azCol){ } case SQLITE_FLOAT: { double r = sqlite3_column_double(pStmt,i); - output_formatted(p, "%!.20g", r); + sqlite3_uint64 ur; + memcpy(&ur,&r,sizeof(r)); + if( ur==0x7ff0000000000000LL ){ + p->xCallback("1e999", p->pArg); + }else if( ur==0xfff0000000000000LL ){ + p->xCallback("-1e999", p->pArg); + }else{ + output_formatted(p, "%!.20g", r); + } break; } case SQLITE_NULL: { diff --git a/manifest b/manifest index 004045a518..c3e1711383 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Pad\sout\sthe\ssqlite3_value\sstructure\sto\sbe\sa\smultiple\sof\s8\sbytes. -D 2018-06-13T16:52:38.060 +C Output\sinfinity\sas\s1e999\sin\sthe\s".dump"\scommand\sof\sthe\scommand-line\sshell. +D 2018-06-13T17:19:20.239 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in bfc40f350586923e0419d2ea4b559c37ec10ee4b6e210e08c14401f8e340f0da @@ -276,7 +276,7 @@ F ext/misc/closure.c fe928228e8dfb2f00227311c203ccba9c2e5561f4f6de6da87e5b4a30cd F ext/misc/completion.c e75b8886a2531f9a7ec02dab5f179bb37e6bd46b5da7665a6cbf2dfbe2daa483 F ext/misc/compress.c dd4f8a6d0baccff3c694757db5b430f3bbd821d8686d1fc24df55cf9f035b189 F ext/misc/csv.c 65297bcce8d5acd5aadef42acbe739aef5a2ef5e74c7b73361ca19f3e21de657 -F ext/misc/dbdump.c 69ef1be5b210538f77dfcc6fcb55b4b5f5e98b1e0bcfd67d818711e10761db4d +F ext/misc/dbdump.c 12389a10c410fadf1e68eeb382def92d5a7fa9ce7cce4fb86a736fa2bac1000a F ext/misc/eval.c 6ea9b22a5fa0dd973b67ca4e53555be177bc0b7b263aadf1024429457c82c0e3 F ext/misc/fileio.c 48c7751c78fc4cdd29d8c862fd2f3f98bbfefa2a3cf1ca1496df4bf02eb8cded F ext/misc/fuzzer.c 7c64b8197bb77b7d64eff7cac7848870235d4c25 @@ -496,7 +496,7 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384 F src/resolve.c 14602f46800ba182ea6a490e0f304127d29ac1f724bdadcc639e25d3223fcf6e F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac F src/select.c 8d3176c5258cc83942815ebe75b4c1f8dcf62b5e0f4d37373a14ebf23c046f9f -F src/shell.c.in 4d0ddf10c403710d241bf920163dcf032c21119aebb61e70840942c0eafecdf9 +F src/shell.c.in 8578421c5fb2a972461b2a996f7173646e55e0dbd2a2eee30c8f5dc7d3dbadfd F src/sqlite.h.in 19de593baa0667854730e7b8bc2e3039c20ee80a4d537e9b5ec2038947fe3daf F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 9887b27e69c01e79c2cbe74ef73bf01af5b5703d6a7f0a4371e386d7249cb1c7 @@ -1731,7 +1731,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b90c3c16c04589583d2d1619320bb45a0b012c5960f23bd4e3f9dbe7c84b2eae -R 26221cffdd1bdfa4d4238fbd0becde05 +P f76dc33bde4b2180b935d1261492d9535772ed37e54489c1a33e9f11c7c90433 +R cf377e6954b0f56a42545b5a437be0b1 U drh -Z 89bccdbe64906d0697d05ec9703d5907 +Z e707adfe00192f8b9a5f1cf3f642b5c6 diff --git a/manifest.uuid b/manifest.uuid index 272693a03d..6ac44a56c4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f76dc33bde4b2180b935d1261492d9535772ed37e54489c1a33e9f11c7c90433 \ No newline at end of file +ee431d55eba618cfba414c3946b3162bc205a70dd4e43d74a7623be332b94c92 \ No newline at end of file diff --git a/src/shell.c.in b/src/shell.c.in index 392580733f..38a8991b9d 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -2033,8 +2033,16 @@ static int shell_callback( }else if( aiType && aiType[i]==SQLITE_FLOAT ){ char z[50]; double r = sqlite3_column_double(p->pStmt, i); - sqlite3_snprintf(50,z,"%!.20g", r); - raw_printf(p->out, "%s", z); + sqlite3_uint64 ur; + memcpy(&ur,&r,sizeof(r)); + if( ur==0x7ff0000000000000LL ){ + raw_printf(p->out, "1e999"); + }else if( ur==0xfff0000000000000LL ){ + raw_printf(p->out, "-1e999"); + }else{ + sqlite3_snprintf(50,z,"%!.20g", r); + raw_printf(p->out, "%s", z); + } }else if( aiType && aiType[i]==SQLITE_BLOB && p->pStmt ){ const void *pBlob = sqlite3_column_blob(p->pStmt, i); int nBlob = sqlite3_column_bytes(p->pStmt, i);