From 8883deb30eb6c31a1150bbc839b5420a52116bd7 Mon Sep 17 00:00:00 2001 From: stephan Date: Wed, 29 Jan 2025 11:08:11 +0000 Subject: [PATCH 01/54] Add experimental support to pause/unpause an SAHPool OPFS VFS, as discussed in [forum:fe8cdb8431c32455|forum post fe8cdb8431c32455], the intent being enable a page to relinquish, perhaps temporarily, the VFS such that the VFS's storage can be accessed by another page/tab. FossilOrigin-Name: 1d2683fe9e4be01c3137e750900f54d287e7d96185e66924d24b50f4647e7ef1 --- ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js | 71 ++++++++++++++++++- ext/wasm/tester1.c-pp.js | 8 ++- manifest | 19 ++--- manifest.uuid | 2 +- 4 files changed, 89 insertions(+), 11 deletions(-) diff --git a/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js b/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js index 6551b5c89c..ac18bd4543 100644 --- a/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js +++ b/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js @@ -832,12 +832,18 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ Removes this object's sqlite3_vfs registration and shuts down this object, releasing all handles, mappings, and whatnot, including deleting its data directory. There is currently no - way to "revive" the object and reaquire its resources. + way to "revive" the object and reaquire its + resources. Similarly, there is no recovery strategy if removal + of any given SAH fails, so such errors are ignored by this + function. This function is intended primarily for testing. Resolves to true if it did its job, false if the VFS has already been shut down. + + @see pauseVfs() + @see unpauseVfs() */ async removeVfs(){ if(!this.#cVfs.pointer || !this.#dhOpaque) return false; @@ -860,6 +866,65 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ } + /** + "Pauses" this VFS by unregistering it from SQLite and + relinquishing all open SAHs, leaving the associated files + intact. If this object is already paused, this is a + no-op. Returns this object. + + This function throws if any database handles are active, as the + alternative would be to invoke Undefined Behavior by closing + that file handle out from under the database. Similarly, + automatically closing any database handles opened by this VFS + would invoke Undefined Behavior in downstream code which is + holding those pointers. + + @see isPaused() + @see unpauseVfs() + */ + pauseVfs(){ + if(this.#mapS3FileToOFile_.size>0){ + toss("Cannot pause a VFS which has an opened database.") + } + if(this.#mapSAHToName.size>0){ + capi.sqlite3_vfs_unregister(this.vfsName); + this.releaseAccessHandles(); + } + return this; + } + + /** + Returns true if this pool is currently paused else false. + + @see pauseVfs() + @see unpauseVfs() + */ + isPaused(){ + return 0===this.#mapSAHToName.size; + } + + /** + "Unpauses" this VFS, reacquiring all SAH's and (if successful) + re-registering it with SQLite. This is a no-op if the VFS is + not currently paused. + + The returned Promise resolves to this function's argument, and + is intended solely for use by the OpfsSAHPoolUtil helper class. + + @see isPaused() + @see pauseVfs() + */ + async unpauseVfs(returnValue){ + if(0===this.#mapSAHToName.size){ + return this.acquireAccessHandles(false). + then(()=>{ + capi.sqlite3_vfs_register(this.#cVfs, 0); + return returnValue; + }); + } + return returnValue; + } + //! Documented elsewhere in this file. exportFile(name){ const sah = this.#mapFilenameToSAH.get(name) || toss("File not found:",name); @@ -984,6 +1049,10 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ async removeVfs(){ return this.#p.removeVfs() } + pauseVfs(){ this.#p.pauseVfs(); return this; } + async unpauseVfs(){ return this.#p.unpauseVfs(this); } + isPaused(){ return this.#p.isPaused() } + }/* class OpfsSAHPoolUtil */; /** diff --git a/ext/wasm/tester1.c-pp.js b/ext/wasm/tester1.c-pp.js index a21a1c330e..f5fff0cfc4 100644 --- a/ext/wasm/tester1.c-pp.js +++ b/ext/wasm/tester1.c-pp.js @@ -3154,8 +3154,14 @@ globalThis.sqlite3InitModule = sqlite3InitModule; db.close(); T.assert(1 === u1.getFileCount()); db = new u2.OpfsSAHPoolDb(dbName); - T.assert(1 === u1.getFileCount()); + T.assert(1 === u1.getFileCount()) + .mustThrow(()=>u2.pauseVfs(), "Cannot pause VFS with opened db."); db.close(); + T.assert( u2===u2.pauseVfs() ) + .assert( u2.isPaused() ) + .assert( 0===capi.sqlite3_vfs_find(u2.vfsName) ) + .assert( u2===await u2.unpauseVfs() ) + .assert( 0!==capi.sqlite3_vfs_find(u2.vfsName) ); const fileNames = u1.getFileNames(); T.assert(1 === fileNames.length) .assert(dbName === fileNames[0]) diff --git a/manifest b/manifest index 39bf2bf6db..4224ec1f0e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhance\sthe\sif()\sand\siif()\sSQL\sfunctions\sso\sthat\sthey\ssupport\sany\nnumber\sof\sarguments\sgreater\sthan\sor\sequal\sto\stwo.\nSuggested\sby\s[forum:/forumpost/40f7867f75f80|forum\spost\s40f7867f75f80]. -D 2025-01-28T20:32:48.256 +C Add\sexperimental\ssupport\sto\spause/unpause\san\sSAHPool\sOPFS\sVFS,\sas\sdiscussed\sin\s[forum:fe8cdb8431c32455|forum\spost\sfe8cdb8431c32455],\sthe\sintent\sbeing\senable\sa\spage\sto\srelinquish,\sperhaps\stemporarily,\sthe\sVFS\ssuch\sthat\sthe\sVFS's\sstorage\scan\sbe\saccessed\sby\sanother\spage/tab. +D 2025-01-29T11:08:11.315 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -645,7 +645,7 @@ F ext/wasm/api/sqlite3-api-worker1.c-pp.js 5cc22a3c0d52828cb32aad8691488719f47d2 F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89 F ext/wasm/api/sqlite3-opfs-async-proxy.js 3774befd97cd1a5e2895c8225a894aad946848c6d9b4028acc988b5d123475af F ext/wasm/api/sqlite3-vfs-helper.c-pp.js 3f828cc66758acb40e9c5b4dcfd87fd478a14c8fb7f0630264e6c7fa0e57515d -F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js bb5e96cd0fd6e1e54538256433f1c60a4e3095063c4d1a79a8a022fc59be9571 +F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 69755ca8d4fa8e71d5411e3eb08c3d73b5130b8cde547eb084ea806f398a1a24 F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 9b86ca2d8276cf919fbc9ba2a10e9786033b64f92c2db844d951804dee6c4b4e F ext/wasm/api/sqlite3-vtab-helper.c-pp.js e809739d71e8b35dfe1b55d24d91f02d04239e6aef7ca1ea92a15a29e704f616 F ext/wasm/api/sqlite3-wasm.c 83f5e9f998e9fa4261eb84e9f092210e3ffe03895119f5ded0429eb34ab9d2be @@ -696,7 +696,7 @@ F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555 F ext/wasm/test-opfs-vfs.js 1618670e466f424aa289859fe0ec8ded223e42e9e69b5c851f809baaaca1a00c F ext/wasm/tester1-worker.html ebc4b820a128963afce328ecf63ab200bd923309eb939f4110510ab449e9814c F ext/wasm/tester1.c-pp.html 1c1bc78b858af2019e663b1a31e76657b73dc24bede28ca92fbe917c3a972af2 -F ext/wasm/tester1.c-pp.js 228101c290003423f0bfb66a6ebbfc6904fa7b1b69466e700c135f74ee83d62a +F ext/wasm/tester1.c-pp.js 7f239383c06078fe67919509f7e1691d3b970a5f6cd4dc4adab71bc8e6cf6fe8 F ext/wasm/tests/opfs/concurrency/index.html 657578a6e9ce1e9b8be951549ed93a6a471f4520a99e5b545928668f4285fb5e F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65ad09f510589c779b7cc6a803a88 F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 @@ -2209,8 +2209,11 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 437fb316389bc3c24c5cdb4d01edfc81e2c2e9f2b399fc2a95b05d279361d8ec -R 79d5061e2e3bbb1ea5ad89bea1a7b048 -U drh -Z 108486be1053ae42ce8d5fd32905dfdb +P fb76d184ee5afc41009c4023bb68b3ddd42c9235a79ec9695c26f5bbe9a1aa25 +R e66195e1cc783f35788121ca02ce3aa2 +T *branch * opfs-sahpool-pause +T *sym-opfs-sahpool-pause * +T -sym-trunk * Cancelled\sby\sbranch. +U stephan +Z 8366991e856ca53edfe28286f618bbf1 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index ae82b8d99e..f443bbd368 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fb76d184ee5afc41009c4023bb68b3ddd42c9235a79ec9695c26f5bbe9a1aa25 +1d2683fe9e4be01c3137e750900f54d287e7d96185e66924d24b50f4647e7ef1 From cb46f1bb95ed8677e85207be7f667b0020d1f200 Mon Sep 17 00:00:00 2001 From: stephan Date: Wed, 29 Jan 2025 11:28:18 +0000 Subject: [PATCH 02/54] Simplify how OpfsSAHPoolUtil.unpauseVfs()'s returned promise is handled. FossilOrigin-Name: d651b8da5a84cd54d71f15bd34e4db685674ef73f26f5cc26b7af5321a2ec05e --- ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js | 14 +++++--------- manifest | 15 ++++++--------- manifest.uuid | 2 +- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js b/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js index ac18bd4543..153c171c3f 100644 --- a/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js +++ b/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js @@ -908,21 +908,17 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ re-registering it with SQLite. This is a no-op if the VFS is not currently paused. - The returned Promise resolves to this function's argument, and - is intended solely for use by the OpfsSAHPoolUtil helper class. + The returned Promise resolves to this object. @see isPaused() @see pauseVfs() */ - async unpauseVfs(returnValue){ + async unpauseVfs(){ if(0===this.#mapSAHToName.size){ return this.acquireAccessHandles(false). - then(()=>{ - capi.sqlite3_vfs_register(this.#cVfs, 0); - return returnValue; - }); + then(()=>capi.sqlite3_vfs_register(this.#cVfs, 0),this); } - return returnValue; + return this; } //! Documented elsewhere in this file. @@ -1050,7 +1046,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ async removeVfs(){ return this.#p.removeVfs() } pauseVfs(){ this.#p.pauseVfs(); return this; } - async unpauseVfs(){ return this.#p.unpauseVfs(this); } + async unpauseVfs(){ return this.#p.unpauseVfs().then(()=>this); } isPaused(){ return this.#p.isPaused() } }/* class OpfsSAHPoolUtil */; diff --git a/manifest b/manifest index 4224ec1f0e..e02024cfb4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sexperimental\ssupport\sto\spause/unpause\san\sSAHPool\sOPFS\sVFS,\sas\sdiscussed\sin\s[forum:fe8cdb8431c32455|forum\spost\sfe8cdb8431c32455],\sthe\sintent\sbeing\senable\sa\spage\sto\srelinquish,\sperhaps\stemporarily,\sthe\sVFS\ssuch\sthat\sthe\sVFS's\sstorage\scan\sbe\saccessed\sby\sanother\spage/tab. -D 2025-01-29T11:08:11.315 +C Simplify\show\sOpfsSAHPoolUtil.unpauseVfs()'s\sreturned\spromise\sis\shandled. +D 2025-01-29T11:28:18.640 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -645,7 +645,7 @@ F ext/wasm/api/sqlite3-api-worker1.c-pp.js 5cc22a3c0d52828cb32aad8691488719f47d2 F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89 F ext/wasm/api/sqlite3-opfs-async-proxy.js 3774befd97cd1a5e2895c8225a894aad946848c6d9b4028acc988b5d123475af F ext/wasm/api/sqlite3-vfs-helper.c-pp.js 3f828cc66758acb40e9c5b4dcfd87fd478a14c8fb7f0630264e6c7fa0e57515d -F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 69755ca8d4fa8e71d5411e3eb08c3d73b5130b8cde547eb084ea806f398a1a24 +F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js c8d6f02d834224290009d25876d2ec011cb9b8dc425e3a0761b7e55d9a67c24f F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 9b86ca2d8276cf919fbc9ba2a10e9786033b64f92c2db844d951804dee6c4b4e F ext/wasm/api/sqlite3-vtab-helper.c-pp.js e809739d71e8b35dfe1b55d24d91f02d04239e6aef7ca1ea92a15a29e704f616 F ext/wasm/api/sqlite3-wasm.c 83f5e9f998e9fa4261eb84e9f092210e3ffe03895119f5ded0429eb34ab9d2be @@ -2209,11 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P fb76d184ee5afc41009c4023bb68b3ddd42c9235a79ec9695c26f5bbe9a1aa25 -R e66195e1cc783f35788121ca02ce3aa2 -T *branch * opfs-sahpool-pause -T *sym-opfs-sahpool-pause * -T -sym-trunk * Cancelled\sby\sbranch. +P 1d2683fe9e4be01c3137e750900f54d287e7d96185e66924d24b50f4647e7ef1 +R 66a514dac494b6089e61caf69206dcd1 U stephan -Z 8366991e856ca53edfe28286f618bbf1 +Z 0fe942552ec304dc399f25e3701534d9 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f443bbd368..056d267bf5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1d2683fe9e4be01c3137e750900f54d287e7d96185e66924d24b50f4647e7ef1 +d651b8da5a84cd54d71f15bd34e4db685674ef73f26f5cc26b7af5321a2ec05e From 654c94d68382493144a5c34e25937d56ba6fe0da Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 31 Jan 2025 14:25:38 +0000 Subject: [PATCH 03/54] Cleanups in the opfs-sahpool VFS pause/unpause feature and its tests. FossilOrigin-Name: 184ba37702f63196deca91d273e798ca895fbb301938e6264bc82815a4e33149 --- ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js | 97 +++++++++++++------ ext/wasm/tester1.c-pp.js | 13 ++- manifest | 14 +-- manifest.uuid | 2 +- 4 files changed, 87 insertions(+), 39 deletions(-) diff --git a/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js b/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js index 153c171c3f..39094a6f80 100644 --- a/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js +++ b/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js @@ -501,22 +501,10 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ currently-opened client-specified filenames. */ getFileNames(){ const rc = []; - const iter = this.#mapFilenameToSAH.keys(); - for(const n of iter) rc.push(n); + for(const n of this.#mapFilenameToSAH.keys()) rc.push(n); return rc; } -// #createFileObject(sah,clientName,opaqueName){ -// const f = Object.assign(Object.create(null),{ -// clientName, opaqueName -// }); -// this.#mapSAHToMeta.set(sah, f); -// return f; -// } -// #unmapFileObject(sah){ -// this.#mapSAHToMeta.delete(sah); -// } - /** Adds n files to the pool's capacity. This change is persistent across settings. Returns a Promise which resolves @@ -557,8 +545,9 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ } /** - Releases all currently-opened SAHs. The only legal - operation after this is acquireAccessHandles(). + Releases all currently-opened SAHs. The only legal operation + after this is acquireAccessHandles() or (if this is called from + pauseVfs()) either of isPaused() or unpauseVfs(). */ releaseAccessHandles(){ for(const ah of this.#mapSAHToName.keys()) ah.close(); @@ -568,17 +557,21 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ } /** - Opens all files under this.vfsDir/this.#dhOpaque and acquires - a SAH for each. returns a Promise which resolves to no value - but completes once all SAHs are acquired. If acquiring an SAH - throws, SAHPool.$error will contain the corresponding - exception. + Opens all files under this.vfsDir/this.#dhOpaque and acquires a + SAH for each. Returns a Promise which resolves to no value but + completes once all SAHs are acquired. If acquiring an SAH + throws, this.$error will contain the corresponding Error + object. + + If it throws, it releases any SAHs which it may have + acquired before the exception was thrown, leaving the VFS in a + well-defined but unusable state. If clearFiles is true, the client-stored state of each file is cleared when its handle is acquired, including its name, flags, and any data stored after the metadata block. */ - async acquireAccessHandles(clearFiles){ + async acquireAccessHandles(clearFiles=false){ const files = []; for await (const [name,h] of this.#dhOpaque){ if('file'===h.kind){ @@ -859,7 +852,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ ); this.#dhVfsRoot = this.#dhVfsParent = undefined; }catch(e){ - sqlite3.config.error(this.vfsName,"removeVfs() failed:",e); + sqlite3.config.error(this.vfsName,"removeVfs() failed with no recovery strategy:",e); /*otherwise ignored - there is no recovery strategy*/ } return true; @@ -872,19 +865,26 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ intact. If this object is already paused, this is a no-op. Returns this object. - This function throws if any database handles are active, as the - alternative would be to invoke Undefined Behavior by closing - that file handle out from under the database. Similarly, - automatically closing any database handles opened by this VFS - would invoke Undefined Behavior in downstream code which is - holding those pointers. + This function throws if SQLite has any opened file handles + hosted by this VFS, as the alternative would be to invoke + Undefined Behavior by closing file handles out from under any + the library. Similarly, automatically closing any database + handles opened by this VFS would invoke Undefined Behavior in + downstream code which is holding those pointers. + + If this function throws due to open file handles then it has + no side effects. If the OPFS API throws while closing handles + then the VFS is left in an undefined state. @see isPaused() @see unpauseVfs() */ pauseVfs(){ if(this.#mapS3FileToOFile_.size>0){ - toss("Cannot pause a VFS which has an opened database.") + sqlite3.SQLite3Error.toss( + capi.SQLITE_MISUSE, "Cannot pause VFS", + this.vfsName,"because it has opened files." + ); } if(this.#mapSAHToName.size>0){ capi.sqlite3_vfs_unregister(this.vfsName); @@ -908,7 +908,9 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ re-registering it with SQLite. This is a no-op if the VFS is not currently paused. - The returned Promise resolves to this object. + The returned Promise resolves to this object. See + acquireAccessHandles() for how it behaves if it throws due to + SAH acquisition failure. @see isPaused() @see pauseVfs() @@ -1282,6 +1284,41 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ Clears all client-defined state of all SAHs and makes all of them available for re-use by the pool. Results are undefined if any such handles are currently in use, e.g. by an sqlite3 db. + + APIs specific to the "pause" capability (added in version 3.49): + + Summary: "pausing" the VFS disassociates it from SQLite and + relinquishes its SAHs so that they may be opened by another + instance of this VFS (running in a separate tab/page or Worker). + "Unpausing" it takes back control, if able. + + - pauseVfs() + + "Pauses" this VFS by unregistering it from SQLite and + relinquishing all open SAHs, leaving the associated files intact. + This enables pages/tabs to coordinate semi-concurrent usage of + this VFS. If this object is already paused, this is a + no-op. Returns this object. Throws if SQLite has any opened file + handles hosted by this VFS. If this function throws due to open + file handles then it has no side effects. If the OPFS API throws + while closing handles then the VFS is left in an undefined state. + + - isPaused() + + Returns true if this VFS is paused, else false. + + - [async] unpauseVfs() + + Restores the VFS to an active state after having called + pauseVfs() on it. This is a no-op if the VFS is not paused. The + returned Promise resolves to this object on success. A rejected + Promise means there was a problem reacquiring the SAH handles + (possibly because they're in use by another instance or have + since been removed). Generically speaking, there is recovery + strategy for that type of error, but if the problem is simply + that the OPFS files are locked, then a later attempt to unpause + it, made after the concurrent instance releases the SAHs, may + recover from the situation. */ sqlite3.installOpfsSAHPoolVfs = async function(options=Object.create(null)){ options = Object.assign(Object.create(null), optionDefaults, (options||{})); diff --git a/ext/wasm/tester1.c-pp.js b/ext/wasm/tester1.c-pp.js index f5fff0cfc4..969fcf067b 100644 --- a/ext/wasm/tester1.c-pp.js +++ b/ext/wasm/tester1.c-pp.js @@ -3155,12 +3155,23 @@ globalThis.sqlite3InitModule = sqlite3InitModule; T.assert(1 === u1.getFileCount()); db = new u2.OpfsSAHPoolDb(dbName); T.assert(1 === u1.getFileCount()) - .mustThrow(()=>u2.pauseVfs(), "Cannot pause VFS with opened db."); + .mustThrowMatching( + ()=>u1.pauseVfs(), + (err)=>{ + return capi.SQLITE_MISUSE===err.resultCode + && /^SQLITE_MISUSE: Cannot pause VFS /.test(err.message); + }, + "Cannot pause VFS with opened db." + ); db.close(); T.assert( u2===u2.pauseVfs() ) .assert( u2.isPaused() ) .assert( 0===capi.sqlite3_vfs_find(u2.vfsName) ) + .mustThrowMatching(()=>new u2.OpfsSAHPoolDb(dbName), + /.+no such vfs: .+/, + "VFS is not available") .assert( u2===await u2.unpauseVfs() ) + .assert( u2===await u1.unpauseVfs(), "unpause is a no-op if the VFS is not paused" ) .assert( 0!==capi.sqlite3_vfs_find(u2.vfsName) ); const fileNames = u1.getFileNames(); T.assert(1 === fileNames.length) diff --git a/manifest b/manifest index 78d794bcbc..6b7707a1c3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\strunk\sinto\sopfs-sahpool-pause\sbranch. -D 2025-01-31T12:39:07.019 +C Cleanups\sin\sthe\sopfs-sahpool\sVFS\spause/unpause\sfeature\sand\sits\stests. +D 2025-01-31T14:25:38.298 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -645,7 +645,7 @@ F ext/wasm/api/sqlite3-api-worker1.c-pp.js 5cc22a3c0d52828cb32aad8691488719f47d2 F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89 F ext/wasm/api/sqlite3-opfs-async-proxy.js 3774befd97cd1a5e2895c8225a894aad946848c6d9b4028acc988b5d123475af F ext/wasm/api/sqlite3-vfs-helper.c-pp.js 3f828cc66758acb40e9c5b4dcfd87fd478a14c8fb7f0630264e6c7fa0e57515d -F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js c8d6f02d834224290009d25876d2ec011cb9b8dc425e3a0761b7e55d9a67c24f +F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 4878cf2a19577093ea82b505f0b052147ca11d27575106c1bb30d2f58efc80a4 F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 9b86ca2d8276cf919fbc9ba2a10e9786033b64f92c2db844d951804dee6c4b4e F ext/wasm/api/sqlite3-vtab-helper.c-pp.js e809739d71e8b35dfe1b55d24d91f02d04239e6aef7ca1ea92a15a29e704f616 F ext/wasm/api/sqlite3-wasm.c 83f5e9f998e9fa4261eb84e9f092210e3ffe03895119f5ded0429eb34ab9d2be @@ -696,7 +696,7 @@ F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555 F ext/wasm/test-opfs-vfs.js 1618670e466f424aa289859fe0ec8ded223e42e9e69b5c851f809baaaca1a00c F ext/wasm/tester1-worker.html ebc4b820a128963afce328ecf63ab200bd923309eb939f4110510ab449e9814c F ext/wasm/tester1.c-pp.html 1c1bc78b858af2019e663b1a31e76657b73dc24bede28ca92fbe917c3a972af2 -F ext/wasm/tester1.c-pp.js 7f239383c06078fe67919509f7e1691d3b970a5f6cd4dc4adab71bc8e6cf6fe8 +F ext/wasm/tester1.c-pp.js 0cda9a3180e743f4a42500cbcde1a14da920b34697eb4b05adedac0dab5381de F ext/wasm/tests/opfs/concurrency/index.html 657578a6e9ce1e9b8be951549ed93a6a471f4520a99e5b545928668f4285fb5e F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65ad09f510589c779b7cc6a803a88 F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d651b8da5a84cd54d71f15bd34e4db685674ef73f26f5cc26b7af5321a2ec05e 56b618da9073db8b8d5dafa177a3c9e4c4d927bf512e14b0e6d23937f91ce4cf -R 0de3f6553f08e8afe4528e7b192214df +P 775a547eca2b0b3dbb6c03990236128a095cc34d28caec44b9a5072510c75b63 +R af1dcaea4b1a4f1eb6d1dba2bd937843 U stephan -Z 411d369a110121e7891ed7e96e9dfba9 +Z 577676d1355d687b76945b6366664411 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 49b6367688..77c1116482 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -775a547eca2b0b3dbb6c03990236128a095cc34d28caec44b9a5072510c75b63 +184ba37702f63196deca91d273e798ca895fbb301938e6264bc82815a4e33149 From cb0da053edf42e314af7802e65200d85fce3729e Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 31 Jan 2025 16:25:18 +0000 Subject: [PATCH 04/54] Add a small test app demonstrating cooperative semi-concurrency of the opfs-sahpool VFS using its un/pauseVfs() APIs. FossilOrigin-Name: 09570c55a23e5af76dd2153a5b28a493f498d7d4a08b0089f3074d0a2c5d3d29 --- ext/wasm/index.html | 4 + ext/wasm/tests/opfs/sahpool/index.html | 31 ++++ .../tests/opfs/sahpool/sahpool-pausing.js | 172 ++++++++++++++++++ ext/wasm/tests/opfs/sahpool/sahpool-worker.js | 89 +++++++++ manifest | 15 +- manifest.uuid | 2 +- 6 files changed, 306 insertions(+), 7 deletions(-) create mode 100644 ext/wasm/tests/opfs/sahpool/index.html create mode 100644 ext/wasm/tests/opfs/sahpool/sahpool-pausing.js create mode 100644 ext/wasm/tests/opfs/sahpool/sahpool-worker.js diff --git a/ext/wasm/index.html b/ext/wasm/index.html index 5d53b62d48..78ff1d91a8 100644 --- a/ext/wasm/index.html +++ b/ext/wasm/index.html @@ -119,6 +119,10 @@
  • OPFS concurrency tests using multiple workers.
  • +
  • OPFS SAHPool cooperative semi-concurrency + demonstrates usage of the OPFS SAHPool VFS's "pause" feature to coordinate + access to a database. +
  • WASMFS-specific tests which require that diff --git a/ext/wasm/tests/opfs/sahpool/index.html b/ext/wasm/tests/opfs/sahpool/index.html new file mode 100644 index 0000000000..f3d07f456a --- /dev/null +++ b/ext/wasm/tests/opfs/sahpool/index.html @@ -0,0 +1,31 @@ + + + + + + + + + sqlite3 tester: OpfsSAHPool Pausing + + +

    + +

    + This page provides a very basic demonstration of + "pausing" and "unpausing" the OPFS SAHPool VFS such that + multiple pages or workers can use it by coordinating which + handler may have it open at any given time. +

    +
    + + +
    +
    + + + + diff --git a/ext/wasm/tests/opfs/sahpool/sahpool-pausing.js b/ext/wasm/tests/opfs/sahpool/sahpool-pausing.js new file mode 100644 index 0000000000..737b2e8611 --- /dev/null +++ b/ext/wasm/tests/opfs/sahpool/sahpool-pausing.js @@ -0,0 +1,172 @@ +/* + 2022-10-12 + + The author disclaims copyright to this source code. In place of a + legal notice, here is a blessing: + + * May you do good and not evil. + * May you find forgiveness for yourself and forgive others. + * May you share freely, never taking more than you give. + + *********************************************************************** + + These tests are specific to the opfs-sahpool VFS and are limited to + demonstrating its pause/unpause capabilities. +*/ +'use strict'; +(function(self){ + let logClass; + + const mapToString = (v)=>{ + switch(typeof v){ + case 'number': case 'string': case 'boolean': + case 'undefined': case 'bigint': + return ''+v; + default: break; + } + if(null===v) return 'null'; + if(v instanceof Error){ + v = { + message: v.message, + stack: v.stack, + errorClass: v.name + }; + } + return JSON.stringify(v,undefined,2); + }; + const normalizeArgs = (args)=>args.map(mapToString); + console.log("Running in the UI thread."); + const logTarget = document.querySelector('#test-output'); + logClass = function(cssClass,...args){ + const ln = document.createElement('div'); + if(cssClass){ + for(const c of (Array.isArray(cssClass) ? cssClass : [cssClass])){ + ln.classList.add(c); + } + } + ln.append(document.createTextNode(normalizeArgs(args).join(' '))); + logTarget.append(ln); + }; + const cbReverse = document.querySelector('#cb-log-reverse'); + //cbReverse.setAttribute('checked','checked'); + const cbReverseKey = 'tester1:cb-log-reverse'; + const cbReverseIt = ()=>{ + logTarget.classList[cbReverse.checked ? 'add' : 'remove']('reverse'); + //localStorage.setItem(cbReverseKey, cbReverse.checked ? 1 : 0); + }; + cbReverse.addEventListener('change', cbReverseIt, true); + /*if(localStorage.getItem(cbReverseKey)){ + cbReverse.checked = !!(+localStorage.getItem(cbReverseKey)); + }*/ + cbReverseIt(); + + const log = (...args)=>{ + //console.log(...args); + logClass('',...args); + } + const warn = (...args)=>{ + console.warn(...args); + logClass('warning',...args); + } + const error = (...args)=>{ + console.error(...args); + logClass('error',...args); + }; + + const toss = (...args)=>{ + error(...args); + throw new Error(args.join(' ')); + }; + + const nextHandlerQueue = []; + + const endOfWork = (passed=true)=>{ + const eH = document.querySelector('#color-target'); + const eT = document.querySelector('title'); + if(passed){ + log("End of work chain. If you made it this far, you win."); + eH.innerText = 'PASS: '+eH.innerText; + eH.classList.add('tests-pass'); + eT.innerText = 'PASS: '+eT.innerText; + }else{ + eH.innerText = 'FAIL: '+eH.innerText; + eH.classList.add('tests-fail'); + eT.innerText = 'FAIL: '+eT.innerText; + } + }; + + const nextHandler = function(workerId,...msg){ + log(workerId,...msg); + (nextHandlerQueue.shift())(); + }; + + const postThen = function(W, msgType, callback){ + nextHandlerQueue.push(callback); + W.postMessage({type:msgType}); + }; + + const runTriangleOfDeath = function(W1, W2){ + postThen(W1, 'vfs-acquire', function(){ + postThen(W1, 'db-init', function(){ + postThen(W1, 'db-query', function(){ + postThen(W1, 'vfs-pause', function(){ + postThen(W2, 'vfs-acquire', function(){ + postThen(W2, 'db-query', function(){ + postThen(W2, 'vfs-remove', endOfWork); + }); + }); + }); + }); + }); + }); + }; + + const runTests = function(){ + log("Running sahpool pausing tests..."); + const wjs = 'sahpool-worker.js?sqlite3.dir=../../../jswasm'; + const W1 = new Worker(wjs+'&workerId=w1'), + W2 = new Worker(wjs+'&workerId=w2'); + W1.workerId = 'w1'; + W2.workerId = 'w2'; + let initCount = 0; + const onmessage = function({data}){ + //log("onmessage:",data); + switch(data.type){ + case 'vfs-acquired': + nextHandler(data.workerId, "VFS acquired"); + break; + case 'vfs-paused': + nextHandler(data.workerId, "VFS paused"); + break; + case 'vfs-unpaused': + nextHandler(data.workerId, 'VFS unpaused'); + break; + case 'vfs-removed': + nextHandler(data.workerId, 'VFS removed'); + break; + case 'db-inited': + nextHandler(data.workerId, 'db initialized'); + break; + case 'query-result': + nextHandler(data.workerId, 'query result', data.payload); + break; + case 'log': + log(data.workerId, ':', ...data.payload); + break; + case 'error': + error(data.workerId, ':', ...data.payload); + endOfWork(false); + break; + case 'initialized': + log(data.workerId, ': Worker initialized',...data.payload); + if( 2===++initCount ){ + runTriangleOfDeath(W1, W2); + } + break; + } + }; + W1.onmessage = W2.onmessage = onmessage; + }; + + runTests(); +})(globalThis); diff --git a/ext/wasm/tests/opfs/sahpool/sahpool-worker.js b/ext/wasm/tests/opfs/sahpool/sahpool-worker.js new file mode 100644 index 0000000000..11815f1bf4 --- /dev/null +++ b/ext/wasm/tests/opfs/sahpool/sahpool-worker.js @@ -0,0 +1,89 @@ +const searchParams = new URL(self.location.href).searchParams; +const workerId = searchParams.get('workerId'); +const wPost = (type,...args)=>postMessage({type, workerId, payload:args}); +const log = (...args)=>wPost('log',...args); +let capi, wasm, S, poolUtil; + +const sahPoolConfig = { + name: 'opfs-sahpool-pausable', + clearOnInit: false, + initialCapacity: 3 +}; + +importScripts(searchParams.get('sqlite3.dir') + '/sqlite3.js'); + +const sqlExec = function(sql){ + const db = new poolUtil.OpfsSAHPoolDb('/my.db'); + try{ + return db.exec(sql); + }finally{ + db.close(); + } +}; + +const clog = console.log.bind(console); +globalThis.onmessage = function({data}){ + clog(workerId+": onmessage:",data); + switch(data.type){ + case 'vfs-acquire': + if( poolUtil ){ + poolUtil.unpauseVfs().then(()=>wPost('vfs-unpaused')); + }else{ + S.installOpfsSAHPoolVfs(sahPoolConfig).then(pu=>{ + poolUtil = pu; + wPost('vfs-acquired'); + }); + } + break; + case 'db-init': + try{ + sqlExec([ + "DROP TABLE IF EXISTS mytable;", + "CREATE TABLE mytable(a);", + "INSERT INTO mytable(a) VALUES(11),(22),(33)" + ]); + wPost('db-inited'); + }catch(e){ + wPost('error',e.message); + } + break; + case 'db-query': { + const rc = sqlExec({ + sql: 'select * from mytable order by a', + rowMode: 'array', + returnValue: 'resultRows' + }); + wPost('query-result',rc); + break; + } + case 'vfs-remove': + poolUtil.removeVfs().then(()=>wPost('vfs-removed')); + break; + case 'vfs-pause': + poolUtil.pauseVfs(); + wPost('vfs-paused'); + break; + } +}; + +const hasOpfs = ()=>{ + return globalThis.FileSystemHandle + && globalThis.FileSystemDirectoryHandle + && globalThis.FileSystemFileHandle + && globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle + && navigator?.storage?.getDirectory; +}; +if( !hasOpfs() ){ + wPost('error',"OPFS not detected"); +}else{ + globalThis.sqlite3InitModule().then(async function(sqlite3){ + S = sqlite3; + capi = S.capi; + wasm = S.wasm; + log("sqlite3 version:",capi.sqlite3_libversion(), + capi.sqlite3_sourceid()); + //return sqlite3.installOpfsSAHPoolVfs(sahPoolConfig).then(pu=>poolUtil=pu); + }).then(()=>{ + wPost('initialized'); + }); +} diff --git a/manifest b/manifest index 6b7707a1c3..66f90cf805 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Cleanups\sin\sthe\sopfs-sahpool\sVFS\spause/unpause\sfeature\sand\sits\stests. -D 2025-01-31T14:25:38.298 +C Add\sa\ssmall\stest\sapp\sdemonstrating\scooperative\ssemi-concurrency\sof\sthe\sopfs-sahpool\sVFS\susing\sits\sun/pauseVfs()\sAPIs. +D 2025-01-31T16:25:18.083 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -677,7 +677,7 @@ F ext/wasm/fiddle/fiddle-worker.js 850e66fce39b89d59e161d1abac43a181a4caa89ddeea F ext/wasm/fiddle/fiddle.js b444a5646a9aac9f3fc06c53d78af5e1912eb235d69a8e6010723e4eb0e9d4a1 F ext/wasm/fiddle/index.html c79b1741cbeba78f88af0a84cf5ec7de87a909a6a8d10a369b1f4824c66c2088 F ext/wasm/index-dist.html 56132399702b15d70c474c3f1952541e25cb0922942868f70daf188f024b3730 -F ext/wasm/index.html 10ff3ad190aadccb713109fa55a38e5c1f3c2a8cf05cd31783745bab3f184079 +F ext/wasm/index.html fd3b5185ae5c436626c939b40c274110f7a1d0c1d7c50588c1f449f9a038a9d8 F ext/wasm/jaccwabyt/jaccwabyt.js 1264710db3cfbcb6887d95665b7aeba60c1126eaef789ca4cf1a4a17d5bc7f54 F ext/wasm/jaccwabyt/jaccwabyt.md 59a20df389abcc3606eb4eaea7fb7ba14504beb3e345dbea9b99a0618ba3bec8 F ext/wasm/mkwasmbuilds.c d5885bacf2253bed913cdc7eb16b44f9c9e782133e10600652d1a78841c337af @@ -700,6 +700,9 @@ F ext/wasm/tester1.c-pp.js 0cda9a3180e743f4a42500cbcde1a14da920b34697eb4b05adeda F ext/wasm/tests/opfs/concurrency/index.html 657578a6e9ce1e9b8be951549ed93a6a471f4520a99e5b545928668f4285fb5e F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65ad09f510589c779b7cc6a803a88 F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 +F ext/wasm/tests/opfs/sahpool/index.html be736567fd92d3ecb9754c145755037cbbd2bca01385e2732294b53f4c842328 +F ext/wasm/tests/opfs/sahpool/sahpool-pausing.js cd64dc1ea91e99a296eafffd806ce84b540b60010bc344f3ed2b95885a6a9900 +F ext/wasm/tests/opfs/sahpool/sahpool-worker.js a3c5ced52d34675cb2b413461c3ed185b1e9aef41eda1f5d22550ff737d057cd F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 F main.mk 043987843e8365dbaf74dce60c11683b62e2bcfcb3122574c14a0324d37a72f3 @@ -2209,8 +2212,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 775a547eca2b0b3dbb6c03990236128a095cc34d28caec44b9a5072510c75b63 -R af1dcaea4b1a4f1eb6d1dba2bd937843 +P 184ba37702f63196deca91d273e798ca895fbb301938e6264bc82815a4e33149 +R 811999f4e14055835b34337c582dd5f9 U stephan -Z 577676d1355d687b76945b6366664411 +Z 6cecf310c2a5b350f628459d87398b50 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 77c1116482..56f7745c3d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -184ba37702f63196deca91d273e798ca895fbb301938e6264bc82815a4e33149 +09570c55a23e5af76dd2153a5b28a493f498d7d4a08b0089f3074d0a2c5d3d29 From a75321d73572305588d51d90a824f260f4b44681 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 31 Jan 2025 16:34:52 +0000 Subject: [PATCH 05/54] Add the conventional license header to sahpool-worker.js and correct the date on the header in sahpool-pausing.js. FossilOrigin-Name: f7c3026b0d2e33cc4e3b906810d860b155b1ff714bbe4e1eb9ee392122217efa --- ext/wasm/tests/opfs/sahpool/sahpool-pausing.js | 2 +- ext/wasm/tests/opfs/sahpool/sahpool-worker.js | 15 +++++++++++++++ manifest | 14 +++++++------- manifest.uuid | 2 +- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/ext/wasm/tests/opfs/sahpool/sahpool-pausing.js b/ext/wasm/tests/opfs/sahpool/sahpool-pausing.js index 737b2e8611..6a4cfbc9f2 100644 --- a/ext/wasm/tests/opfs/sahpool/sahpool-pausing.js +++ b/ext/wasm/tests/opfs/sahpool/sahpool-pausing.js @@ -1,5 +1,5 @@ /* - 2022-10-12 + 2025-01-31 The author disclaims copyright to this source code. In place of a legal notice, here is a blessing: diff --git a/ext/wasm/tests/opfs/sahpool/sahpool-worker.js b/ext/wasm/tests/opfs/sahpool/sahpool-worker.js index 11815f1bf4..592f159551 100644 --- a/ext/wasm/tests/opfs/sahpool/sahpool-worker.js +++ b/ext/wasm/tests/opfs/sahpool/sahpool-worker.js @@ -1,3 +1,18 @@ +/* + 2025-01-31 + + The author disclaims copyright to this source code. In place of a + legal notice, here is a blessing: + + * May you do good and not evil. + * May you find forgiveness for yourself and forgive others. + * May you share freely, never taking more than you give. + + *********************************************************************** + + This file is part of sahpool-pausing.js's demonstration of the + pause/unpause feature of the opfs-sahpool VFS. +*/ const searchParams = new URL(self.location.href).searchParams; const workerId = searchParams.get('workerId'); const wPost = (type,...args)=>postMessage({type, workerId, payload:args}); diff --git a/manifest b/manifest index 66f90cf805..8ee72d5491 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\ssmall\stest\sapp\sdemonstrating\scooperative\ssemi-concurrency\sof\sthe\sopfs-sahpool\sVFS\susing\sits\sun/pauseVfs()\sAPIs. -D 2025-01-31T16:25:18.083 +C Add\sthe\sconventional\slicense\sheader\sto\ssahpool-worker.js\sand\scorrect\sthe\sdate\son\sthe\sheader\sin\ssahpool-pausing.js. +D 2025-01-31T16:34:52.960 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -701,8 +701,8 @@ F ext/wasm/tests/opfs/concurrency/index.html 657578a6e9ce1e9b8be951549ed93a6a471 F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65ad09f510589c779b7cc6a803a88 F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/tests/opfs/sahpool/index.html be736567fd92d3ecb9754c145755037cbbd2bca01385e2732294b53f4c842328 -F ext/wasm/tests/opfs/sahpool/sahpool-pausing.js cd64dc1ea91e99a296eafffd806ce84b540b60010bc344f3ed2b95885a6a9900 -F ext/wasm/tests/opfs/sahpool/sahpool-worker.js a3c5ced52d34675cb2b413461c3ed185b1e9aef41eda1f5d22550ff737d057cd +F ext/wasm/tests/opfs/sahpool/sahpool-pausing.js 780952b64dcde74ced1bb74813c0f995b689130f93d0a589995c78a783ec88ac +F ext/wasm/tests/opfs/sahpool/sahpool-worker.js bd25a43fc2ab2d1bafd8f2854ad3943ef673f7c3be03e95ecf1612ff6e8e2a61 F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 F main.mk 043987843e8365dbaf74dce60c11683b62e2bcfcb3122574c14a0324d37a72f3 @@ -2212,8 +2212,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 184ba37702f63196deca91d273e798ca895fbb301938e6264bc82815a4e33149 -R 811999f4e14055835b34337c582dd5f9 +P 09570c55a23e5af76dd2153a5b28a493f498d7d4a08b0089f3074d0a2c5d3d29 +R bfbe4fbf82db0e350871f46cfbfa28ef U stephan -Z 6cecf310c2a5b350f628459d87398b50 +Z d959934b83791a6e7fb628c4c0368bb3 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 56f7745c3d..071eb4c7ef 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -09570c55a23e5af76dd2153a5b28a493f498d7d4a08b0089f3074d0a2c5d3d29 +f7c3026b0d2e33cc4e3b906810d860b155b1ff714bbe4e1eb9ee392122217efa From cee760907489075386e27c37fe6c86c835604857 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 31 Jan 2025 17:47:47 +0000 Subject: [PATCH 06/54] Minor cleanups in the opfs-sahpool pause/unpause API demo. FossilOrigin-Name: e205cdc468e02eefdeb8d391d921aa2d4d28a8b7b87036d6d937a9928261a413 --- ext/wasm/api/sqlite3-worker1-promiser.c-pp.js | 4 +-- .../tests/opfs/sahpool/sahpool-pausing.js | 27 +++++++++++++------ manifest | 14 +++++----- manifest.uuid | 2 +- 4 files changed, 29 insertions(+), 18 deletions(-) diff --git a/ext/wasm/api/sqlite3-worker1-promiser.c-pp.js b/ext/wasm/api/sqlite3-worker1-promiser.c-pp.js index 55e497ead5..c043fd1486 100644 --- a/ext/wasm/api/sqlite3-worker1-promiser.c-pp.js +++ b/ext/wasm/api/sqlite3-worker1-promiser.c-pp.js @@ -335,8 +335,8 @@ sqlite3Worker1Promiser.v2 = function(config){ /** When built as a module, we export sqlite3Worker1Promiser.v2() instead of sqlite3Worker1Promise() because (A) its interface is more - conventional for ESM usage and (B) the ESM option export option for - this API did not exist until v2 was created, so there's no backwards + conventional for ESM usage and (B) the ESM export option for this + API did not exist until v2 was created, so there's no backwards incompatibility. */ export default sqlite3Worker1Promiser.v2; diff --git a/ext/wasm/tests/opfs/sahpool/sahpool-pausing.js b/ext/wasm/tests/opfs/sahpool/sahpool-pausing.js index 6a4cfbc9f2..1aa98d3cb3 100644 --- a/ext/wasm/tests/opfs/sahpool/sahpool-pausing.js +++ b/ext/wasm/tests/opfs/sahpool/sahpool-pausing.js @@ -12,9 +12,12 @@ These tests are specific to the opfs-sahpool VFS and are limited to demonstrating its pause/unpause capabilities. + + Most of this file is infrastructure for displaying results to the + user. Search for runTests() to find where the work actually starts. */ 'use strict'; -(function(self){ +(function(){ let logClass; const mapToString = (v)=>{ @@ -35,7 +38,6 @@ return JSON.stringify(v,undefined,2); }; const normalizeArgs = (args)=>args.map(mapToString); - console.log("Running in the UI thread."); const logTarget = document.querySelector('#test-output'); logClass = function(cssClass,...args){ const ln = document.createElement('div'); @@ -78,8 +80,6 @@ throw new Error(args.join(' ')); }; - const nextHandlerQueue = []; - const endOfWork = (passed=true)=>{ const eH = document.querySelector('#color-target'); const eT = document.querySelector('title'); @@ -95,6 +95,8 @@ } }; + const nextHandlerQueue = []; + const nextHandler = function(workerId,...msg){ log(workerId,...msg); (nextHandlerQueue.shift())(); @@ -105,7 +107,16 @@ W.postMessage({type:msgType}); }; - const runTriangleOfDeath = function(W1, W2){ + /** + Run a series of operations on an sahpool db spanning two workers. + This would arguably be more legible with Promises, but creating a + Promise-based communication channel for this purpose is left as + an exercise for the reader. An example of such a proxy can be + found in the SQLite source tree: + + https://sqlite.org/src/file/ext/wasm/api/sqlite3-worker1-promiser.c-pp.js + */ + const runPyramidOfDoom = function(W1, W2){ postThen(W1, 'vfs-acquire', function(){ postThen(W1, 'db-init', function(){ postThen(W1, 'db-query', function(){ @@ -122,7 +133,7 @@ }; const runTests = function(){ - log("Running sahpool pausing tests..."); + log("Running opfs-sahpool pausing tests..."); const wjs = 'sahpool-worker.js?sqlite3.dir=../../../jswasm'; const W1 = new Worker(wjs+'&workerId=w1'), W2 = new Worker(wjs+'&workerId=w2'); @@ -160,7 +171,7 @@ case 'initialized': log(data.workerId, ': Worker initialized',...data.payload); if( 2===++initCount ){ - runTriangleOfDeath(W1, W2); + runPyramidOfDoom(W1, W2); } break; } @@ -169,4 +180,4 @@ }; runTests(); -})(globalThis); +})(); diff --git a/manifest b/manifest index 8ee72d5491..eef00b8912 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\sconventional\slicense\sheader\sto\ssahpool-worker.js\sand\scorrect\sthe\sdate\son\sthe\sheader\sin\ssahpool-pausing.js. -D 2025-01-31T16:34:52.960 +C Minor\scleanups\sin\sthe\sopfs-sahpool\spause/unpause\sAPI\sdemo. +D 2025-01-31T17:47:47.173 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -649,7 +649,7 @@ F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 4878cf2a19577093ea82b505f0b05214 F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 9b86ca2d8276cf919fbc9ba2a10e9786033b64f92c2db844d951804dee6c4b4e F ext/wasm/api/sqlite3-vtab-helper.c-pp.js e809739d71e8b35dfe1b55d24d91f02d04239e6aef7ca1ea92a15a29e704f616 F ext/wasm/api/sqlite3-wasm.c 83f5e9f998e9fa4261eb84e9f092210e3ffe03895119f5ded0429eb34ab9d2be -F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js 46f303ba8ddd1b2f0a391798837beddfa72e8c897038c8047eda49ce7d5ed46b +F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js bc65debfe43b81fc39fb25c40ad0cc1946bd82580fbf644351107b544d6177ee F ext/wasm/api/sqlite3-worker1.c-pp.js 5e8706c2c4af2a57fbcdc02f4e7ef79869971bc21bb8ede777687786ce1c92d5 F ext/wasm/batch-runner-sahpool.html e9a38fdeb36a13eac7b50241dfe7ae066fe3f51f5c0b0151e7baee5fce0d07a7 F ext/wasm/batch-runner-sahpool.js 54a3ac228e6c4703fe72fb65c897e19156263a51fe9b7e21d2834a45e876aabd @@ -701,7 +701,7 @@ F ext/wasm/tests/opfs/concurrency/index.html 657578a6e9ce1e9b8be951549ed93a6a471 F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65ad09f510589c779b7cc6a803a88 F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/tests/opfs/sahpool/index.html be736567fd92d3ecb9754c145755037cbbd2bca01385e2732294b53f4c842328 -F ext/wasm/tests/opfs/sahpool/sahpool-pausing.js 780952b64dcde74ced1bb74813c0f995b689130f93d0a589995c78a783ec88ac +F ext/wasm/tests/opfs/sahpool/sahpool-pausing.js f264925cfc82155de38cecb3d204c36e0f6991460fff0cb7c15079454679a4e2 F ext/wasm/tests/opfs/sahpool/sahpool-worker.js bd25a43fc2ab2d1bafd8f2854ad3943ef673f7c3be03e95ecf1612ff6e8e2a61 F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 @@ -2212,8 +2212,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 09570c55a23e5af76dd2153a5b28a493f498d7d4a08b0089f3074d0a2c5d3d29 -R bfbe4fbf82db0e350871f46cfbfa28ef +P f7c3026b0d2e33cc4e3b906810d860b155b1ff714bbe4e1eb9ee392122217efa +R d3225c8561b09d79116dc329da2feefd U stephan -Z d959934b83791a6e7fb628c4c0368bb3 +Z 1cb85d7c9b9ce473d92184ec221c275c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 071eb4c7ef..abe785492f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f7c3026b0d2e33cc4e3b906810d860b155b1ff714bbe4e1eb9ee392122217efa +e205cdc468e02eefdeb8d391d921aa2d4d28a8b7b87036d6d937a9928261a413 From ba8e3ca139f65c7cae79bcf905032705ddd765f7 Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 11 Feb 2025 17:10:10 +0000 Subject: [PATCH 07/54] Move the configure flags definition and handling into autosetup/sqlite-config.tcl to avoid duplication between auto.def and autoconf/auto.def while still giving us a way to filter the canonical-tree-only flags out of the autoconf build. FossilOrigin-Name: 9978c87139b7b04208fd1f62121fc4e1e2080723fde69a2bbdca88769f4baf22 --- auto.def | 212 +----------------------------- autoconf/auto.def | 75 +---------- autosetup/sqlite-config.tcl | 251 ++++++++++++++++++++++++++++++++++-- manifest | 16 +-- manifest.uuid | 2 +- 5 files changed, 250 insertions(+), 306 deletions(-) diff --git a/auto.def b/auto.def index 6274d79b68..d9fa7018a3 100644 --- a/auto.def +++ b/auto.def @@ -12,217 +12,9 @@ # # JimTCL: https://jim.tcl.tk # + use sqlite-config - -if {[string first " " $autosetup(srcdir)] != -1} { - user-error "The pathname of the source tree\ - may not contain space characters" -} -if {[string first " " $autosetup(builddir)] != -1} { - user-error "The pathname of the build directory\ - may not contain space characters" -} - - -######################################################################## -# Regarding flag compatibility with the historical autotool configure -# script: -# -# A very long story made short, autosetup's --flag handling has -# some behaviors which make it impossible to implement 100% identical -# flags compared to the historical autotools build. The differences -# are documented here: -# -# 1) --debug is used by autosetup itself, but we patch it because -# decades of muscle memory expect --debug to apply to this code, -# not the configure script (details are in autosetup/README.md). -# -# 2) In autosetup, all flags starting with (--enable, --disable) are -# forced to be booleans and receive special handling in how they're -# resolved. Because of that we have to rename: -# -# 2.1) --enable-tempstore[=no] to --with-tempstore[=no], noting that -# it has four legal values, not two. -# -######################################################################## -# A gentle introduction to flags handling in autosetup -# -# Reference: https://msteveb.github.io/autosetup/developer/ -# -# All configure flags must be described in an 'options' call, which -# must appear very early on in this script. The general syntax is: -# -# FLAG => {Help text} -# -# Where FLAG can have any of the following formats: -# -# boolopt => "a boolean option which defaults to disabled" -# boolopt2=1 => "a boolean option which defaults to enabled" -# stringopt: => "an option which takes an argument, e.g. --stringopt=value" -# stringopt2:=value => "an option where the argument is optional and defaults to 'value'" -# optalias booltopt3 => "a boolean with a hidden alias. --optalias is not shown in --help" -# -# Autosetup does no small amount of specialized handling for flags, -# especially booleans. Each bool-type --FLAG implicitly gets -# --enable-FLAG and --disable-FLAG forms. e.g. we define a flag -# "readline", which will be interpreted in one of two ways, depending -# on how it's invoked and how its default is defined: -# -# --enable-readline ==> boolean true -# --disable-readline ==> boolean false -# -# Passing --readline or --readline=1 is equivalent to passing -# --enable-readline, and --readline=0 is equivalent to -# --disable-readline. -# -# The behavior described above can lead lead to some confusion when -# writing help text. For example: -# -# options { json=1 {Disable JSON functions} } -# -# The reason the help text says "disable" is because a boolean option -# which defaults to true is, in the --help text, rendered as: -# -# --disable-json Disable JSON functions -# -# Whereas a bool flag which defaults to false will instead render as: -# -# --enable-FLAG -# -# Non-boolean flags, in contrast, use the names specifically given to -# them in the [options] invocation. e.g. "with-tcl" is the --with-tcl -# flag. -# -# Fetching values for flags: -# -# booleans: use one of: -# - [opt-bool FLAG] is autosetup's built-in command for this, but we -# have some convenience variants: -# - [proj-opt-truthy FLAG] -# - [proj-opt-if-truthy FLAG {THEN} {ELSE}] -# -# Non-boolean (i.e. string) flags: -# - [opt-val FLAG ?default?] -# - [opt-str ...] - see the docs in ./autosetup/autosetup -# -######################################################################## -set flags { - # When writing {help text blocks}, be aware that autosetup formats - # them differently (left-aligned, directly under the --flag) if the - # block starts with a newline. It does NOT expand vars and commands, - # but we use a [subst] call below which will replace (only) var - # refs. - - # - shared=1 => {Disable build of shared libary} - static=1 => {Disable build of static library (mostly)} - amalgamation=1 => {Disable the amalgamation and instead build all files separately.} - # - # - threadsafe=1 => {Disable mutexing} - with-tempstore:=no => {Use an in-RAM database for temporary tables: never,no,yes,always} - largefile=1 => {Disable large file support} - load-extension=1 => {Disable loading of external extensions} - math=1 => {Disable math functions} - json=1 => {Disable JSON functions} - memsys5 => {Enable MEMSYS5} - memsys3 => {Enable MEMSYS3} - fts3 => {Enable the FTS3 extension} - fts4 => {Enable the FTS4 extension} - fts5 => {Enable the FTS5 extension} - update-limit => {Enable the UPDATE/DELETE LIMIT clause} - geopoly => {Enable the GEOPOLY extension} - rtree => {Enable the RTREE extension} - session => {Enable the SESSION extension} - all => {Enable FTS4, FTS5, Geopoly, RTree, Sessions} - # - # - with-tcl:DIR => - {Directory containing tclConfig.sh or a directory one level up from - that, from which we can derive a directory containing tclConfig.sh. - A dir name of "prefix" is equivalent to the directory specified by - the --prefix flag.} - with-tclsh:PATH => - {Full pathname of tclsh to use. It is used for (A) trying to find - tclConfig.sh and (B) all TCL-based code generation. Warning: if - its containing dir has multiple tclsh versions, it may select the - wrong tclConfig.sh!} - tcl=1 => - {Disable components which require TCL, including all tests. - This tree requires TCL for code generation but can use the in-tree - copy of autosetup/jimsh0.c for that. The SQLite TCL extension and the - test code require a canonical tclsh.} - # - # - readline=1 => {Disable readline support} - # --with-readline-lib is a backwards-compatible alias for - # --with-readline-ldflags - with-readline-lib: - with-readline-ldflags:=auto - => {Readline LDFLAGS, e.g. -lreadline -lncurses} - # --with-readline-inc is a backwards-compatible alias for - # --with-readline-cflags. - with-readline-inc: - with-readline-cflags:=auto - => {Readline CFLAGS, e.g. -I/path/to/includes} - with-readline-header:PATH - => {Full path to readline.h, from which --with-readline-cflags will be derived} - with-linenoise:DIR => {Source directory for linenoise.c and linenoise.h} - editline=0 => {Enable BSD editline support} - # - # - with-icu-ldflags:LDFLAGS - => {Enable SQLITE_ENABLE_ICU and add the given linker flags for the ICU libraries} - with-icu-cflags:CFLAGS - => {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU. e.g. -I/usr/local/include} - with-icu-config:=auto => {Enable SQLITE_ENABLE_ICU. Value must be one of: auto, pkg-config, /path/to/icu-config} - icu-collations=0 => {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-ldflags=... or --with-icu-config} - # - # - with-wasi-sdk:=/opt/wasi-sdk - => {Top-most dir of the wasi-sdk for a WASI build} - with-emsdk:=auto => {Top-most dir of the Emscripten SDK installation. Default = EMSDK env var.} - # - # - # Note that using the --debug/--enable-debug flag here requires patching - # autosetup/autosetup to rename the --debug to --autosetup-debug. - with-debug=0 - debug=0 => - {Enable debug build flags. This option will impact performance by - as much as 4x, as it includes large numbers of assert()s in - performance-critical loops. Never use --debug for production - builds.} - scanstatus => {Enable the SQLITE_ENABLE_STMT_SCANSTATUS feature flag} - dev => {Enable dev-mode build: automatically enables certain other flags} - test-status => {Enable status of tests} - gcov=0 => {Enable coverage testing using gcov} - linemacros => {Enable #line macros in the amalgamation} - dynlink-tools => {Dynamically link libsqlite3 to certain tools which normally statically embed it.} - dump-defines=0 => {Dump autosetup defines to $::sqliteConfig(dump-defines-txt) (for build debugging)} - # - # - soname:=legacy => - # --soname has a long story behind it: https://sqlite.org/src/forumpost/5a3b44f510df8ded - {SONAME for libsqlite3.so. "none", or not using this flag, sets no - soname. "legacy" sets it to its historical value of - libsqlite3.so.0. A value matching the glob "libsqlite3.*" sets - it to that literal value. Any other value is assumed to be a - suffix which gets applied to "libsqlite3.so.", - e.g. --soname=9.10 equates to "libsqlite3.so.9.10". - } - out-implib=0 => - {Enable use of --out-implib linker flag to generate an "import library" for the DLL} - # -} -if {"" ne $::sqliteConfig(dump-defines-json)} { - lappend flags \ - defines-json-include-lowercase=0 \ - => {Include lower-case defines (primarily system paths) in $::sqliteConfig(dump-defines-json)} -} - -options [subst -nobackslashes -nocommands $flags] -unset flags -sqlite-post-options-init +sqlite-config-bootstrap canonical sqlite-setup-default-cflags proj-if-opt-truthy dev { diff --git a/autoconf/auto.def b/autoconf/auto.def index 42af1b459b..8732f74137 100644 --- a/autoconf/auto.def +++ b/autoconf/auto.def @@ -8,80 +8,7 @@ # included in this source tree as ./autosetup/jimsh0.c. # use sqlite-config - -options { - # - static=1 => {Disable build of static library} - shared=1 => {Disable build of shared library} - # - # - threadsafe=1 => {Disable mutexing} - with-tempstore:=no => {Use an in-RAM database for temporary tables: never,no,yes,always} - load-extension=1 => {Disable loading of external extensions} - math=1 => {Disable math functions} - json=1 => {Disable JSON functions} - memsys5 => {Enable MEMSYS5} - memsys3 => {Enable MEMSYS3} - fts3 => {Enable the FTS3 extension} - fts4 => {Enable the FTS4 extension} - fts5 => {Enable the FTS5 extension} - update-limit => {Enable the UPDATE/DELETE LIMIT clause} - geopoly => {Enable the GEOPOLY extension} - rtree => {Enable the RTREE extension} - session => {Enable the SESSION extension} - all => {Enable FTS4, FTS5, Geopoly, RTree, Sessions} - # - # - readline=1 => {Disable readline support} - # --with-readline-lib is a backwards-compatible alias for - # --with-readline-ldflags - with-readline-lib: - with-readline-ldflags:=auto - => {Readline LDFLAGS, e.g. -lreadline -lncurses} - # --with-readline-inc is a backwards-compatible alias for - # --with-readline-cflags. - with-readline-inc: - with-readline-cflags:=auto - => {Readline CFLAGS, e.g. -I/path/to/includes} - with-readline-header:PATH - => {Full path to readline.h, from which --with-readline-cflags will be derived} - with-linenoise:DIR => {Source directory for linenoise.c and linenoise.h} - editline=0 => {Enable BSD editline support} - # - # - with-icu-ldflags:LDFLAGS - => {Enable SQLITE_ENABLE_ICU and add the given linker flags for the ICU libraries} - with-icu-cflags:CFLAGS - => {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU. e.g. -I/usr/local/include} - with-icu-config:=auto => {Enable SQLITE_ENABLE_ICU. Value must be one of: auto, pkg-config, /path/to/icu-config} - icu-collations=0 => {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-ldflags=... or --with-icu-config} - # - # - # Note that using the --debug/--enable-debug flag here requires patching - # autosetup/autosetup to rename the --debug to --autosetup-debug. - with-debug=0 - debug=0 => - {Enable debug build flags. This option will impact performance by - as much as 4x, as it includes large numbers of assert()s in - performance-critical loops. Never use --debug for production - builds.} - # - # - soname:=legacy => - # --soname has a long story behind it: https://sqlite.org/src/forumpost/5a3b44f510df8ded - {SONAME for libsqlite3.so. "none", or not using this flag, sets no - soname. "legacy" sets it to its historical value of - libsqlite3.so.0. A value matching the glob "libsqlite3.*" sets - it to that literal value. Any other value is assumed to be a - suffix which gets applied to "libsqlite3.so.", - e.g. --soname=9.10 equates to "libsqlite3.so.9.10". - } - out-implib=0 => - {Enable use of --out-implib linker flag to generate an "import library" for the DLL} - # -} - -sqlite-post-options-init +sqlite-config-bootstrap autoconf sqlite-check-common-bins sqlite-check-common-system-deps proj-check-rpath diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 1aaa8af374..f474fe7b82 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -3,6 +3,15 @@ # that they can be reused in the TEA sub-tree. This file requires # functions from proj.tcl. +if {[string first " " $autosetup(srcdir)] != -1} { + user-error "The pathname of the source tree\ + may not contain space characters" +} +if {[string first " " $autosetup(builddir)] != -1} { + user-error "The pathname of the build directory\ + may not contain space characters" +} + use cc cc-db cc-shared cc-lib pkg-config proj # @@ -22,15 +31,6 @@ array set sqliteConfig [proj-strip-hash-comments { # Output file for --dump-defines. Intended only for build debugging # and not part of the public build interface. dump-defines-txt ./config.defines.txt - # - # Output file for --dump-defines-json. This is the autosetup - # counterpart of the historical "DEFS" var which was generated by - # the autotools in the pre-processed autotools builds (but not in - # the canonical tree). Generation of this file is disabled (via an - # empty file name) until/unless someone voices a specific interest - # in it. The original motivating use case is handled fine by - # sqlite_cfg.h. - dump-defines-json "" }] # @@ -41,6 +41,231 @@ array set sqliteConfig [proj-strip-hash-comments { # set sqliteConfig(is-cross-compiling) [proj-is-cross-compiling] +######################################################################## +# Processes all configure --flags for this build $buildMode must be +# either "canonical" or "autoconf", and others may be added in the +# future. +proc sqlite-config-bootstrap {buildMode} { + if {$buildMode ni {canonical autoconf}} { + user-error "Invalid build mode: $buildMode. Expecting one of: canonical, autoconf" + } + ######################################################################## + # A gentle introduction to flags handling in autosetup + # + # Reference: https://msteveb.github.io/autosetup/developer/ + # + # All configure flags must be described in an 'options' call. The + # general syntax is: + # + # FLAG => {Help text} + # + # Where FLAG can have any of the following formats: + # + # boolopt => "a boolean option which defaults to disabled" + # boolopt2=1 => "a boolean option which defaults to enabled" + # stringopt: => "an option which takes an argument, e.g. --stringopt=value" + # stringopt2:=value => "an option where the argument is optional and defaults to 'value'" + # optalias booltopt3 => "a boolean with a hidden alias. --optalias is not shown in --help" + # + # Autosetup does no small amount of specialized handling for flags, + # especially booleans. Each bool-type --FLAG implicitly gets + # --enable-FLAG and --disable-FLAG forms. That can lead lead to some + # confusion when writing help text. For example: + # + # options { json=1 {Disable JSON functions} } + # + # The reason the help text says "disable" is because a boolean option + # which defaults to true is, in the --help text, rendered as: + # + # --disable-json Disable JSON functions + # + # Whereas a bool flag which defaults to false will instead render as: + # + # --enable-FLAG + # + # Non-boolean flags, in contrast, use the names specifically given to + # them in the [options] invocation. e.g. "with-tcl" is the --with-tcl + # flag. + # + # Fetching values for flags: + # + # booleans: use one of: + # - [opt-bool FLAG] is autosetup's built-in command for this, but we + # have some convenience variants: + # - [proj-opt-truthy FLAG] + # - [proj-opt-if-truthy FLAG {THEN} {ELSE}] + # + # Non-boolean (i.e. string) flags: + # - [opt-val FLAG ?default?] + # - [opt-str ...] - see the docs in ./autosetup/autosetup + # + # [proj-opt-was-provided] can be used to determine whether a flag was + # explicitly provided, which is often useful for distinguishing from + # the case of a default value. + ######################################################################## + set allFlags { + # Structure: a list of M {Z}, where M is a descriptive option + # group name and Z is a list of X Y pairs. X is a list of + # $buildMode name(s) to which these flags apply, or {*} to apply + # to all builds. Y is a {block} in the form expected by + # autosetup's [options] command. Each block which is applicable + # to $buildMode is appended to a new list before that list is + # passed on to [options]. The order of each Y and sub-Y is + # retained, which is significant for rendering of --help. + + # When writing {help text blocks}, be aware that autosetup formats + # them differently (left-aligned, directly under the --flag) if the + # block starts with a newline. It does NOT expand vars and commands, + # but we use a [subst] call below which will replace (only) var + # refs. + + build-modes { + {*} { + shared=1 => {Disable build of shared libary} + static=1 => {Disable build of static library (mostly)} + } + {canonical} { + amalgamation=1 => {Disable the amalgamation and instead build all files separately.} + } + } + + lib-features { + {*} { + threadsafe=1 => {Disable mutexing} + with-tempstore:=no => {Use an in-RAM database for temporary tables: never,no,yes,always} + largefile=1 => {Disable large file support} + load-extension=1 => {Disable loading of external extensions} + math=1 => {Disable math functions} + json=1 => {Disable JSON functions} + memsys5 => {Enable MEMSYS5} + memsys3 => {Enable MEMSYS3} + fts3 => {Enable the FTS3 extension} + fts4 => {Enable the FTS4 extension} + fts5 => {Enable the FTS5 extension} + update-limit => {Enable the UPDATE/DELETE LIMIT clause} + geopoly => {Enable the GEOPOLY extension} + rtree => {Enable the RTREE extension} + session => {Enable the SESSION extension} + all => {Enable FTS4, FTS5, Geopoly, RTree, Sessions} + } + } + + tcl { + {canonical} { + with-tcl:DIR => + {Directory containing tclConfig.sh or a directory one level up from + that, from which we can derive a directory containing tclConfig.sh. + A dir name of "prefix" is equivalent to the directory specified by + the --prefix flag.} + with-tclsh:PATH => + {Full pathname of tclsh to use. It is used for (A) trying to find + tclConfig.sh and (B) all TCL-based code generation. Warning: if + its containing dir has multiple tclsh versions, it may select the + wrong tclConfig.sh!} + tcl=1 => + {Disable components which require TCL, including all tests. + This tree requires TCL for code generation but can use the in-tree + copy of autosetup/jimsh0.c for that. The SQLite TCL extension and the + test code require a canonical tclsh.} + } + } + + line-editing { + {*} { + readline=1 => {Disable readline support} + # --with-readline-lib is a backwards-compatible alias for + # --with-readline-ldflags + with-readline-lib: + with-readline-ldflags:=auto + => {Readline LDFLAGS, e.g. -lreadline -lncurses} + # --with-readline-inc is a backwards-compatible alias for + # --with-readline-cflags. + with-readline-inc: + with-readline-cflags:=auto + => {Readline CFLAGS, e.g. -I/path/to/includes} + with-readline-header:PATH + => {Full path to readline.h, from which --with-readline-cflags will be derived} + with-linenoise:DIR => {Source directory for linenoise.c and linenoise.h} + editline=0 => {Enable BSD editline support} + } + } + + icu { + {*} { + with-icu-ldflags:LDFLAGS + => {Enable SQLITE_ENABLE_ICU and add the given linker flags for the ICU libraries} + with-icu-cflags:CFLAGS + => {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU. e.g. -I/usr/local/include} + with-icu-config:=auto => {Enable SQLITE_ENABLE_ICU. Value must be one of: auto, pkg-config, /path/to/icu-config} + icu-collations=0 => {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-ldflags=... or --with-icu-config} + } + } + + alternative-builds { + {canonical} { + with-wasi-sdk:=/opt/wasi-sdk + => {Top-most dir of the wasi-sdk for a WASI build} + with-emsdk:=auto => {Top-most dir of the Emscripten SDK installation. Default = EMSDK env var.} + } + } + + # Note that using the --debug/--enable-debug flag here requires patching + # autosetup/autosetup to rename the --debug to --autosetup-debug. + developer { + {*} { + with-debug=0 + debug=0 => + {Enable debug build flags. This option will impact performance by + as much as 4x, as it includes large numbers of assert()s in + performance-critical loops. Never use --debug for production + builds.} + scanstatus => {Enable the SQLITE_ENABLE_STMT_SCANSTATUS feature flag} + } + {canonical} { + dev => {Enable dev-mode build: automatically enables certain other flags} + test-status => {Enable status of tests} + gcov=0 => {Enable coverage testing using gcov} + linemacros => {Enable #line macros in the amalgamation} + dynlink-tools => {Dynamically link libsqlite3 to certain tools which normally statically embed it.} + } + {*} { + dump-defines=0 => {Dump autosetup defines to $::sqliteConfig(dump-defines-txt) (for build debugging)} + } + } + + packaging { + {*} { + # soname: https://sqlite.org/src/forumpost/5a3b44f510df8ded + soname:=legacy => + {SONAME for libsqlite3.so. "none", or not using this flag, sets no + soname. "legacy" sets it to its historical value of + libsqlite3.so.0. A value matching the glob "libsqlite3.*" sets + it to that literal value. Any other value is assumed to be a + suffix which gets applied to "libsqlite3.so.", + e.g. --soname=9.10 equates to "libsqlite3.so.9.10". + } + out-implib=0 => + {Enable use of --out-implib linker flag to generate an "import library" for the DLL} + } + } + }; # $allOpts + + set opts {} + foreach {group XY} [subst -nobackslashes -nocommands [proj-strip-hash-comments $allFlags]] { + foreach {X Y} $XY { + if { $buildMode in $X || "*" in $X } { + foreach y $Y { + lappend opts $y + } + } + } + } + #puts "options = $opts" + #exit 0 + options $opts + sqlite-post-options-init +}; # sqlite-config-bootstrap + ######################################################################## # Runs some common initialization which must happen immediately after # autosetup's [options] function is called. This is also a convenient @@ -1472,10 +1697,10 @@ proc sqlite-dump-defines {} { -array {*.list} -auto {OPT_* PACKAGE_* HAVE_*} } - if {[opt-bool defines-json-include-lowercase]} { - lappend dumpDefsOpt -none {lib_*} ; # remnants from proj-check-function-in-lib and friends - lappend dumpDefsOpt -auto {[a-z]*} - } +# if {$::sqliteConfig(dump-defines-json-include-lowercase)} { +# lappend dumpDefsOpt -none {lib_*} ; # remnants from proj-check-function-in-lib and friends +# lappend dumpDefsOpt -auto {[a-z]*} +# } lappend dumpDefsOpt -none * proj-dump-defs-json $::sqliteConfig(dump-defines-json) {*}$dumpDefsOpt undefine OPT_FEATURE_FLAGS.list diff --git a/manifest b/manifest index 77a1282113..4248868afc 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\sthe\s--out-implib\ssupport\s([6092b0b86bf93a3d])\sspecifically\sopt-in\sbecause\sthe\sfeature\scheck\sfor\sit\spasses\son\ssome\splatforms\swhere\sit\sis\snot\srecognized\sat\slink-time. -D 2025-02-11T13:13:46.626 +C Move\sthe\sconfigure\sflags\sdefinition\sand\shandling\sinto\sautosetup/sqlite-config.tcl\sto\savoid\sduplication\sbetween\sauto.def\sand\sautoconf/auto.def\swhile\sstill\sgiving\sus\sa\sway\sto\sfilter\sthe\scanonical-tree-only\sflags\sout\sof\sthe\sautoconf\sbuild. +D 2025-02-11T17:10:10.238 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -14,13 +14,13 @@ F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 -F auto.def ccf74471ec89edfd5bf942fd6d60fc8ce09f7aa7527d668a1ac44d1bbbcb412d +F auto.def d06ef819324fc157e231413ad55d1cb26ad4d83bfafa14a1daa3b9d97e33e771 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac F autoconf/Makefile.in 7bd73a4c8cd89025cbc92b4f887c6fd1b8cd8ecbe62c4ac1f36ac84d04043479 F autoconf/Makefile.msc 0a071367537dc395285a5d624ac4f99f3a387b27cc5e89752423c0499e15aec4 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 -F autoconf/auto.def f468a32e6f57c52390e0fe2466974d0afaa1b0fc1d51cbacb4cb3950bd089f67 +F autoconf/auto.def db6c33338294a8b10e205a9081c540b90620b12d916c2fd728a8939fb6fdd97b F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl 62fd6e8782ecfb9f8e54cf2860e590ce9d8692218f03cfa8b25e87ff6b1d0b9b +F autosetup/sqlite-config.tcl 297f5b10a46b46d0dd417a937595916d3868c5fe70af59d7c52516d0b31d6956 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 1768de6e9e2c6ff3a9ee29fa6f488fb3d23a3599195ac7d1b09e61c02b7d18b3 -R fdc42f738677b90118628cf2f1a344a1 +P 75535f2355b3b2e83dd57f4c30340af98c8dbcfe6ff1e9be17d23bd30d7d766c +R b6935973a927dd6f6aec058ecd42249d U stephan -Z 712b8acba7b833aec2f3ddadc507080f +Z 9498d37db1e807d01c315ee284e7bf43 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d8bcef0a58..0f5e4505b2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -75535f2355b3b2e83dd57f4c30340af98c8dbcfe6ff1e9be17d23bd30d7d766c +9978c87139b7b04208fd1f62121fc4e1e2080723fde69a2bbdca88769f4baf22 From db253d086235cab3912cf5ae534e7e90dc2b2531 Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 11 Feb 2025 17:20:12 +0000 Subject: [PATCH 08/54] Rename a configure-internal function and fix handling of --dump-defines for the autoconf bundle. FossilOrigin-Name: 6aa54cc180e034a10d8fc8f8b0c13d7bc0c94509b4240ac855121d501853768f --- auto.def | 3 +-- autoconf/auto.def | 2 +- autosetup/sqlite-config.tcl | 8 +++++++- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/auto.def b/auto.def index d9fa7018a3..981b455954 100644 --- a/auto.def +++ b/auto.def @@ -71,5 +71,4 @@ sqlite-handle-load-extension sqlite-handle-math sqlite-handle-icu sqlite-handle-emsdk -sqlite-common-late-stage-config -sqlite-dump-defines +sqlite-config-finalize diff --git a/autoconf/auto.def b/autoconf/auto.def index 8732f74137..c2e02fe3d8 100644 --- a/autoconf/auto.def +++ b/autoconf/auto.def @@ -25,4 +25,4 @@ sqlite-handle-icu define ENABLE_LIB_SHARED [opt-bool shared] define ENABLE_LIB_STATIC [opt-bool static] -sqlite-common-late-stage-config +sqlite-config-finalize diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index f474fe7b82..3d3f892bf0 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -31,6 +31,11 @@ array set sqliteConfig [proj-strip-hash-comments { # Output file for --dump-defines. Intended only for build debugging # and not part of the public build interface. dump-defines-txt ./config.defines.txt + # + # If not empty then --dump-defines will dump not only + # (dump-defines-txt) but also a JSON file named after this option's + # value. + dump-defines-json "" }] # @@ -1215,11 +1220,12 @@ proc sqlite-check-out-implib {} { ######################################################################## # Performs late-stage config steps common to both the canonical and # autoconf bundle builds. -proc sqlite-common-late-stage-config {} { +proc sqlite-config-finalize {} { sqlite-check-mac-cversion sqlite-check-out-implib sqlite-process-dot-in-files sqlite-post-config-validation + sqlite-dump-defines } ######################################################################## diff --git a/manifest b/manifest index 4248868afc..615d5d04e7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Move\sthe\sconfigure\sflags\sdefinition\sand\shandling\sinto\sautosetup/sqlite-config.tcl\sto\savoid\sduplication\sbetween\sauto.def\sand\sautoconf/auto.def\swhile\sstill\sgiving\sus\sa\sway\sto\sfilter\sthe\scanonical-tree-only\sflags\sout\sof\sthe\sautoconf\sbuild. -D 2025-02-11T17:10:10.238 +C Rename\sa\sconfigure-internal\sfunction\sand\sfix\shandling\sof\s--dump-defines\sfor\sthe\sautoconf\sbundle. +D 2025-02-11T17:20:12.606 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -14,13 +14,13 @@ F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 -F auto.def d06ef819324fc157e231413ad55d1cb26ad4d83bfafa14a1daa3b9d97e33e771 +F auto.def 74ec59fbf7de5038aa9c3d0b1e0fea67e128e432ff9d84472c4016b08ec3d60b F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac F autoconf/Makefile.in 7bd73a4c8cd89025cbc92b4f887c6fd1b8cd8ecbe62c4ac1f36ac84d04043479 F autoconf/Makefile.msc 0a071367537dc395285a5d624ac4f99f3a387b27cc5e89752423c0499e15aec4 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 -F autoconf/auto.def db6c33338294a8b10e205a9081c540b90620b12d916c2fd728a8939fb6fdd97b +F autoconf/auto.def 1900a63cfa18e662b16d912c849ea81609a90b5fe00cea54955a41572e2c2cd0 F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl 297f5b10a46b46d0dd417a937595916d3868c5fe70af59d7c52516d0b31d6956 +F autosetup/sqlite-config.tcl 40107b6a75a2ee367359b2adeb2221e118f5dfa6f10b0a0c0f237fc59fbedef3 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 75535f2355b3b2e83dd57f4c30340af98c8dbcfe6ff1e9be17d23bd30d7d766c -R b6935973a927dd6f6aec058ecd42249d +P 9978c87139b7b04208fd1f62121fc4e1e2080723fde69a2bbdca88769f4baf22 +R 76e33179af2e988165dad18e5266ff58 U stephan -Z 9498d37db1e807d01c315ee284e7bf43 +Z 2f25ba1e1af4da40884b8449b6a5c47c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0f5e4505b2..37bfe81875 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9978c87139b7b04208fd1f62121fc4e1e2080723fde69a2bbdca88769f4baf22 +6aa54cc180e034a10d8fc8f8b0c13d7bc0c94509b4240ac855121d501853768f From 374c6a451e09bc6c14ef7e671bf4c788bfdfefef Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 11 Feb 2025 19:40:19 +0000 Subject: [PATCH 09/54] Omit the src/ctime.c source file, since it is automatically generated by a TCL script. Instead, add rules to the various makefiles to generate ctime.c on demand. FossilOrigin-Name: 958bb5de7c484cc503c38d38d51a30f679244fd364df5cbfc1992e36995b2ff9 --- Makefile.msc | 11 +- main.mk | 12 +- manifest | 21 +- manifest.uuid | 2 +- src/ctime.c | 796 ----------------------------------------- tool/mkctimec.tcl | 10 +- tool/srctree-check.tcl | 17 - 7 files changed, 31 insertions(+), 838 deletions(-) delete mode 100644 src/ctime.c diff --git a/Makefile.msc b/Makefile.msc index 93b0935b1e..3618ae0bcc 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1396,7 +1396,7 @@ SRC00 = \ $(TOP)\src\build.c \ $(TOP)\src\callback.c \ $(TOP)\src\complete.c \ - $(TOP)\src\ctime.c \ + ctime.c \ $(TOP)\src\date.c \ $(TOP)\src\dbpage.c \ $(TOP)\src\dbstat.c \ @@ -2099,8 +2099,11 @@ callback.lo: $(TOP)\src\callback.c $(HDR) complete.lo: $(TOP)\src\complete.c $(HDR) $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\complete.c -ctime.lo: $(TOP)\src\ctime.c $(HDR) - $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\ctime.c +ctime.c: $(TOP)\tool\mkctimec.tcl $(JIM_TCLSH) + $(JIM_TCLSH) $(TOP)\tool\mkctimec.tcl + +ctime.lo: ctime.c $(HDR) + $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c ctime.c date.lo: $(TOP)\src\date.c $(HDR) $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\date.c @@ -2812,7 +2815,7 @@ moreclean: clean clean: del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL del /Q *.bsc *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL - del /Q sqlite3.def tclsqlite3.def 2>NUL + del /Q sqlite3.def tclsqlite3.def ctime.c 2>NUL del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL # <> del /Q $(SQLITE3TCLDLL) pkgIndex.tcl 2>NUL diff --git a/main.mk b/main.mk index 9eec5495ee..82f44a0306 100644 --- a/main.mk +++ b/main.mk @@ -548,7 +548,7 @@ SRC = \ $(TOP)/src/build.c \ $(TOP)/src/callback.c \ $(TOP)/src/complete.c \ - $(TOP)/src/ctime.c \ + ctime.c \ $(TOP)/src/date.c \ $(TOP)/src/dbpage.c \ $(TOP)/src/dbstat.c \ @@ -792,7 +792,7 @@ TESTSRC2 = \ $(TOP)/src/bitvec.c \ $(TOP)/src/btree.c \ $(TOP)/src/build.c \ - $(TOP)/src/ctime.c \ + ctime.c \ $(TOP)/src/date.c \ $(TOP)/src/dbpage.c \ $(TOP)/src/dbstat.c \ @@ -1137,8 +1137,11 @@ callback.o: $(TOP)/src/callback.c $(DEPS_OBJ_COMMON) complete.o: $(TOP)/src/complete.c $(DEPS_OBJ_COMMON) $(T.cc.sqlite) -c $(TOP)/src/complete.c -ctime.o: $(TOP)/src/ctime.c $(DEPS_OBJ_COMMON) - $(T.cc.sqlite) -c $(TOP)/src/ctime.c +ctime.c: $(TOP)/tool/mkctimec.tcl + $(TCLSH_CMD) $(TOP)/tool/mkctimec.tcl + +ctime.o: ctime.c $(DEPS_OBJ_COMMON) + $(T.cc.sqlite) -c ctime.c date.o: $(TOP)/src/date.c $(DEPS_OBJ_COMMON) $(T.cc.sqlite) -c $(TOP)/src/date.c @@ -2353,6 +2356,7 @@ tidy: tidy-. rm -f src-verify$(B.exe) rm -f tclsqlite3.c has_tclsh* $(T.tcl.env.sh) rm -f sqlite3rc.h sqlite3.def + rm -f ctime.c # # Removes build products and test logs. Retains ./configure outputs. diff --git a/manifest b/manifest index 615d5d04e7..9c05778077 100644 --- a/manifest +++ b/manifest @@ -1,11 +1,11 @@ -C Rename\sa\sconfigure-internal\sfunction\sand\sfix\shandling\sof\s--dump-defines\sfor\sthe\sautoconf\sbundle. -D 2025-02-11T17:20:12.606 +C Omit\sthe\ssrc/ctime.c\ssource\sfile,\ssince\sit\sis\sautomatically\sgenerated\sby\sa\sTCL\nscript.\s\sInstead,\sadd\srules\sto\sthe\svarious\smakefiles\sto\sgenerate\sctime.c\son\ndemand. +D 2025-02-11T19:40:19.136 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d F Makefile.in aa869faf7ca086f35c9b3e974fddc7fd65ed2dc45a246b1a94e6f9fdc99b0ed5 F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0 -F Makefile.msc 990e4ea94a417135d1b2fd35550997c3f40fc1758bd7546bd17c0f4312f0babc +F Makefile.msc 3715ce0974666c8cafe391e2383a902956b983aa08bfea1cd57e98ddd27a35bb F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159 F VERSION 001dea55eb8304ec9130b6b44a32d3fc349f279d45a7e224fc0730c3cb8e2372 F art/icon-243x273.gif 9750b734f82fdb3dc43127753d5e6fbf3b62c9f4e136c2fbf573b2f57ea87af5 @@ -702,7 +702,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk c85055d36c36c188cee94cabe2e252cd912d10d1a9d62af477e855533b9531b2 +F main.mk b7d36efaac04a13a85008c694762bf7b58de748dc1565c70a4dd797a944c9f9b F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -725,7 +725,6 @@ F src/btreeInt.h 98aadb6dcb77b012cab2574d6a728fad56b337fc946839b9898c4b4c969e30b F src/build.c 602fc45ea6301a3dc03ec20a9f9b294c492b7e1766ae96651f2ba8044dc445a6 F src/callback.c acae8c8dddda41ee85cfdf19b926eefe830f371069f8aadca3aa39adf5b1c859 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e -F src/ctime.c d35723024b963edce9c0fad5b3303e8bb9266083784844baed10a6dedfe26f3b F src/date.c 842c08ac143a56a627b05ac51d68624f2b7b03e3b4cba596205e735eed64ee57 F src/dbpage.c 2e677acb658a29965e55398bbc61161cb7819da538057c8032adac7ab8e4a8c0 F src/dbstat.c 73362c0df0f40ad5523a6f5501224959d0976757b511299bf892313e79d14f5c @@ -2146,7 +2145,7 @@ F tool/merge-test.tcl de76b62f2de2a92d4c1ca4f976bce0aea6899e0229e250479b229b2a19 F tool/mkamalzip.tcl 8aa5ebe7973c8b8774062d34e15fea9815c4cc2ceea3a9b184695f005910876a F tool/mkautoconfamal.sh 14d2144043c6455958012f92324f4ce7c90a261b5daa2f2c7509498468475f8d F tool/mkccode.tcl 210159febe0ef0ecbc53c79833500663ceaba0115b2b374405818dc835b5f84b x -F tool/mkctimec.tcl ef6a67ec82e5b6fc19152a4c79f237227b18bf67ff16d155bac7adb94355d9cf x +F tool/mkctimec.tcl b57ab5c43cf6a46ba4030027da1cc73d7839e7b78da3b328545bc941bb62360b x F tool/mkkeywordhash.c 6b0be901c47f9ad42215fc995eb2f4384ac49213b1fba395102ec3e999acf559 F tool/mkmsvcmin.tcl d76c45efda1cce2d4005bcea7b8a22bb752e3256009f331120fb4fecb14ebb7a F tool/mkopcodec.tcl 33d20791e191df43209b77d37f0ff0904620b28465cca6990cf8d60da61a07ef @@ -2195,7 +2194,7 @@ F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaa F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848 F tool/src-verify.c d00f93263aa2fa6ba0cba0106d95458e6effb94fdb5fc634f56834f90c05bbb4 F tool/srcck1.c 371de5363b70154012955544f86fdee8f6e5326f -F tool/srctree-check.tcl 1f1f505835a4beca64c1751a7ebec5c41a1ddf22b1e80481345b95059eef6583 +F tool/srctree-check.tcl 5e40c7beaca50c3f29cd9c3aa8d6c9256359690ea0989174f097ace92d6390c2 F tool/stack_usage.tcl f8e71b92cdb099a147dad572375595eae55eca43 F tool/stripccomments.c dfe9cc03cf87728ac9836be30763f8aa52b82caca0780b3d3f3572e4643b01d3 F tool/symbols-mingw.sh 4dbcea7e74768305384c9fd2ed2b41bbf9f0414d @@ -2209,8 +2208,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9978c87139b7b04208fd1f62121fc4e1e2080723fde69a2bbdca88769f4baf22 -R 76e33179af2e988165dad18e5266ff58 -U stephan -Z 2f25ba1e1af4da40884b8449b6a5c47c +P 6aa54cc180e034a10d8fc8f8b0c13d7bc0c94509b4240ac855121d501853768f +R e691176b85b17541b0449680ba0ba564 +U drh +Z 88df15dbb3e7e15a4c35762ecebc556a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 37bfe81875..25b7683b02 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6aa54cc180e034a10d8fc8f8b0c13d7bc0c94509b4240ac855121d501853768f +958bb5de7c484cc503c38d38d51a30f679244fd364df5cbfc1992e36995b2ff9 diff --git a/src/ctime.c b/src/ctime.c deleted file mode 100644 index 9f358bd27f..0000000000 --- a/src/ctime.c +++ /dev/null @@ -1,796 +0,0 @@ -/* DO NOT EDIT! -** This file is automatically generated by the script in the canonical -** SQLite source tree at tool/mkctimec.tcl. -** -** To modify this header, edit any of the various lists in that script -** which specify categories of generated conditionals in this file. -*/ - -/* -** 2010 February 23 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file implements routines used to report what compile-time options -** SQLite was built with. -*/ -#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS /* IMP: R-16824-07538 */ - -/* -** Include the configuration header output by 'configure' if we're using the -** autoconf-based build -*/ -#if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H) -#include "sqlite_cfg.h" -#define SQLITECONFIG_H 1 -#endif - -/* These macros are provided to "stringify" the value of the define -** for those options in which the value is meaningful. */ -#define CTIMEOPT_VAL_(opt) #opt -#define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt) - -/* Like CTIMEOPT_VAL, but especially for SQLITE_DEFAULT_LOOKASIDE. This -** option requires a separate macro because legal values contain a single -** comma. e.g. (-DSQLITE_DEFAULT_LOOKASIDE="100,100") */ -#define CTIMEOPT_VAL2_(opt1,opt2) #opt1 "," #opt2 -#define CTIMEOPT_VAL2(opt) CTIMEOPT_VAL2_(opt) -#include "sqliteInt.h" - -/* -** An array of names of all compile-time options. This array should -** be sorted A-Z. -** -** This array looks large, but in a typical installation actually uses -** only a handful of compile-time options, so most times this array is usually -** rather short and uses little memory space. -*/ -static const char * const sqlite3azCompileOpt[] = { - -#ifdef SQLITE_32BIT_ROWID - "32BIT_ROWID", -#endif -#ifdef SQLITE_4_BYTE_ALIGNED_MALLOC - "4_BYTE_ALIGNED_MALLOC", -#endif -#ifdef SQLITE_ALLOW_COVERING_INDEX_SCAN -# if SQLITE_ALLOW_COVERING_INDEX_SCAN != 1 - "ALLOW_COVERING_INDEX_SCAN=" CTIMEOPT_VAL(SQLITE_ALLOW_COVERING_INDEX_SCAN), -# endif -#endif -#ifdef SQLITE_ALLOW_ROWID_IN_VIEW - "ALLOW_ROWID_IN_VIEW", -#endif -#ifdef SQLITE_ALLOW_URI_AUTHORITY - "ALLOW_URI_AUTHORITY", -#endif -#ifdef SQLITE_ATOMIC_INTRINSICS - "ATOMIC_INTRINSICS=" CTIMEOPT_VAL(SQLITE_ATOMIC_INTRINSICS), -#endif -#ifdef SQLITE_BITMASK_TYPE - "BITMASK_TYPE=" CTIMEOPT_VAL(SQLITE_BITMASK_TYPE), -#endif -#ifdef SQLITE_BUG_COMPATIBLE_20160819 - "BUG_COMPATIBLE_20160819", -#endif -#ifdef SQLITE_CASE_SENSITIVE_LIKE - "CASE_SENSITIVE_LIKE", -#endif -#ifdef SQLITE_CHECK_PAGES - "CHECK_PAGES", -#endif -#if defined(__clang__) && defined(__clang_major__) - "COMPILER=clang-" CTIMEOPT_VAL(__clang_major__) "." - CTIMEOPT_VAL(__clang_minor__) "." - CTIMEOPT_VAL(__clang_patchlevel__), -#elif defined(_MSC_VER) - "COMPILER=msvc-" CTIMEOPT_VAL(_MSC_VER), -#elif defined(__GNUC__) && defined(__VERSION__) - "COMPILER=gcc-" __VERSION__, -#endif -#ifdef SQLITE_COVERAGE_TEST - "COVERAGE_TEST", -#endif -#ifdef SQLITE_DEBUG - "DEBUG", -#endif -#ifdef SQLITE_DEFAULT_AUTOMATIC_INDEX - "DEFAULT_AUTOMATIC_INDEX", -#endif -#ifdef SQLITE_DEFAULT_AUTOVACUUM - "DEFAULT_AUTOVACUUM", -#endif -#ifdef SQLITE_DEFAULT_CACHE_SIZE - "DEFAULT_CACHE_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_CACHE_SIZE), -#endif -#ifdef SQLITE_DEFAULT_CKPTFULLFSYNC - "DEFAULT_CKPTFULLFSYNC", -#endif -#ifdef SQLITE_DEFAULT_FILE_FORMAT - "DEFAULT_FILE_FORMAT=" CTIMEOPT_VAL(SQLITE_DEFAULT_FILE_FORMAT), -#endif -#ifdef SQLITE_DEFAULT_FILE_PERMISSIONS - "DEFAULT_FILE_PERMISSIONS=" CTIMEOPT_VAL(SQLITE_DEFAULT_FILE_PERMISSIONS), -#endif -#ifdef SQLITE_DEFAULT_FOREIGN_KEYS - "DEFAULT_FOREIGN_KEYS", -#endif -#ifdef SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT - "DEFAULT_JOURNAL_SIZE_LIMIT=" CTIMEOPT_VAL(SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT), -#endif -#ifdef SQLITE_DEFAULT_LOCKING_MODE - "DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE), -#endif -#ifdef SQLITE_DEFAULT_LOOKASIDE - "DEFAULT_LOOKASIDE=" CTIMEOPT_VAL2(SQLITE_DEFAULT_LOOKASIDE), -#endif -#ifdef SQLITE_DEFAULT_MEMSTATUS -# if SQLITE_DEFAULT_MEMSTATUS != 1 - "DEFAULT_MEMSTATUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_MEMSTATUS), -# endif -#endif -#ifdef SQLITE_DEFAULT_MMAP_SIZE - "DEFAULT_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_MMAP_SIZE), -#endif -#ifdef SQLITE_DEFAULT_PAGE_SIZE - "DEFAULT_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_PAGE_SIZE), -#endif -#ifdef SQLITE_DEFAULT_PCACHE_INITSZ - "DEFAULT_PCACHE_INITSZ=" CTIMEOPT_VAL(SQLITE_DEFAULT_PCACHE_INITSZ), -#endif -#ifdef SQLITE_DEFAULT_PROXYDIR_PERMISSIONS - "DEFAULT_PROXYDIR_PERMISSIONS=" CTIMEOPT_VAL(SQLITE_DEFAULT_PROXYDIR_PERMISSIONS), -#endif -#ifdef SQLITE_DEFAULT_RECURSIVE_TRIGGERS - "DEFAULT_RECURSIVE_TRIGGERS", -#endif -#ifdef SQLITE_DEFAULT_ROWEST - "DEFAULT_ROWEST=" CTIMEOPT_VAL(SQLITE_DEFAULT_ROWEST), -#endif -#ifdef SQLITE_DEFAULT_SECTOR_SIZE - "DEFAULT_SECTOR_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_SECTOR_SIZE), -#endif -#ifdef SQLITE_DEFAULT_SYNCHRONOUS - "DEFAULT_SYNCHRONOUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_SYNCHRONOUS), -#endif -#ifdef SQLITE_DEFAULT_WAL_AUTOCHECKPOINT - "DEFAULT_WAL_AUTOCHECKPOINT=" CTIMEOPT_VAL(SQLITE_DEFAULT_WAL_AUTOCHECKPOINT), -#endif -#ifdef SQLITE_DEFAULT_WAL_SYNCHRONOUS - "DEFAULT_WAL_SYNCHRONOUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_WAL_SYNCHRONOUS), -#endif -#ifdef SQLITE_DEFAULT_WORKER_THREADS - "DEFAULT_WORKER_THREADS=" CTIMEOPT_VAL(SQLITE_DEFAULT_WORKER_THREADS), -#endif -#ifdef SQLITE_DIRECT_OVERFLOW_READ - "DIRECT_OVERFLOW_READ", -#endif -#ifdef SQLITE_DISABLE_DIRSYNC - "DISABLE_DIRSYNC", -#endif -#ifdef SQLITE_DISABLE_FTS3_UNICODE - "DISABLE_FTS3_UNICODE", -#endif -#ifdef SQLITE_DISABLE_FTS4_DEFERRED - "DISABLE_FTS4_DEFERRED", -#endif -#ifdef SQLITE_DISABLE_INTRINSIC - "DISABLE_INTRINSIC", -#endif -#ifdef SQLITE_DISABLE_LFS - "DISABLE_LFS", -#endif -#ifdef SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS - "DISABLE_PAGECACHE_OVERFLOW_STATS", -#endif -#ifdef SQLITE_DISABLE_SKIPAHEAD_DISTINCT - "DISABLE_SKIPAHEAD_DISTINCT", -#endif -#ifdef SQLITE_DQS - "DQS=" CTIMEOPT_VAL(SQLITE_DQS), -#endif -#ifdef SQLITE_ENABLE_8_3_NAMES - "ENABLE_8_3_NAMES=" CTIMEOPT_VAL(SQLITE_ENABLE_8_3_NAMES), -#endif -#ifdef SQLITE_ENABLE_API_ARMOR - "ENABLE_API_ARMOR", -#endif -#ifdef SQLITE_ENABLE_ATOMIC_WRITE - "ENABLE_ATOMIC_WRITE", -#endif -#ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE - "ENABLE_BATCH_ATOMIC_WRITE", -#endif -#ifdef SQLITE_ENABLE_BYTECODE_VTAB - "ENABLE_BYTECODE_VTAB", -#endif -#ifdef SQLITE_ENABLE_CEROD - "ENABLE_CEROD=" CTIMEOPT_VAL(SQLITE_ENABLE_CEROD), -#endif -#ifdef SQLITE_ENABLE_COLUMN_METADATA - "ENABLE_COLUMN_METADATA", -#endif -#ifdef SQLITE_ENABLE_COLUMN_USED_MASK - "ENABLE_COLUMN_USED_MASK", -#endif -#ifdef SQLITE_ENABLE_COSTMULT - "ENABLE_COSTMULT", -#endif -#ifdef SQLITE_ENABLE_CURSOR_HINTS - "ENABLE_CURSOR_HINTS", -#endif -#ifdef SQLITE_ENABLE_DBPAGE_VTAB - "ENABLE_DBPAGE_VTAB", -#endif -#ifdef SQLITE_ENABLE_DBSTAT_VTAB - "ENABLE_DBSTAT_VTAB", -#endif -#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT - "ENABLE_EXPENSIVE_ASSERT", -#endif -#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS - "ENABLE_EXPLAIN_COMMENTS", -#endif -#ifdef SQLITE_ENABLE_FTS3 - "ENABLE_FTS3", -#endif -#ifdef SQLITE_ENABLE_FTS3_PARENTHESIS - "ENABLE_FTS3_PARENTHESIS", -#endif -#ifdef SQLITE_ENABLE_FTS3_TOKENIZER - "ENABLE_FTS3_TOKENIZER", -#endif -#ifdef SQLITE_ENABLE_FTS4 - "ENABLE_FTS4", -#endif -#ifdef SQLITE_ENABLE_FTS5 - "ENABLE_FTS5", -#endif -#ifdef SQLITE_ENABLE_GEOPOLY - "ENABLE_GEOPOLY", -#endif -#ifdef SQLITE_ENABLE_HIDDEN_COLUMNS - "ENABLE_HIDDEN_COLUMNS", -#endif -#ifdef SQLITE_ENABLE_ICU - "ENABLE_ICU", -#endif -#ifdef SQLITE_ENABLE_IOTRACE - "ENABLE_IOTRACE", -#endif -#ifdef SQLITE_ENABLE_LOAD_EXTENSION - "ENABLE_LOAD_EXTENSION", -#endif -#ifdef SQLITE_ENABLE_LOCKING_STYLE - "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE), -#endif -#ifdef SQLITE_ENABLE_MATH_FUNCTIONS - "ENABLE_MATH_FUNCTIONS", -#endif -#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT - "ENABLE_MEMORY_MANAGEMENT", -#endif -#ifdef SQLITE_ENABLE_MEMSYS3 - "ENABLE_MEMSYS3", -#endif -#ifdef SQLITE_ENABLE_MEMSYS5 - "ENABLE_MEMSYS5", -#endif -#ifdef SQLITE_ENABLE_MULTIPLEX - "ENABLE_MULTIPLEX", -#endif -#ifdef SQLITE_ENABLE_NORMALIZE - "ENABLE_NORMALIZE", -#endif -#ifdef SQLITE_ENABLE_NULL_TRIM - "ENABLE_NULL_TRIM", -#endif -#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC - "ENABLE_OFFSET_SQL_FUNC", -#endif -#ifdef SQLITE_ENABLE_ORDERED_SET_AGGREGATES - "ENABLE_ORDERED_SET_AGGREGATES", -#endif -#ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK - "ENABLE_OVERSIZE_CELL_CHECK", -#endif -#ifdef SQLITE_ENABLE_PREUPDATE_HOOK - "ENABLE_PREUPDATE_HOOK", -#endif -#ifdef SQLITE_ENABLE_QPSG - "ENABLE_QPSG", -#endif -#ifdef SQLITE_ENABLE_RBU - "ENABLE_RBU", -#endif -#ifdef SQLITE_ENABLE_RTREE - "ENABLE_RTREE", -#endif -#ifdef SQLITE_ENABLE_SESSION - "ENABLE_SESSION", -#endif -#ifdef SQLITE_ENABLE_SNAPSHOT - "ENABLE_SNAPSHOT", -#endif -#ifdef SQLITE_ENABLE_SORTER_REFERENCES - "ENABLE_SORTER_REFERENCES", -#endif -#ifdef SQLITE_ENABLE_SQLLOG - "ENABLE_SQLLOG", -#endif -#ifdef SQLITE_ENABLE_STAT4 - "ENABLE_STAT4", -#endif -#ifdef SQLITE_ENABLE_STMTVTAB - "ENABLE_STMTVTAB", -#endif -#ifdef SQLITE_ENABLE_STMT_SCANSTATUS - "ENABLE_STMT_SCANSTATUS", -#endif -#ifdef SQLITE_ENABLE_TREETRACE - "ENABLE_TREETRACE", -#endif -#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION - "ENABLE_UNKNOWN_SQL_FUNCTION", -#endif -#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY - "ENABLE_UNLOCK_NOTIFY", -#endif -#ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT - "ENABLE_UPDATE_DELETE_LIMIT", -#endif -#ifdef SQLITE_ENABLE_URI_00_ERROR - "ENABLE_URI_00_ERROR", -#endif -#ifdef SQLITE_ENABLE_VFSTRACE - "ENABLE_VFSTRACE", -#endif -#ifdef SQLITE_ENABLE_WHERETRACE - "ENABLE_WHERETRACE", -#endif -#ifdef SQLITE_ENABLE_ZIPVFS - "ENABLE_ZIPVFS", -#endif -#ifdef SQLITE_EXPLAIN_ESTIMATED_ROWS - "EXPLAIN_ESTIMATED_ROWS", -#endif -#ifdef SQLITE_EXTRA_AUTOEXT - "EXTRA_AUTOEXT=" CTIMEOPT_VAL(SQLITE_EXTRA_AUTOEXT), -#endif -#ifdef SQLITE_EXTRA_IFNULLROW - "EXTRA_IFNULLROW", -#endif -#ifdef SQLITE_EXTRA_INIT - "EXTRA_INIT=" CTIMEOPT_VAL(SQLITE_EXTRA_INIT), -#endif -#ifdef SQLITE_EXTRA_SHUTDOWN - "EXTRA_SHUTDOWN=" CTIMEOPT_VAL(SQLITE_EXTRA_SHUTDOWN), -#endif -#ifdef SQLITE_FTS3_MAX_EXPR_DEPTH - "FTS3_MAX_EXPR_DEPTH=" CTIMEOPT_VAL(SQLITE_FTS3_MAX_EXPR_DEPTH), -#endif -#ifdef SQLITE_FTS5_ENABLE_TEST_MI - "FTS5_ENABLE_TEST_MI", -#endif -#ifdef SQLITE_FTS5_NO_WITHOUT_ROWID - "FTS5_NO_WITHOUT_ROWID", -#endif -#if HAVE_ISNAN || SQLITE_HAVE_ISNAN - "HAVE_ISNAN", -#endif -#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX -# if SQLITE_HOMEGROWN_RECURSIVE_MUTEX != 1 - "HOMEGROWN_RECURSIVE_MUTEX=" CTIMEOPT_VAL(SQLITE_HOMEGROWN_RECURSIVE_MUTEX), -# endif -#endif -#ifdef SQLITE_IGNORE_AFP_LOCK_ERRORS - "IGNORE_AFP_LOCK_ERRORS", -#endif -#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS - "IGNORE_FLOCK_LOCK_ERRORS", -#endif -#ifdef SQLITE_INLINE_MEMCPY - "INLINE_MEMCPY", -#endif -#ifdef SQLITE_INT64_TYPE - "INT64_TYPE", -#endif -#ifdef SQLITE_INTEGRITY_CHECK_ERROR_MAX - "INTEGRITY_CHECK_ERROR_MAX=" CTIMEOPT_VAL(SQLITE_INTEGRITY_CHECK_ERROR_MAX), -#endif -#ifdef SQLITE_LEGACY_JSON_VALID - "LEGACY_JSON_VALID", -#endif -#ifdef SQLITE_LIKE_DOESNT_MATCH_BLOBS - "LIKE_DOESNT_MATCH_BLOBS", -#endif -#ifdef SQLITE_LOCK_TRACE - "LOCK_TRACE", -#endif -#ifdef SQLITE_LOG_CACHE_SPILL - "LOG_CACHE_SPILL", -#endif -#ifdef SQLITE_MALLOC_SOFT_LIMIT - "MALLOC_SOFT_LIMIT=" CTIMEOPT_VAL(SQLITE_MALLOC_SOFT_LIMIT), -#endif -#ifdef SQLITE_MAX_ATTACHED - "MAX_ATTACHED=" CTIMEOPT_VAL(SQLITE_MAX_ATTACHED), -#endif -#ifdef SQLITE_MAX_COLUMN - "MAX_COLUMN=" CTIMEOPT_VAL(SQLITE_MAX_COLUMN), -#endif -#ifdef SQLITE_MAX_COMPOUND_SELECT - "MAX_COMPOUND_SELECT=" CTIMEOPT_VAL(SQLITE_MAX_COMPOUND_SELECT), -#endif -#ifdef SQLITE_MAX_DEFAULT_PAGE_SIZE - "MAX_DEFAULT_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_DEFAULT_PAGE_SIZE), -#endif -#ifdef SQLITE_MAX_EXPR_DEPTH - "MAX_EXPR_DEPTH=" CTIMEOPT_VAL(SQLITE_MAX_EXPR_DEPTH), -#endif -#ifdef SQLITE_MAX_FUNCTION_ARG - "MAX_FUNCTION_ARG=" CTIMEOPT_VAL(SQLITE_MAX_FUNCTION_ARG), -#endif -#ifdef SQLITE_MAX_LENGTH - "MAX_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_LENGTH), -#endif -#ifdef SQLITE_MAX_LIKE_PATTERN_LENGTH - "MAX_LIKE_PATTERN_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_LIKE_PATTERN_LENGTH), -#endif -#ifdef SQLITE_MAX_MEMORY - "MAX_MEMORY=" CTIMEOPT_VAL(SQLITE_MAX_MEMORY), -#endif -#ifdef SQLITE_MAX_MMAP_SIZE - "MAX_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_MMAP_SIZE), -#endif -#ifdef SQLITE_MAX_MMAP_SIZE_ - "MAX_MMAP_SIZE_=" CTIMEOPT_VAL(SQLITE_MAX_MMAP_SIZE_), -#endif -#ifdef SQLITE_MAX_PAGE_COUNT - "MAX_PAGE_COUNT=" CTIMEOPT_VAL(SQLITE_MAX_PAGE_COUNT), -#endif -#ifdef SQLITE_MAX_PAGE_SIZE - "MAX_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_PAGE_SIZE), -#endif -#ifdef SQLITE_MAX_SCHEMA_RETRY - "MAX_SCHEMA_RETRY=" CTIMEOPT_VAL(SQLITE_MAX_SCHEMA_RETRY), -#endif -#ifdef SQLITE_MAX_SQL_LENGTH - "MAX_SQL_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_SQL_LENGTH), -#endif -#ifdef SQLITE_MAX_TRIGGER_DEPTH - "MAX_TRIGGER_DEPTH=" CTIMEOPT_VAL(SQLITE_MAX_TRIGGER_DEPTH), -#endif -#ifdef SQLITE_MAX_VARIABLE_NUMBER - "MAX_VARIABLE_NUMBER=" CTIMEOPT_VAL(SQLITE_MAX_VARIABLE_NUMBER), -#endif -#ifdef SQLITE_MAX_VDBE_OP - "MAX_VDBE_OP=" CTIMEOPT_VAL(SQLITE_MAX_VDBE_OP), -#endif -#ifdef SQLITE_MAX_WORKER_THREADS - "MAX_WORKER_THREADS=" CTIMEOPT_VAL(SQLITE_MAX_WORKER_THREADS), -#endif -#ifdef SQLITE_MEMDEBUG - "MEMDEBUG", -#endif -#ifdef SQLITE_MIXED_ENDIAN_64BIT_FLOAT - "MIXED_ENDIAN_64BIT_FLOAT", -#endif -#ifdef SQLITE_MMAP_READWRITE - "MMAP_READWRITE", -#endif -#ifdef SQLITE_MUTEX_NOOP - "MUTEX_NOOP", -#endif -#ifdef SQLITE_MUTEX_OMIT - "MUTEX_OMIT", -#endif -#ifdef SQLITE_MUTEX_PTHREADS - "MUTEX_PTHREADS", -#endif -#ifdef SQLITE_MUTEX_W32 - "MUTEX_W32", -#endif -#ifdef SQLITE_NEED_ERR_NAME - "NEED_ERR_NAME", -#endif -#ifdef SQLITE_NO_SYNC - "NO_SYNC", -#endif -#ifdef SQLITE_OMIT_ALTERTABLE - "OMIT_ALTERTABLE", -#endif -#ifdef SQLITE_OMIT_ANALYZE - "OMIT_ANALYZE", -#endif -#ifdef SQLITE_OMIT_ATTACH - "OMIT_ATTACH", -#endif -#ifdef SQLITE_OMIT_AUTHORIZATION - "OMIT_AUTHORIZATION", -#endif -#ifdef SQLITE_OMIT_AUTOINCREMENT - "OMIT_AUTOINCREMENT", -#endif -#ifdef SQLITE_OMIT_AUTOINIT - "OMIT_AUTOINIT", -#endif -#ifdef SQLITE_OMIT_AUTOMATIC_INDEX - "OMIT_AUTOMATIC_INDEX", -#endif -#ifdef SQLITE_OMIT_AUTORESET - "OMIT_AUTORESET", -#endif -#ifdef SQLITE_OMIT_AUTOVACUUM - "OMIT_AUTOVACUUM", -#endif -#ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION - "OMIT_BETWEEN_OPTIMIZATION", -#endif -#ifdef SQLITE_OMIT_BLOB_LITERAL - "OMIT_BLOB_LITERAL", -#endif -#ifdef SQLITE_OMIT_CAST - "OMIT_CAST", -#endif -#ifdef SQLITE_OMIT_CHECK - "OMIT_CHECK", -#endif -#ifdef SQLITE_OMIT_COMPLETE - "OMIT_COMPLETE", -#endif -#ifdef SQLITE_OMIT_COMPOUND_SELECT - "OMIT_COMPOUND_SELECT", -#endif -#ifdef SQLITE_OMIT_CONFLICT_CLAUSE - "OMIT_CONFLICT_CLAUSE", -#endif -#ifdef SQLITE_OMIT_CTE - "OMIT_CTE", -#endif -#if defined(SQLITE_OMIT_DATETIME_FUNCS) || defined(SQLITE_OMIT_FLOATING_POINT) - "OMIT_DATETIME_FUNCS", -#endif -#ifdef SQLITE_OMIT_DECLTYPE - "OMIT_DECLTYPE", -#endif -#ifdef SQLITE_OMIT_DEPRECATED - "OMIT_DEPRECATED", -#endif -#ifdef SQLITE_OMIT_DESERIALIZE - "OMIT_DESERIALIZE", -#endif -#ifdef SQLITE_OMIT_DISKIO - "OMIT_DISKIO", -#endif -#ifdef SQLITE_OMIT_EXPLAIN - "OMIT_EXPLAIN", -#endif -#ifdef SQLITE_OMIT_FLAG_PRAGMAS - "OMIT_FLAG_PRAGMAS", -#endif -#ifdef SQLITE_OMIT_FLOATING_POINT - "OMIT_FLOATING_POINT", -#endif -#ifdef SQLITE_OMIT_FOREIGN_KEY - "OMIT_FOREIGN_KEY", -#endif -#ifdef SQLITE_OMIT_GET_TABLE - "OMIT_GET_TABLE", -#endif -#ifdef SQLITE_OMIT_HEX_INTEGER - "OMIT_HEX_INTEGER", -#endif -#ifdef SQLITE_OMIT_INCRBLOB - "OMIT_INCRBLOB", -#endif -#ifdef SQLITE_OMIT_INTEGRITY_CHECK - "OMIT_INTEGRITY_CHECK", -#endif -#ifdef SQLITE_OMIT_INTROSPECTION_PRAGMAS - "OMIT_INTROSPECTION_PRAGMAS", -#endif -#ifdef SQLITE_OMIT_JSON - "OMIT_JSON", -#endif -#ifdef SQLITE_OMIT_LIKE_OPTIMIZATION - "OMIT_LIKE_OPTIMIZATION", -#endif -#ifdef SQLITE_OMIT_LOAD_EXTENSION - "OMIT_LOAD_EXTENSION", -#endif -#ifdef SQLITE_OMIT_LOCALTIME - "OMIT_LOCALTIME", -#endif -#ifdef SQLITE_OMIT_LOOKASIDE - "OMIT_LOOKASIDE", -#endif -#ifdef SQLITE_OMIT_MEMORYDB - "OMIT_MEMORYDB", -#endif -#ifdef SQLITE_OMIT_OR_OPTIMIZATION - "OMIT_OR_OPTIMIZATION", -#endif -#ifdef SQLITE_OMIT_PAGER_PRAGMAS - "OMIT_PAGER_PRAGMAS", -#endif -#ifdef SQLITE_OMIT_PARSER_TRACE - "OMIT_PARSER_TRACE", -#endif -#ifdef SQLITE_OMIT_POPEN - "OMIT_POPEN", -#endif -#ifdef SQLITE_OMIT_PRAGMA - "OMIT_PRAGMA", -#endif -#ifdef SQLITE_OMIT_PROGRESS_CALLBACK - "OMIT_PROGRESS_CALLBACK", -#endif -#ifdef SQLITE_OMIT_QUICKBALANCE - "OMIT_QUICKBALANCE", -#endif -#ifdef SQLITE_OMIT_REINDEX - "OMIT_REINDEX", -#endif -#ifdef SQLITE_OMIT_SCHEMA_PRAGMAS - "OMIT_SCHEMA_PRAGMAS", -#endif -#ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS - "OMIT_SCHEMA_VERSION_PRAGMAS", -#endif -#ifdef SQLITE_OMIT_SEH - "OMIT_SEH", -#endif -#ifdef SQLITE_OMIT_SHARED_CACHE - "OMIT_SHARED_CACHE", -#endif -#ifdef SQLITE_OMIT_SHUTDOWN_DIRECTORIES - "OMIT_SHUTDOWN_DIRECTORIES", -#endif -#ifdef SQLITE_OMIT_SUBQUERY - "OMIT_SUBQUERY", -#endif -#ifdef SQLITE_OMIT_TCL_VARIABLE - "OMIT_TCL_VARIABLE", -#endif -#ifdef SQLITE_OMIT_TEMPDB - "OMIT_TEMPDB", -#endif -#ifdef SQLITE_OMIT_TEST_CONTROL - "OMIT_TEST_CONTROL", -#endif -#ifdef SQLITE_OMIT_TRACE -# if SQLITE_OMIT_TRACE != 1 - "OMIT_TRACE=" CTIMEOPT_VAL(SQLITE_OMIT_TRACE), -# endif -#endif -#ifdef SQLITE_OMIT_TRIGGER - "OMIT_TRIGGER", -#endif -#ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION - "OMIT_TRUNCATE_OPTIMIZATION", -#endif -#ifdef SQLITE_OMIT_UTF16 - "OMIT_UTF16", -#endif -#ifdef SQLITE_OMIT_VACUUM - "OMIT_VACUUM", -#endif -#ifdef SQLITE_OMIT_VIEW - "OMIT_VIEW", -#endif -#ifdef SQLITE_OMIT_VIRTUALTABLE - "OMIT_VIRTUALTABLE", -#endif -#ifdef SQLITE_OMIT_WAL - "OMIT_WAL", -#endif -#ifdef SQLITE_OMIT_WSD - "OMIT_WSD", -#endif -#ifdef SQLITE_OMIT_XFER_OPT - "OMIT_XFER_OPT", -#endif -#ifdef SQLITE_PERFORMANCE_TRACE - "PERFORMANCE_TRACE", -#endif -#ifdef SQLITE_POWERSAFE_OVERWRITE -# if SQLITE_POWERSAFE_OVERWRITE != 1 - "POWERSAFE_OVERWRITE=" CTIMEOPT_VAL(SQLITE_POWERSAFE_OVERWRITE), -# endif -#endif -#ifdef SQLITE_PREFER_PROXY_LOCKING - "PREFER_PROXY_LOCKING", -#endif -#ifdef SQLITE_PROXY_DEBUG - "PROXY_DEBUG", -#endif -#ifdef SQLITE_REVERSE_UNORDERED_SELECTS - "REVERSE_UNORDERED_SELECTS", -#endif -#ifdef SQLITE_RTREE_INT_ONLY - "RTREE_INT_ONLY", -#endif -#ifdef SQLITE_SECURE_DELETE - "SECURE_DELETE", -#endif -#ifdef SQLITE_SMALL_STACK - "SMALL_STACK", -#endif -#ifdef SQLITE_SORTER_PMASZ - "SORTER_PMASZ=" CTIMEOPT_VAL(SQLITE_SORTER_PMASZ), -#endif -#ifdef SQLITE_SOUNDEX - "SOUNDEX", -#endif -#ifdef SQLITE_STAT4_SAMPLES - "STAT4_SAMPLES=" CTIMEOPT_VAL(SQLITE_STAT4_SAMPLES), -#endif -#ifdef SQLITE_STMTJRNL_SPILL - "STMTJRNL_SPILL=" CTIMEOPT_VAL(SQLITE_STMTJRNL_SPILL), -#endif -#ifdef SQLITE_SUBSTR_COMPATIBILITY - "SUBSTR_COMPATIBILITY", -#endif -#if (!defined(SQLITE_WIN32_MALLOC) \ - && !defined(SQLITE_ZERO_MALLOC) \ - && !defined(SQLITE_MEMDEBUG) \ - ) || defined(SQLITE_SYSTEM_MALLOC) - "SYSTEM_MALLOC", -#endif -#ifdef SQLITE_TCL - "TCL", -#endif -#ifdef SQLITE_TEMP_STORE - "TEMP_STORE=" CTIMEOPT_VAL(SQLITE_TEMP_STORE), -#endif -#ifdef SQLITE_TEST - "TEST", -#endif -#if defined(SQLITE_THREADSAFE) - "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE), -#elif defined(THREADSAFE) - "THREADSAFE=" CTIMEOPT_VAL(THREADSAFE), -#else - "THREADSAFE=1", -#endif -#ifdef SQLITE_UNLINK_AFTER_CLOSE - "UNLINK_AFTER_CLOSE", -#endif -#ifdef SQLITE_UNTESTABLE - "UNTESTABLE", -#endif -#ifdef SQLITE_USE_ALLOCA - "USE_ALLOCA", -#endif -#ifdef SQLITE_USE_FCNTL_TRACE - "USE_FCNTL_TRACE", -#endif -#ifdef SQLITE_USE_URI - "USE_URI", -#endif -#ifdef SQLITE_VDBE_COVERAGE - "VDBE_COVERAGE", -#endif -#ifdef SQLITE_WIN32_MALLOC - "WIN32_MALLOC", -#endif -#ifdef SQLITE_ZERO_MALLOC - "ZERO_MALLOC", -#endif - -} ; - -const char **sqlite3CompileOptions(int *pnOpt){ - *pnOpt = sizeof(sqlite3azCompileOpt) / sizeof(sqlite3azCompileOpt[0]); - return (const char**)sqlite3azCompileOpt; -} - -#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */ diff --git a/tool/mkctimec.tcl b/tool/mkctimec.tcl index 69d25c678e..1a845b00bf 100755 --- a/tool/mkctimec.tcl +++ b/tool/mkctimec.tcl @@ -4,13 +4,13 @@ # # const char **azCompileOpt[] # -# definition used in src/ctime.c, run this script from -# the checkout root. It generates src/ctime.c . +# definition used in ctime.c, run this script from +# the checkout root. It generates ctime.c . # -# Results are normally written into src/ctime.c. But if an argument is +# Results are normally written into ctime.c. But if an argument is # provided, results are written there instead. Examples: # -# tclsh tool/mkctimec.tcl ;# <-- results to src/ctime.c +# tclsh tool/mkctimec.tcl ;# <-- ctime.c # # tclsh tool/mkctimec.tcl /dev/tty ;# <-- results to the terminal # @@ -440,7 +440,7 @@ foreach v $value2_options { if {$argc>0} { set destfile [lindex $argv 0] } else { - set destfile "[file dir [file dir [file normal $argv0]]]/src/ctime.c" + set destfile ctime.c puts "Overwriting $destfile..." } diff --git a/tool/srctree-check.tcl b/tool/srctree-check.tcl index b65e223db9..918f12a9d6 100644 --- a/tool/srctree-check.tcl +++ b/tool/srctree-check.tcl @@ -4,7 +4,6 @@ # various aspects of the source tree are up-to-date. Items checked include: # # * Makefile.msc and autoconf/Makefile.msc agree -# * src/ctime.tcl is consistent with tool/mkctimec.tcl # * VERSION agrees with autoconf/tea/configure.ac # * src/pragma.h agrees with tool/mkpragmatab.tcl # @@ -74,19 +73,3 @@ if {$f1 != $f2} { puts "...... Fix: tclsh tool/mkpragmatab.tcl" incr NERR } - -######################### src/ctime.c ######################################## - -set f1 [readfile $ROOT/src/ctime.c] -exec $TCLSH $ROOT/tool/mkctimec.tcl tmp3.txt -set f2 [readfile tmp3.txt] -file delete tmp3.txt -if {$f1 != $f2} { - puts "ERROR: ./src/ctime.c does not agree with ./tool/mkctimec.tcl" - puts "..... Fix: tclsh tool/mkctimec.tcl" - incr NERR -} - -# If any errors are seen, exit 1 so that the build will fail. -# -if {$NERR>0} {exit 1} From cd56ad4ccb42b598f3422f2c554a6feaa5c10951 Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 11 Feb 2025 19:54:13 +0000 Subject: [PATCH 10/54] Omit the src/pragma.h file. It is generated by the tool/mkpragmatab.tcl script. The makefiles now know how to build this file for themselves. FossilOrigin-Name: 9709ed1cdfa17f690ffd4ec8cfc54efefec8352143c1d8b701f09299bd7eef6e --- Makefile.msc | 9 +- autoconf/Makefile.msc | 2 +- main.mk | 13 +- manifest | 21 +- manifest.uuid | 2 +- src/pragma.h | 660 ----------------------------------------- tool/mkpragmatab.tcl | 8 +- tool/srctree-check.tcl | 13 - 8 files changed, 30 insertions(+), 698 deletions(-) delete mode 100644 src/pragma.h diff --git a/Makefile.msc b/Makefile.msc index 3618ae0bcc..05fff146bc 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1495,7 +1495,7 @@ SRC04 = \ SRC05 = \ $(TOP)\src\pager.h \ $(TOP)\src\pcache.h \ - $(TOP)\src\pragma.h \ + pragma.h \ $(TOP)\src\sqlite.h.in \ $(TOP)\src\sqlite3ext.h \ $(TOP)\src\sqliteInt.h \ @@ -1698,7 +1698,7 @@ HDR = \ $(TOP)\src\pager.h \ $(TOP)\src\pcache.h \ parse.h \ - $(TOP)\src\pragma.h \ + pragma.h \ $(SQLITE3H) \ sqlite3ext.h \ $(TOP)\src\sqliteInt.h \ @@ -2336,6 +2336,9 @@ parse.c: $(TOP)\src\parse.y lemon.exe copy /B parse.y +,, .\lemon.exe $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS) $(OPTS) -S parse.y +pragma.h: $(TOP)\tool\mkpragmatab.tcl $(JIM_TCLSH) + $(JIM_TCLSH) $(TOP)\tool\mkpragmatab.tcl + $(SQLITE3H): $(TOP)\src\sqlite.h.in $(TOP)\manifest mksourceid.exe $(TOP)\VERSION $(JIM_TCLSH) $(JIM_TCLSH) $(TOP)\tool\mksqlite3h.tcl "$(TOP:\=/)" -o $(SQLITE3H) $(MKSQLITE3H_ARGS) @@ -2815,7 +2818,7 @@ moreclean: clean clean: del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL del /Q *.bsc *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL - del /Q sqlite3.def tclsqlite3.def ctime.c 2>NUL + del /Q sqlite3.def tclsqlite3.def ctime.c pragma.h 2>NUL del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL # <> del /Q $(SQLITE3TCLDLL) pkgIndex.tcl 2>NUL diff --git a/autoconf/Makefile.msc b/autoconf/Makefile.msc index 47e0a83af8..f891036a14 100644 --- a/autoconf/Makefile.msc +++ b/autoconf/Makefile.msc @@ -1088,5 +1088,5 @@ $(LIBRESOBJS): $(TOP)\sqlite3.rc rcver.vc $(SQLITE3H) clean: del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL del /Q *.bsc *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL - del /Q sqlite3.def tclsqlite3.def 2>NUL + del /Q sqlite3.def tclsqlite3.def ctime.c 2>NUL del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL diff --git a/main.mk b/main.mk index 82f44a0306..615dc97fb5 100644 --- a/main.mk +++ b/main.mk @@ -596,7 +596,7 @@ SRC = \ $(TOP)/src/pcache.h \ $(TOP)/src/pcache1.c \ $(TOP)/src/pragma.c \ - $(TOP)/src/pragma.h \ + pragma.h \ $(TOP)/src/prepare.c \ $(TOP)/src/printf.c \ $(TOP)/src/random.c \ @@ -857,7 +857,7 @@ HDR = \ $(TOP)/src/pager.h \ $(TOP)/src/pcache.h \ parse.h \ - $(TOP)/src/pragma.h \ + pragma.h \ sqlite3.h \ $(TOP)/src/sqlite3ext.h \ $(TOP)/src/sqliteInt.h \ @@ -1137,8 +1137,8 @@ callback.o: $(TOP)/src/callback.c $(DEPS_OBJ_COMMON) complete.o: $(TOP)/src/complete.c $(DEPS_OBJ_COMMON) $(T.cc.sqlite) -c $(TOP)/src/complete.c -ctime.c: $(TOP)/tool/mkctimec.tcl - $(TCLSH_CMD) $(TOP)/tool/mkctimec.tcl +ctime.c: $(TOP)/tool/mkctimec.tcl $(B.tclsh) + $(B.tclsh) $(TOP)/tool/mkctimec.tcl ctime.o: ctime.c $(DEPS_OBJ_COMMON) $(T.cc.sqlite) -c ctime.c @@ -1385,6 +1385,9 @@ parse.c: $(TOP)/src/parse.y lemon$(B.exe) cp $(TOP)/src/parse.y . ./lemon$(B.exe) $(OPT_FEATURE_FLAGS) $(OPTS) -S parse.y +pragma.h: $(TOP)/tool/mkpragmatab.tcl $(B.tclsh) + $(B.tclsh) $(TOP)/tool/mkpragmatab.tcl + sqlite3rc.h: $(TOP)/src/sqlite3.rc $(TOP)/VERSION $(B.tclsh) echo '#ifndef SQLITE_RESOURCE_VERSION' >$@ echo -n '#define SQLITE_RESOURCE_VERSION ' >>$@ @@ -2356,7 +2359,7 @@ tidy: tidy-. rm -f src-verify$(B.exe) rm -f tclsqlite3.c has_tclsh* $(T.tcl.env.sh) rm -f sqlite3rc.h sqlite3.def - rm -f ctime.c + rm -f ctime.c pragma.h # # Removes build products and test logs. Retains ./configure outputs. diff --git a/manifest b/manifest index 9c05778077..e71a53be0b 100644 --- a/manifest +++ b/manifest @@ -1,11 +1,11 @@ -C Omit\sthe\ssrc/ctime.c\ssource\sfile,\ssince\sit\sis\sautomatically\sgenerated\sby\sa\sTCL\nscript.\s\sInstead,\sadd\srules\sto\sthe\svarious\smakefiles\sto\sgenerate\sctime.c\son\ndemand. -D 2025-02-11T19:40:19.136 +C Omit\sthe\ssrc/pragma.h\sfile.\s\sIt\sis\sgenerated\sby\sthe\stool/mkpragmatab.tcl\sscript.\nThe\smakefiles\snow\sknow\show\sto\sbuild\sthis\sfile\sfor\sthemselves. +D 2025-02-11T19:54:13.594 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d F Makefile.in aa869faf7ca086f35c9b3e974fddc7fd65ed2dc45a246b1a94e6f9fdc99b0ed5 F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0 -F Makefile.msc 3715ce0974666c8cafe391e2383a902956b983aa08bfea1cd57e98ddd27a35bb +F Makefile.msc 50c656e096ae49ccf9e5e88b4995f0a155f231ebae5b6d185cc64ce99d728a83 F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159 F VERSION 001dea55eb8304ec9130b6b44a32d3fc349f279d45a7e224fc0730c3cb8e2372 F art/icon-243x273.gif 9750b734f82fdb3dc43127753d5e6fbf3b62c9f4e136c2fbf573b2f57ea87af5 @@ -17,7 +17,7 @@ F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821 F auto.def 74ec59fbf7de5038aa9c3d0b1e0fea67e128e432ff9d84472c4016b08ec3d60b F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac F autoconf/Makefile.in 7bd73a4c8cd89025cbc92b4f887c6fd1b8cd8ecbe62c4ac1f36ac84d04043479 -F autoconf/Makefile.msc 0a071367537dc395285a5d624ac4f99f3a387b27cc5e89752423c0499e15aec4 +F autoconf/Makefile.msc 4f09fead3bf7de337242896f107c5d03cd8f7b39754315ab091a2e4d02892c40 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 F autoconf/auto.def 1900a63cfa18e662b16d912c849ea81609a90b5fe00cea54955a41572e2c2cd0 @@ -702,7 +702,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk b7d36efaac04a13a85008c694762bf7b58de748dc1565c70a4dd797a944c9f9b +F main.mk ecf4b449c742eaa3a872a5cd0e8e5c19e2dccfe3b5b0ccafd0c926dc1030c661 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -773,7 +773,6 @@ F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484 F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5 F src/pcache1.c 49516ad7718a3626f28f710fa7448ef1fce3c07fd169acbb4817341950264319 F src/pragma.c ce1182217aa540e034c6da2f17515e3706bf52c837e8222361be9ccd7a9d495a -F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7 F src/prepare.c 1832be043fce7d489959aae6f994c452d023914714c4d5457beaed51c0f3d126 F src/printf.c 96f7f8baeedc7639da94e4e7a4a2c200e2537c4eec9e5e1c2ffc821f40eb3105 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c @@ -2151,7 +2150,7 @@ F tool/mkmsvcmin.tcl d76c45efda1cce2d4005bcea7b8a22bb752e3256009f331120fb4fecb14 F tool/mkopcodec.tcl 33d20791e191df43209b77d37f0ff0904620b28465cca6990cf8d60da61a07ef F tool/mkopcodeh.tcl 2b4e6967a670ef21bf53a164964c35c6163277d002a4c6f56fa231d68c88d023 F tool/mkopts.tcl 680f785fdb09729fd9ac50632413da4eadbdf9071535e3f26d03795828ab07fa -F tool/mkpragmatab.tcl 32e359ccb21011958a821955254bd7a5fa7915d01a8c16fed91ffc8b40cb4adf +F tool/mkpragmatab.tcl 365ff4c0367b2fa686fdb20a1a03e36c697959c1ca854fc82af42b9056170893 F tool/mkshellc.tcl 9ce74de0fa904a2c56a96f8d8b5261246bacb0eaa8d7e184f9e18ff94145ebbc F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9 F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 @@ -2194,7 +2193,7 @@ F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaa F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848 F tool/src-verify.c d00f93263aa2fa6ba0cba0106d95458e6effb94fdb5fc634f56834f90c05bbb4 F tool/srcck1.c 371de5363b70154012955544f86fdee8f6e5326f -F tool/srctree-check.tcl 5e40c7beaca50c3f29cd9c3aa8d6c9256359690ea0989174f097ace92d6390c2 +F tool/srctree-check.tcl 4e635aed7dd8198d2b212353823d4b10b380211bf9a8287921ec6b2b773ca097 F tool/stack_usage.tcl f8e71b92cdb099a147dad572375595eae55eca43 F tool/stripccomments.c dfe9cc03cf87728ac9836be30763f8aa52b82caca0780b3d3f3572e4643b01d3 F tool/symbols-mingw.sh 4dbcea7e74768305384c9fd2ed2b41bbf9f0414d @@ -2208,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6aa54cc180e034a10d8fc8f8b0c13d7bc0c94509b4240ac855121d501853768f -R e691176b85b17541b0449680ba0ba564 +P 958bb5de7c484cc503c38d38d51a30f679244fd364df5cbfc1992e36995b2ff9 +R c612f3371ab876eff4ecd15f96d1d3bd U drh -Z 88df15dbb3e7e15a4c35762ecebc556a +Z d8718e46243e2a0107a59b8d9076cbbd # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 25b7683b02..3c2620d3c5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -958bb5de7c484cc503c38d38d51a30f679244fd364df5cbfc1992e36995b2ff9 +9709ed1cdfa17f690ffd4ec8cfc54efefec8352143c1d8b701f09299bd7eef6e diff --git a/src/pragma.h b/src/pragma.h deleted file mode 100644 index 7270db1db4..0000000000 --- a/src/pragma.h +++ /dev/null @@ -1,660 +0,0 @@ -/* DO NOT EDIT! -** This file is automatically generated by the script at -** ../tool/mkpragmatab.tcl. To update the set of pragmas, edit -** that script and rerun it. -*/ - -/* The various pragma types */ -#define PragTyp_ACTIVATE_EXTENSIONS 0 -#define PragTyp_ANALYSIS_LIMIT 1 -#define PragTyp_HEADER_VALUE 2 -#define PragTyp_AUTO_VACUUM 3 -#define PragTyp_FLAG 4 -#define PragTyp_BUSY_TIMEOUT 5 -#define PragTyp_CACHE_SIZE 6 -#define PragTyp_CACHE_SPILL 7 -#define PragTyp_CASE_SENSITIVE_LIKE 8 -#define PragTyp_COLLATION_LIST 9 -#define PragTyp_COMPILE_OPTIONS 10 -#define PragTyp_DATA_STORE_DIRECTORY 11 -#define PragTyp_DATABASE_LIST 12 -#define PragTyp_DEFAULT_CACHE_SIZE 13 -#define PragTyp_ENCODING 14 -#define PragTyp_FOREIGN_KEY_CHECK 15 -#define PragTyp_FOREIGN_KEY_LIST 16 -#define PragTyp_FUNCTION_LIST 17 -#define PragTyp_HARD_HEAP_LIMIT 18 -#define PragTyp_INCREMENTAL_VACUUM 19 -#define PragTyp_INDEX_INFO 20 -#define PragTyp_INDEX_LIST 21 -#define PragTyp_INTEGRITY_CHECK 22 -#define PragTyp_JOURNAL_MODE 23 -#define PragTyp_JOURNAL_SIZE_LIMIT 24 -#define PragTyp_LOCK_PROXY_FILE 25 -#define PragTyp_LOCKING_MODE 26 -#define PragTyp_PAGE_COUNT 27 -#define PragTyp_MMAP_SIZE 28 -#define PragTyp_MODULE_LIST 29 -#define PragTyp_OPTIMIZE 30 -#define PragTyp_PAGE_SIZE 31 -#define PragTyp_PRAGMA_LIST 32 -#define PragTyp_SECURE_DELETE 33 -#define PragTyp_SHRINK_MEMORY 34 -#define PragTyp_SOFT_HEAP_LIMIT 35 -#define PragTyp_SYNCHRONOUS 36 -#define PragTyp_TABLE_INFO 37 -#define PragTyp_TABLE_LIST 38 -#define PragTyp_TEMP_STORE 39 -#define PragTyp_TEMP_STORE_DIRECTORY 40 -#define PragTyp_THREADS 41 -#define PragTyp_WAL_AUTOCHECKPOINT 42 -#define PragTyp_WAL_CHECKPOINT 43 -#define PragTyp_LOCK_STATUS 44 -#define PragTyp_STATS 45 - -/* Property flags associated with various pragma. */ -#define PragFlg_NeedSchema 0x01 /* Force schema load before running */ -#define PragFlg_NoColumns 0x02 /* OP_ResultRow called with zero columns */ -#define PragFlg_NoColumns1 0x04 /* zero columns if RHS argument is present */ -#define PragFlg_ReadOnly 0x08 /* Read-only HEADER_VALUE */ -#define PragFlg_Result0 0x10 /* Acts as query when no argument */ -#define PragFlg_Result1 0x20 /* Acts as query when has one argument */ -#define PragFlg_SchemaOpt 0x40 /* Schema restricts name search if present */ -#define PragFlg_SchemaReq 0x80 /* Schema required - "main" is default */ - -/* Names of columns for pragmas that return multi-column result -** or that return single-column results where the name of the -** result column is different from the name of the pragma -*/ -static const char *const pragCName[] = { - /* 0 */ "id", /* Used by: foreign_key_list */ - /* 1 */ "seq", - /* 2 */ "table", - /* 3 */ "from", - /* 4 */ "to", - /* 5 */ "on_update", - /* 6 */ "on_delete", - /* 7 */ "match", - /* 8 */ "cid", /* Used by: table_xinfo */ - /* 9 */ "name", - /* 10 */ "type", - /* 11 */ "notnull", - /* 12 */ "dflt_value", - /* 13 */ "pk", - /* 14 */ "hidden", - /* table_info reuses 8 */ - /* 15 */ "schema", /* Used by: table_list */ - /* 16 */ "name", - /* 17 */ "type", - /* 18 */ "ncol", - /* 19 */ "wr", - /* 20 */ "strict", - /* 21 */ "seqno", /* Used by: index_xinfo */ - /* 22 */ "cid", - /* 23 */ "name", - /* 24 */ "desc", - /* 25 */ "coll", - /* 26 */ "key", - /* 27 */ "name", /* Used by: function_list */ - /* 28 */ "builtin", - /* 29 */ "type", - /* 30 */ "enc", - /* 31 */ "narg", - /* 32 */ "flags", - /* 33 */ "tbl", /* Used by: stats */ - /* 34 */ "idx", - /* 35 */ "wdth", - /* 36 */ "hght", - /* 37 */ "flgs", - /* 38 */ "seq", /* Used by: index_list */ - /* 39 */ "name", - /* 40 */ "unique", - /* 41 */ "origin", - /* 42 */ "partial", - /* 43 */ "table", /* Used by: foreign_key_check */ - /* 44 */ "rowid", - /* 45 */ "parent", - /* 46 */ "fkid", - /* index_info reuses 21 */ - /* 47 */ "seq", /* Used by: database_list */ - /* 48 */ "name", - /* 49 */ "file", - /* 50 */ "busy", /* Used by: wal_checkpoint */ - /* 51 */ "log", - /* 52 */ "checkpointed", - /* collation_list reuses 38 */ - /* 53 */ "database", /* Used by: lock_status */ - /* 54 */ "status", - /* 55 */ "cache_size", /* Used by: default_cache_size */ - /* module_list pragma_list reuses 9 */ - /* 56 */ "timeout", /* Used by: busy_timeout */ -}; - -/* Definitions of all built-in pragmas */ -typedef struct PragmaName { - const char *const zName; /* Name of pragma */ - u8 ePragTyp; /* PragTyp_XXX value */ - u8 mPragFlg; /* Zero or more PragFlg_XXX values */ - u8 iPragCName; /* Start of column names in pragCName[] */ - u8 nPragCName; /* Num of col names. 0 means use pragma name */ - u64 iArg; /* Extra argument */ -} PragmaName; -static const PragmaName aPragmaName[] = { -#if defined(SQLITE_ENABLE_CEROD) - {/* zName: */ "activate_extensions", - /* ePragTyp: */ PragTyp_ACTIVATE_EXTENSIONS, - /* ePragFlg: */ 0, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif - {/* zName: */ "analysis_limit", - /* ePragTyp: */ PragTyp_ANALYSIS_LIMIT, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) - {/* zName: */ "application_id", - /* ePragTyp: */ PragTyp_HEADER_VALUE, - /* ePragFlg: */ PragFlg_NoColumns1|PragFlg_Result0, - /* ColNames: */ 0, 0, - /* iArg: */ BTREE_APPLICATION_ID }, -#endif -#if !defined(SQLITE_OMIT_AUTOVACUUM) - {/* zName: */ "auto_vacuum", - /* ePragTyp: */ PragTyp_AUTO_VACUUM, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) -#if !defined(SQLITE_OMIT_AUTOMATIC_INDEX) - {/* zName: */ "automatic_index", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_AutoIndex }, -#endif -#endif - {/* zName: */ "busy_timeout", - /* ePragTyp: */ PragTyp_BUSY_TIMEOUT, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 56, 1, - /* iArg: */ 0 }, -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) - {/* zName: */ "cache_size", - /* ePragTyp: */ PragTyp_CACHE_SIZE, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - {/* zName: */ "cache_spill", - /* ePragTyp: */ PragTyp_CACHE_SPILL, - /* ePragFlg: */ PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_CASE_SENSITIVE_LIKE_PRAGMA) - {/* zName: */ "case_sensitive_like", - /* ePragTyp: */ PragTyp_CASE_SENSITIVE_LIKE, - /* ePragFlg: */ PragFlg_NoColumns, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif - {/* zName: */ "cell_size_check", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_CellSizeCk }, -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - {/* zName: */ "checkpoint_fullfsync", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_CkptFullFSync }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) - {/* zName: */ "collation_list", - /* ePragTyp: */ PragTyp_COLLATION_LIST, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 38, 2, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_COMPILEOPTION_DIAGS) - {/* zName: */ "compile_options", - /* ePragTyp: */ PragTyp_COMPILE_OPTIONS, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - {/* zName: */ "count_changes", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_CountRows }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_OS_WIN - {/* zName: */ "data_store_directory", - /* ePragTyp: */ PragTyp_DATA_STORE_DIRECTORY, - /* ePragFlg: */ PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) - {/* zName: */ "data_version", - /* ePragTyp: */ PragTyp_HEADER_VALUE, - /* ePragFlg: */ PragFlg_ReadOnly|PragFlg_Result0, - /* ColNames: */ 0, 0, - /* iArg: */ BTREE_DATA_VERSION }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) - {/* zName: */ "database_list", - /* ePragTyp: */ PragTyp_DATABASE_LIST, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 47, 3, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED) - {/* zName: */ "default_cache_size", - /* ePragTyp: */ PragTyp_DEFAULT_CACHE_SIZE, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1, - /* ColNames: */ 55, 1, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) -#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER) - {/* zName: */ "defer_foreign_keys", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_DeferFKs }, -#endif -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - {/* zName: */ "empty_result_callbacks", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_NullCallback }, -#endif -#if !defined(SQLITE_OMIT_UTF16) - {/* zName: */ "encoding", - /* ePragTyp: */ PragTyp_ENCODING, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER) - {/* zName: */ "foreign_key_check", - /* ePragTyp: */ PragTyp_FOREIGN_KEY_CHECK, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_Result1|PragFlg_SchemaOpt, - /* ColNames: */ 43, 4, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FOREIGN_KEY) - {/* zName: */ "foreign_key_list", - /* ePragTyp: */ PragTyp_FOREIGN_KEY_LIST, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt, - /* ColNames: */ 0, 8, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) -#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER) - {/* zName: */ "foreign_keys", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_ForeignKeys }, -#endif -#endif -#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) - {/* zName: */ "freelist_count", - /* ePragTyp: */ PragTyp_HEADER_VALUE, - /* ePragFlg: */ PragFlg_ReadOnly|PragFlg_Result0, - /* ColNames: */ 0, 0, - /* iArg: */ BTREE_FREE_PAGE_COUNT }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - {/* zName: */ "full_column_names", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_FullColNames }, - {/* zName: */ "fullfsync", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_FullFSync }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) -#if !defined(SQLITE_OMIT_INTROSPECTION_PRAGMAS) - {/* zName: */ "function_list", - /* ePragTyp: */ PragTyp_FUNCTION_LIST, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 27, 6, - /* iArg: */ 0 }, -#endif -#endif - {/* zName: */ "hard_heap_limit", - /* ePragTyp: */ PragTyp_HARD_HEAP_LIMIT, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) -#if !defined(SQLITE_OMIT_CHECK) - {/* zName: */ "ignore_check_constraints", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_IgnoreChecks }, -#endif -#endif -#if !defined(SQLITE_OMIT_AUTOVACUUM) - {/* zName: */ "incremental_vacuum", - /* ePragTyp: */ PragTyp_INCREMENTAL_VACUUM, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_NoColumns, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) - {/* zName: */ "index_info", - /* ePragTyp: */ PragTyp_INDEX_INFO, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt, - /* ColNames: */ 21, 3, - /* iArg: */ 0 }, - {/* zName: */ "index_list", - /* ePragTyp: */ PragTyp_INDEX_LIST, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt, - /* ColNames: */ 38, 5, - /* iArg: */ 0 }, - {/* zName: */ "index_xinfo", - /* ePragTyp: */ PragTyp_INDEX_INFO, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt, - /* ColNames: */ 21, 6, - /* iArg: */ 1 }, -#endif -#if !defined(SQLITE_OMIT_INTEGRITY_CHECK) - {/* zName: */ "integrity_check", - /* ePragTyp: */ PragTyp_INTEGRITY_CHECK, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_Result1|PragFlg_SchemaOpt, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) - {/* zName: */ "journal_mode", - /* ePragTyp: */ PragTyp_JOURNAL_MODE, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, - {/* zName: */ "journal_size_limit", - /* ePragTyp: */ PragTyp_JOURNAL_SIZE_LIMIT, - /* ePragFlg: */ PragFlg_Result0|PragFlg_SchemaReq, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - {/* zName: */ "legacy_alter_table", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_LegacyAlter }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_ENABLE_LOCKING_STYLE - {/* zName: */ "lock_proxy_file", - /* ePragTyp: */ PragTyp_LOCK_PROXY_FILE, - /* ePragFlg: */ PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) - {/* zName: */ "lock_status", - /* ePragTyp: */ PragTyp_LOCK_STATUS, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 53, 2, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) - {/* zName: */ "locking_mode", - /* ePragTyp: */ PragTyp_LOCKING_MODE, - /* ePragFlg: */ PragFlg_Result0|PragFlg_SchemaReq, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, - {/* zName: */ "max_page_count", - /* ePragTyp: */ PragTyp_PAGE_COUNT, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, - {/* zName: */ "mmap_size", - /* ePragTyp: */ PragTyp_MMAP_SIZE, - /* ePragFlg: */ 0, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) -#if !defined(SQLITE_OMIT_VIRTUALTABLE) -#if !defined(SQLITE_OMIT_INTROSPECTION_PRAGMAS) - {/* zName: */ "module_list", - /* ePragTyp: */ PragTyp_MODULE_LIST, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 9, 1, - /* iArg: */ 0 }, -#endif -#endif -#endif - {/* zName: */ "optimize", - /* ePragTyp: */ PragTyp_OPTIMIZE, - /* ePragFlg: */ PragFlg_Result1|PragFlg_NeedSchema, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) - {/* zName: */ "page_count", - /* ePragTyp: */ PragTyp_PAGE_COUNT, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, - {/* zName: */ "page_size", - /* ePragTyp: */ PragTyp_PAGE_SIZE, - /* ePragFlg: */ PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) -#if defined(SQLITE_DEBUG) - {/* zName: */ "parser_trace", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_ParserTrace }, -#endif -#endif -#if !defined(SQLITE_OMIT_INTROSPECTION_PRAGMAS) - {/* zName: */ "pragma_list", - /* ePragTyp: */ PragTyp_PRAGMA_LIST, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 9, 1, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - {/* zName: */ "query_only", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_QueryOnly }, -#endif -#if !defined(SQLITE_OMIT_INTEGRITY_CHECK) - {/* zName: */ "quick_check", - /* ePragTyp: */ PragTyp_INTEGRITY_CHECK, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_Result1|PragFlg_SchemaOpt, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - {/* zName: */ "read_uncommitted", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_ReadUncommit }, - {/* zName: */ "recursive_triggers", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_RecTriggers }, - {/* zName: */ "reverse_unordered_selects", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_ReverseOrder }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) - {/* zName: */ "schema_version", - /* ePragTyp: */ PragTyp_HEADER_VALUE, - /* ePragFlg: */ PragFlg_NoColumns1|PragFlg_Result0, - /* ColNames: */ 0, 0, - /* iArg: */ BTREE_SCHEMA_VERSION }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) - {/* zName: */ "secure_delete", - /* ePragTyp: */ PragTyp_SECURE_DELETE, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - {/* zName: */ "short_column_names", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_ShortColNames }, -#endif - {/* zName: */ "shrink_memory", - /* ePragTyp: */ PragTyp_SHRINK_MEMORY, - /* ePragFlg: */ PragFlg_NoColumns, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, - {/* zName: */ "soft_heap_limit", - /* ePragTyp: */ PragTyp_SOFT_HEAP_LIMIT, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) -#if defined(SQLITE_DEBUG) - {/* zName: */ "sql_trace", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_SqlTrace }, -#endif -#endif -#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) && defined(SQLITE_DEBUG) - {/* zName: */ "stats", - /* ePragTyp: */ PragTyp_STATS, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq, - /* ColNames: */ 33, 5, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) - {/* zName: */ "synchronous", - /* ePragTyp: */ PragTyp_SYNCHRONOUS, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) - {/* zName: */ "table_info", - /* ePragTyp: */ PragTyp_TABLE_INFO, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt, - /* ColNames: */ 8, 6, - /* iArg: */ 0 }, - {/* zName: */ "table_list", - /* ePragTyp: */ PragTyp_TABLE_LIST, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1, - /* ColNames: */ 15, 6, - /* iArg: */ 0 }, - {/* zName: */ "table_xinfo", - /* ePragTyp: */ PragTyp_TABLE_INFO, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt, - /* ColNames: */ 8, 7, - /* iArg: */ 1 }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) - {/* zName: */ "temp_store", - /* ePragTyp: */ PragTyp_TEMP_STORE, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, - {/* zName: */ "temp_store_directory", - /* ePragTyp: */ PragTyp_TEMP_STORE_DIRECTORY, - /* ePragFlg: */ PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif - {/* zName: */ "threads", - /* ePragTyp: */ PragTyp_THREADS, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - {/* zName: */ "trusted_schema", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_TrustedSchema }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) - {/* zName: */ "user_version", - /* ePragTyp: */ PragTyp_HEADER_VALUE, - /* ePragFlg: */ PragFlg_NoColumns1|PragFlg_Result0, - /* ColNames: */ 0, 0, - /* iArg: */ BTREE_USER_VERSION }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) -#if defined(SQLITE_DEBUG) - {/* zName: */ "vdbe_addoptrace", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_VdbeAddopTrace }, - {/* zName: */ "vdbe_debug", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_SqlTrace|SQLITE_VdbeListing|SQLITE_VdbeTrace }, - {/* zName: */ "vdbe_eqp", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_VdbeEQP }, - {/* zName: */ "vdbe_listing", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_VdbeListing }, - {/* zName: */ "vdbe_trace", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_VdbeTrace }, -#endif -#endif -#if !defined(SQLITE_OMIT_WAL) - {/* zName: */ "wal_autocheckpoint", - /* ePragTyp: */ PragTyp_WAL_AUTOCHECKPOINT, - /* ePragFlg: */ 0, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, - {/* zName: */ "wal_checkpoint", - /* ePragTyp: */ PragTyp_WAL_CHECKPOINT, - /* ePragFlg: */ PragFlg_NeedSchema, - /* ColNames: */ 50, 3, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - {/* zName: */ "writable_schema", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_WriteSchema|SQLITE_NoSchemaError }, -#endif -}; -/* Number of pragmas: 68 on by default, 78 total. */ diff --git a/tool/mkpragmatab.tcl b/tool/mkpragmatab.tcl index 2b5b6fdcdb..81ef0ea002 100644 --- a/tool/mkpragmatab.tcl +++ b/tool/mkpragmatab.tcl @@ -4,16 +4,16 @@ # # To add new pragmas, first add the name and other relevant attributes # of the pragma to the "pragma_def" object below. Then run this script -# to generate the ../src/pragma.h header file that contains macros and +# to generate the pragma.h header file that contains macros and # the lookup table needed for pragma name lookup in the pragma.c module. # Then add the extra "case PragTyp_XXXXX:" and subsequent code for the # new pragma in ../src/pragma.c. # -# The results are normally written into the ../src/pragma.h file. However, +# The results are normally written into the pragma.h file. However, # if an alternative output file name is provided as an argument, then # results are written into the alternative. For example: # -# tclsh tool/mkpragmatab.tcl ;# <--- Results to src/pragma.h +# tclsh tool/mkpragmatab.tcl ;# <--- Results to pragma.h # # tclsh tool/mkpragmatab.tcl /dev/tty ;# <-- results to terminal # @@ -413,7 +413,7 @@ set pragma_def { if {$argc>0} { set destfile [lindex $argv 0] } else { - set destfile "[file dir [file dir [file normal $argv0]]]/src/pragma.h" + set destfile "pragma.h" puts "Overwriting $destfile with new pragma table..." } set fd [open $destfile wb] diff --git a/tool/srctree-check.tcl b/tool/srctree-check.tcl index 918f12a9d6..b16bd924a0 100644 --- a/tool/srctree-check.tcl +++ b/tool/srctree-check.tcl @@ -5,7 +5,6 @@ # # * Makefile.msc and autoconf/Makefile.msc agree # * VERSION agrees with autoconf/tea/configure.ac -# * src/pragma.h agrees with tool/mkpragmatab.tcl # # Other tests might be added later. # @@ -61,15 +60,3 @@ if {$f1 != $f2} { puts "...... Fix: tclsh tool/mkmsvcmin.tcl" incr NERR } - -######################### src/pragma.h ######################################## - -set f1 [readfile $ROOT/src/pragma.h] -exec $TCLSH $ROOT/tool/mkpragmatab.tcl tmp2.txt -set f2 [readfile tmp2.txt] -file delete tmp2.txt -if {$f1 != $f2} { - puts "ERROR: ./src/pragma.h does not agree with ./tool/mkpragmatab.tcl" - puts "...... Fix: tclsh tool/mkpragmatab.tcl" - incr NERR -} From 56ff8df023aef7b63d755bf5e1fc2841d335f94b Mon Sep 17 00:00:00 2001 From: stephan Date: Wed, 12 Feb 2025 14:51:02 +0000 Subject: [PATCH 11/54] Tiny tcl comment tweaks. No functional changes. FossilOrigin-Name: da94e551c0ed354ae782c89fd9495d607b77ad7572d90c41ceac12bd6ec4c31b --- auto.def | 2 +- autoconf/auto.def | 2 +- autosetup/sqlite-config.tcl | 2 +- manifest | 18 +++++++++--------- manifest.uuid | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/auto.def b/auto.def index 981b455954..4528293cd7 100644 --- a/auto.def +++ b/auto.def @@ -1,4 +1,4 @@ -#/do/not/tclsh +#!/do/not/tclsh # ^^^ help out editors which guess this file's content type. # # This is the main autosetup-compatible configure script for the diff --git a/autoconf/auto.def b/autoconf/auto.def index c2e02fe3d8..bb8710378f 100644 --- a/autoconf/auto.def +++ b/autoconf/auto.def @@ -1,4 +1,4 @@ -#/do/not/tclsh +#!/do/not/tclsh # ^^^ help out editors which guess this file's content type. # # This is the main autosetup-compatible configure script for the diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 3d3f892bf0..108edaa1c1 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -130,7 +130,7 @@ proc sqlite-config-bootstrap {buildMode} { static=1 => {Disable build of static library (mostly)} } {canonical} { - amalgamation=1 => {Disable the amalgamation and instead build all files separately.} + amalgamation=1 => {Disable the amalgamation and instead build all files separately} } } diff --git a/manifest b/manifest index e71a53be0b..d99039541a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Omit\sthe\ssrc/pragma.h\sfile.\s\sIt\sis\sgenerated\sby\sthe\stool/mkpragmatab.tcl\sscript.\nThe\smakefiles\snow\sknow\show\sto\sbuild\sthis\sfile\sfor\sthemselves. -D 2025-02-11T19:54:13.594 +C Tiny\stcl\scomment\stweaks.\sNo\sfunctional\schanges. +D 2025-02-12T14:51:02.700 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -14,13 +14,13 @@ F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 -F auto.def 74ec59fbf7de5038aa9c3d0b1e0fea67e128e432ff9d84472c4016b08ec3d60b +F auto.def 542572667678019e75e16c3e970bfb9358abed9a6ec70f3715997dd9a04b7fd9 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac F autoconf/Makefile.in 7bd73a4c8cd89025cbc92b4f887c6fd1b8cd8ecbe62c4ac1f36ac84d04043479 F autoconf/Makefile.msc 4f09fead3bf7de337242896f107c5d03cd8f7b39754315ab091a2e4d02892c40 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 -F autoconf/auto.def 1900a63cfa18e662b16d912c849ea81609a90b5fe00cea54955a41572e2c2cd0 +F autoconf/auto.def 9af634c6d51fa4b82c9bb61b51249ca087f2cbe09c7c3c31f920759082a1ffdb F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl 40107b6a75a2ee367359b2adeb2221e118f5dfa6f10b0a0c0f237fc59fbedef3 +F autosetup/sqlite-config.tcl bdafc3585865ada5d9a0f2b462e21ea735d49d82353fdfb641cf6f841f8eae9e F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 958bb5de7c484cc503c38d38d51a30f679244fd364df5cbfc1992e36995b2ff9 -R c612f3371ab876eff4ecd15f96d1d3bd -U drh -Z d8718e46243e2a0107a59b8d9076cbbd +P 9709ed1cdfa17f690ffd4ec8cfc54efefec8352143c1d8b701f09299bd7eef6e +R 2e6463fde99e2450982f05262b049e36 +U stephan +Z 11dbfcf3ee53aaad351b744d008979f9 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 3c2620d3c5..fb3fb9c21f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9709ed1cdfa17f690ffd4ec8cfc54efefec8352143c1d8b701f09299bd7eef6e +da94e551c0ed354ae782c89fd9495d607b77ad7572d90c41ceac12bd6ec4c31b From f3e24d08753e6bea3b8a77c097fd3d1a1f138a36 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 12 Feb 2025 15:31:26 +0000 Subject: [PATCH 12/54] Remove old function declaration accidentally left in sqlite3session.h. FossilOrigin-Name: 0cfbe349d4b740f3d2be8c714cf679901fc2465db4c64e4c3742da700d82f4e7 --- ext/session/sqlite3session.h | 13 ------------- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/ext/session/sqlite3session.h b/ext/session/sqlite3session.h index f950d419b5..919365b14f 100644 --- a/ext/session/sqlite3session.h +++ b/ext/session/sqlite3session.h @@ -883,19 +883,6 @@ int sqlite3changeset_concat( void **ppOut /* OUT: Buffer containing output changeset */ ); - -/* -** CAPI3REF: Upgrade the Schema of a Changeset/Patchset -*/ -int sqlite3changeset_upgrade( - sqlite3 *db, - const char *zDb, - int nIn, const void *pIn, /* Input changeset */ - int *pnOut, void **ppOut /* OUT: Inverse of input */ -); - - - /* ** CAPI3REF: Changegroup Handle ** diff --git a/manifest b/manifest index d99039541a..716b9c746b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Tiny\stcl\scomment\stweaks.\sNo\sfunctional\schanges. -D 2025-02-12T14:51:02.700 +C Remove\sold\sfunction\sdeclaration\saccidentally\sleft\sin\ssqlite3session.h. +D 2025-02-12T15:31:26.463 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -616,7 +616,7 @@ F ext/session/sessionsize.test 8fcf4685993c3dbaa46a24183940ab9f5aa9ed0d23e5fb63b F ext/session/sessionstat1.test 5e718d5888c0c49bbb33a7a4f816366db85f59f6a4f97544a806421b85dc2dec F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009ecef8511f4cf3fc F ext/session/sqlite3session.c 52a680dbb03c4734748b215d95987fb4d95ab23baaf053a01ac2626610963b58 -F ext/session/sqlite3session.h 683ccbf16e2c2521661fc4c1cf918ce57002039efbcabcd8097fa4bca569104b +F ext/session/sqlite3session.h aa5de3ec8ef0e5313e9f65dafd69e8ba292d170f07b57da9200c040068dab061 F ext/session/test_session.c 12e0a2c15fd60f92da4bb29c697c9177ff0c0dbcdc5129a54c47e999f147937a F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c F ext/wasm/GNUmakefile 06e0556e9840fd3d8870997025c2507ace9ba7bf11195f770295fc7947dfc1b5 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9709ed1cdfa17f690ffd4ec8cfc54efefec8352143c1d8b701f09299bd7eef6e -R 2e6463fde99e2450982f05262b049e36 -U stephan -Z 11dbfcf3ee53aaad351b744d008979f9 +P da94e551c0ed354ae782c89fd9495d607b77ad7572d90c41ceac12bd6ec4c31b +R 6f7f1710621940ea4683c778ed859375 +U dan +Z 8c9d99e3c5ea71beb7debabd9d22f723 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index fb3fb9c21f..d19a148ee4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -da94e551c0ed354ae782c89fd9495d607b77ad7572d90c41ceac12bd6ec4c31b +0cfbe349d4b740f3d2be8c714cf679901fc2465db4c64e4c3742da700d82f4e7 From 1be96b44c198a20f8fd567b319ba9fcb82ffa09e Mon Sep 17 00:00:00 2001 From: stephan Date: Wed, 12 Feb 2025 16:59:07 +0000 Subject: [PATCH 13/54] configure --help cleanups and eliminate the use of a JS-esque inner function in sqlite-config.tcl. No functional changes. FossilOrigin-Name: 6df859cd18ded3ca64a184e45709503dd9b6a3f65e7611d3352f0bad288400f4 --- autosetup/sqlite-config.tcl | 153 +++++++++++++++++++++--------------- manifest | 14 ++-- manifest.uuid | 2 +- 3 files changed, 99 insertions(+), 70 deletions(-) diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 108edaa1c1..14cdcf5da1 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -109,21 +109,26 @@ proc sqlite-config-bootstrap {buildMode} { # the case of a default value. ######################################################################## set allFlags { - # Structure: a list of M {Z}, where M is a descriptive option - # group name and Z is a list of X Y pairs. X is a list of - # $buildMode name(s) to which these flags apply, or {*} to apply + # Structure: a list of M {Z} pairs, where M is a descriptive + # option group name and Z is a list of X Y pairs. X is a list of + # $buildMode name(s) to which the Y flags apply, or {*} to apply # to all builds. Y is a {block} in the form expected by # autosetup's [options] command. Each block which is applicable # to $buildMode is appended to a new list before that list is # passed on to [options]. The order of each Y and sub-Y is # retained, which is significant for rendering of --help. - # When writing {help text blocks}, be aware that autosetup formats - # them differently (left-aligned, directly under the --flag) if the - # block starts with a newline. It does NOT expand vars and commands, - # but we use a [subst] call below which will replace (only) var - # refs. + # When writing {help text blocks}, be aware that: + # + # A) autosetup formats them differently if the {block} starts with + # a newline: it starts left-aligned, directly under the --flag, and + # the rest of the block is pasted verbatim rather than + # pretty-printed. + # + # B) Vars and commands are NOT expanded, but we use a [subst] call + # below which will replace (only) var refs. + # Options for how to build the library build-modes { {*} { shared=1 => {Disable build of shared libary} @@ -134,11 +139,14 @@ proc sqlite-config-bootstrap {buildMode} { } } + # Library-level features and defaults lib-features { {*} { threadsafe=1 => {Disable mutexing} with-tempstore:=no => {Use an in-RAM database for temporary tables: never,no,yes,always} largefile=1 => {Disable large file support} + # ^^^ It's not clear that this actually does anything, as + # HAVE_LFS is not checked anywhere in the .c/.h/.in files. load-extension=1 => {Disable loading of external extensions} math=1 => {Disable math functions} json=1 => {Disable JSON functions} @@ -155,108 +163,130 @@ proc sqlite-config-bootstrap {buildMode} { } } + # Options for TCL support tcl { {canonical} { - with-tcl:DIR => - {Directory containing tclConfig.sh or a directory one level up from - that, from which we can derive a directory containing tclConfig.sh. - A dir name of "prefix" is equivalent to the directory specified by - the --prefix flag.} - with-tclsh:PATH => - {Full pathname of tclsh to use. It is used for (A) trying to find - tclConfig.sh and (B) all TCL-based code generation. Warning: if - its containing dir has multiple tclsh versions, it may select the - wrong tclConfig.sh!} - tcl=1 => - {Disable components which require TCL, including all tests. - This tree requires TCL for code generation but can use the in-tree - copy of autosetup/jimsh0.c for that. The SQLite TCL extension and the - test code require a canonical tclsh.} + with-tcl:DIR + => {Directory containing tclConfig.sh or a directory one level up from + that, from which we can derive a directory containing tclConfig.sh. + A dir name of "prefix" is equivalent to the directory specified by + the --prefix flag.} + with-tclsh:PATH + => {Full pathname of tclsh to use. It is used for (A) trying to find + tclConfig.sh and (B) all TCL-based code generation. Warning: if + its containing dir has multiple tclsh versions, it may select the + wrong tclConfig.sh!} + tcl=1 + => {Disable components which require TCL, including all tests. + This tree requires TCL for code generation but can use the in-tree + copy of autosetup/jimsh0.c for that. The SQLite TCL extension and the + test code require a canonical tclsh.} } } + # Options for line-editing modes for the CLI shell line-editing { {*} { - readline=1 => {Disable readline support} + readline=1 + => {Disable readline support} # --with-readline-lib is a backwards-compatible alias for # --with-readline-ldflags with-readline-lib: with-readline-ldflags:=auto - => {Readline LDFLAGS, e.g. -lreadline -lncurses} + => {Readline LDFLAGS, e.g. -lreadline -lncurses} # --with-readline-inc is a backwards-compatible alias for # --with-readline-cflags. with-readline-inc: with-readline-cflags:=auto - => {Readline CFLAGS, e.g. -I/path/to/includes} + => {Readline CFLAGS, e.g. -I/path/to/includes} with-readline-header:PATH - => {Full path to readline.h, from which --with-readline-cflags will be derived} - with-linenoise:DIR => {Source directory for linenoise.c and linenoise.h} - editline=0 => {Enable BSD editline support} + => {Full path to readline.h, from which --with-readline-cflags will be derived} + with-linenoise:DIR + => {Source directory for linenoise.c and linenoise.h} + editline=0 + => {Enable BSD editline support} } } + # Options for ICU: International Components for Unicode icu { {*} { with-icu-ldflags:LDFLAGS - => {Enable SQLITE_ENABLE_ICU and add the given linker flags for the ICU libraries} + => {Enable SQLITE_ENABLE_ICU and add the given linker flags for the + ICU libraries} with-icu-cflags:CFLAGS - => {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU. e.g. -I/usr/local/include} - with-icu-config:=auto => {Enable SQLITE_ENABLE_ICU. Value must be one of: auto, pkg-config, /path/to/icu-config} - icu-collations=0 => {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-ldflags=... or --with-icu-config} + => {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU. + e.g. -I/usr/local/include} + with-icu-config:=auto + => {Enable SQLITE_ENABLE_ICU. Value must be one of: auto, pkg-config, + /path/to/icu-config} + icu-collations=0 + => {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-ldflags=... + or --with-icu-config} } } + # Options for exotic/alternative build modes alternative-builds { {canonical} { with-wasi-sdk:=/opt/wasi-sdk - => {Top-most dir of the wasi-sdk for a WASI build} - with-emsdk:=auto => {Top-most dir of the Emscripten SDK installation. Default = EMSDK env var.} + => {Top-most dir of the wasi-sdk for a WASI build} + with-emsdk:=auto + => {Top-most dir of the Emscripten SDK installation. + Default = EMSDK env var.} } } - # Note that using the --debug/--enable-debug flag here requires patching - # autosetup/autosetup to rename the --debug to --autosetup-debug. + # Options mostly for sqlite's own development developer { {*} { + # Note that using the --debug/--enable-debug flag here + # requires patching autosetup/autosetup to rename the --debug + # to --autosetup-debug. with-debug=0 - debug=0 => - {Enable debug build flags. This option will impact performance by - as much as 4x, as it includes large numbers of assert()s in - performance-critical loops. Never use --debug for production - builds.} - scanstatus => {Enable the SQLITE_ENABLE_STMT_SCANSTATUS feature flag} + debug=0 + => {Enable debug build flags. This option will impact performance by + as much as 4x, as it includes large numbers of assert()s in + performance-critical loops. Never use --debug for production + builds.} + scanstatus + => {Enable the SQLITE_ENABLE_STMT_SCANSTATUS feature flag} } {canonical} { dev => {Enable dev-mode build: automatically enables certain other flags} test-status => {Enable status of tests} gcov=0 => {Enable coverage testing using gcov} linemacros => {Enable #line macros in the amalgamation} - dynlink-tools => {Dynamically link libsqlite3 to certain tools which normally statically embed it.} + dynlink-tools => {Dynamically link libsqlite3 to certain tools which normally statically embed it} } {*} { dump-defines=0 => {Dump autosetup defines to $::sqliteConfig(dump-defines-txt) (for build debugging)} } } + # Options specifically for downstream package maintainers packaging { {*} { # soname: https://sqlite.org/src/forumpost/5a3b44f510df8ded - soname:=legacy => - {SONAME for libsqlite3.so. "none", or not using this flag, sets no - soname. "legacy" sets it to its historical value of - libsqlite3.so.0. A value matching the glob "libsqlite3.*" sets - it to that literal value. Any other value is assumed to be a - suffix which gets applied to "libsqlite3.so.", - e.g. --soname=9.10 equates to "libsqlite3.so.9.10". - } - out-implib=0 => - {Enable use of --out-implib linker flag to generate an "import library" for the DLL} + soname:=legacy + => {SONAME for libsqlite3.so. "none", or not using this flag, sets no + soname. "legacy" sets it to its historical value of + libsqlite3.so.0. A value matching the glob "libsqlite3.*" sets + it to that literal value. Any other value is assumed to be a + suffix which gets applied to "libsqlite3.so.", + e.g. --soname=9.10 equates to "libsqlite3.so.9.10".} + # out-implib: https://sqlite.org/forum/forumpost/0c7fc097b2 + out-implib=0 + => {Enable use of --out-implib linker flag to generate an + "import library" for the DLL} } } }; # $allOpts + # Filter allOpts to create the set of [options] legal for this build set opts {} - foreach {group XY} [subst -nobackslashes -nocommands [proj-strip-hash-comments $allFlags]] { + foreach {group XY} [subst -nobackslashes -nocommands \ + [proj-strip-hash-comments $allFlags]] { foreach {X Y} $XY { if { $buildMode in $X || "*" in $X } { foreach y $Y { @@ -265,8 +295,7 @@ proc sqlite-config-bootstrap {buildMode} { } } } - #puts "options = $opts" - #exit 0 + #puts "options = $opts"; exit 0 options $opts sqlite-post-options-init }; # sqlite-config-bootstrap @@ -334,19 +363,19 @@ proc sqlite-autoreconfig {} { # configure script with the same arguments it was initially invoked # with. This can be used to automatically reconfigure # - proc squote {arg} { + set squote {{arg} { # Wrap $arg in single-quotes if it looks like it might need that # to avoid mis-handling as a shell argument. We assume that $arg # will never contain any single-quote characters. if {[string match {*[ &;$*"]*} $arg]} { return '$arg' } return $arg - } - define-append SQLITE_AUTORECONFIG cd [squote $::autosetup(builddir)] && [squote $::autosetup(srcdir)/configure] + }} + define-append SQLITE_AUTORECONFIG cd [apply $squote $::autosetup(builddir)] \ + && [apply $squote $::autosetup(srcdir)/configure] #{*}$::autosetup(argv) breaks with --flag='val with spaces', so... foreach arg $::autosetup(argv) { - define-append SQLITE_AUTORECONFIG [squote $arg] + define-append SQLITE_AUTORECONFIG [apply $squote $arg] } - rename squote "" } define OPT_FEATURE_FLAGS {} ; # -DSQLITE_OMIT/ENABLE flags. diff --git a/manifest b/manifest index 716b9c746b..7b764e1e9f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sold\sfunction\sdeclaration\saccidentally\sleft\sin\ssqlite3session.h. -D 2025-02-12T15:31:26.463 +C configure\s--help\scleanups\sand\seliminate\sthe\suse\sof\sa\sJS-esque\sinner\sfunction\sin\ssqlite-config.tcl.\sNo\sfunctional\schanges. +D 2025-02-12T16:59:07.174 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl bdafc3585865ada5d9a0f2b462e21ea735d49d82353fdfb641cf6f841f8eae9e +F autosetup/sqlite-config.tcl ece913b7bb1efbabdd44fd787c0e4d2fd462d3019cc079a5e6bbe43c83d302b3 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P da94e551c0ed354ae782c89fd9495d607b77ad7572d90c41ceac12bd6ec4c31b -R 6f7f1710621940ea4683c778ed859375 -U dan -Z 8c9d99e3c5ea71beb7debabd9d22f723 +P 0cfbe349d4b740f3d2be8c714cf679901fc2465db4c64e4c3742da700d82f4e7 +R c7fed59cac15bf384efc445c22702858 +U stephan +Z 6f4cb9af43d8857f0cc800aca12dd8f2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d19a148ee4..0ca67e3513 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0cfbe349d4b740f3d2be8c714cf679901fc2465db4c64e4c3742da700d82f4e7 +6df859cd18ded3ca64a184e45709503dd9b6a3f65e7611d3352f0bad288400f4 From 25367c1eb04aa55b47d1e253e5e85cf9e6d7228b Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 12 Feb 2025 20:19:57 +0000 Subject: [PATCH 14/54] Fix a few 32-bit overflow problems in showdb.c. FossilOrigin-Name: 9377766647eeaa575d646cf5f66c3163ef7074930aa5c3b11073e6b1e90ce799 --- manifest | 14 +++++++------- manifest.uuid | 2 +- tool/showdb.c | 7 ++++--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 7b764e1e9f..d046f2682d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C configure\s--help\scleanups\sand\seliminate\sthe\suse\sof\sa\sJS-esque\sinner\sfunction\sin\ssqlite-config.tcl.\sNo\sfunctional\schanges. -D 2025-02-12T16:59:07.174 +C Fix\sa\sfew\s32-bit\soverflow\sproblems\sin\sshowdb.c. +D 2025-02-12T20:19:57.718 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -2170,7 +2170,7 @@ F tool/replace.tcl 511c61acfe563dfb58675efb4628bb158a13d48ff8322123ac447e9d25a82 F tool/restore_jrnl.tcl 1079ecba47cc82fa82115b81c1f68097ab1f956f357ee8da5fc4b2589af6bd98 F tool/rollback-test.c 9fc98427d1e23e84429d7e6d07d9094fbdec65a5 F tool/run-speed-test.sh f95d19fd669b68c4c38b6b475242841d47c66076 -F tool/showdb.c 81b04bfaa9a63665f75945947323aa68b820570aa156b1574f440fc8276092c6 +F tool/showdb.c 3956d71e5193162609a60e8c9edfcf09274c00cfea2b1d221261427adb2b5cca F tool/showjournal.c 5bad7ae8784a43d2b270d953060423b8bd480818 F tool/showlocks.c 9cc5e66d4ebbf2d194f39db2527ece92077e86ae627ddd233ee48e16e8142564 F tool/showshm.c a0ab6ec32dd1f11218ca2a4018f8fb875b59414801ab8ceed8b2e69b7b45a809 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 0cfbe349d4b740f3d2be8c714cf679901fc2465db4c64e4c3742da700d82f4e7 -R c7fed59cac15bf384efc445c22702858 -U stephan -Z 6f4cb9af43d8857f0cc800aca12dd8f2 +P 6df859cd18ded3ca64a184e45709503dd9b6a3f65e7611d3352f0bad288400f4 +R ccf520bbb9a2866ca6aec9263e29fec3 +U dan +Z 06705c2bc45432ef657decbbc71b836f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0ca67e3513..84fa86757b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6df859cd18ded3ca64a184e45709503dd9b6a3f65e7611d3352f0bad288400f4 +9377766647eeaa575d646cf5f66c3163ef7074930aa5c3b11073e6b1e90ce799 diff --git a/tool/showdb.c b/tool/showdb.c index 12c2e271b7..f0bd9737cf 100644 --- a/tool/showdb.c +++ b/tool/showdb.c @@ -27,7 +27,7 @@ typedef sqlite3_uint64 u64; /* unsigned 64-bit */ static struct GlobalData { - u32 pagesize; /* Size of a database page */ + i64 pagesize; /* Size of a database page */ int dbfd; /* File descriptor for reading the DB */ u32 mxPage; /* Last page number */ int perLine; /* HEX elements to print per line */ @@ -1178,7 +1178,7 @@ int main(int argc, char **argv){ if( g.pagesize==0 ) g.pagesize = 1024; sqlite3_free(zPgSz); - printf("Pagesize: %d\n", g.pagesize); + printf("Pagesize: %d\n", (int)g.pagesize); g.mxPage = (u32)((szFile+g.pagesize-1)/g.pagesize); printf("Available pages: 1..%u\n", g.mxPage); @@ -1218,7 +1218,8 @@ int main(int argc, char **argv){ iEnd = strtol(&zLeft[2], 0, 0); checkPageValidity(iEnd); }else if( zLeft && zLeft[0]=='b' ){ - int ofst, nByte, hdrSize; + i64 ofst; + int nByte, hdrSize; unsigned char *a; if( iStart==1 ){ ofst = hdrSize = 100; From 5087eacb18b6e89291abc15c2818832ae99fd3cc Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 13 Feb 2025 14:47:25 +0000 Subject: [PATCH 15/54] Ensure the counts of "deferred FK violations" and "deferred immediate FK violations" are kept separate when "PRAGMA defer_foreign_keys" is used. FossilOrigin-Name: c5190b0fd9bd76653fb7bb08e931699e42c88cef8a00352360d091948cda93a2 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/pragma.c | 5 ++++- src/vdbe.c | 10 ++++++---- test/fkey6.test | 30 ++++++++++++++++++++++++++++++ 5 files changed, 49 insertions(+), 14 deletions(-) diff --git a/manifest b/manifest index d046f2682d..ecfcfa1a08 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sfew\s32-bit\soverflow\sproblems\sin\sshowdb.c. -D 2025-02-12T20:19:57.718 +C Ensure\sthe\scounts\sof\s"deferred\sFK\sviolations"\sand\s"deferred\simmediate\sFK\sviolations"\sare\skept\sseparate\swhen\s"PRAGMA\sdefer_foreign_keys"\sis\sused. +D 2025-02-13T14:47:25.229 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -772,7 +772,7 @@ F src/parse.y f84673f1454e2bcf517623d4346e67fb2d73e57826ea103681ad5848238f6029 F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484 F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5 F src/pcache1.c 49516ad7718a3626f28f710fa7448ef1fce3c07fd169acbb4817341950264319 -F src/pragma.c ce1182217aa540e034c6da2f17515e3706bf52c837e8222361be9ccd7a9d495a +F src/pragma.c c7ada272232e1182c4536d9637fa7b955a10bc1bd8d5a87d4dc9309dab827791 F src/prepare.c 1832be043fce7d489959aae6f994c452d023914714c4d5457beaed51c0f3d126 F src/printf.c 96f7f8baeedc7639da94e4e7a4a2c200e2537c4eec9e5e1c2ffc821f40eb3105 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c @@ -847,7 +847,7 @@ F src/upsert.c 215328c3f91623c520ec8672c44323553f12caeb4f01b1090ebdca99fdf7b4f1 F src/utf.c 8b29d9a5956569ea2700f869669b8ef67a9662ee5e724ff77ab3c387e27094ba F src/util.c 9ff6470dabcf943fd796d2da766c98bd328c8f6fe036a31e5b338e628603f989 F src/vacuum.c b763b6457bd058d2072ef9364832351fd8d11e8abf70cbb349657360f7d55c40 -F src/vdbe.c b98d86de7f0e6c02fb14e0e1ae8feab6aa84669d389771a848e23f59eb70dcad +F src/vdbe.c 063763e08f1ad00890b7377fc663dbccec85a47630f5d2bbb13f3fdf77e06f78 F src/vdbe.h 3d26d5c7660c5c7bd33ffb0d8784615072d8b23c81f8110870efe2631136bc89 F src/vdbeInt.h 078b1c15b26587b54c1c1879d0d2f4dec812b9de4c337fed9faf73fbcc3bf091 F src/vdbeapi.c 82fe278a7c71b653235c6f9fb5de0b5de589908dfcb011ba2a782e8becf06f86 @@ -1153,7 +1153,7 @@ F test/fkey2.test 1063d65e5923c054cfb8f0555a92a3ae0fa8c067275a33ee1715bd856cdb30 F test/fkey3.test 76d475c80b84ee7a5d062e56ccb6ea68882e2b49 F test/fkey4.test 86446017011273aad8f9a99c1a65019e7bd9ca9d F test/fkey5.test 6727452e163a427147e84e739da18713da553d79f9783559b04fdcd36d5c7421 -F test/fkey6.test ebd11efb00b9c70b57f4c6b6184445145c96e320329bd90a175036570c5b25ca +F test/fkey6.test 1e0874ba15f8ed1e14a1d0a40fc8fb90a9912f4c82ea220a43137d4d9eff4d69 F test/fkey7.test 64fb28da03da5dfe3cdef5967aa7e832c2507bf7fb8f0780cacbca1f2338d031 F test/fkey8.test 51deda7f1a1448bca95875e4a6e1a3a75b4bd7215e924e845bd60de60e4d84bf F test/fkey_malloc.test 594a7ea1fbab553c036c70813cd8bd9407d63749 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6df859cd18ded3ca64a184e45709503dd9b6a3f65e7611d3352f0bad288400f4 -R ccf520bbb9a2866ca6aec9263e29fec3 +P 9377766647eeaa575d646cf5f66c3163ef7074930aa5c3b11073e6b1e90ce799 +R 83e471c75257ae61568ff2a0fb629999 U dan -Z 06705c2bc45432ef657decbbc71b836f +Z e4f9c0246de36460838c8b5d3a4c9bbe # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 84fa86757b..3179d7a518 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9377766647eeaa575d646cf5f66c3163ef7074930aa5c3b11073e6b1e90ce799 +c5190b0fd9bd76653fb7bb08e931699e42c88cef8a00352360d091948cda93a2 diff --git a/src/pragma.c b/src/pragma.c index 291ccf7af1..f1a922d1ac 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -1153,7 +1153,10 @@ void sqlite3Pragma( } }else{ db->flags &= ~mask; - if( mask==SQLITE_DeferFKs ) db->nDeferredImmCons = 0; + if( mask==SQLITE_DeferFKs ){ + db->nDeferredImmCons = 0; + db->nDeferredCons = 0; + } if( (mask & SQLITE_WriteSchema)!=0 && sqlite3_stricmp(zRight, "reset")==0 ){ diff --git a/src/vdbe.c b/src/vdbe.c index ec871c5a6e..6d7769173f 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -7483,12 +7483,14 @@ case OP_Param: { /* out2 */ ** statement counter is incremented (immediate foreign key constraints). */ case OP_FkCounter: { - if( db->flags & SQLITE_DeferFKs ){ - db->nDeferredImmCons += pOp->p2; - }else if( pOp->p1 ){ + if( pOp->p1 ){ db->nDeferredCons += pOp->p2; }else{ - p->nFkConstraint += pOp->p2; + if( db->flags & SQLITE_DeferFKs ){ + db->nDeferredImmCons += pOp->p2; + }else{ + p->nFkConstraint += pOp->p2; + } } break; } diff --git a/test/fkey6.test b/test/fkey6.test index 72de926b52..7cdc8ab0ae 100644 --- a/test/fkey6.test +++ b/test/fkey6.test @@ -267,5 +267,35 @@ do_execsql_test 5.1 { COMMIT; } +#------------------------------------------------------------------------- +# +reset_db + +do_execsql_test 6.1 { + PRAGMA writable_schema = 1; + INSERT INTO sqlite_schema + VALUES('table', 't1', 't1', 2, 'CREATE TABLE t1(x INTEGER PRIMARY KEY)'); +} +db close +sqlite3 db test.db +do_execsql_test 6.1 { + PRAGMA foreign_keys = 1; + PRAGMA writable_schema = 1; +} +do_execsql_test 6.2 { + CREATE TABLE t2( + y INTEGER PRIMARY KEY, + z INTEGER REFERENCES t1(x) DEFERRABLE INITIALLY DEFERRED + ); +} +do_execsql_test 6.3 { + BEGIN; + INSERT INTO t2 VALUES(1,0),(2,1); + CREATE VIRTUAL TABLE t3 USING fts5(a, b, content='', tokendata=1); + INSERT INTO t3 VALUES(3,3); + PRAGMA defer_foreign_keys=ON; + DELETE FROM t2; + COMMIT; +} finish_test From e89f31f19ab45dcb939a1ecf0ef5113b27a25868 Mon Sep 17 00:00:00 2001 From: stephan Date: Thu, 13 Feb 2025 16:20:05 +0000 Subject: [PATCH 16/54] When using the --out-implib build option, install the generated .dll.a file to PREFIX/lib. FossilOrigin-Name: 0dadea0ec86b6ac74281915433e41ae66cc20547d9882c4be2933a24c8287927 --- autoconf/Makefile.in | 5 ++++- main.mk | 10 +++++++--- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in index 8e09b9c610..c6cde3c181 100644 --- a/autoconf/Makefile.in +++ b/autoconf/Makefile.in @@ -157,6 +157,9 @@ all: $(libsqlite3.LIB) install-so-1: $(install-dir.lib) $(libsqlite3.SO) $(INSTALL) $(libsqlite3.SO) "$(install-dir.lib)" + @if [ -f $(libsqlite3.SO).a ]; then \ + $(INSTALL) $(libsqlite3.SO).a "$(install-dir.lib)"; \ + fi @echo "Setting up $(libsqlite3.SO) version symlinks..."; \ cd "$(install-dir.lib)" || exit $$?; \ if [ x.dylib = x$(T.dll) ]; then \ @@ -171,7 +174,7 @@ install-so-1: $(install-dir.lib) $(libsqlite3.SO) mv $(libsqlite3.SO) $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO) || exit $$?; \ ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0 || exit $$?; \ - ls -la $(libsqlite3.SO) $(libsqlite3.SO).[03]*; \ + ls -la $(libsqlite3.SO) $(libsqlite3.SO).[a03]*; \ if [ -e $(libsqlite3.SO).0.8.6 ]; then \ echo "ACHTUNG: legacy libtool-compatible install found. Re-linking it..."; \ rm -f libsqlite3.la $(libsqlite3.SO).0.8.6 || exit $$?; \ diff --git a/main.mk b/main.mk index 615dc97fb5..a63fa2a814 100644 --- a/main.mk +++ b/main.mk @@ -1477,6 +1477,9 @@ all: so # install-so-1: $(install-dir.lib) $(libsqlite3.SO) $(INSTALL) $(libsqlite3.SO) "$(install-dir.lib)" + @if [ -f $(libsqlite3.SO).a ]; then \ + $(INSTALL) $(libsqlite3.SO).a "$(install-dir.lib)"; \ + fi @echo "Setting up $(libsqlite3.SO) version symlinks..."; \ cd "$(install-dir.lib)" || exit $$?; \ if [ x.dylib = x$(T.dll) ]; then \ @@ -1491,7 +1494,7 @@ install-so-1: $(install-dir.lib) $(libsqlite3.SO) mv $(libsqlite3.SO) $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO) || exit $$?; \ ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0 || exit $$?; \ - ls -la $(libsqlite3.SO) $(libsqlite3.SO).[03]*; \ + ls -la $(libsqlite3.SO) $(libsqlite3.SO).[a03]*; \ if [ -e $(libsqlite3.SO).0.8.6 ]; then \ echo "ACHTUNG: legacy libtool-compatible install found. Re-linking it..."; \ rm -f libsqlite3.la $(libsqlite3.SO).0.8.6 || exit $$?; \ @@ -1504,6 +1507,7 @@ install-so-1: $(install-dir.lib) $(libsqlite3.SO) ls -la $(libsqlite3.SO).0.8.6; \ fi; \ fi + install-so-0 install-so-: install-so: install-so-$(ENABLE_SHARED) install: install-so @@ -2339,7 +2343,7 @@ tidy: tidy-. rm -f lemon$(B.exe) sqlite*.tar.gz rm -f mkkeywordhash$(B.exe) mksourceid$(B.exe) rm -f parse.* fts5parse.* - rm -f $(libsqlite3.SO) $(libsqlite3.LIB) $(libtclsqlite3.SO) libsqlite3$(T.dll).a + rm -f $(libsqlite3.SO) $(libsqlite3.LIB) $(libtclsqlite3.SO) $(libsqlite3.SO).a rm -f tclsqlite3$(T.exe) $(TESTPROGS) rm -f LogEst$(T.exe) fts3view$(T.exe) rollback-test$(T.exe) showdb$(T.exe) rm -f showjournal$(T.exe) showstat4$(T.exe) showwal$(T.exe) speedtest1$(T.exe) @@ -2374,7 +2378,7 @@ distclean: distclean-. clean # Show important variable settings. -show-variables: +show-variables: @echo "CC = $(CC)" @echo "B.cc = $(B.cc)" @echo "T.cc = $(T.cc)" diff --git a/manifest b/manifest index ecfcfa1a08..da6a8bb7bd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Ensure\sthe\scounts\sof\s"deferred\sFK\sviolations"\sand\s"deferred\simmediate\sFK\sviolations"\sare\skept\sseparate\swhen\s"PRAGMA\sdefer_foreign_keys"\sis\sused. -D 2025-02-13T14:47:25.229 +C When\susing\sthe\s--out-implib\sbuild\soption,\sinstall\sthe\sgenerated\s.dll.a\sfile\sto\sPREFIX/lib. +D 2025-02-13T16:20:05.290 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -16,7 +16,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 F auto.def 542572667678019e75e16c3e970bfb9358abed9a6ec70f3715997dd9a04b7fd9 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac -F autoconf/Makefile.in 7bd73a4c8cd89025cbc92b4f887c6fd1b8cd8ecbe62c4ac1f36ac84d04043479 +F autoconf/Makefile.in 0c71fcc6b2bd1703799a8e5b8f137ba64aad9bdee43c3cc23598cd0d6ce95715 F autoconf/Makefile.msc 4f09fead3bf7de337242896f107c5d03cd8f7b39754315ab091a2e4d02892c40 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 @@ -702,7 +702,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk ecf4b449c742eaa3a872a5cd0e8e5c19e2dccfe3b5b0ccafd0c926dc1030c661 +F main.mk a127ee141eb7db341d0c949a743a45d1b068b31ac3f1f09cf3b2870b2f18739f F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9377766647eeaa575d646cf5f66c3163ef7074930aa5c3b11073e6b1e90ce799 -R 83e471c75257ae61568ff2a0fb629999 -U dan -Z e4f9c0246de36460838c8b5d3a4c9bbe +P c5190b0fd9bd76653fb7bb08e931699e42c88cef8a00352360d091948cda93a2 +R f439c2b5346ac4c6cf58b3b95ae0e844 +U stephan +Z 52b2d5f34b70aec8885831f59cc359bf # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 3179d7a518..c2065efdfe 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c5190b0fd9bd76653fb7bb08e931699e42c88cef8a00352360d091948cda93a2 +0dadea0ec86b6ac74281915433e41ae66cc20547d9882c4be2933a24c8287927 From f338ab20efd7d06c9b1553a68ca07be31e568d28 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 14 Feb 2025 10:28:28 +0000 Subject: [PATCH 17/54] Fix test cases added for [d7b90d92ffbfc61f] so that they also work when compiling with ICU support. [forum:/forumpost/2ca8a09a7e|Forum post 2ca8a09a7e] FossilOrigin-Name: 5964616dc9de9323fddfede0ded29ee135498c8760017ce1158461f596fe6914 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/like3.test | 8 ++++++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index da6a8bb7bd..192970f34b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C When\susing\sthe\s--out-implib\sbuild\soption,\sinstall\sthe\sgenerated\s.dll.a\sfile\sto\sPREFIX/lib. -D 2025-02-13T16:20:05.290 +C Fix\stest\scases\sadded\sfor\s[d7b90d92ffbfc61f]\sso\sthat\sthey\salso\swork\swhen\ncompiling\swith\sICU\ssupport.\n[forum:/forumpost/2ca8a09a7e|Forum\spost\s2ca8a09a7e] +D 2025-02-14T10:28:28.618 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -1399,7 +1399,7 @@ F test/laststmtchanges.test ae613f53819206b3222771828d024154d51db200 F test/lemon-test01.y 70110eff607ab137ccc851edb2bc7e14a6d4f246b5d2d25f82a60b69d87a9ff2 F test/like.test b3ea2ba3558199aa8f25a42ddeb54772e234fab50868c9f066047acdbda8fc58 F test/like2.test d3be15fefee3e02fc88942a9b98f26c5339bbdef7783c90023c092c4955fe3d3 -F test/like3.test b21284df226d6028feeb4dcc56ad9d32673d82c14a63f15f25471292c36491e7 +F test/like3.test 1179fef50a9baa22767a431244aeefbf29f36606f0f854d4ab9e1d2fecf97dd3 F test/limit.test 350f5d03c29e7dff9a2cde016f84f8d368d40bcd02fa2b2a52fa10c4bf3cbfaf F test/limit2.test 9409b033284642a859fafc95f29a5a6a557bd57c1f0d7c3f554bd64ed69df77e F test/literal.test a65dca9fef86e51b8e45544268e37abbd4bb94ba35fd65f6fdcab2f288cd8f79 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P c5190b0fd9bd76653fb7bb08e931699e42c88cef8a00352360d091948cda93a2 -R f439c2b5346ac4c6cf58b3b95ae0e844 -U stephan -Z 52b2d5f34b70aec8885831f59cc359bf +P 0dadea0ec86b6ac74281915433e41ae66cc20547d9882c4be2933a24c8287927 +R 2aa968ae6750fa58cc8b9f9ab1460920 +U drh +Z d2f9f0edcea4c1ead34b1dd8879b3a1a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index c2065efdfe..666aafe40e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0dadea0ec86b6ac74281915433e41ae66cc20547d9882c4be2933a24c8287927 +5964616dc9de9323fddfede0ded29ee135498c8760017ce1158461f596fe6914 diff --git a/test/like3.test b/test/like3.test index 0b28574376..01d19a54f6 100644 --- a/test/like3.test +++ b/test/like3.test @@ -304,11 +304,19 @@ ifcapable utf16 { #------------------------------------------------------------------------- reset_db +# See forum thread https://sqlite.org/forum/info/d7b90d92ffbfc61f foreach enc { UTF-8 UTF-16le UTF-16be } { + ifcapable icu { + if {$enc=="UTF-8"} { + # The invalid UTF8 used in these tests is incompatible with ICU + # https://sqlite.org/forum/forumpost/2ca8a09a7e + continue + } + } foreach {tn expr} { 1 "CAST (X'FF' AS TEXT)" 2 "CAST (X'FFBF' AS TEXT)" From e3157582bf32324d37078f828509e91008aded2d Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 14 Feb 2025 16:42:37 +0000 Subject: [PATCH 18/54] ICU config support: add more details to error messages and correct a typo which would cause a configure crash if --with-icu-config=X refered to a non-executable X. FossilOrigin-Name: ff508926651d632d86081ccde89d3367c89538dde469e9e925540d634ac8a416 --- autosetup/sqlite-config.tcl | 18 ++++++++++++++---- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 14cdcf5da1..1616b10920 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -213,7 +213,7 @@ proc sqlite-config-bootstrap {buildMode} { {*} { with-icu-ldflags:LDFLAGS => {Enable SQLITE_ENABLE_ICU and add the given linker flags for the - ICU libraries} + ICU libraries. e.g. on Ubuntu systems, try '-licui18n -licuuc -licudata'.} with-icu-cflags:CFLAGS => {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU. e.g. -I/usr/local/include} @@ -1062,6 +1062,7 @@ proc sqlite-handle-icu {} { define LDFLAGS_ICU [join [opt-val with-icu-ldflags ""]] define CFLAGS_ICU [join [opt-val with-icu-cflags ""]] if {[proj-opt-was-provided with-icu-config]} { + msg-result "Checking for ICU support..." set icuConfigBin [opt-val with-icu-config] set tryIcuConfigBin 1; # set to 0 if we end up using pkg-config if {"auto" eq $icuConfigBin || "pkg-config" eq $icuConfigBin} { @@ -1085,19 +1086,28 @@ proc sqlite-handle-icu {} { /usr/local/bin/icu-config \ /usr/bin/icu-config] if {"" eq $icuConfigBin} { - proj-fatal "--with-icu-config=auto cannot find (pkg-config icu-io) or icu-config binary" + proj-indented-notice -error { + --with-icu-config=auto cannot find (pkg-config icu-io) or icu-config binary. + On Ubuntu-like systems try: + --with-icu-ldflags='-licui18n -licuuc -licudata' + } } } if {[file-isexec $icuConfigBin]} { set x [exec $icuConfigBin --ldflags] if {"" eq $x} { - proj-fatal "$icuConfigBin --ldflags returned no data" + proj-indented-notice -error \ + [subst { + $icuConfigBin --ldflags returned no data. + On Ubuntu-like systems try: + --with-icu-ldflags='-licui18n -licuuc -licudata' + }] } define-append LDFLAGS_ICU $x set x [exec $icuConfigBin --cppflags] define-append CFLAGS_ICU $x } else { - proj-fatal "--with-icu-config=$bin does not refer to an executable" + proj-fatal "--with-icu-config=$icuConfigBin does not refer to an executable" } } } diff --git a/manifest b/manifest index 192970f34b..9b1a8780b3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\stest\scases\sadded\sfor\s[d7b90d92ffbfc61f]\sso\sthat\sthey\salso\swork\swhen\ncompiling\swith\sICU\ssupport.\n[forum:/forumpost/2ca8a09a7e|Forum\spost\s2ca8a09a7e] -D 2025-02-14T10:28:28.618 +C ICU\sconfig\ssupport:\sadd\smore\sdetails\sto\serror\smessages\sand\scorrect\sa\stypo\swhich\swould\scause\sa\sconfigure\scrash\sif\s--with-icu-config=X\srefered\sto\sa\snon-executable\sX. +D 2025-02-14T16:42:37.638 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl ece913b7bb1efbabdd44fd787c0e4d2fd462d3019cc079a5e6bbe43c83d302b3 +F autosetup/sqlite-config.tcl c0a5e95b10d8168eb0f942a9d46b1b6a31a06a19991a294d2eace6b0a9d7e897 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 0dadea0ec86b6ac74281915433e41ae66cc20547d9882c4be2933a24c8287927 -R 2aa968ae6750fa58cc8b9f9ab1460920 -U drh -Z d2f9f0edcea4c1ead34b1dd8879b3a1a +P 5964616dc9de9323fddfede0ded29ee135498c8760017ce1158461f596fe6914 +R 8f2beaf5ac609f50ce863af5a49fb8f4 +U stephan +Z a0a82d139cbfe850e3642558116bae4d # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 666aafe40e..ac337f3b52 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5964616dc9de9323fddfede0ded29ee135498c8760017ce1158461f596fe6914 +ff508926651d632d86081ccde89d3367c89538dde469e9e925540d634ac8a416 From a09fd7b91330616b1ec31546c21550449b184661 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 14 Feb 2025 17:21:05 +0000 Subject: [PATCH 19/54] Work around a autosetup --help bug which only(?) triggers on tcl 8.6, introduced by [9978c87139b7b042] and reported upstream as [https://github.com/msteveb/autosetup/issues/73|ticket #73]. Summary: calling 'options' from a proc, instead of the global scope, triggers an error about an invalid use of 'break'. FossilOrigin-Name: 6a21d6a2ed627ba0a864bef85369ed17553b808ae5c19891fa1f70505dfcbe39 --- auto.def | 10 ++++++++-- autoconf/auto.def | 9 ++++++++- autosetup/sqlite-config.tcl | 11 ++++++++--- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 5 files changed, 33 insertions(+), 15 deletions(-) diff --git a/auto.def b/auto.def index 4528293cd7..455b246e09 100644 --- a/auto.def +++ b/auto.def @@ -14,8 +14,14 @@ # use sqlite-config -sqlite-config-bootstrap canonical - +if {0} { + sqlite-config-bootstrap canonical +} else { + set sq3options [sqlite-config-bootstrap canonical] + options $sq3options + unset sq3options + sqlite-post-options-init +} sqlite-setup-default-cflags proj-if-opt-truthy dev { # --enable-dev needs to come early so that the downstream tests diff --git a/autoconf/auto.def b/autoconf/auto.def index bb8710378f..7e154caa32 100644 --- a/autoconf/auto.def +++ b/autoconf/auto.def @@ -8,7 +8,14 @@ # included in this source tree as ./autosetup/jimsh0.c. # use sqlite-config -sqlite-config-bootstrap autoconf +if {0} { + sqlite-config-bootstrap autoconf +} else { + set sq3options [sqlite-config-bootstrap autoconf] + options $sq3options + unset sq3options + sqlite-post-options-init +} sqlite-check-common-bins sqlite-check-common-system-deps proj-check-rpath diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 1616b10920..338eb2408b 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -295,9 +295,14 @@ proc sqlite-config-bootstrap {buildMode} { } } } - #puts "options = $opts"; exit 0 - options $opts - sqlite-post-options-init + if {0} { + #puts "options = $opts"; exit 0 + options $opts + sqlite-post-options-init + } else { + # Workaround for https://github.com/msteveb/autosetup/issues/73 + return $opts + } }; # sqlite-config-bootstrap ######################################################################## diff --git a/manifest b/manifest index 9b1a8780b3..ec9077572f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C ICU\sconfig\ssupport:\sadd\smore\sdetails\sto\serror\smessages\sand\scorrect\sa\stypo\swhich\swould\scause\sa\sconfigure\scrash\sif\s--with-icu-config=X\srefered\sto\sa\snon-executable\sX. -D 2025-02-14T16:42:37.638 +C Work\saround\sa\sautosetup\s--help\sbug\swhich\sonly(?)\striggers\son\stcl\s8.6,\sintroduced\sby\s[9978c87139b7b042]\sand\sreported\supstream\sas\s[https://github.com/msteveb/autosetup/issues/73|ticket\s#73].\sSummary:\scalling\s'options'\sfrom\sa\sproc,\sinstead\sof\sthe\sglobal\sscope,\striggers\san\serror\sabout\san\sinvalid\suse\sof\s'break'. +D 2025-02-14T17:21:05.787 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -14,13 +14,13 @@ F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 -F auto.def 542572667678019e75e16c3e970bfb9358abed9a6ec70f3715997dd9a04b7fd9 +F auto.def 559f8f904a63950fcbe8d5692141ea4e5bf6b1e38ffb25b89a572d829d8ea648 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac F autoconf/Makefile.in 0c71fcc6b2bd1703799a8e5b8f137ba64aad9bdee43c3cc23598cd0d6ce95715 F autoconf/Makefile.msc 4f09fead3bf7de337242896f107c5d03cd8f7b39754315ab091a2e4d02892c40 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 -F autoconf/auto.def 9af634c6d51fa4b82c9bb61b51249ca087f2cbe09c7c3c31f920759082a1ffdb +F autoconf/auto.def ef517ef2bb4445b0df5644ef06ba414538192f6e62ad4c03f56d8041a9a78d88 F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl c0a5e95b10d8168eb0f942a9d46b1b6a31a06a19991a294d2eace6b0a9d7e897 +F autosetup/sqlite-config.tcl 6a2f007f7c190a0077b99bd442d5bd41638f3d329c08a045653e096f21c9d16d F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 5964616dc9de9323fddfede0ded29ee135498c8760017ce1158461f596fe6914 -R 8f2beaf5ac609f50ce863af5a49fb8f4 +P ff508926651d632d86081ccde89d3367c89538dde469e9e925540d634ac8a416 +R f4836849041855b59c987e999995c2b8 U stephan -Z a0a82d139cbfe850e3642558116bae4d +Z 3d0710da40d3f26ab6ec370f0db703f9 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index ac337f3b52..67eb80d7f6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ff508926651d632d86081ccde89d3367c89538dde469e9e925540d634ac8a416 +6a21d6a2ed627ba0a864bef85369ed17553b808ae5c19891fa1f70505dfcbe39 From b0c987967f9b94eb08c0f1b202fbed079c3f5d42 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 14 Feb 2025 17:52:57 +0000 Subject: [PATCH 20/54] Simplify the --help workaround introduced in [6a21d6a2ed]. FossilOrigin-Name: b0928f2043ed2a5d445c65f0d7271431e182f5a6fcd24ddcd57ea1cdcf4bbaa2 --- auto.def | 4 +--- autoconf/auto.def | 4 +--- manifest | 14 +++++++------- manifest.uuid | 2 +- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/auto.def b/auto.def index 455b246e09..8a964ad75c 100644 --- a/auto.def +++ b/auto.def @@ -17,9 +17,7 @@ use sqlite-config if {0} { sqlite-config-bootstrap canonical } else { - set sq3options [sqlite-config-bootstrap canonical] - options $sq3options - unset sq3options + options [sqlite-config-bootstrap canonical] sqlite-post-options-init } sqlite-setup-default-cflags diff --git a/autoconf/auto.def b/autoconf/auto.def index 7e154caa32..ccbaaa89ee 100644 --- a/autoconf/auto.def +++ b/autoconf/auto.def @@ -11,9 +11,7 @@ use sqlite-config if {0} { sqlite-config-bootstrap autoconf } else { - set sq3options [sqlite-config-bootstrap autoconf] - options $sq3options - unset sq3options + options [sqlite-config-bootstrap autoconf] sqlite-post-options-init } sqlite-check-common-bins diff --git a/manifest b/manifest index ec9077572f..4ae8152a9e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Work\saround\sa\sautosetup\s--help\sbug\swhich\sonly(?)\striggers\son\stcl\s8.6,\sintroduced\sby\s[9978c87139b7b042]\sand\sreported\supstream\sas\s[https://github.com/msteveb/autosetup/issues/73|ticket\s#73].\sSummary:\scalling\s'options'\sfrom\sa\sproc,\sinstead\sof\sthe\sglobal\sscope,\striggers\san\serror\sabout\san\sinvalid\suse\sof\s'break'. -D 2025-02-14T17:21:05.787 +C Simplify\sthe\s--help\sworkaround\sintroduced\sin\s[6a21d6a2ed]. +D 2025-02-14T17:52:57.730 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -14,13 +14,13 @@ F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 -F auto.def 559f8f904a63950fcbe8d5692141ea4e5bf6b1e38ffb25b89a572d829d8ea648 +F auto.def 6120063c2901500ee7ff662dee63f234fe24e546c9c0292c3fcb3beb9c2e59f5 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac F autoconf/Makefile.in 0c71fcc6b2bd1703799a8e5b8f137ba64aad9bdee43c3cc23598cd0d6ce95715 F autoconf/Makefile.msc 4f09fead3bf7de337242896f107c5d03cd8f7b39754315ab091a2e4d02892c40 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 -F autoconf/auto.def ef517ef2bb4445b0df5644ef06ba414538192f6e62ad4c03f56d8041a9a78d88 +F autoconf/auto.def c160516ad490b00fad64235323ff18323a6a6523607d2a9705f2ec38ea2f5c33 F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ff508926651d632d86081ccde89d3367c89538dde469e9e925540d634ac8a416 -R f4836849041855b59c987e999995c2b8 +P 6a21d6a2ed627ba0a864bef85369ed17553b808ae5c19891fa1f70505dfcbe39 +R ccbb8a55e81df7376a41b6d85d79a9b1 U stephan -Z 3d0710da40d3f26ab6ec370f0db703f9 +Z 440d189d3f6211449eb539edd8ee3916 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 67eb80d7f6..47d8d4598b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6a21d6a2ed627ba0a864bef85369ed17553b808ae5c19891fa1f70505dfcbe39 +b0928f2043ed2a5d445c65f0d7271431e182f5a6fcd24ddcd57ea1cdcf4bbaa2 From d04782206bbd7f3d6dffee706c23bc45e4a99503 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 14 Feb 2025 18:06:28 +0000 Subject: [PATCH 21/54] Make failure to find pthreads support non-fatal unless --enable-threadsafe is specifically passed in. Build regression reported in [8e0fdb8c0d]. FossilOrigin-Name: 806ad1ac173d7c0d6d94bfccd3b961fc5c9541b32773c063a8c4082380d7a90d --- autosetup/sqlite-config.tcl | 29 ++++++++++++++++------------- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 338eb2408b..1c0e859042 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -680,29 +680,32 @@ proc sqlite-handle-soname {} { } ######################################################################## -# If --enable-thresafe is set, this adds -DSQLITE_THREADSAFE=1 to +# If --enable-threadsafe is set, this adds -DSQLITE_THREADSAFE=1 to # OPT_FEATURE_FLAGS and sets LDFLAGS_PTHREAD to the linker flags -# needed for linking pthread. If --enable-threadsafe is not set, adds -# -DSQLITE_THREADSAFE=0 to OPT_FEATURE_FLAGS and sets LDFLAGS_PTHREAD -# to an empty string. +# needed for linking pthread (possibly an empty string). If +# --enable-threadsafe is not set, adds -DSQLITE_THREADSAFE=0 to +# OPT_FEATURE_FLAGS and sets LDFLAGS_PTHREAD to an empty string. proc sqlite-handle-threadsafe {} { msg-checking "Support threadsafe operation? " + define LDFLAGS_PTHREAD "" + set enable 0 proj-if-opt-truthy threadsafe { - msg-result yes - sqlite-add-feature-flag -DSQLITE_THREADSAFE=1 - if {![proj-check-function-in-lib pthread_create pthread] - || ![proj-check-function-in-lib pthread_mutexattr_init pthread]} { - user-error "Missing required pthread bits" + if {[proj-check-function-in-lib pthread_create pthread] + && [proj-check-function-in-lib pthread_mutexattr_init pthread]} { + set enable 1 + define LDFLAGS_PTHREAD [get-define lib_pthread_create] + undefine lib_pthread_create + undefine lib_pthread_mutexattr_init + } elseif {[proj-opt-was-provided threadsafe]} { + user-error "Missing required pthread libraries. Use --disable-threadsafe to disable this check." } - define LDFLAGS_PTHREAD [get-define lib_pthread_create] - undefine lib_pthread_create # Recall that LDFLAGS_PTHREAD might be empty even if pthreads if # found because it's in -lc on some platforms. } { msg-result no - sqlite-add-feature-flag -DSQLITE_THREADSAFE=0 - define LDFLAGS_PTHREAD "" } + sqlite-add-feature-flag -DSQLITE_THREADSAFE=${enable} + return $enable } ######################################################################## diff --git a/manifest b/manifest index 4ae8152a9e..ac1e73bf34 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Simplify\sthe\s--help\sworkaround\sintroduced\sin\s[6a21d6a2ed]. -D 2025-02-14T17:52:57.730 +C Make\sfailure\sto\sfind\spthreads\ssupport\snon-fatal\sunless\s--enable-threadsafe\sis\sspecifically\spassed\sin.\sBuild\sregression\sreported\sin\s[8e0fdb8c0d]. +D 2025-02-14T18:06:28.632 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl 6a2f007f7c190a0077b99bd442d5bd41638f3d329c08a045653e096f21c9d16d +F autosetup/sqlite-config.tcl 9d193c15975228021821cb3eed667491c6de340baf26d5b21a2ad861187d4936 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6a21d6a2ed627ba0a864bef85369ed17553b808ae5c19891fa1f70505dfcbe39 -R ccbb8a55e81df7376a41b6d85d79a9b1 +P b0928f2043ed2a5d445c65f0d7271431e182f5a6fcd24ddcd57ea1cdcf4bbaa2 +R deb7bf34e9c57df9897124263106b638 U stephan -Z 440d189d3f6211449eb539edd8ee3916 +Z 5ed369aff0b10c102cba383c3de65e06 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 47d8d4598b..cc8dc2bf44 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b0928f2043ed2a5d445c65f0d7271431e182f5a6fcd24ddcd57ea1cdcf4bbaa2 +806ad1ac173d7c0d6d94bfccd3b961fc5c9541b32773c063a8c4082380d7a90d From 6b5599726b752e72763d857a25897b8af882aed7 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 14 Feb 2025 18:17:31 +0000 Subject: [PATCH 22/54] More informative output for the pthread feature test. FossilOrigin-Name: 01b9ed73ca6e72411dcf5a81f445c15c5bc42fa068fc7eca485ac72635b9d2fc --- autosetup/sqlite-config.tcl | 5 ++++- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 1c0e859042..d70220723f 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -690,6 +690,7 @@ proc sqlite-handle-threadsafe {} { define LDFLAGS_PTHREAD "" set enable 0 proj-if-opt-truthy threadsafe { + msg-result "Checking for libs..." if {[proj-check-function-in-lib pthread_create pthread] && [proj-check-function-in-lib pthread_mutexattr_init pthread]} { set enable 1 @@ -698,11 +699,13 @@ proc sqlite-handle-threadsafe {} { undefine lib_pthread_mutexattr_init } elseif {[proj-opt-was-provided threadsafe]} { user-error "Missing required pthread libraries. Use --disable-threadsafe to disable this check." + } else { + msg-result "pthread support not detected" } # Recall that LDFLAGS_PTHREAD might be empty even if pthreads if # found because it's in -lc on some platforms. } { - msg-result no + msg-result "Disabled using --disable-threadsafe" } sqlite-add-feature-flag -DSQLITE_THREADSAFE=${enable} return $enable diff --git a/manifest b/manifest index ac1e73bf34..17137cbb99 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\sfailure\sto\sfind\spthreads\ssupport\snon-fatal\sunless\s--enable-threadsafe\sis\sspecifically\spassed\sin.\sBuild\sregression\sreported\sin\s[8e0fdb8c0d]. -D 2025-02-14T18:06:28.632 +C More\sinformative\soutput\sfor\sthe\spthread\sfeature\stest. +D 2025-02-14T18:17:31.710 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl 9d193c15975228021821cb3eed667491c6de340baf26d5b21a2ad861187d4936 +F autosetup/sqlite-config.tcl 48c55d221189cda985cadd81a88d5a046d327db6e8c5f7395bfde577040ba59f F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b0928f2043ed2a5d445c65f0d7271431e182f5a6fcd24ddcd57ea1cdcf4bbaa2 -R deb7bf34e9c57df9897124263106b638 +P 806ad1ac173d7c0d6d94bfccd3b961fc5c9541b32773c063a8c4082380d7a90d +R 09a63536408c62281d4a45ffc0125d28 U stephan -Z 5ed369aff0b10c102cba383c3de65e06 +Z fe9efd4025c936400a0447a11687e271 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index cc8dc2bf44..d3ca8dc79f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -806ad1ac173d7c0d6d94bfccd3b961fc5c9541b32773c063a8c4082380d7a90d +01b9ed73ca6e72411dcf5a81f445c15c5bc42fa068fc7eca485ac72635b9d2fc From 4e87ddc105c16f6557f041cc4426fbe72e5642ab Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 15 Feb 2025 14:12:24 +0000 Subject: [PATCH 23/54] A cleaner workaround for [6a21d6a2], provided by autosetup's creator. FossilOrigin-Name: 334ed723d0fc0b202f79a9746459181f637ca99c54864a4aa11629eecb4b8d0c --- auto.def | 7 +------ autoconf/auto.def | 7 +------ autosetup/sqlite-config.tcl | 14 +++++++------- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 5 files changed, 18 insertions(+), 28 deletions(-) diff --git a/auto.def b/auto.def index 8a964ad75c..9df87f579a 100644 --- a/auto.def +++ b/auto.def @@ -14,12 +14,7 @@ # use sqlite-config -if {0} { - sqlite-config-bootstrap canonical -} else { - options [sqlite-config-bootstrap canonical] - sqlite-post-options-init -} +sqlite-config-bootstrap canonical sqlite-setup-default-cflags proj-if-opt-truthy dev { # --enable-dev needs to come early so that the downstream tests diff --git a/autoconf/auto.def b/autoconf/auto.def index ccbaaa89ee..bb8710378f 100644 --- a/autoconf/auto.def +++ b/autoconf/auto.def @@ -8,12 +8,7 @@ # included in this source tree as ./autosetup/jimsh0.c. # use sqlite-config -if {0} { - sqlite-config-bootstrap autoconf -} else { - options [sqlite-config-bootstrap autoconf] - sqlite-post-options-init -} +sqlite-config-bootstrap autoconf sqlite-check-common-bins sqlite-check-common-system-deps proj-check-rpath diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index d70220723f..ccb114868c 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -295,14 +295,14 @@ proc sqlite-config-bootstrap {buildMode} { } } } - if {0} { - #puts "options = $opts"; exit 0 - options $opts - sqlite-post-options-init - } else { - # Workaround for https://github.com/msteveb/autosetup/issues/73 - return $opts + #lappend opts "soname:=duplicateEntry => {x}"; #just testing + if {[catch {options $opts}]} { + # Workaround for + # where [options] behaves oddly on _some_ TCL builds when it's + # called from deeper than the global scope. + return -code break } + sqlite-post-options-init }; # sqlite-config-bootstrap ######################################################################## diff --git a/manifest b/manifest index 17137cbb99..60ccc5f65f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C More\sinformative\soutput\sfor\sthe\spthread\sfeature\stest. -D 2025-02-14T18:17:31.710 +C A\scleaner\sworkaround\sfor\s[6a21d6a2],\sprovided\sby\sautosetup's\screator. +D 2025-02-15T14:12:24.766 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -14,13 +14,13 @@ F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 -F auto.def 6120063c2901500ee7ff662dee63f234fe24e546c9c0292c3fcb3beb9c2e59f5 +F auto.def eddf6aef976e2c1a56c0accc3244945e0b22ec6799074c40be160e5a9a5662b0 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac F autoconf/Makefile.in 0c71fcc6b2bd1703799a8e5b8f137ba64aad9bdee43c3cc23598cd0d6ce95715 F autoconf/Makefile.msc 4f09fead3bf7de337242896f107c5d03cd8f7b39754315ab091a2e4d02892c40 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 -F autoconf/auto.def c160516ad490b00fad64235323ff18323a6a6523607d2a9705f2ec38ea2f5c33 +F autoconf/auto.def 9af634c6d51fa4b82c9bb61b51249ca087f2cbe09c7c3c31f920759082a1ffdb F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl 48c55d221189cda985cadd81a88d5a046d327db6e8c5f7395bfde577040ba59f +F autosetup/sqlite-config.tcl 17b5417841c402dcf8f656749be6fcff651f3360c48afcdc01aad375fe414fec F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 806ad1ac173d7c0d6d94bfccd3b961fc5c9541b32773c063a8c4082380d7a90d -R 09a63536408c62281d4a45ffc0125d28 +P 01b9ed73ca6e72411dcf5a81f445c15c5bc42fa068fc7eca485ac72635b9d2fc +R 4a76560a1c5bc38f5777d5f7ba110253 U stephan -Z fe9efd4025c936400a0447a11687e271 +Z 15f10168d95dbdd3c940ff559a29ad5c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d3ca8dc79f..db6cfe8045 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -01b9ed73ca6e72411dcf5a81f445c15c5bc42fa068fc7eca485ac72635b9d2fc +334ed723d0fc0b202f79a9746459181f637ca99c54864a4aa11629eecb4b8d0c From 984f699ccb04322a5edee5f9ebda7131e2493558 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 15 Feb 2025 16:12:28 +0000 Subject: [PATCH 24/54] DLL installation rules no longer create versioned symlinks on platforms where the DLL extension is '.dll' (cygwin, msys2, etc.), as suggested in [forum:28bb79638844c328|forum post 28bb79638844c328]. FossilOrigin-Name: d743410665df8ba962db6e1f245d929b005d0add77be95af3c3c7f87a1c758fb --- autoconf/Makefile.in | 9 ++++++--- main.mk | 23 ++++++++++++----------- manifest | 14 +++++++------- manifest.uuid | 2 +- 4 files changed, 26 insertions(+), 22 deletions(-) diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in index c6cde3c181..65108ee5d0 100644 --- a/autoconf/Makefile.in +++ b/autoconf/Makefile.in @@ -87,7 +87,7 @@ install-dir.all = $(install-dir.bin) $(install-dir.include) \ $(install-dir.lib) $(install-dir.man1) \ $(install-dir.pkgconfig) $(install-dir.all): - if [ ! -d "$@" ]; then $(INSTALL) -d "$@"; fi + @if [ ! -d "$@" ]; then set -x; $(INSTALL) -d "$@"; fi # ^^^^ on some platforms, install -d fails if the target already exists. @@ -161,8 +161,10 @@ install-so-1: $(install-dir.lib) $(libsqlite3.SO) $(INSTALL) $(libsqlite3.SO).a "$(install-dir.lib)"; \ fi @echo "Setting up $(libsqlite3.SO) version symlinks..."; \ - cd "$(install-dir.lib)" || exit $$?; \ - if [ x.dylib = x$(T.dll) ]; then \ + if [ x.dll = x$(T.dll) ]; then \ + echo "No library symlinks needed on this platform"; \ + elif [ x.dylib = x$(T.dll) ]; then \ + cd "$(install-dir.lib)" || exit $$?; \ rm -f libsqlite3.0$(T.dll) libsqlite3.$(PACKAGE_VERSION)$(T.dll) || exit $$?; \ dllname=libsqlite3.$(PACKAGE_VERSION)$(T.dll); \ mv $(libsqlite3.SO) $$dllname || exit $$?; \ @@ -170,6 +172,7 @@ install-so-1: $(install-dir.lib) $(libsqlite3.SO) ln -s $$dllname libsqlite3.0$(T.dll) || exit $$?; \ ls -la $$dllname $(libsqlite3.SO) libsqlite3.0$(T.dll); \ else \ + cd "$(install-dir.lib)" || exit $$?; \ rm -f $(libsqlite3.SO).0 $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ mv $(libsqlite3.SO) $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO) || exit $$?; \ diff --git a/main.mk b/main.mk index a63fa2a814..00e519d216 100644 --- a/main.mk +++ b/main.mk @@ -436,7 +436,7 @@ install-dir.all = $(install-dir.bin) $(install-dir.include) \ $(install-dir.lib) $(install-dir.man1) \ $(install-dir.pkgconfig) $(install-dir.all): - if [ ! -d "$@" ]; then $(INSTALL) -d "$@"; fi + @if [ ! -d "$@" ]; then set -x; $(INSTALL) -d "$@"; fi # ^^^^ on some platforms, install -d fails if the target already exists. # @@ -1427,19 +1427,17 @@ so: $(libsqlite3.SO)-$(ENABLE_SHARED) all: so # -# Install the $(libsqlite3.SO) as $(libsqlite3.SO).$(PACKAGE_VERSION) -# and create symlinks which point to it: +# On most Unix-like platforms, install the $(libsqlite3.SO) as +# $(libsqlite3.SO).$(PACKAGE_VERSION) and create symlinks which point +# to it: # # - libsqlite3.so.$(PACKAGE_VERSION) # - libsqlite3.so.0 =symlink-> libsqlite3.so.$(PACKAGE_VERSION) (see below) # - libsqlite3.so =symlink-> libsqlite3.so.3 # -# N.B. we initially had a link named libsqlite3.so.3 but it's -# unnecessary unless we want to set SONAME to libsqlite3.so.3, which -# is also unnecessary. -# -# N.B. different transformations are applied on systems where $(T.dll) -# is ".dylib" and none of the following docs apply on such systems. +# The symlinks are not added on platforms where $(T.dll) is ".dll", +# and different transformations take place on platforms where $(T.dll) +# is ".dylib". # # The link named libsqlite3.so.0 is provided in an attempt to reduce # downstream disruption when performing upgrades from pre-3.48 to a @@ -1481,8 +1479,10 @@ install-so-1: $(install-dir.lib) $(libsqlite3.SO) $(INSTALL) $(libsqlite3.SO).a "$(install-dir.lib)"; \ fi @echo "Setting up $(libsqlite3.SO) version symlinks..."; \ - cd "$(install-dir.lib)" || exit $$?; \ - if [ x.dylib = x$(T.dll) ]; then \ + if [ x.dll = x$(T.dll) ]; then \ + echo "No library symlinks needed on this platform"; \ + elif [ x.dylib = x$(T.dll) ]; then \ + cd "$(install-dir.lib)" || exit $$?; \ rm -f libsqlite3.0$(T.dll) libsqlite3.$(PACKAGE_VERSION)$(T.dll) || exit $$?; \ dllname=libsqlite3.$(PACKAGE_VERSION)$(T.dll); \ mv $(libsqlite3.SO) $$dllname || exit $$?; \ @@ -1490,6 +1490,7 @@ install-so-1: $(install-dir.lib) $(libsqlite3.SO) ln -s $$dllname libsqlite3.0$(T.dll) || exit $$?; \ ls -la $$dllname $(libsqlite3.SO) libsqlite3.0$(T.dll); \ else \ + cd "$(install-dir.lib)" || exit $$?; \ rm -f $(libsqlite3.SO).0 $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ mv $(libsqlite3.SO) $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO) || exit $$?; \ diff --git a/manifest b/manifest index 60ccc5f65f..9f60cfd2ce 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C A\scleaner\sworkaround\sfor\s[6a21d6a2],\sprovided\sby\sautosetup's\screator. -D 2025-02-15T14:12:24.766 +C DLL\sinstallation\srules\sno\slonger\screate\sversioned\ssymlinks\son\splatforms\swhere\sthe\sDLL\sextension\sis\s'.dll'\s(cygwin,\smsys2,\setc.),\sas\ssuggested\sin\s[forum:28bb79638844c328|forum\spost\s28bb79638844c328]. +D 2025-02-15T16:12:28.303 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -16,7 +16,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 F auto.def eddf6aef976e2c1a56c0accc3244945e0b22ec6799074c40be160e5a9a5662b0 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac -F autoconf/Makefile.in 0c71fcc6b2bd1703799a8e5b8f137ba64aad9bdee43c3cc23598cd0d6ce95715 +F autoconf/Makefile.in 40106236dd97053cbeed7f47880375fb402c89f6dc7b8effe363c791f8ef3ca3 F autoconf/Makefile.msc 4f09fead3bf7de337242896f107c5d03cd8f7b39754315ab091a2e4d02892c40 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 @@ -702,7 +702,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk a127ee141eb7db341d0c949a743a45d1b068b31ac3f1f09cf3b2870b2f18739f +F main.mk 840f0b3ac055a026930e52eb9d6300753e91ddd9fcbafe30395201908ad35e61 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 01b9ed73ca6e72411dcf5a81f445c15c5bc42fa068fc7eca485ac72635b9d2fc -R 4a76560a1c5bc38f5777d5f7ba110253 +P 334ed723d0fc0b202f79a9746459181f637ca99c54864a4aa11629eecb4b8d0c +R 09a6356f5a88db966518edd4cb1e0940 U stephan -Z 15f10168d95dbdd3c940ff559a29ad5c +Z b289b7542f84beb5087c6c73ca65d385 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index db6cfe8045..5f6eb79423 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -334ed723d0fc0b202f79a9746459181f637ca99c54864a4aa11629eecb4b8d0c +d743410665df8ba962db6e1f245d929b005d0add77be95af3c3c7f87a1c758fb From 4a1c44eea7d9f3d444f9aa2b743edce2c3c42ad0 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 15 Feb 2025 16:24:05 +0000 Subject: [PATCH 25/54] Automate update of the library version number in autoconf/tea/configure.ac as part of the tool/mkautoconfamal.sh process, per /chat discussion. FossilOrigin-Name: be265559a334eda127862ae54edb58c46051f74445642daa84a9f61a81df1bac --- autoconf/Makefile.in | 1 + autoconf/tea/{configure.ac => configure.ac.in} | 2 +- manifest | 16 ++++++++-------- manifest.uuid | 2 +- tool/mkautoconfamal.sh | 14 ++++++++------ 5 files changed, 19 insertions(+), 16 deletions(-) rename autoconf/tea/{configure.ac => configure.ac.in} (99%) diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in index 65108ee5d0..d7cc0e946f 100644 --- a/autoconf/Makefile.in +++ b/autoconf/Makefile.in @@ -249,6 +249,7 @@ dist: rm -fr $(dist_name) mkdir -p $(dist_name) cp -rp $(DIST_FILES) $(dist_name)/. + rm -f $(dist_name)/tea/configure.ac.in tar czf $(dist_tarball) $(dist_name) rm -fr $(dist_name) ls -l $(dist_tarball) diff --git a/autoconf/tea/configure.ac b/autoconf/tea/configure.ac.in similarity index 99% rename from autoconf/tea/configure.ac rename to autoconf/tea/configure.ac.in index d3952707a2..a13a1e7615 100644 --- a/autoconf/tea/configure.ac +++ b/autoconf/tea/configure.ac.in @@ -19,7 +19,7 @@ dnl to configure the system for the local environment. # so that we create the export library with the dll. #----------------------------------------------------------------------- -AC_INIT([sqlite],[3.50.0]) +AC_INIT([sqlite],[@VERSION@]) #-------------------------------------------------------------------- # Call TEA_INIT as the first TEA_ macro to set up initial vars. diff --git a/manifest b/manifest index 9f60cfd2ce..5bc360dce6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C DLL\sinstallation\srules\sno\slonger\screate\sversioned\ssymlinks\son\splatforms\swhere\sthe\sDLL\sextension\sis\s'.dll'\s(cygwin,\smsys2,\setc.),\sas\ssuggested\sin\s[forum:28bb79638844c328|forum\spost\s28bb79638844c328]. -D 2025-02-15T16:12:28.303 +C Automate\supdate\sof\sthe\slibrary\sversion\snumber\sin\sautoconf/tea/configure.ac\sas\spart\sof\sthe\stool/mkautoconfamal.sh\sprocess,\sper\s/chat\sdiscussion. +D 2025-02-15T16:24:05.242 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -16,7 +16,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 F auto.def eddf6aef976e2c1a56c0accc3244945e0b22ec6799074c40be160e5a9a5662b0 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac -F autoconf/Makefile.in 40106236dd97053cbeed7f47880375fb402c89f6dc7b8effe363c791f8ef3ca3 +F autoconf/Makefile.in 5e5ab43450b27e7247a0066f0606c5471e72f935c59ac3ba40038e23ebce92d5 F autoconf/Makefile.msc 4f09fead3bf7de337242896f107c5d03cd8f7b39754315ab091a2e4d02892c40 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 @@ -24,7 +24,7 @@ F autoconf/auto.def 9af634c6d51fa4b82c9bb61b51249ca087f2cbe09c7c3c31f920759082a1 F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 -F autoconf/tea/configure.ac 830cb2af5a3888312d0fd88402c2509d551d60e4c03f0481006a07c78313ef12 +F autoconf/tea/configure.ac.in da18360dfdeac7414fa8deb549f3d65aeca0ae1150ff1a8b902019b39ce019a4 w autoconf/tea/configure.ac F autoconf/tea/doc/sqlite3.n e1fe45d4f5286ee3d0ccc877aca2a0def488e9bb F autoconf/tea/license.terms 13bd403c9610fd2b76ece0ab50c4c5eda933d523 F autoconf/tea/pkgIndex.tcl.in 55aec3c6d7e9a1de9b8d2fdc9c27fd055da3ac3a51b572195e2ae7300bcfd3a2 @@ -2142,7 +2142,7 @@ F tool/logest.c c34e5944318415de513d29a6098df247a9618c96d83c38d4abd88641fe46e669 F tool/max-limits.c cbb635fbb37ae4d05f240bfb5b5270bb63c54439 F tool/merge-test.tcl de76b62f2de2a92d4c1ca4f976bce0aea6899e0229e250479b229b2a1914b176 F tool/mkamalzip.tcl 8aa5ebe7973c8b8774062d34e15fea9815c4cc2ceea3a9b184695f005910876a -F tool/mkautoconfamal.sh 14d2144043c6455958012f92324f4ce7c90a261b5daa2f2c7509498468475f8d +F tool/mkautoconfamal.sh c5e65fa1c922f2e3b3e4f6cd0331ec7d84bdef085f32cb1c46673cdf95ec8090 F tool/mkccode.tcl 210159febe0ef0ecbc53c79833500663ceaba0115b2b374405818dc835b5f84b x F tool/mkctimec.tcl b57ab5c43cf6a46ba4030027da1cc73d7839e7b78da3b328545bc941bb62360b x F tool/mkkeywordhash.c 6b0be901c47f9ad42215fc995eb2f4384ac49213b1fba395102ec3e999acf559 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 334ed723d0fc0b202f79a9746459181f637ca99c54864a4aa11629eecb4b8d0c -R 09a6356f5a88db966518edd4cb1e0940 +P d743410665df8ba962db6e1f245d929b005d0add77be95af3c3c7f87a1c758fb +R f10f58ea0cc54a3a2f87d5e937cce9f5 U stephan -Z b289b7542f84beb5087c6c73ca65d385 +Z 7cd96ea5b5e041e12c38e608e87b6e81 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5f6eb79423..d8fe83f80f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d743410665df8ba962db6e1f245d929b005d0add77be95af3c3c7f87a1c758fb +be265559a334eda127862ae54edb58c46051f74445642daa84a9f61a81df1bac diff --git a/tool/mkautoconfamal.sh b/tool/mkautoconfamal.sh index c26ca47bf1..c26ac8c73c 100644 --- a/tool/mkautoconfamal.sh +++ b/tool/mkautoconfamal.sh @@ -25,10 +25,14 @@ VERSION=`cat $TOP/VERSION` HASH=`cut -c1-10 $TOP/manifest.uuid` DATETIME=`grep '^D' $TOP/manifest | tr -c -d '[0-9]' | cut -c1-12` -# Verify that the version number in the TEA autoconf file is correct. -# Fail with an error if not. +# Inject the current version into the TEA autoconf file. # -if grep $VERSION $TOP/autoconf/tea/configure.ac +sed -e "s/@VERSION@/$VERSION/" \ + < $TOP/autoconf/tea/configure.ac.in \ + > $TOP/autoconf/tea/configure.ac +# And then verify that that worked... +# +if grep $VERSION $TOP/autoconf/tea/configure.ac > /dev/null then echo "TEA version number ok" else echo "TEA version number mismatch. Should be $VERSION"; exit 1 fi @@ -91,10 +95,8 @@ cat < tea/generic/tclsqlite3.c EOF cat $TOP/src/tclsqlite.c >> tea/generic/tclsqlite3.c -sed "s/AC_INIT(\[sqlite\], .*)/AC_INIT([sqlite], [$VERSION])/" tea/configure.ac > tmp -mv tmp tea/configure.ac - cd tea +rm -f configure.ac.in autoconf rm -rf autom4te.cache From ac729894be0d60e9bf298b3c45611a4bf7b74b1c Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 15 Feb 2025 17:29:56 +0000 Subject: [PATCH 26/54] Remove tea version check from tool/srctree-check.tcl, as it's obsoleted by [be265559]. FossilOrigin-Name: 1860ea060bd373f49d0b5d41367409a4607e9a0a0cb606af99927af15de1e21e --- manifest | 14 +++++++------- manifest.uuid | 2 +- tool/srctree-check.tcl | 15 --------------- 3 files changed, 8 insertions(+), 23 deletions(-) diff --git a/manifest b/manifest index 5bc360dce6..2f7a6368f8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Automate\supdate\sof\sthe\slibrary\sversion\snumber\sin\sautoconf/tea/configure.ac\sas\spart\sof\sthe\stool/mkautoconfamal.sh\sprocess,\sper\s/chat\sdiscussion. -D 2025-02-15T16:24:05.242 +C Remove\stea\sversion\scheck\sfrom\stool/srctree-check.tcl,\sas\sit's\sobsoleted\sby\s[be265559]. +D 2025-02-15T17:29:56.489 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -24,7 +24,7 @@ F autoconf/auto.def 9af634c6d51fa4b82c9bb61b51249ca087f2cbe09c7c3c31f920759082a1 F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 -F autoconf/tea/configure.ac.in da18360dfdeac7414fa8deb549f3d65aeca0ae1150ff1a8b902019b39ce019a4 w autoconf/tea/configure.ac +F autoconf/tea/configure.ac.in da18360dfdeac7414fa8deb549f3d65aeca0ae1150ff1a8b902019b39ce019a4 F autoconf/tea/doc/sqlite3.n e1fe45d4f5286ee3d0ccc877aca2a0def488e9bb F autoconf/tea/license.terms 13bd403c9610fd2b76ece0ab50c4c5eda933d523 F autoconf/tea/pkgIndex.tcl.in 55aec3c6d7e9a1de9b8d2fdc9c27fd055da3ac3a51b572195e2ae7300bcfd3a2 @@ -2193,7 +2193,7 @@ F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaa F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848 F tool/src-verify.c d00f93263aa2fa6ba0cba0106d95458e6effb94fdb5fc634f56834f90c05bbb4 F tool/srcck1.c 371de5363b70154012955544f86fdee8f6e5326f -F tool/srctree-check.tcl 4e635aed7dd8198d2b212353823d4b10b380211bf9a8287921ec6b2b773ca097 +F tool/srctree-check.tcl fa4d82dd3e8a38d5cbce7d6ade8abef2f42b9eca0394484d521dc8d086739460 F tool/stack_usage.tcl f8e71b92cdb099a147dad572375595eae55eca43 F tool/stripccomments.c dfe9cc03cf87728ac9836be30763f8aa52b82caca0780b3d3f3572e4643b01d3 F tool/symbols-mingw.sh 4dbcea7e74768305384c9fd2ed2b41bbf9f0414d @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d743410665df8ba962db6e1f245d929b005d0add77be95af3c3c7f87a1c758fb -R f10f58ea0cc54a3a2f87d5e937cce9f5 +P be265559a334eda127862ae54edb58c46051f74445642daa84a9f61a81df1bac +R ec0de275110a891612615fec90c077b9 U stephan -Z 7cd96ea5b5e041e12c38e608e87b6e81 +Z db33573bd4969af02b51c5852b05ae57 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d8fe83f80f..99249bbdb0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -be265559a334eda127862ae54edb58c46051f74445642daa84a9f61a81df1bac +1860ea060bd373f49d0b5d41367409a4607e9a0a0cb606af99927af15de1e21e diff --git a/tool/srctree-check.tcl b/tool/srctree-check.tcl index b16bd924a0..921bb0976e 100644 --- a/tool/srctree-check.tcl +++ b/tool/srctree-check.tcl @@ -34,21 +34,6 @@ set TCLSH [info nameofexe] # set NERR 0 -######################### autoconf/tea/configure.ac ########################### - -set confac [readfile $ROOT/autoconf/tea/configure.ac] -set vers [readfile $ROOT/VERSION] -set pattern {AC_INIT([sqlite],[} -append pattern [string trim $vers] -append pattern {])} -if {[string first $pattern $confac]<=0} { - puts "ERROR: ./autoconf/tea/configure.ac does not agree with ./VERSION" - puts "...... Fix: manually edit ./autoconf/tea/configure.ac and put the" - puts "...... correct version number in AC_INIT()" - incr NERR -} -unset confac - ######################### autoconf/Makefile.msc ############################### set f1 [readfile $ROOT/autoconf/Makefile.msc] From f4fc2ee20311a0a5141726c71d318ab52001c974 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sun, 16 Feb 2025 10:57:25 +0000 Subject: [PATCH 27/54] Add a typecast to avoid 32-bit integer overflow in the concat_ws() function with an enormous separator values and many arguments. FossilOrigin-Name: 498e3f1cf57f164fbd8380e92bf91b9f26d6aa05d092fcd135d754abf1e5b1b5 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/func.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 2f7a6368f8..9f03427425 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\stea\sversion\scheck\sfrom\stool/srctree-check.tcl,\sas\sit's\sobsoleted\sby\s[be265559]. -D 2025-02-15T17:29:56.489 +C Add\sa\stypecast\sto\savoid\s32-bit\sinteger\soverflow\sin\sthe\sconcat_ws()\nfunction\swith\san\senormous\sseparator\svalues\sand\smany\sarguments. +D 2025-02-16T10:57:25.604 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -732,7 +732,7 @@ F src/delete.c 03a77ba20e54f0f42ebd8eddf15411ed6bdb06a2c472ac4b6b336521bf7cea42 F src/expr.c ca943270395374afc65256ce86cdb152a22fa6ff146895175833b89ba870e117 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c 928ed2517e8732113d2b9821aa37af639688d752f4ea9ac6e0e393d713eeb76f -F src/func.c b2fb33139972d7d65640b27ea962a49f1616265428001090cab39fcf270228e1 +F src/func.c 838bb4c02065daef6ef359cf294e6b6f95a73d4ff0159240a4710478bae80e1c F src/global.c a19e4b1ca1335f560e9560e590fc13081e21f670643367f99cb9e8f9dc7d615b F src/hash.c 73934a7f7ab1cb110614a9388cb516893b0cf5b7b69e4fd1a0780ac4ce166be7 F src/hash.h 46b92795a95bfefb210f52f0c316e9d7cdbcdd7e7fcfb0d8be796d3a5767cddf @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P be265559a334eda127862ae54edb58c46051f74445642daa84a9f61a81df1bac -R ec0de275110a891612615fec90c077b9 -U stephan -Z db33573bd4969af02b51c5852b05ae57 +P 1860ea060bd373f49d0b5d41367409a4607e9a0a0cb606af99927af15de1e21e +R a83683a53b87e7c1a91cc72d41480630 +U drh +Z e32688ad6baa8e44c1d5b0c7282d0615 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 99249bbdb0..f4fea86bdd 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1860ea060bd373f49d0b5d41367409a4607e9a0a0cb606af99927af15de1e21e +498e3f1cf57f164fbd8380e92bf91b9f26d6aa05d092fcd135d754abf1e5b1b5 diff --git a/src/func.c b/src/func.c index 52462b4682..222c9ac64a 100644 --- a/src/func.c +++ b/src/func.c @@ -1570,7 +1570,7 @@ static void concatFuncCore( for(i=0; i Date: Sun, 16 Feb 2025 13:13:19 +0000 Subject: [PATCH 28/54] API naming typo reported in [forum:416f2d8dec|forum post 416f2d8dec]. No functional changes. FossilOrigin-Name: 0cfb9e234e116741d01b65d0abf18210e495276319fb08ec6e40d3f2e698956d --- ext/jni/src/org/sqlite/jni/capi/CApi.java | 12 ++++++------ manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ext/jni/src/org/sqlite/jni/capi/CApi.java b/ext/jni/src/org/sqlite/jni/capi/CApi.java index b5d08306e2..3387282378 100644 --- a/ext/jni/src/org/sqlite/jni/capi/CApi.java +++ b/ext/jni/src/org/sqlite/jni/capi/CApi.java @@ -199,16 +199,16 @@ public final class CApi { } private static native sqlite3_backup sqlite3_backup_init( - @NotNull long ptrToDbDest, @NotNull String destTableName, - @NotNull long ptrToDbSrc, @NotNull String srcTableName + @NotNull long ptrToDbDest, @NotNull String destSchemaName, + @NotNull long ptrToDbSrc, @NotNull String srcSchemaName ); public static sqlite3_backup sqlite3_backup_init( - @NotNull sqlite3 dbDest, @NotNull String destTableName, - @NotNull sqlite3 dbSrc, @NotNull String srcTableName + @NotNull sqlite3 dbDest, @NotNull String destSchemaName, + @NotNull sqlite3 dbSrc, @NotNull String srcSchemaName ){ - return sqlite3_backup_init( dbDest.getNativePointer(), destTableName, - dbSrc.getNativePointer(), srcTableName ); + return sqlite3_backup_init( dbDest.getNativePointer(), destSchemaName, + dbSrc.getNativePointer(), srcSchemaName ); } private static native int sqlite3_backup_pagecount(@NotNull long ptrToBackup); diff --git a/manifest b/manifest index 9f03427425..aaf0236700 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\stypecast\sto\savoid\s32-bit\sinteger\soverflow\sin\sthe\sconcat_ws()\nfunction\swith\san\senormous\sseparator\svalues\sand\smany\sarguments. -D 2025-02-16T10:57:25.604 +C API\snaming\stypo\sreported\sin\s[forum:416f2d8dec|forum\spost\s416f2d8dec].\sNo\sfunctional\schanges. +D 2025-02-16T13:13:19.874 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -298,7 +298,7 @@ F ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java 0b72cdff61533b564d65b63 F ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java c045a5b47e02bb5f1af91973814a905f12048c428a3504fbc5266d1c1be3de5a F ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java 74cc4998a73d6563542ecb90804a3c4f4e828cb4bd69e61226d1a51f4646e759 F ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java 7b8e19810c42b0ad21a04b5d8c804b32ee5905d137148703f16a75b612c380ca -F ext/jni/src/org/sqlite/jni/capi/CApi.java 27bbd944ea8c147afd25b93f17dc397f3627611ebe2878944a32ffeffc98e99e +F ext/jni/src/org/sqlite/jni/capi/CApi.java 8620c652138b84af795fd65bc200028590f533407c093d4355f9524dc594c004 F ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java 57e2d275dcebe690b1fc1f3d34eb96879b2d7039bce30b563aee547bf45d8a8b F ext/jni/src/org/sqlite/jni/capi/CollationCallback.java e29bcfc540fdd343e2f5cca4d27235113f2886acb13380686756d5cabdfd065a F ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java 5bfa226a8e7a92e804fd52d6e42b4c7b875fa7a94f8e2c330af8cc244a8920ab @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 1860ea060bd373f49d0b5d41367409a4607e9a0a0cb606af99927af15de1e21e -R a83683a53b87e7c1a91cc72d41480630 -U drh -Z e32688ad6baa8e44c1d5b0c7282d0615 +P 498e3f1cf57f164fbd8380e92bf91b9f26d6aa05d092fcd135d754abf1e5b1b5 +R 4e1e370efca67eead8ee775d6ab0dd45 +U stephan +Z 1f778f59dd3029d05607c051f27c5963 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f4fea86bdd..274efd1e8c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -498e3f1cf57f164fbd8380e92bf91b9f26d6aa05d092fcd135d754abf1e5b1b5 +0cfb9e234e116741d01b65d0abf18210e495276319fb08ec6e40d3f2e698956d From 4b1c8362e756d44a6227b7054bb07b9d65a35374 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 16 Feb 2025 13:49:18 +0000 Subject: [PATCH 29/54] Update autoconf/Makefile.msc from tool/mkmsvcmin.tcl. FossilOrigin-Name: 9ffe94d2ea0b3679c3d2657e2c3b67f84c09e9bcbbe0a13c76d58858df367d1b --- autoconf/Makefile.msc | 2 +- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/autoconf/Makefile.msc b/autoconf/Makefile.msc index f891036a14..538cc43a4b 100644 --- a/autoconf/Makefile.msc +++ b/autoconf/Makefile.msc @@ -1088,5 +1088,5 @@ $(LIBRESOBJS): $(TOP)\sqlite3.rc rcver.vc $(SQLITE3H) clean: del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL del /Q *.bsc *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL - del /Q sqlite3.def tclsqlite3.def ctime.c 2>NUL + del /Q sqlite3.def tclsqlite3.def ctime.c pragma.h 2>NUL del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL diff --git a/manifest b/manifest index aaf0236700..afcb520cfa 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C API\snaming\stypo\sreported\sin\s[forum:416f2d8dec|forum\spost\s416f2d8dec].\sNo\sfunctional\schanges. -D 2025-02-16T13:13:19.874 +C Update\sautoconf/Makefile.msc\sfrom\stool/mkmsvcmin.tcl. +D 2025-02-16T13:49:18.989 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -17,7 +17,7 @@ F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821 F auto.def eddf6aef976e2c1a56c0accc3244945e0b22ec6799074c40be160e5a9a5662b0 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac F autoconf/Makefile.in 5e5ab43450b27e7247a0066f0606c5471e72f935c59ac3ba40038e23ebce92d5 -F autoconf/Makefile.msc 4f09fead3bf7de337242896f107c5d03cd8f7b39754315ab091a2e4d02892c40 +F autoconf/Makefile.msc 1249e425a24859c7b3f17575275247df9eec3bddc0d1d7e73941f1abdbb95a92 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 F autoconf/auto.def 9af634c6d51fa4b82c9bb61b51249ca087f2cbe09c7c3c31f920759082a1ffdb @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 498e3f1cf57f164fbd8380e92bf91b9f26d6aa05d092fcd135d754abf1e5b1b5 -R 4e1e370efca67eead8ee775d6ab0dd45 +P 0cfb9e234e116741d01b65d0abf18210e495276319fb08ec6e40d3f2e698956d +R 9c4f553142a0ea668666d37befbf6bf0 U stephan -Z 1f778f59dd3029d05607c051f27c5963 +Z 4091a24d92e7409613201f686c9db113 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 274efd1e8c..d99bcbb45f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0cfb9e234e116741d01b65d0abf18210e495276319fb08ec6e40d3f2e698956d +9ffe94d2ea0b3679c3d2657e2c3b67f84c09e9bcbbe0a13c76d58858df367d1b From c2d56ea4ea131ee09d0dbd09e96ba5d511d96ee0 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 16 Feb 2025 18:14:05 +0000 Subject: [PATCH 30/54] Re-add the --disable-static-shell configure feature to the autoconf bundle. It got lost in the autoconf-to-autosetup port, as reported in [forum:cc219ee7044|forum post cc219ee7044]. FossilOrigin-Name: 47e817f663468ce08dae4965b7ecacefb921a77398ec958b35bf5cedee767e24 --- autoconf/Makefile.in | 15 ++++++++++++--- autoconf/auto.def | 1 + autosetup/sqlite-config.tcl | 4 ++++ manifest | 16 ++++++++-------- manifest.uuid | 2 +- 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in index d7cc0e946f..b186f498b9 100644 --- a/autoconf/Makefile.in +++ b/autoconf/Makefile.in @@ -202,12 +202,21 @@ install-lib: install-lib-$(ENABLE_LIB_STATIC) install: install-lib -sqlite3$(T.exe): $(TOP)/shell.c $(TOP)/sqlite3.c +# Flags to link the shell app either directly against sqlite3.c +# (ENABLE_STATIC_SHELL==1) or libsqlite3.so (ENABLE_STATIC_SHELL==0). +# +ENABLE_STATIC_SHELL = @ENABLE_STATIC_SHELL@ +sqlite3-shell-link-flags.1 = $(TOP)/sqlite3.c $(LDFLAGS.libsqlite3) +sqlite3-shell-link-flags.0 = -L. -lsqlite3 $(LDFLAGS.zlib) +sqlite3-shell-deps.1 = $(TOP)/sqlite3.c +sqlite3-shell-deps.0 = $(libsqlite3.SO) +sqlite3$(T.exe): $(TOP)/shell.c $(sqlite3-shell-deps.$(ENABLE_STATIC_SHELL)) $(CC) -o $@ \ - $(TOP)/shell.c $(TOP)/sqlite3.c \ + $(TOP)/shell.c $(sqlite3-shell-link-flags.$(ENABLE_STATIC_SHELL)) \ -I. $(OPT_FEATURE_FLAGS) $(SHELL_OPT) \ $(CFLAGS) $(CFLAGS.readline) $(CFLAGS.icu) \ - $(LDFLAGS) $(LDFLAGS.libsqlite3) $(LDFLAGS.readline) + $(LDFLAGS) $(LDFLAGS.readline) + all: sqlite3$(T.exe) install-shell: sqlite3$(T.exe) $(install-dir.bin) diff --git a/autoconf/auto.def b/autoconf/auto.def index bb8710378f..099b52aff7 100644 --- a/autoconf/auto.def +++ b/autoconf/auto.def @@ -22,6 +22,7 @@ sqlite-handle-load-extension sqlite-handle-math sqlite-handle-icu +define ENABLE_STATIC_SHELL [opt-bool static-shell] define ENABLE_LIB_SHARED [opt-bool shared] define ENABLE_LIB_STATIC [opt-bool static] diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index ccb114868c..4416372951 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -259,6 +259,10 @@ proc sqlite-config-bootstrap {buildMode} { linemacros => {Enable #line macros in the amalgamation} dynlink-tools => {Dynamically link libsqlite3 to certain tools which normally statically embed it} } + {autoconf} { + # --disable-static-shell: https://sqlite.org/forum/forumpost/cc219ee704 + static-shell=1 => {Link the sqlite3 shell app against the DLL instead of embedding sqlite3.c} + } {*} { dump-defines=0 => {Dump autosetup defines to $::sqliteConfig(dump-defines-txt) (for build debugging)} } diff --git a/manifest b/manifest index afcb520cfa..8d78e7da63 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sautoconf/Makefile.msc\sfrom\stool/mkmsvcmin.tcl. -D 2025-02-16T13:49:18.989 +C Re-add\sthe\s--disable-static-shell\sconfigure\sfeature\sto\sthe\sautoconf\sbundle.\sIt\sgot\slost\sin\sthe\sautoconf-to-autosetup\sport,\sas\sreported\sin\s[forum:cc219ee7044|forum\spost\scc219ee7044]. +D 2025-02-16T18:14:05.950 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -16,11 +16,11 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 F auto.def eddf6aef976e2c1a56c0accc3244945e0b22ec6799074c40be160e5a9a5662b0 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac -F autoconf/Makefile.in 5e5ab43450b27e7247a0066f0606c5471e72f935c59ac3ba40038e23ebce92d5 +F autoconf/Makefile.in 491e16a002c19263af3aeba857ca4619d2e8ad8550f6c9cea89ba0385fdd4344 F autoconf/Makefile.msc 1249e425a24859c7b3f17575275247df9eec3bddc0d1d7e73941f1abdbb95a92 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 -F autoconf/auto.def 9af634c6d51fa4b82c9bb61b51249ca087f2cbe09c7c3c31f920759082a1ffdb +F autoconf/auto.def 3a318c4898024b35ed61a4876a42e3dcc313f93bd8486874d1ad498b88643d1a F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl 17b5417841c402dcf8f656749be6fcff651f3360c48afcdc01aad375fe414fec +F autosetup/sqlite-config.tcl 671b79027b162b9d945367d288cf82a9f6c7bd834c7b6812a24084f9ecf763ea F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 0cfb9e234e116741d01b65d0abf18210e495276319fb08ec6e40d3f2e698956d -R 9c4f553142a0ea668666d37befbf6bf0 +P 9ffe94d2ea0b3679c3d2657e2c3b67f84c09e9bcbbe0a13c76d58858df367d1b +R 98921f713d8fbfbddc4ac85a3af675c9 U stephan -Z 4091a24d92e7409613201f686c9db113 +Z e6ed162aea3b5e30451735f568dc1c13 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d99bcbb45f..dbd9d9bc69 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9ffe94d2ea0b3679c3d2657e2c3b67f84c09e9bcbbe0a13c76d58858df367d1b +47e817f663468ce08dae4965b7ecacefb921a77398ec958b35bf5cedee767e24 From 3cc3898e13e903e620f9e471313fc4f290dc5c14 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 16 Feb 2025 19:16:09 +0000 Subject: [PATCH 31/54] Internal reordering/re-grouping of some configure flags. No functional changes. FossilOrigin-Name: 0c085a5ab51d6ac793a147a865bd086b1a6a572932c251b38d3854e4ea802f8d --- autosetup/sqlite-config.tcl | 44 ++++++++++++++++++------------------- manifest | 12 +++++----- manifest.uuid | 2 +- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 4416372951..7d9a9ea84b 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -237,6 +237,28 @@ proc sqlite-config-bootstrap {buildMode} { } } + # Options primarily for downstream packagers/package maintainers + packaging { + {autoconf} { + # --disable-static-shell: https://sqlite.org/forum/forumpost/cc219ee704 + static-shell=1 => {Link the sqlite3 shell app against the DLL instead of embedding sqlite3.c} + } + {*} { + # soname: https://sqlite.org/src/forumpost/5a3b44f510df8ded + soname:=legacy + => {SONAME for libsqlite3.so. "none", or not using this flag, sets no + soname. "legacy" sets it to its historical value of + libsqlite3.so.0. A value matching the glob "libsqlite3.*" sets + it to that literal value. Any other value is assumed to be a + suffix which gets applied to "libsqlite3.so.", + e.g. --soname=9.10 equates to "libsqlite3.so.9.10".} + # out-implib: https://sqlite.org/forum/forumpost/0c7fc097b2 + out-implib=0 + => {Enable use of --out-implib linker flag to generate an + "import library" for the DLL} + } + } + # Options mostly for sqlite's own development developer { {*} { @@ -259,32 +281,10 @@ proc sqlite-config-bootstrap {buildMode} { linemacros => {Enable #line macros in the amalgamation} dynlink-tools => {Dynamically link libsqlite3 to certain tools which normally statically embed it} } - {autoconf} { - # --disable-static-shell: https://sqlite.org/forum/forumpost/cc219ee704 - static-shell=1 => {Link the sqlite3 shell app against the DLL instead of embedding sqlite3.c} - } {*} { dump-defines=0 => {Dump autosetup defines to $::sqliteConfig(dump-defines-txt) (for build debugging)} } } - - # Options specifically for downstream package maintainers - packaging { - {*} { - # soname: https://sqlite.org/src/forumpost/5a3b44f510df8ded - soname:=legacy - => {SONAME for libsqlite3.so. "none", or not using this flag, sets no - soname. "legacy" sets it to its historical value of - libsqlite3.so.0. A value matching the glob "libsqlite3.*" sets - it to that literal value. Any other value is assumed to be a - suffix which gets applied to "libsqlite3.so.", - e.g. --soname=9.10 equates to "libsqlite3.so.9.10".} - # out-implib: https://sqlite.org/forum/forumpost/0c7fc097b2 - out-implib=0 - => {Enable use of --out-implib linker flag to generate an - "import library" for the DLL} - } - } }; # $allOpts # Filter allOpts to create the set of [options] legal for this build diff --git a/manifest b/manifest index 8d78e7da63..1c68ce988d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Re-add\sthe\s--disable-static-shell\sconfigure\sfeature\sto\sthe\sautoconf\sbundle.\sIt\sgot\slost\sin\sthe\sautoconf-to-autosetup\sport,\sas\sreported\sin\s[forum:cc219ee7044|forum\spost\scc219ee7044]. -D 2025-02-16T18:14:05.950 +C Internal\sreordering/re-grouping\sof\ssome\sconfigure\sflags.\sNo\sfunctional\schanges. +D 2025-02-16T19:16:09.834 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl 671b79027b162b9d945367d288cf82a9f6c7bd834c7b6812a24084f9ecf763ea +F autosetup/sqlite-config.tcl e1d65cc632e1de94ff39618ac82b649f2062f674ca36dae78ab3573cab096761 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9ffe94d2ea0b3679c3d2657e2c3b67f84c09e9bcbbe0a13c76d58858df367d1b -R 98921f713d8fbfbddc4ac85a3af675c9 +P 47e817f663468ce08dae4965b7ecacefb921a77398ec958b35bf5cedee767e24 +R 969cb5a3f034581c276e9924fba081e4 U stephan -Z e6ed162aea3b5e30451735f568dc1c13 +Z e3597b532b91bea5961ce10f269dd158 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index dbd9d9bc69..70121ce06d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -47e817f663468ce08dae4965b7ecacefb921a77398ec958b35bf5cedee767e24 +0c085a5ab51d6ac793a147a865bd086b1a6a572932c251b38d3854e4ea802f8d From 59c64e086abcd938662c63a331683f34a39f696a Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 17 Feb 2025 10:58:23 +0000 Subject: [PATCH 32/54] Fix a typo (a missing ")") in a comment that is used to generate documentation. No changes to code. FossilOrigin-Name: ea21685658df8246551650666ff59945ac27271b10a675104cbadaf57d48595f --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/sqlite.h.in | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 1c68ce988d..836882a5fa 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Internal\sreordering/re-grouping\sof\ssome\sconfigure\sflags.\sNo\sfunctional\schanges. -D 2025-02-16T19:16:09.834 +C Fix\sa\stypo\s(a\smissing\s")")\sin\sa\scomment\sthat\sis\sused\sto\sgenerate\ndocumentation.\s\sNo\schanges\sto\scode. +D 2025-02-17T10:58:23.329 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -780,7 +780,7 @@ F src/resolve.c 626c24b258b111f75c22107aa5614ad89810df3026f5ca071116d3fe75925c75 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 57893cc8b099f231f7ed5b84faff14841f2aabb4776e32e17fae00aeae0a8993 F src/shell.c.in b377a59822f207106424f08aead37e78b609222e98f86f04cc8a03563ccf3237 -F src/sqlite.h.in d2902f13ace94d3d3609646bd6d12a2d7a4f6cbdf6a5a4097580ac305f54c3f0 +F src/sqlite.h.in 16e92876a50762b860e8855dadb3448880aaaa8da42b7b5a73d7a5afff54305e F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 F src/sqliteInt.h 8cbfef6c26efd539eb93011905f4d3ce7fdb77475d1280764d86f9e7954c464b @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 47e817f663468ce08dae4965b7ecacefb921a77398ec958b35bf5cedee767e24 -R 969cb5a3f034581c276e9924fba081e4 -U stephan -Z e3597b532b91bea5961ce10f269dd158 +P 0c085a5ab51d6ac793a147a865bd086b1a6a572932c251b38d3854e4ea802f8d +R b319f27049b560368bfb8eee14269c8c +U drh +Z 1ed7fde276b92255807656366cd0eace # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 70121ce06d..5c4a155602 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0c085a5ab51d6ac793a147a865bd086b1a6a572932c251b38d3854e4ea802f8d +ea21685658df8246551650666ff59945ac27271b10a675104cbadaf57d48595f diff --git a/src/sqlite.h.in b/src/sqlite.h.in index a9eb5fed72..52968a20c7 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -2239,7 +2239,7 @@ struct sqlite3_mem_methods { ** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two, ** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE ** should have a total of five parameters. -** ^The first argument (the third parameter to [sqlite3_db_config()] is a +** ^The first argument (the third parameter to [sqlite3_db_config()]) is a ** pointer to a memory buffer to use for lookaside memory. ** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb ** may be NULL in which case SQLite will allocate the From 56d2fd008b108109f489339f5fd55212bb50afd4 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 17 Feb 2025 14:16:49 +0000 Subject: [PATCH 33/54] Harden the SQLITE_DBCONFIG_LOOKASIDE interface against misuse, such as described in [forum:/forumpost/48f365daec|forum post 48f365daec]. Enhancements to the SQLITE_DBCONFIG_LOOKASIDE documentation. Test cases in TH3. FossilOrigin-Name: 1ec4c308c76c69fba031184254fc3340f07607cfbf8342b13713ab445563d377 --- manifest | 14 +++++------ manifest.uuid | 2 +- src/main.c | 42 ++++++++++++++++++++------------- src/sqlite.h.in | 62 +++++++++++++++++++++++++++++++++---------------- 4 files changed, 76 insertions(+), 44 deletions(-) diff --git a/manifest b/manifest index 836882a5fa..a4fe1e8034 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\stypo\s(a\smissing\s")")\sin\sa\scomment\sthat\sis\sused\sto\sgenerate\ndocumentation.\s\sNo\schanges\sto\scode. -D 2025-02-17T10:58:23.329 +C Harden\sthe\sSQLITE_DBCONFIG_LOOKASIDE\sinterface\sagainst\smisuse,\ssuch\sas\ndescribed\sin\s[forum:/forumpost/48f365daec|forum\spost\s48f365daec].\s\sEnhancements\nto\sthe\sSQLITE_DBCONFIG_LOOKASIDE\sdocumentation.\s\sTest\scases\sin\sTH3. +D 2025-02-17T14:16:49.747 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -742,7 +742,7 @@ F src/insert.c 05e04ef637cbc0dccb9a5c5d188a5a2608891e554c8ec17c7a71afe2cf896a06 F src/json.c 2663a0c7e574cb928de944720dcdcc11c931877d877549b8f1258a4002efd6f7 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 7432c944ff197046d67a1207790a1b13eec4548c85a9457eb0896bb3641dfb36 -F src/main.c b99d15d843f7a86adbec855de77b1656dde07359722ef63a9d9393678dbb58d1 +F src/main.c 2650f54f7c2aa2c53cc61b571bad9c7c32d60400e3f6a270bd444f5d76e03eb8 F src/malloc.c 410e570b30c26cc36e3372577df50f7a96ee3eed5b2b161c6b6b48773c650c5e F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2 @@ -780,7 +780,7 @@ F src/resolve.c 626c24b258b111f75c22107aa5614ad89810df3026f5ca071116d3fe75925c75 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 57893cc8b099f231f7ed5b84faff14841f2aabb4776e32e17fae00aeae0a8993 F src/shell.c.in b377a59822f207106424f08aead37e78b609222e98f86f04cc8a03563ccf3237 -F src/sqlite.h.in 16e92876a50762b860e8855dadb3448880aaaa8da42b7b5a73d7a5afff54305e +F src/sqlite.h.in 8d4486fb28a90de818ac1e8c6206ea458e7de6bd8e0dfa3d554494f155be8c01 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 F src/sqliteInt.h 8cbfef6c26efd539eb93011905f4d3ce7fdb77475d1280764d86f9e7954c464b @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 0c085a5ab51d6ac793a147a865bd086b1a6a572932c251b38d3854e4ea802f8d -R b319f27049b560368bfb8eee14269c8c +P ea21685658df8246551650666ff59945ac27271b10a675104cbadaf57d48595f +R 178cf752f8b81a96b68c7190d2092e4d U drh -Z 1ed7fde276b92255807656366cd0eace +Z b489b8d8bee8421d4edf281585fd7758 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5c4a155602..f2fb8fb0d3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ea21685658df8246551650666ff59945ac27271b10a675104cbadaf57d48595f +1ec4c308c76c69fba031184254fc3340f07607cfbf8342b13713ab445563d377 diff --git a/src/main.c b/src/main.c index 17d0cd434a..28a7216405 100644 --- a/src/main.c +++ b/src/main.c @@ -759,17 +759,22 @@ int sqlite3_config(int op, ...){ ** If lookaside is already active, return SQLITE_BUSY. ** ** The sz parameter is the number of bytes in each lookaside slot. -** The cnt parameter is the number of slots. If pStart is NULL the -** space for the lookaside memory is obtained from sqlite3_malloc(). -** If pStart is not NULL then it is sz*cnt bytes of memory to use for -** the lookaside memory. +** The cnt parameter is the number of slots. If pBuf is NULL the +** space for the lookaside memory is obtained from sqlite3_malloc() +** or similar. If pBuf is not NULL then it is sz*cnt bytes of memory +** to use for the lookaside memory. */ -static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){ +static int setupLookaside( + sqlite3 *db, /* Database connection being configured */ + void *pBuf, /* Memory to use for lookaside. May be NULL */ + int sz, /* Desired size of each lookaside memory slot */ + int cnt /* Number of slots to allocate */ +){ #ifndef SQLITE_OMIT_LOOKASIDE - void *pStart; - sqlite3_int64 szAlloc = sz*(sqlite3_int64)cnt; - int nBig; /* Number of full-size slots */ - int nSm; /* Number smaller LOOKASIDE_SMALL-byte slots */ + void *pStart; /* Start of the lookaside buffer */ + sqlite3_int64 szAlloc; /* Total space set aside for lookaside memory */ + int nBig; /* Number of full-size slots */ + int nSm; /* Number smaller LOOKASIDE_SMALL-byte slots */ if( sqlite3LookasideUsed(db,0)>0 ){ return SQLITE_BUSY; @@ -782,17 +787,22 @@ static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){ sqlite3_free(db->lookaside.pStart); } /* The size of a lookaside slot after ROUNDDOWN8 needs to be larger - ** than a pointer to be useful. + ** than a pointer and small enough to fit in a u16. */ - sz = ROUNDDOWN8(sz); /* IMP: R-33038-09382 */ + sz = ROUNDDOWN8(sz); if( sz<=(int)sizeof(LookasideSlot*) ) sz = 0; - if( cnt<0 ) cnt = 0; - if( sz==0 || cnt==0 ){ + if( sz>65528 ) sz = 65528; + /* Count must be at least 1 to be useful, but not so large as to use + ** more than 0x7fff0000 total bytes for lookaside. */ + if( cnt<1 ) cnt = 0; + if( sz>0 && cnt>(0x7fff0000/sz) ) cnt = 0x7fff0000/sz; + szAlloc = (i64)sz*(i64)cnt; + if( szAlloc==0 ){ sz = 0; pStart = 0; }else if( pBuf==0 ){ sqlite3BeginBenignMalloc(); - pStart = sqlite3Malloc( szAlloc ); /* IMP: R-61949-35727 */ + pStart = sqlite3Malloc( szAlloc ); sqlite3EndBenignMalloc(); if( pStart ) szAlloc = sqlite3MallocSize(pStart); }else{ @@ -801,10 +811,10 @@ static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){ #ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE if( sz>=LOOKASIDE_SMALL*3 ){ nBig = szAlloc/(3*LOOKASIDE_SMALL+sz); - nSm = (szAlloc - sz*nBig)/LOOKASIDE_SMALL; + nSm = (szAlloc - (i64)sz*(i64)nBig)/LOOKASIDE_SMALL; }else if( sz>=LOOKASIDE_SMALL*2 ){ nBig = szAlloc/(LOOKASIDE_SMALL+sz); - nSm = (szAlloc - sz*nBig)/LOOKASIDE_SMALL; + nSm = (szAlloc - (i64)sz*(i64)nBig)/LOOKASIDE_SMALL; }else #endif /* SQLITE_OMIT_TWOSIZE_LOOKASIDE */ if( sz>0 ){ diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 52968a20c7..43cc4962e9 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -1989,13 +1989,16 @@ struct sqlite3_mem_methods { ** ** [[SQLITE_CONFIG_LOOKASIDE]]
    SQLITE_CONFIG_LOOKASIDE
    **
    ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine -** the default size of lookaside memory on each [database connection]. +** the default size of [lookaside memory] on each [database connection]. ** The first argument is the -** size of each lookaside buffer slot and the second is the number of -** slots allocated to each database connection.)^ ^(SQLITE_CONFIG_LOOKASIDE -** sets the default lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE] -** option to [sqlite3_db_config()] can be used to change the lookaside -** configuration on individual connections.)^
    +** size of each lookaside buffer slot ("sz") and the second is the number of +** slots allocated to each database connection ("cnt").)^ +** ^(SQLITE_CONFIG_LOOKASIDE sets the default lookaside size. +** The [SQLITE_DBCONFIG_LOOKASIDE] option to [sqlite3_db_config()] can +** be used to change the lookaside configuration on individual connections.)^ +** The [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to change the +** default lookaside configuration at compile-time. +** ** ** [[SQLITE_CONFIG_PCACHE2]]
    SQLITE_CONFIG_PCACHE2
    **
    ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is @@ -2232,31 +2235,50 @@ struct sqlite3_mem_methods { ** [[SQLITE_DBCONFIG_LOOKASIDE]] **
    SQLITE_DBCONFIG_LOOKASIDE
    **
    The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the -** configuration of the lookaside memory allocator within a database +** configuration of the [lookaside memory allocator] within a database ** connection. ** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are not ** in the [DBCONFIG arguments|usual format]. ** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two, ** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE ** should have a total of five parameters. -** ^The first argument (the third parameter to [sqlite3_db_config()]) is a +**
      +**
    1. The first argument ("buf") is a ** pointer to a memory buffer to use for lookaside memory. -** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb -** may be NULL in which case SQLite will allocate the -** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the -** size of each lookaside buffer slot. ^The third argument is the number of -** slots. The size of the buffer in the first argument must be greater than -** or equal to the product of the second and third arguments. The buffer -** must be aligned to an 8-byte boundary. ^If the second argument to -** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally -** rounded down to the next smaller multiple of 8. ^(The lookaside memory +** The first argument may be NULL in which case SQLite will allocate the +** lookaside buffer itself using [sqlite3_malloc()]. +**

    2. The second argument ("sz") is the +** size of each lookaside buffer slot. Lookaside is disabled if "sz" +** is less than 8. The "sz" argument should be a multiple of 8 less than +** 65536. If "sz" does not meet this constraint, it is reduced in size until +** it does. +**

    3. The third argument ("cnt") is the number of slots. Lookaside is disabled +** if "cnt"is less than 1. The "cnt" value will be reduced, if necessary, so +** that the product of "sz" and "cnt" does not exceed 2,147,418,112. The "cnt" +** parameter is usually chosen so that the product of "sz" and "cnt" is less +** than 1,000,000. +**

    +**

    If the "buf" argument is not NULL, then it must +** point to a memory buffer with a size that is greater than +** or equal to the product of "sz" and "cnt". +** The buffer must be aligned to an 8-byte boundary. +** The lookaside memory ** configuration for a database connection can only be changed when that ** connection is not currently using lookaside memory, or in other words -** when the "current value" returned by -** [sqlite3_db_status](D,[SQLITE_DBSTATUS_LOOKASIDE_USED],...) is zero. +** when the value returned by [SQLITE_DBSTATUS_LOOKASIDE_USED] is zero. ** Any attempt to change the lookaside memory configuration when lookaside ** memory is in use leaves the configuration unchanged and returns -** [SQLITE_BUSY].)^

    +** [SQLITE_BUSY]. +** If the "buf" argument is NULL and an attempt +** to allocate memory based on "sz" and "cnt" fails, then +** lookaside is silently disabled. +**

    +** The [SQLITE_CONFIG_LOOKASIDE] configuration option can be used to set the +** default lookaside configuration at initialization. The +** [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to set the default lookaside +** configuration at compile-time. Typical values for lookaside are 1200 for +** "sz" and 40 to 100 for "cnt". +** ** ** [[SQLITE_DBCONFIG_ENABLE_FKEY]] **

    SQLITE_DBCONFIG_ENABLE_FKEY
    From f6757b305a57c7df59e7b8de134946c7d35b4914 Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 17 Feb 2025 16:04:21 +0000 Subject: [PATCH 34/54] Replace TEXE (legacy name) with T.exe (3.48+ name) in two places in makefiles. This fixes distclean of jimsh.exe in the canonical build in non-native Windows environments. FossilOrigin-Name: edb8a78c0238f085eefbf86aa7777528f36f3400d4ef096ffd6855cf3321a97b --- Makefile.in | 2 +- main.mk | 2 +- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Makefile.in b/Makefile.in index 59a62d0618..1ff791c8ab 100644 --- a/Makefile.in +++ b/Makefile.in @@ -147,7 +147,7 @@ T.cc.sqlite += -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite # shell command. # CFLAGS.jimsh = @CFLAGS_JIMSH@ -JIMSH = ./jimsh$(TEXE) +JIMSH = ./jimsh$(T.exe) # # $(B.tclsh) is documented in main.mk. diff --git a/main.mk b/main.mk index 00e519d216..6081fbdfd8 100644 --- a/main.mk +++ b/main.mk @@ -1708,7 +1708,7 @@ fuzztest: fuzzcheck$(T.exe) $(FUZZDATA) sessionfuzz$(T.exe) ./fuzzcheck$(T.exe) $(FUZZDATA) ./sessionfuzz$(T.exe) run $(TOP)/test/sessionfuzz-data1.db -valgrindfuzz: fuzzcheck$(TEXT) $(FUZZDATA) sessionfuzz$(T.exe) +valgrindfuzz: fuzzcheck$(T.exe) $(FUZZDATA) sessionfuzz$(T.exe) valgrind ./fuzzcheck$(T.exe) --cell-size-check --limit-mem 10M $(FUZZDATA) valgrind ./sessionfuzz$(T.exe) run $(TOP)/test/sessionfuzz-data1.db diff --git a/manifest b/manifest index a4fe1e8034..89d17bb2ce 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Harden\sthe\sSQLITE_DBCONFIG_LOOKASIDE\sinterface\sagainst\smisuse,\ssuch\sas\ndescribed\sin\s[forum:/forumpost/48f365daec|forum\spost\s48f365daec].\s\sEnhancements\nto\sthe\sSQLITE_DBCONFIG_LOOKASIDE\sdocumentation.\s\sTest\scases\sin\sTH3. -D 2025-02-17T14:16:49.747 +C Replace\sTEXE\s(legacy\sname)\swith\sT.exe\s(3.48+\sname)\sin\stwo\splaces\sin\smakefiles.\sThis\sfixes\sdistclean\sof\sjimsh.exe\sin\sthe\scanonical\sbuild\sin\snon-native\sWindows\senvironments. +D 2025-02-17T16:04:21.900 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d -F Makefile.in aa869faf7ca086f35c9b3e974fddc7fd65ed2dc45a246b1a94e6f9fdc99b0ed5 +F Makefile.in 80be2e281d4647ac15a5bac15d5d20fc76d1cfb3f3f6dc01d1a26e3346a5042a F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0 F Makefile.msc 50c656e096ae49ccf9e5e88b4995f0a155f231ebae5b6d185cc64ce99d728a83 F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159 @@ -702,7 +702,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk 840f0b3ac055a026930e52eb9d6300753e91ddd9fcbafe30395201908ad35e61 +F main.mk 323e71cd79e49c9e33d39b6558694a71c08973d9ac3ee4f211aa32e58bd876f5 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ea21685658df8246551650666ff59945ac27271b10a675104cbadaf57d48595f -R 178cf752f8b81a96b68c7190d2092e4d -U drh -Z b489b8d8bee8421d4edf281585fd7758 +P 1ec4c308c76c69fba031184254fc3340f07607cfbf8342b13713ab445563d377 +R 04096de493525d9bda4b4505f3bd6b4f +U stephan +Z fb1f31bb07ada248f4e4b04a26bc9aeb # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f2fb8fb0d3..1b2fe3d822 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1ec4c308c76c69fba031184254fc3340f07607cfbf8342b13713ab445563d377 +edb8a78c0238f085eefbf86aa7777528f36f3400d4ef096ffd6855cf3321a97b From ad5dcff53bfb93d0e2ce8165fc2d63f83edd4c79 Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 17 Feb 2025 16:14:15 +0000 Subject: [PATCH 35/54] Add two generated files to the distclean rules of the autoconf bundle. FossilOrigin-Name: b59d0ebb22e4ca2f3a7a73dd49a0c142dbca538cb1b4eafd35a78bac87c6c456 --- autoconf/Makefile.in | 2 +- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in index b186f498b9..d494e9d1e0 100644 --- a/autoconf/Makefile.in +++ b/autoconf/Makefile.in @@ -240,7 +240,7 @@ clean: rm -f $(libsqlite3.LIB) $(libsqlite3.SO) $(libsqlite3.SO).a distclean: clean - rm -f jimsh0$(T.exe) config.* sqlite3.pc + rm -f jimsh0$(T.exe) config.* sqlite3.pc sqlite_cfg.h Makefile DIST_FILES := \ README.txt VERSION \ diff --git a/manifest b/manifest index 89d17bb2ce..826c33b244 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Replace\sTEXE\s(legacy\sname)\swith\sT.exe\s(3.48+\sname)\sin\stwo\splaces\sin\smakefiles.\sThis\sfixes\sdistclean\sof\sjimsh.exe\sin\sthe\scanonical\sbuild\sin\snon-native\sWindows\senvironments. -D 2025-02-17T16:04:21.900 +C Add\stwo\sgenerated\sfiles\sto\sthe\sdistclean\srules\sof\sthe\sautoconf\sbundle. +D 2025-02-17T16:14:15.880 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -16,7 +16,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 F auto.def eddf6aef976e2c1a56c0accc3244945e0b22ec6799074c40be160e5a9a5662b0 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac -F autoconf/Makefile.in 491e16a002c19263af3aeba857ca4619d2e8ad8550f6c9cea89ba0385fdd4344 +F autoconf/Makefile.in 844bc155e1c02075821530b2b4d996ab3d162e647352bb6e2895f3d0e64ad988 F autoconf/Makefile.msc 1249e425a24859c7b3f17575275247df9eec3bddc0d1d7e73941f1abdbb95a92 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 1ec4c308c76c69fba031184254fc3340f07607cfbf8342b13713ab445563d377 -R 04096de493525d9bda4b4505f3bd6b4f +P edb8a78c0238f085eefbf86aa7777528f36f3400d4ef096ffd6855cf3321a97b +R 35984cc59a3a13710af92ec281a18a95 U stephan -Z fb1f31bb07ada248f4e4b04a26bc9aeb +Z b005a16738a1a2fa13fe8f4e242441b2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 1b2fe3d822..3431f51c49 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -edb8a78c0238f085eefbf86aa7777528f36f3400d4ef096ffd6855cf3321a97b +b59d0ebb22e4ca2f3a7a73dd49a0c142dbca538cb1b4eafd35a78bac87c6c456 From ef86b942b9ffbfc2086da7865effea3e7950c7a0 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 17 Feb 2025 17:33:14 +0000 Subject: [PATCH 36/54] Code changes that make it easier to prove that no 32-bit integer overflows happen during memory allocation. No problems fixed; this change is just to make future maintenance easier. FossilOrigin-Name: 215650a5a1d55bdbca9c92524804a1a54456a17f42a17e53747b21a6507506f5 --- manifest | 50 ++++++++++++++++++++++++------------------------- manifest.uuid | 2 +- src/analyze.c | 2 +- src/attach.c | 2 +- src/bitvec.c | 2 +- src/btree.c | 5 +++-- src/build.c | 24 ++++++++++++++++-------- src/expr.c | 2 +- src/func.c | 2 +- src/memdb.c | 4 ++-- src/os_win.c | 19 +++++++++---------- src/pager.c | 30 ++++++++++++++++------------- src/pcache1.c | 8 ++++---- src/printf.c | 2 +- src/sqliteInt.h | 8 ++++++++ src/vdbe.c | 10 +++++----- src/vdbeapi.c | 7 +++++-- src/vdbeaux.c | 5 +++-- src/vdbemem.c | 4 ++-- src/vdbesort.c | 6 ++++-- src/wal.c | 2 +- 21 files changed, 111 insertions(+), 85 deletions(-) diff --git a/manifest b/manifest index 826c33b244..1e1fb70b59 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\stwo\sgenerated\sfiles\sto\sthe\sdistclean\srules\sof\sthe\sautoconf\sbundle. -D 2025-02-17T16:14:15.880 +C Code\schanges\sthat\smake\sit\seasier\sto\sprove\sthat\sno\s32-bit\sinteger\soverflows\nhappen\sduring\smemory\sallocation.\s\sNo\sproblems\sfixed;\sthis\schange\sis\sjust\nto\smake\sfuture\smaintenance\seasier. +D 2025-02-17T17:33:14.937 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -713,26 +713,26 @@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b F sqlite3.1 acdff36db796e2d00225b911d3047d580cd136547298435426ce9d40347973cc F sqlite3.pc.in 0977c03a4da7c4204bd60e784a0efb8d51a190448aba78a4e973fe7192bdaf03 F src/alter.c 1751e231d8385067fa0d0145f0d461a092db6bd3d7edbfc3172db625aceccd9a -F src/analyze.c 0823d2edb3ce564157e9d62714cc729027933209b712e95fbabb23e47fff0aec -F src/attach.c 3a5cb9ee4aad6c5b22268287340a4f2f7b07959b7a522201be30fee23cd802e9 +F src/analyze.c 6d27b425a16817975e6a4f8501e531d13dd1bf4b53bff2329dbc1f301aeef82d +F src/attach.c c36d9d82811e2274bd06bf3b34459e36d8ae8a7f32efa5cbf3f890eef08a9987 F src/auth.c 54ab9c6c5803b47c0d45b76ce27eff22a03b4b1f767c5945a3a4eb13aa4c78dc F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523 -F src/bitvec.c 9eac5f42c11914d5ef00a75605bb205e934f435c579687f985f1f8b0995c8645 +F src/bitvec.c d64aa60cd5f2721ebd6c155b3ac5ff7342086bead485239d57342cdfdccb9f50 F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522 -F src/btree.c 63ca6b647342e8cef643863cd0962a542f133e1069460725ba4461dcda92b03c +F src/btree.c 9316859aa5f14bde4a3719ffb1570219e51c5de433221e38b87ea19db868aedf F src/btree.h 18e5e7b2124c23426a283523e5f31a4bff029131b795bb82391f9d2f3136fc50 F src/btreeInt.h 98aadb6dcb77b012cab2574d6a728fad56b337fc946839b9898c4b4c969e30b6 -F src/build.c 602fc45ea6301a3dc03ec20a9f9b294c492b7e1766ae96651f2ba8044dc445a6 +F src/build.c 2fa35745a279e2a17eec6df67a3cd35d456c136a7f5c75e80bdd6c5658423b60 F src/callback.c acae8c8dddda41ee85cfdf19b926eefe830f371069f8aadca3aa39adf5b1c859 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/date.c 842c08ac143a56a627b05ac51d68624f2b7b03e3b4cba596205e735eed64ee57 F src/dbpage.c 2e677acb658a29965e55398bbc61161cb7819da538057c8032adac7ab8e4a8c0 F src/dbstat.c 73362c0df0f40ad5523a6f5501224959d0976757b511299bf892313e79d14f5c F src/delete.c 03a77ba20e54f0f42ebd8eddf15411ed6bdb06a2c472ac4b6b336521bf7cea42 -F src/expr.c ca943270395374afc65256ce86cdb152a22fa6ff146895175833b89ba870e117 +F src/expr.c 6e0635f3e3761f368d10e77d26d29a1a521ab208f1be66e84c13354ffbcf5ad2 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c 928ed2517e8732113d2b9821aa37af639688d752f4ea9ac6e0e393d713eeb76f -F src/func.c 838bb4c02065daef6ef359cf294e6b6f95a73d4ff0159240a4710478bae80e1c +F src/func.c 6c8b7bbdc5b588f3cfc79ed5effcfd3031758f5034c464fcd8891e8010b4d317 F src/global.c a19e4b1ca1335f560e9560e590fc13081e21f670643367f99cb9e8f9dc7d615b F src/hash.c 73934a7f7ab1cb110614a9388cb516893b0cf5b7b69e4fd1a0780ac4ce166be7 F src/hash.h 46b92795a95bfefb210f52f0c316e9d7cdbcdd7e7fcfb0d8be796d3a5767cddf @@ -749,7 +749,7 @@ F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2 F src/mem2.c c8bfc9446fd0798bddd495eb5d9dbafa7d4b7287d8c22d50a83ac9daa26d8a75 F src/mem3.c 30301196cace2a085cbedee1326a49f4b26deff0af68774ca82c1f7c06fda4f6 F src/mem5.c b7da5c10a726aacacc9ad7cdcb0667deec643e117591cc69cf9b4b9e7f3e96ff -F src/memdb.c 16679def118b5fd75292a253166d3feba3ec9c6189205bf209643ecdb2174ecc +F src/memdb.c a3feb427cdd4036ea2db0ba56d152f14c8212ca760ccb05fb7aa49ff6b897df3 F src/memjournal.c c283c6c95d940eb9dc70f1863eef3ee40382dbd35e5a1108026e7817c206e8a0 F src/msvc.h 80b35f95d93bf996ccb3e498535255f2ef1118c78764719a7cd15ab4106ccac9 F src/mutex.c 06bcd9c3dbf2d9b21fcd182606c00fafb9bfe0287983c8e17acd13d2c81a2fa9 @@ -764,17 +764,17 @@ F src/os_common.h 6c0eb8dd40ef3e12fe585a13e709710267a258e2c8dd1c40b1948a1d14582e F src/os_kv.c 4d39e1f1c180b11162c6dc4aa8ad34053873a639bac6baae23272fc03349986a F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d872107 F src/os_unix.c 4c73f89479d90412cb736a180e9ef89ac1495a158753a7f5de1260c197bc8e1f -F src/os_win.c 49c7725b500f5867e8360e75eeb30f9d70b62fa1f05c8a101da627210578df32 +F src/os_win.c 2423a45e70c2cda01bfc84106f7e9f34feb1add42121ab2e35a67ba24589ac52 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a -F src/pager.c 3a1c4e7f69af482e33c8cba8a75afe0dda0ea6391240adac22b040ce1bdeef44 +F src/pager.c 8d73e7a0ebbecd8bb4996ff285cc055cec56b7e3edb5a4609d0748e0fa39d28a F src/pager.h 6137149346e6c8a3ddc1eeb40aee46381e9bc8b0fcc6dda8a1efde993c2275b8 F src/parse.y f84673f1454e2bcf517623d4346e67fb2d73e57826ea103681ad5848238f6029 F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484 F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5 -F src/pcache1.c 49516ad7718a3626f28f710fa7448ef1fce3c07fd169acbb4817341950264319 +F src/pcache1.c 78d4935e510f7bed0fdd1a3f742c0e663b36a795f9dc7411161dc22bdae1245e F src/pragma.c c7ada272232e1182c4536d9637fa7b955a10bc1bd8d5a87d4dc9309dab827791 F src/prepare.c 1832be043fce7d489959aae6f994c452d023914714c4d5457beaed51c0f3d126 -F src/printf.c 96f7f8baeedc7639da94e4e7a4a2c200e2537c4eec9e5e1c2ffc821f40eb3105 +F src/printf.c b9ac740dfaf68552f5da1266be28ae2824b53a6b73d93425f7c6b2ef62457cbb F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 626c24b258b111f75c22107aa5614ad89810df3026f5ca071116d3fe75925c75 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 @@ -783,7 +783,7 @@ F src/shell.c.in b377a59822f207106424f08aead37e78b609222e98f86f04cc8a03563ccf323 F src/sqlite.h.in 8d4486fb28a90de818ac1e8c6206ea458e7de6bd8e0dfa3d554494f155be8c01 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 -F src/sqliteInt.h 8cbfef6c26efd539eb93011905f4d3ce7fdb77475d1280764d86f9e7954c464b +F src/sqliteInt.h 020aff180111b7dfe5bbdf8e59e8595c195b956488e9ca955f876cb7482e6de5 F src/sqliteLimit.h 1bbdbf72bd0411d003267ffebc59a262f061df5653027a75627d03f48ca30523 F src/status.c cb11f8589a6912af2da3bb1ec509a94dd8ef27df4d4c1a97e0bcf2309ece972b F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 @@ -847,19 +847,19 @@ F src/upsert.c 215328c3f91623c520ec8672c44323553f12caeb4f01b1090ebdca99fdf7b4f1 F src/utf.c 8b29d9a5956569ea2700f869669b8ef67a9662ee5e724ff77ab3c387e27094ba F src/util.c 9ff6470dabcf943fd796d2da766c98bd328c8f6fe036a31e5b338e628603f989 F src/vacuum.c b763b6457bd058d2072ef9364832351fd8d11e8abf70cbb349657360f7d55c40 -F src/vdbe.c 063763e08f1ad00890b7377fc663dbccec85a47630f5d2bbb13f3fdf77e06f78 +F src/vdbe.c e7567bed441a53c4ceb48d2bdf3d1747677fc296a91e8d2a0fe8facdb9b890ce F src/vdbe.h 3d26d5c7660c5c7bd33ffb0d8784615072d8b23c81f8110870efe2631136bc89 F src/vdbeInt.h 078b1c15b26587b54c1c1879d0d2f4dec812b9de4c337fed9faf73fbcc3bf091 -F src/vdbeapi.c 82fe278a7c71b653235c6f9fb5de0b5de589908dfcb011ba2a782e8becf06f86 -F src/vdbeaux.c 541d3d232714455960eab4ed10b34cb48b4bcd565d7539ef31092f5e73648e6b +F src/vdbeapi.c cb8eb9e41a16f5fa3ce5b8f3910edfbba336d10156cfb7a79f92cf7bf443977b +F src/vdbeaux.c d7ef1a0a7233589d789eda1ba9ffa4b0ea61fca9651e4f47fb4250d03d62bcaf F src/vdbeblob.c 9166b6eb7054e5da82e35255892fb1ed551355a4716452539e8e3ac14f25fbe3 -F src/vdbemem.c 4af21a948820259ced96e3d46d70f9af347afa2deb7cb60a8b3981d5748e4279 -F src/vdbesort.c d0a3c7056c081703c8b6d91ad60f17da5e062a5c64bf568ed0fa1b5f4cae311f +F src/vdbemem.c 571ae3116dbf840a62c4aaa6bc09d577dfef8ad4d3978cf37275bb5f9653217b +F src/vdbesort.c 3e8e6340ec5f68909a975031081102471300eaec9791d081b5443822e1061cda F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823 F src/vdbevtab.c fc46b9cbd759dc013f0b3724549cc0d71379183c667df3a5988f7e2f1bd485f3 F src/vtab.c 828221bdbeaaa6d62126ee6d07fd4ec0d09dcaea846f87ad01944d8b7e548859 F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 -F src/wal.c 4e6181d8780ab0af2e1388d0754cbe6f2f04593d2b1ab6c41699a89942fd8997 +F src/wal.c cefdffc112c767c79596d9c0d15cb4de27071132e9b8a0fce323b140cd4af683 F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452 F src/walker.c d5006d6b005e4ea7302ad390957a8d41ed83faa177e412f89bc5600a7462a014 F src/where.c 09dc313e7223ca1217c39c7026b00f16ff449a8323511a762fcba7863a00f4cd @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P edb8a78c0238f085eefbf86aa7777528f36f3400d4ef096ffd6855cf3321a97b -R 35984cc59a3a13710af92ec281a18a95 -U stephan -Z b005a16738a1a2fa13fe8f4e242441b2 +P b59d0ebb22e4ca2f3a7a73dd49a0c142dbca538cb1b4eafd35a78bac87c6c456 +R a324a0ad4ec5bff22beea8348186f31d +U drh +Z e55663a48a3fa77210e8f8e7032e8f31 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 3431f51c49..cab7456372 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b59d0ebb22e4ca2f3a7a73dd49a0c142dbca538cb1b4eafd35a78bac87c6c456 +215650a5a1d55bdbca9c92524804a1a54456a17f42a17e53747b21a6507506f5 diff --git a/src/analyze.c b/src/analyze.c index 799d43924c..58cea90caa 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -407,7 +407,7 @@ static void statInit( int nCol; /* Number of columns in index being sampled */ int nKeyCol; /* Number of key columns */ int nColUp; /* nCol rounded up for alignment */ - int n; /* Bytes of space to allocate */ + i64 n; /* Bytes of space to allocate */ sqlite3 *db = sqlite3_context_db_handle(context); /* Database connection */ #ifdef SQLITE_ENABLE_STAT4 /* Maximum number of samples. 0 if STAT4 data is not collected */ diff --git a/src/attach.c b/src/attach.c index 399a6cb537..f6c224710d 100644 --- a/src/attach.c +++ b/src/attach.c @@ -156,7 +156,7 @@ static void attachFunc( if( aNew==0 ) return; memcpy(aNew, db->aDb, sizeof(db->aDb[0])*2); }else{ - aNew = sqlite3DbRealloc(db, db->aDb, sizeof(db->aDb[0])*(db->nDb+1) ); + aNew = sqlite3DbRealloc(db, db->aDb, sizeof(db->aDb[0])*(1+(i64)db->nDb)); if( aNew==0 ) return; } db->aDb = aNew; diff --git a/src/bitvec.c b/src/bitvec.c index 13f87d5676..32bfade115 100644 --- a/src/bitvec.c +++ b/src/bitvec.c @@ -344,7 +344,7 @@ int sqlite3BitvecBuiltinTest(int sz, int *aOp){ /* Allocate the Bitvec to be tested and a linear array of ** bits to act as the reference */ pBitvec = sqlite3BitvecCreate( sz ); - pV = sqlite3MallocZero( (sz+7)/8 + 1 ); + pV = sqlite3MallocZero( (7+(i64)sz)/8 + 1 ); pTmpSpace = sqlite3_malloc64(BITVEC_SZ); if( pBitvec==0 || pV==0 || pTmpSpace==0 ) goto bitvec_end; diff --git a/src/btree.c b/src/btree.c index 49eb1d8037..97fbdf8d21 100644 --- a/src/btree.c +++ b/src/btree.c @@ -729,7 +729,7 @@ static int saveCursorKey(BtCursor *pCur){ ** below. */ void *pKey; pCur->nKey = sqlite3BtreePayloadSize(pCur); - pKey = sqlite3Malloc( pCur->nKey + 9 + 8 ); + pKey = sqlite3Malloc( ((i64)pCur->nKey) + 9 + 8 ); if( pKey ){ rc = sqlite3BtreePayload(pCur, 0, (int)pCur->nKey, pKey); if( rc==SQLITE_OK ){ @@ -6100,7 +6100,7 @@ bypass_moveto_root: rc = SQLITE_CORRUPT_PAGE(pPage); goto moveto_index_finish; } - pCellKey = sqlite3Malloc( nCell+nOverrun ); + pCellKey = sqlite3Malloc( (u64)nCell+(u64)nOverrun ); if( pCellKey==0 ){ rc = SQLITE_NOMEM_BKPT; goto moveto_index_finish; @@ -11289,6 +11289,7 @@ int sqlite3BtreeIsInBackup(Btree *p){ */ void *sqlite3BtreeSchema(Btree *p, int nBytes, void(*xFree)(void *)){ BtShared *pBt = p->pBt; + assert( nBytes==0 || nBytes==sizeof(Schema) ); sqlite3BtreeEnter(p); if( !pBt->pSchema && nBytes ){ pBt->pSchema = sqlite3DbMallocZero(0, nBytes); diff --git a/src/build.c b/src/build.c index 8f64d5ec30..986201bfb4 100644 --- a/src/build.c +++ b/src/build.c @@ -68,6 +68,7 @@ static SQLITE_NOINLINE void lockTable( } } + assert( pToplevel->nTableLock < 0x7fff0000 ); nBytes = sizeof(TableLock) * (pToplevel->nTableLock+1); pToplevel->aTableLock = sqlite3DbReallocOrFree(pToplevel->db, pToplevel->aTableLock, nBytes); @@ -2089,7 +2090,8 @@ static void identPut(char *z, int *pIdx, char *zSignedIdent){ ** from sqliteMalloc() and must be freed by the calling function. */ static char *createTableStmt(sqlite3 *db, Table *p){ - int i, k, n; + int i, k, len; + i64 n; char *zStmt; char *zSep, *zSep2, *zEnd; Column *pCol; @@ -2113,8 +2115,9 @@ static char *createTableStmt(sqlite3 *db, Table *p){ sqlite3OomFault(db); return 0; } - sqlite3_snprintf(n, zStmt, "CREATE TABLE "); - k = sqlite3Strlen30(zStmt); + assert( n>14 && n<=0x7fffffff ); + memcpy(zStmt, "CREATE TABLE ", 13); + k = 13; identPut(zStmt, &k, p->zName); zStmt[k++] = '('; for(pCol=p->aCol, i=0; inCol; i++, pCol++){ @@ -2126,13 +2129,15 @@ static char *createTableStmt(sqlite3 *db, Table *p){ /* SQLITE_AFF_REAL */ " REAL", /* SQLITE_AFF_FLEXNUM */ " NUM", }; - int len; const char *zType; - sqlite3_snprintf(n-k, &zStmt[k], zSep); - k += sqlite3Strlen30(&zStmt[k]); + len = sqlite3Strlen30(zSep); + assert( k+lenzCnName); + assert( kaffinity-SQLITE_AFF_BLOB >= 0 ); assert( pCol->affinity-SQLITE_AFF_BLOB < ArraySize(azType) ); testcase( pCol->affinity==SQLITE_AFF_BLOB ); @@ -2147,11 +2152,14 @@ static char *createTableStmt(sqlite3 *db, Table *p){ assert( pCol->affinity==SQLITE_AFF_BLOB || pCol->affinity==SQLITE_AFF_FLEXNUM || pCol->affinity==sqlite3AffinityType(zType, 0) ); + assert( k+lenop==TK_IN ); - zRet = sqlite3DbMallocRaw(pParse->db, nVal+1); + zRet = sqlite3DbMallocRaw(pParse->db, 1+(i64)nVal); if( zRet ){ int i; for(i=0; izPath); - pNew = sqlite3MallocZero( sizeof(*pShmNode) + nName + 17 ); + pNew = sqlite3MallocZero( sizeof(*pShmNode) + (i64)nName + 17 ); if( pNew==0 ){ sqlite3_free(p); return SQLITE_IOERR_NOMEM_BKPT; @@ -4759,7 +4759,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){ size_t i, j; DWORD pid; int nPre = sqlite3Strlen30(SQLITE_TEMP_FILE_PREFIX); - int nMax, nBuf, nDir, nLen; + i64 nMax, nBuf, nDir, nLen; char *zBuf; /* It's odd to simulate an io-error here, but really this is just @@ -4771,7 +4771,8 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){ /* Allocate a temporary buffer to store the fully qualified file ** name for the temporary file. If this fails, we cannot continue. */ - nMax = pVfs->mxPathname; nBuf = nMax + 2; + nMax = pVfs->mxPathname; + nBuf = 2 + (i64)nMax; zBuf = sqlite3MallocZero( nBuf ); if( !zBuf ){ OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); @@ -5630,7 +5631,7 @@ static int winFullPathnameNoMutex( ** for converting the relative path name to an absolute ** one by prepending the data directory and a slash. */ - char *zOut = sqlite3MallocZero( pVfs->mxPathname+1 ); + char *zOut = sqlite3MallocZero( 1+(u64)pVfs->mxPathname ); if( !zOut ){ return SQLITE_IOERR_NOMEM_BKPT; } @@ -5725,13 +5726,12 @@ static int winFullPathnameNoMutex( return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(), "winFullPathname1", zRelative); } - nByte += 3; - zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) ); + zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) + 3*sizeof(zTemp[0]) ); if( zTemp==0 ){ sqlite3_free(zConverted); return SQLITE_IOERR_NOMEM_BKPT; } - nByte = osGetFullPathNameW((LPCWSTR)zConverted, nByte, zTemp, 0); + nByte = osGetFullPathNameW((LPCWSTR)zConverted, nByte+3, zTemp, 0); if( nByte==0 ){ sqlite3_free(zConverted); sqlite3_free(zTemp); @@ -5751,13 +5751,12 @@ static int winFullPathnameNoMutex( return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(), "winFullPathname3", zRelative); } - nByte += 3; - zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) ); + zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) + 3*sizeof(zTemp[0]) ); if( zTemp==0 ){ sqlite3_free(zConverted); return SQLITE_IOERR_NOMEM_BKPT; } - nByte = osGetFullPathNameA((char*)zConverted, nByte, zTemp, 0); + nByte = osGetFullPathNameA((char*)zConverted, nByte+3, zTemp, 0); if( nByte==0 ){ sqlite3_free(zConverted); sqlite3_free(zTemp); diff --git a/src/pager.c b/src/pager.c index ecec892b45..5d279001e7 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1291,7 +1291,7 @@ static void checkPage(PgHdr *pPg){ ** If an error occurs while reading from the journal file, an SQLite ** error code is returned. */ -static int readSuperJournal(sqlite3_file *pJrnl, char *zSuper, u32 nSuper){ +static int readSuperJournal(sqlite3_file *pJrnl, char *zSuper, u64 nSuper){ int rc; /* Return code */ u32 len; /* Length in bytes of super-journal name */ i64 szJ; /* Total size in bytes of journal file pJrnl */ @@ -2527,12 +2527,12 @@ static int pager_delsuper(Pager *pPager, const char *zSuper){ char *zJournal; /* Pointer to one journal within MJ file */ char *zSuperPtr; /* Space to hold super-journal filename */ char *zFree = 0; /* Free this buffer */ - int nSuperPtr; /* Amount of space allocated to zSuperPtr[] */ + i64 nSuperPtr; /* Amount of space allocated to zSuperPtr[] */ /* Allocate space for both the pJournal and pSuper file descriptors. ** If successful, open the super-journal file for reading. */ - pSuper = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile * 2); + pSuper = (sqlite3_file *)sqlite3MallocZero(2 * (i64)pVfs->szOsFile); if( !pSuper ){ rc = SQLITE_NOMEM_BKPT; pJournal = 0; @@ -2550,11 +2550,14 @@ static int pager_delsuper(Pager *pPager, const char *zSuper){ */ rc = sqlite3OsFileSize(pSuper, &nSuperJournal); if( rc!=SQLITE_OK ) goto delsuper_out; - nSuperPtr = pVfs->mxPathname+1; + nSuperPtr = 1 + (i64)pVfs->mxPathname; + assert( nSuperJournal>=0 && nSuperPtr>0 ); zFree = sqlite3Malloc(4 + nSuperJournal + nSuperPtr + 2); if( !zFree ){ rc = SQLITE_NOMEM_BKPT; goto delsuper_out; + }else{ + assert( nSuperJournal<=0x7fffffff ); } zFree[0] = zFree[1] = zFree[2] = zFree[3] = 0; zSuperJournal = &zFree[4]; @@ -2815,7 +2818,7 @@ static int pager_playback(Pager *pPager, int isHot){ ** for pageSize. */ zSuper = pPager->pTmpSpace; - rc = readSuperJournal(pPager->jfd, zSuper, pPager->pVfs->mxPathname+1); + rc = readSuperJournal(pPager->jfd, zSuper, 1+(i64)pPager->pVfs->mxPathname); if( rc==SQLITE_OK && zSuper[0] ){ rc = sqlite3OsAccess(pVfs, zSuper, SQLITE_ACCESS_EXISTS, &res); } @@ -2954,7 +2957,7 @@ end_playback: ** which case it requires 4 0x00 bytes in memory immediately before ** the filename. */ zSuper = &pPager->pTmpSpace[4]; - rc = readSuperJournal(pPager->jfd, zSuper, pPager->pVfs->mxPathname+1); + rc = readSuperJournal(pPager->jfd, zSuper, 1+(i64)pPager->pVfs->mxPathname); testcase( rc!=SQLITE_OK ); } if( rc==SQLITE_OK @@ -4724,6 +4727,7 @@ int sqlite3PagerOpen( u32 szPageDflt = SQLITE_DEFAULT_PAGE_SIZE; /* Default page size */ const char *zUri = 0; /* URI args to copy */ int nUriByte = 1; /* Number of bytes of URI args at *zUri */ + /* Figure out how much space is required for each journal file-handle ** (there are two of them, the main journal and the sub-journal). */ @@ -4750,8 +4754,8 @@ int sqlite3PagerOpen( */ if( zFilename && zFilename[0] ){ const char *z; - nPathname = pVfs->mxPathname+1; - zPathname = sqlite3DbMallocRaw(0, nPathname*2); + nPathname = pVfs->mxPathname + 1; + zPathname = sqlite3DbMallocRaw(0, 2*(i64)nPathname); if( zPathname==0 ){ return SQLITE_NOMEM_BKPT; } @@ -4838,14 +4842,14 @@ int sqlite3PagerOpen( ROUND8(sizeof(*pPager)) + /* Pager structure */ ROUND8(pcacheSize) + /* PCache object */ ROUND8(pVfs->szOsFile) + /* The main db file */ - journalFileSize * 2 + /* The two journal files */ + (u64)journalFileSize * 2 + /* The two journal files */ SQLITE_PTRSIZE + /* Space to hold a pointer */ 4 + /* Database prefix */ - nPathname + 1 + /* database filename */ - nUriByte + /* query parameters */ - nPathname + 8 + 1 + /* Journal filename */ + (u64)nPathname + 1 + /* database filename */ + (u64)nUriByte + /* query parameters */ + (u64)nPathname + 8 + 1 + /* Journal filename */ #ifndef SQLITE_OMIT_WAL - nPathname + 4 + 1 + /* WAL filename */ + (u64)nPathname + 4 + 1 + /* WAL filename */ #endif 3 /* Terminator */ ); diff --git a/src/pcache1.c b/src/pcache1.c index a0a8c7e28c..88a7b3a0b4 100644 --- a/src/pcache1.c +++ b/src/pcache1.c @@ -538,12 +538,12 @@ static int pcache1UnderMemoryPressure(PCache1 *pCache){ */ static void pcache1ResizeHash(PCache1 *p){ PgHdr1 **apNew; - unsigned int nNew; - unsigned int i; + u64 nNew; + u32 i; assert( sqlite3_mutex_held(p->pGroup->mutex) ); - nNew = p->nHash*2; + nNew = 2*(u64)p->nHash; if( nNew<256 ){ nNew = 256; } @@ -766,7 +766,7 @@ static void pcache1Destroy(sqlite3_pcache *p); static sqlite3_pcache *pcache1Create(int szPage, int szExtra, int bPurgeable){ PCache1 *pCache; /* The newly created page cache */ PGroup *pGroup; /* The group the new page cache will belong to */ - int sz; /* Bytes of memory required to allocate the new cache */ + i64 sz; /* Bytes of memory required to allocate the new cache */ assert( (szPage & (szPage-1))==0 && szPage>=512 && szPage<=65536 ); assert( szExtra < 300 ); diff --git a/src/printf.c b/src/printf.c index 71363f91b4..97f93dc157 100644 --- a/src/printf.c +++ b/src/printf.c @@ -1057,7 +1057,7 @@ void sqlite3_str_appendall(sqlite3_str *p, const char *z){ static SQLITE_NOINLINE char *strAccumFinishRealloc(StrAccum *p){ char *zText; assert( p->mxAlloc>0 && !isMalloced(p) ); - zText = sqlite3DbMallocRaw(p->db, p->nChar+1 ); + zText = sqlite3DbMallocRaw(p->db, 1+(u64)p->nChar ); if( zText ){ memcpy(zText, p->zText, p->nChar+1); p->printfFlags |= SQLITE_PRINTF_MALLOCED; diff --git a/src/sqliteInt.h b/src/sqliteInt.h index c8ecaf8571..6ebd8eb4fe 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -1016,6 +1016,14 @@ typedef INT16_TYPE LogEst; #define LARGEST_UINT64 (0xffffffff|(((u64)0xffffffff)<<32)) #define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64) +/* +** Macro SMXV(n) return the maximum value that can be held in variable n, +** assuming n is a signed integer type. UMXV(n) is similar for unsigned +** integer types. +*/ +#define SMXV(n) ((((i64)1)<<(sizeof(n)-1))-1) +#define UMXV(n) ((((i64)1)<<(sizeof(n)))-1) + /* ** Round up a number to the next larger multiple of 8. This is used ** to force 8-byte alignment on 64-bit architectures. diff --git a/src/vdbe.c b/src/vdbe.c index 6d7769173f..b78a0aabf2 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -276,7 +276,7 @@ static VdbeCursor *allocateCursor( */ Mem *pMem = iCur>0 ? &p->aMem[p->nMem-iCur] : p->aMem; - int nByte; + i64 nByte; VdbeCursor *pCx = 0; nByte = ROUND8P(sizeof(VdbeCursor)) + 2*sizeof(u32)*nField + @@ -304,7 +304,7 @@ static VdbeCursor *allocateCursor( pMem->szMalloc = 0; return 0; } - pMem->szMalloc = nByte; + pMem->szMalloc = (int)nByte; } p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->zMalloc; @@ -7325,7 +7325,7 @@ case OP_RowSetTest: { /* jump, in1, in3 */ */ case OP_Program: { /* jump0 */ int nMem; /* Number of memory registers for sub-program */ - int nByte; /* Bytes of runtime space required for sub-program */ + i64 nByte; /* Bytes of runtime space required for sub-program */ Mem *pRt; /* Register to allocate runtime space */ Mem *pMem; /* Used to iterate through memory cells */ Mem *pEnd; /* Last memory cell in new array */ @@ -7376,7 +7376,7 @@ case OP_Program: { /* jump0 */ nByte = ROUND8(sizeof(VdbeFrame)) + nMem * sizeof(Mem) + pProgram->nCsr * sizeof(VdbeCursor*) - + (pProgram->nOp + 7)/8; + + (7 + (i64)pProgram->nOp)/8; pFrame = sqlite3DbMallocZero(db, nByte); if( !pFrame ){ goto no_mem; @@ -7384,7 +7384,7 @@ case OP_Program: { /* jump0 */ sqlite3VdbeMemRelease(pRt); pRt->flags = MEM_Blob|MEM_Dyn; pRt->z = (char*)pFrame; - pRt->n = nByte; + pRt->n = (int)nByte; pRt->xDel = sqlite3VdbeFrameMemDel; pFrame->v = p; diff --git a/src/vdbeapi.c b/src/vdbeapi.c index 0dc09d501e..31880d85b5 100644 --- a/src/vdbeapi.c +++ b/src/vdbeapi.c @@ -2233,7 +2233,9 @@ int sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppValue){ Column *pCol = &p->pTab->aCol[iIdx]; if( pCol->iDflt>0 ){ if( p->apDflt==0 ){ - int nByte = sizeof(sqlite3_value*)*p->pTab->nCol; + int nByte; + assert( sizeof(sqlite3_value*)*UMXV(p->pTab->nCol) < 0x7fffffff ); + nByte = sizeof(sqlite3_value*)*p->pTab->nCol; p->apDflt = (sqlite3_value**)sqlite3DbMallocZero(db, nByte); if( p->apDflt==0 ) goto preupdate_old_out; } @@ -2383,7 +2385,8 @@ int sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppValue){ */ assert( p->op==SQLITE_UPDATE ); if( !p->aNew ){ - p->aNew = (Mem *)sqlite3DbMallocZero(db, sizeof(Mem) * p->pCsr->nField); + assert( sizeof(Mem)*UMXV(p->pCsr->nField) < 0x7fffffff ); + p->aNew = (Mem *)sqlite3DbMallocZero(db, sizeof(Mem)*p->pCsr->nField); if( !p->aNew ){ rc = SQLITE_NOMEM; goto preupdate_new_out; diff --git a/src/vdbeaux.c b/src/vdbeaux.c index cf661eb9cb..6a8db6f394 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -726,7 +726,7 @@ static Op *opIterNext(VdbeOpIter *p){ } if( pRet->p4type==P4_SUBPROGRAM ){ - int nByte = (p->nSub+1)*sizeof(SubProgram*); + i64 nByte = (1+(u64)p->nSub)*sizeof(SubProgram*); int j; for(j=0; jnSub; j++){ if( p->apSub[j]==pRet->p4.pProgram ) break; @@ -1198,7 +1198,7 @@ void sqlite3VdbeScanStatus( const char *zName /* Name of table or index being scanned */ ){ if( IS_STMT_SCANSTATUS(p->db) ){ - sqlite3_int64 nByte = (p->nScan+1) * sizeof(ScanStatus); + i64 nByte = (1+(i64)p->nScan) * sizeof(ScanStatus); ScanStatus *aNew; aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte); if( aNew ){ @@ -4219,6 +4219,7 @@ UnpackedRecord *sqlite3VdbeAllocUnpackedRecord( ){ UnpackedRecord *p; /* Unpacked record to return */ int nByte; /* Number of bytes required for *p */ + assert( sizeof(UnpackedRecord) + sizeof(Mem)*65536 < 0x7fffffff ); nByte = ROUND8P(sizeof(UnpackedRecord)) + sizeof(Mem)*(pKeyInfo->nKeyField+1); p = (UnpackedRecord *)sqlite3DbMallocRaw(pKeyInfo->db, nByte); if( !p ) return 0; diff --git a/src/vdbemem.c b/src/vdbemem.c index 61298d10ff..8534849432 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -1440,7 +1440,7 @@ static sqlite3_value *valueNew(sqlite3 *db, struct ValueNewStat4Ctx *p){ if( pRec==0 ){ Index *pIdx = p->pIdx; /* Index being probed */ - int nByte; /* Bytes of space to allocate */ + i64 nByte; /* Bytes of space to allocate */ int i; /* Counter variable */ int nCol = pIdx->nColumn; /* Number of index columns including rowid */ @@ -1506,7 +1506,7 @@ static int valueFromFunction( ){ sqlite3_context ctx; /* Context object for function invocation */ sqlite3_value **apVal = 0; /* Function arguments */ - int nVal = 0; /* Size of apVal[] array */ + int nVal = 0; /* Number of function arguments */ FuncDef *pFunc = 0; /* Function definition */ sqlite3_value *pVal = 0; /* New value */ int rc = SQLITE_OK; /* Return code */ diff --git a/src/vdbesort.c b/src/vdbesort.c index 239c0a0f36..5774537b81 100644 --- a/src/vdbesort.c +++ b/src/vdbesort.c @@ -936,7 +936,7 @@ int sqlite3VdbeSorterInit( VdbeSorter *pSorter; /* The new sorter */ KeyInfo *pKeyInfo; /* Copy of pCsr->pKeyInfo with db==0 */ int szKeyInfo; /* Size of pCsr->pKeyInfo in bytes */ - int sz; /* Size of pSorter in bytes */ + i64 sz; /* Size of pSorter in bytes */ int rc = SQLITE_OK; #if SQLITE_MAX_WORKER_THREADS==0 # define nWorker 0 @@ -964,6 +964,8 @@ int sqlite3VdbeSorterInit( assert( pCsr->pKeyInfo ); assert( !pCsr->isEphemeral ); assert( pCsr->eCurType==CURTYPE_SORTER ); + assert( sizeof(KeyInfo) + UMXV(pCsr->pKeyInfo->nKeyField)*sizeof(CollSeq*) + < 0x7fffffff ); szKeyInfo = sizeof(KeyInfo) + (pCsr->pKeyInfo->nKeyField-1)*sizeof(CollSeq*); sz = sizeof(VdbeSorter) + nWorker * sizeof(SortSubtask); @@ -1177,7 +1179,7 @@ static int vdbeSorterJoinAll(VdbeSorter *pSorter, int rcin){ */ static MergeEngine *vdbeMergeEngineNew(int nReader){ int N = 2; /* Smallest power of two >= nReader */ - int nByte; /* Total bytes of space to allocate */ + i64 nByte; /* Total bytes of space to allocate */ MergeEngine *pNew; /* Pointer to allocated object to return */ assert( nReader<=SORTER_MAX_MERGE_COUNT ); diff --git a/src/wal.c b/src/wal.c index 42ce3cb97b..0b4510e179 100644 --- a/src/wal.c +++ b/src/wal.c @@ -753,7 +753,7 @@ static SQLITE_NOINLINE int walIndexPageRealloc( /* Enlarge the pWal->apWiData[] array if required */ if( pWal->nWiData<=iPage ){ - sqlite3_int64 nByte = sizeof(u32*)*(iPage+1); + sqlite3_int64 nByte = sizeof(u32*)*(1+(i64)iPage); volatile u32 **apNew; apNew = (volatile u32 **)sqlite3Realloc((void *)pWal->apWiData, nByte); if( !apNew ){ From 7bfa4452a3cc9b57d970938cbc642cb48024a2a7 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 17 Feb 2025 18:09:24 +0000 Subject: [PATCH 37/54] Additional changes making it easier to prove that integer overflow does not occur. No problems found. FossilOrigin-Name: e846743a875430a5c51d41f00ac9532214f97d9925e6261113b63580f92369fc --- ext/fts3/fts3.c | 2 +- ext/fts3/fts3_expr.c | 2 +- ext/fts5/fts5_index.c | 9 +++++---- ext/fts5/fts5_vocab.c | 6 +++--- manifest | 20 ++++++++++---------- manifest.uuid | 2 +- src/json.c | 7 ++++--- 7 files changed, 25 insertions(+), 23 deletions(-) diff --git a/ext/fts3/fts3.c b/ext/fts3/fts3.c index 2b2c3b8d26..d5db2a3dd1 100644 --- a/ext/fts3/fts3.c +++ b/ext/fts3/fts3.c @@ -4438,7 +4438,7 @@ static int fts3EvalDeferredPhrase(Fts3Cursor *pCsr, Fts3Phrase *pPhrase){ nDistance = iPrev - nMaxUndeferred; } - aOut = (char *)sqlite3Fts3MallocZero(nPoslist+FTS3_BUFFER_PADDING); + aOut = (char *)sqlite3Fts3MallocZero(((i64)nPoslist)+FTS3_BUFFER_PADDING); if( !aOut ){ sqlite3_free(aPoslist); return SQLITE_NOMEM; diff --git a/ext/fts3/fts3_expr.c b/ext/fts3/fts3_expr.c index 9e201b1684..ce4282dea5 100644 --- a/ext/fts3/fts3_expr.c +++ b/ext/fts3/fts3_expr.c @@ -283,7 +283,7 @@ static int getNextString( Fts3Expr *p = 0; sqlite3_tokenizer_cursor *pCursor = 0; char *zTemp = 0; - int nTemp = 0; + i64 nTemp = 0; const int nSpace = sizeof(Fts3Expr) + sizeof(Fts3Phrase); int nToken = 0; diff --git a/ext/fts5/fts5_index.c b/ext/fts5/fts5_index.c index f56aa82e8c..3ac5008502 100644 --- a/ext/fts5/fts5_index.c +++ b/ext/fts5/fts5_index.c @@ -5206,7 +5206,7 @@ static void fts5DoSecureDelete( int iDelKeyOff = 0; /* Offset of deleted key, if any */ nIdx = nPg-iPgIdx; - aIdx = sqlite3Fts5MallocZero(&p->rc, nIdx+16); + aIdx = sqlite3Fts5MallocZero(&p->rc, ((i64)nIdx)+16); if( p->rc ) return; memcpy(aIdx, &aPg[iPgIdx], nIdx); @@ -5800,7 +5800,7 @@ static Fts5Structure *fts5IndexOptimizeStruct( assert( pStruct->aLevel[i].nMerge<=nThis ); } - nByte += (pStruct->nLevel+1) * sizeof(Fts5StructureLevel); + nByte += (((i64)pStruct->nLevel)+1) * sizeof(Fts5StructureLevel); pNew = (Fts5Structure*)sqlite3Fts5MallocZero(&p->rc, nByte); if( pNew ){ @@ -6688,7 +6688,8 @@ static void fts5SetupPrefixIter( } } - pData = fts5IdxMalloc(p, sizeof(*pData)+s.doclist.n+FTS5_DATA_ZERO_PADDING); + pData = fts5IdxMalloc(p, sizeof(*pData) + + ((i64)s.doclist.n)+FTS5_DATA_ZERO_PADDING); assert( pData!=0 || p->rc!=SQLITE_OK ); if( pData ){ pData->p = (u8*)&pData[1]; @@ -8912,7 +8913,7 @@ static void fts5DecodeFunction( ** buffer overreads even if the record is corrupt. */ n = sqlite3_value_bytes(apVal[1]); aBlob = sqlite3_value_blob(apVal[1]); - nSpace = n + FTS5_DATA_ZERO_PADDING; + nSpace = ((i64)n) + FTS5_DATA_ZERO_PADDING; a = (u8*)sqlite3Fts5MallocZero(&rc, nSpace); if( a==0 ) goto decode_out; if( n>0 ) memcpy(a, aBlob, n); diff --git a/ext/fts5/fts5_vocab.c b/ext/fts5/fts5_vocab.c index fb280567f4..b157ab0d97 100644 --- a/ext/fts5/fts5_vocab.c +++ b/ext/fts5/fts5_vocab.c @@ -193,12 +193,12 @@ static int fts5VocabInitVtab( *pzErr = sqlite3_mprintf("wrong number of vtable arguments"); rc = SQLITE_ERROR; }else{ - int nByte; /* Bytes of space to allocate */ + i64 nByte; /* Bytes of space to allocate */ const char *zDb = bDb ? argv[3] : argv[1]; const char *zTab = bDb ? argv[4] : argv[3]; const char *zType = bDb ? argv[5] : argv[4]; - int nDb = (int)strlen(zDb)+1; - int nTab = (int)strlen(zTab)+1; + i64 nDb = strlen(zDb)+1; + i64 nTab = strlen(zTab)+1; int eType = 0; rc = fts5VocabTableType(zType, pzErr, &eType); diff --git a/manifest b/manifest index 1e1fb70b59..3d8c78ede6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Code\schanges\sthat\smake\sit\seasier\sto\sprove\sthat\sno\s32-bit\sinteger\soverflows\nhappen\sduring\smemory\sallocation.\s\sNo\sproblems\sfixed;\sthis\schange\sis\sjust\nto\smake\sfuture\smaintenance\seasier. -D 2025-02-17T17:33:14.937 +C Additional\schanges\smaking\sit\seasier\sto\sprove\sthat\sinteger\soverflow\sdoes\snot\noccur.\s\sNo\sproblems\sfound. +D 2025-02-17T18:09:24.766 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -78,11 +78,11 @@ F ext/fts3/README.content b9078d0843a094d86af0d48dffbff13c906702b4c3558012e67b9c F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a F ext/fts3/README.tokenizers b92bdeb8b46503f0dd301d364efc5ef59ef9fa8e2758b8e742f39fa93a2e422d F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d -F ext/fts3/fts3.c b840ee915a6fb36571e3fe3c096e8a481a4a9cd8a35199a1b976b132b9f84ad3 +F ext/fts3/fts3.c 1da0265e8798f335165d54959459eeb69b6d32f586f85cf8795ab5d3b1292dcb F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe F ext/fts3/fts3Int.h 2fe7c76dfd7d46dff964d17d3f4c53bca2116cf5d6252552ebbc22e38afdf4e0 F ext/fts3/fts3_aux.c 7eab82a9cf0830f6551ba3abfdbe73ed39e322a4d3940ee82fbf723674ecd9f3 -F ext/fts3/fts3_expr.c 365849a2a1185e19028a9db2d9f1ea63efe909a3a6aca7ec86fc26a13a60bd58 +F ext/fts3/fts3_expr.c ebf7f2adead8cc54bc91deb41cb4a156874003078116f76631d65b87ff47464d F ext/fts3/fts3_hash.c 8b6e31bfb0844c27dc6092c2620bdb1fca17ed613072db057d96952c6bdb48b7 F ext/fts3/fts3_hash.h 39cf6874dc239d6b4e30479b1975fe5b22a3caaf F ext/fts3/fts3_icu.c 305ce7fb6036484085b5556a9c8e62acdc7763f0f4cdf5fd538212a9f3720116 @@ -112,7 +112,7 @@ F ext/fts5/fts5_buffer.c 0eec58bff585f1a44ea9147eae5da2447292080ea435957f7488c70 F ext/fts5/fts5_config.c e7d8dd062b44a66cd77e5a0f74f23a2354cd1f3f8575afb967b2773c3384f7f8 F ext/fts5/fts5_expr.c 69b8d976058512c07dfe86e229521b7a871768157bd1607cedf1a5038dfd72c9 F ext/fts5/fts5_hash.c adda4272be401566a6e0ba1acbe70ee5cb97fce944bc2e04dc707152a0ec91b1 -F ext/fts5/fts5_index.c f1eec0931548b529ddd7ebd274eaef37de7461fe2b0ebdc9818f37324bdf9494 +F ext/fts5/fts5_index.c b7827b32e0e1e1ff7d7cb27c5d0480426a01c8ec4e89fd7e106bb463e2b63dd1 F ext/fts5/fts5_main.c 9a1daef7247f9b8a50b4159323e340efa6b0e4bea4fcd83580480f94d4f2c888 F ext/fts5/fts5_storage.c 1ad05dab4830a4e2eaf2900bb143477f93bc17437093582f36f4b818809e88d8 F ext/fts5/fts5_tcl.c 7fb5a3d3404099075aaa2457307cb459bbc257c0de3dbd52b1e80a5b503e0329 @@ -121,7 +121,7 @@ F ext/fts5/fts5_test_tok.c 3cb0a9b508b30d17ef025ccddd26ae3dc8ddffbe76c057616e59a F ext/fts5/fts5_tokenize.c 49aea8cc400a690a6c4f83c4cedc67f4f8830c6789c4ee343404f62bcaebca7b F ext/fts5/fts5_unicode2.c 6f9b0fb79a8facaed76628ffd4eb9c16d7f2b84b52872784f617cf3422a9b043 F ext/fts5/fts5_varint.c e64d2113f6e1bfee0032972cffc1207b77af63319746951bf1d09885d1dadf80 -F ext/fts5/fts5_vocab.c e4830b00809e5da53bc10f93adc59e321407b0f801c7f4167c0e47f5552267e0 +F ext/fts5/fts5_vocab.c ff0441c4ea165081e8152dec6d29056faa0cdc281a9f218a00e3d7aacc1958bc F ext/fts5/fts5parse.y eb526940f892ade5693f22ffd6c4f2702543a9059942772526eac1fde256bb05 F ext/fts5/mkportersteps.tcl 5acf962d2e0074f701620bb5308155fa1e4a63ba F ext/fts5/test/fts5_common.tcl c5aa7cf7148b6dcffb5b61520ae18212baf169936af734ab265143f59db328fe @@ -739,7 +739,7 @@ F src/hash.h 46b92795a95bfefb210f52f0c316e9d7cdbcdd7e7fcfb0d8be796d3a5767cddf F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6 F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 F src/insert.c 05e04ef637cbc0dccb9a5c5d188a5a2608891e554c8ec17c7a71afe2cf896a06 -F src/json.c 2663a0c7e574cb928de944720dcdcc11c931877d877549b8f1258a4002efd6f7 +F src/json.c 5abb5cb782e74451a8882f6b7ee4d5e629246642262660bd1980a5e1b796258d F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 7432c944ff197046d67a1207790a1b13eec4548c85a9457eb0896bb3641dfb36 F src/main.c 2650f54f7c2aa2c53cc61b571bad9c7c32d60400e3f6a270bd444f5d76e03eb8 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b59d0ebb22e4ca2f3a7a73dd49a0c142dbca538cb1b4eafd35a78bac87c6c456 -R a324a0ad4ec5bff22beea8348186f31d +P 215650a5a1d55bdbca9c92524804a1a54456a17f42a17e53747b21a6507506f5 +R 051727f689eef9866e97198933e64087 U drh -Z e55663a48a3fa77210e8f8e7032e8f31 +Z 6482d56e78ea7ae46b1be7711d2aadc0 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index cab7456372..4265221c97 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -215650a5a1d55bdbca9c92524804a1a54456a17f42a17e53747b21a6507506f5 +e846743a875430a5c51d41f00ac9532214f97d9925e6261113b63580f92369fc diff --git a/src/json.c b/src/json.c index 47a9c875e7..97bf25b2dd 100644 --- a/src/json.c +++ b/src/json.c @@ -1086,7 +1086,7 @@ static void jsonWrongNumArgs( */ static int jsonBlobExpand(JsonParse *pParse, u32 N){ u8 *aNew; - u32 t; + u64 t; assert( N>pParse->nBlobAlloc ); if( pParse->nBlobAlloc==0 ){ t = 100; @@ -1096,8 +1096,9 @@ static int jsonBlobExpand(JsonParse *pParse, u32 N){ if( tdb, pParse->aBlob, t); if( aNew==0 ){ pParse->oom = 1; return 1; } + assert( t<0x7fffffff ); pParse->aBlob = aNew; - pParse->nBlobAlloc = t; + pParse->nBlobAlloc = (u32)t; return 0; } @@ -3116,7 +3117,7 @@ static void jsonReturnFromBlob( char *zOut; u32 nOut = sz; z = (const char*)&pParse->aBlob[i+n]; - zOut = sqlite3DbMallocRaw(db, nOut+1); + zOut = sqlite3DbMallocRaw(db, ((u64)nOut)+1); if( zOut==0 ) goto returnfromblob_oom; for(iIn=iOut=0; iIn Date: Mon, 17 Feb 2025 19:44:45 +0000 Subject: [PATCH 38/54] Fix problems in test script fkey6.test. FossilOrigin-Name: 088e476519c2c759ba9387cb18eaad7c042cc37e45e96237d3125ba33ee3633a --- manifest | 14 ++++++------- manifest.uuid | 2 +- test/fkey6.test | 53 +++++++++++++++++++++++++++---------------------- 3 files changed, 37 insertions(+), 32 deletions(-) diff --git a/manifest b/manifest index 3d8c78ede6..e98c2b76af 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Additional\schanges\smaking\sit\seasier\sto\sprove\sthat\sinteger\soverflow\sdoes\snot\noccur.\s\sNo\sproblems\sfound. -D 2025-02-17T18:09:24.766 +C Fix\sproblems\sin\stest\sscript\sfkey6.test. +D 2025-02-17T19:44:45.980 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -1153,7 +1153,7 @@ F test/fkey2.test 1063d65e5923c054cfb8f0555a92a3ae0fa8c067275a33ee1715bd856cdb30 F test/fkey3.test 76d475c80b84ee7a5d062e56ccb6ea68882e2b49 F test/fkey4.test 86446017011273aad8f9a99c1a65019e7bd9ca9d F test/fkey5.test 6727452e163a427147e84e739da18713da553d79f9783559b04fdcd36d5c7421 -F test/fkey6.test 1e0874ba15f8ed1e14a1d0a40fc8fb90a9912f4c82ea220a43137d4d9eff4d69 +F test/fkey6.test 668a7299e75899b0a3342c36df655be57f76a05aca3544bda939a6e676e2f000 F test/fkey7.test 64fb28da03da5dfe3cdef5967aa7e832c2507bf7fb8f0780cacbca1f2338d031 F test/fkey8.test 51deda7f1a1448bca95875e4a6e1a3a75b4bd7215e924e845bd60de60e4d84bf F test/fkey_malloc.test 594a7ea1fbab553c036c70813cd8bd9407d63749 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 215650a5a1d55bdbca9c92524804a1a54456a17f42a17e53747b21a6507506f5 -R 051727f689eef9866e97198933e64087 -U drh -Z 6482d56e78ea7ae46b1be7711d2aadc0 +P e846743a875430a5c51d41f00ac9532214f97d9925e6261113b63580f92369fc +R bf9a2dfadfc67dccdfbf52fd5d450169 +U dan +Z 6cfd174e1e1a340132d02a73b4dc4571 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 4265221c97..d45c550bf9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e846743a875430a5c51d41f00ac9532214f97d9925e6261113b63580f92369fc +088e476519c2c759ba9387cb18eaad7c042cc37e45e96237d3125ba33ee3633a diff --git a/test/fkey6.test b/test/fkey6.test index 7cdc8ab0ae..415daeaf3e 100644 --- a/test/fkey6.test +++ b/test/fkey6.test @@ -271,31 +271,36 @@ do_execsql_test 5.1 { # reset_db -do_execsql_test 6.1 { - PRAGMA writable_schema = 1; - INSERT INTO sqlite_schema - VALUES('table', 't1', 't1', 2, 'CREATE TABLE t1(x INTEGER PRIMARY KEY)'); +ifcapable fts5 { +if {[permutation]!="inmemory_journal"} { + do_execsql_test 6.1 { + PRAGMA auto_vacuum = 0; + PRAGMA writable_schema = 1; + INSERT INTO sqlite_schema + VALUES('table', 't1', 't1', 2, 'CREATE TABLE t1(x INTEGER PRIMARY KEY)'); + } + db close + sqlite3 db test.db + do_execsql_test 6.1 { + PRAGMA foreign_keys = 1; + PRAGMA writable_schema = 1; + } + do_execsql_test 6.2 { + CREATE TABLE t2( + y INTEGER PRIMARY KEY, + z INTEGER REFERENCES t1(x) DEFERRABLE INITIALLY DEFERRED + ); + } + do_execsql_test 6.3 { + BEGIN; + INSERT INTO t2 VALUES(1,0),(2,1); + CREATE VIRTUAL TABLE t3 USING fts5(a, b, content='', tokendata=1); + INSERT INTO t3 VALUES(3,3); + PRAGMA defer_foreign_keys=ON; + DELETE FROM t2; + COMMIT; + } } -db close -sqlite3 db test.db -do_execsql_test 6.1 { - PRAGMA foreign_keys = 1; - PRAGMA writable_schema = 1; -} -do_execsql_test 6.2 { - CREATE TABLE t2( - y INTEGER PRIMARY KEY, - z INTEGER REFERENCES t1(x) DEFERRABLE INITIALLY DEFERRED - ); -} -do_execsql_test 6.3 { - BEGIN; - INSERT INTO t2 VALUES(1,0),(2,1); - CREATE VIRTUAL TABLE t3 USING fts5(a, b, content='', tokendata=1); - INSERT INTO t3 VALUES(3,3); - PRAGMA defer_foreign_keys=ON; - DELETE FROM t2; - COMMIT; } finish_test From 21212923f276c11aaa048819779853a19c3d6636 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 17 Feb 2025 20:13:20 +0000 Subject: [PATCH 39/54] Add an ORDER BY to a test case for skip-scan to make the output consistent. FossilOrigin-Name: 9c9c19414ac243ce48a34bf13a08bff54a465e54a0c09ded50508b8d4bdba227 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/skipscan6.test | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index e98c2b76af..6b0a647388 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sproblems\sin\stest\sscript\sfkey6.test. -D 2025-02-17T19:44:45.980 +C Add\san\sORDER\sBY\sto\sa\stest\scase\sfor\sskip-scan\sto\smake\sthe\soutput\sconsistent. +D 2025-02-17T20:13:20.679 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -1653,7 +1653,7 @@ F test/skipscan1.test 9cbbb6575517b15292bd87ee85b853bbd3cd4b4735d69b0f083020cec1 F test/skipscan2.test b032ed3e0ba5caa4df6c43ef22c31566aac67783bc031869155989a7ccdb5bd5 F test/skipscan3.test ec5bab3f81c7038b43450e7b3062e04a198bdbb5 F test/skipscan5.test 0672103fd2c8f96bd114133f356192b35ece45c794fe3677e1d9e5e3104a608e -F test/skipscan6.test bddbb35dd335e2d21b7791a61e3b2e1f3255dc307ce80aa6fe19cc298e6feb13 +F test/skipscan6.test e2b256cf5d538a605beb97dc97ca5e2836dfc24c5e1d9b7a09e13c069a3b8b49 F test/snapshot.test a504f2e7009f512ef66c719f0ea1c55a556bdaf1e1312c80a04d46fc1a3e9632 F test/snapshot2.test 8d6ff5dd9cc503f6e12d408a30409c3f9c653507b24408d9cd7195931c89bc54 F test/snapshot3.test 41350216abc6c7da37113ad462259c070786e5ad70bdc8709daaed148b1b3a2c @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e846743a875430a5c51d41f00ac9532214f97d9925e6261113b63580f92369fc -R bf9a2dfadfc67dccdfbf52fd5d450169 -U dan -Z 6cfd174e1e1a340132d02a73b4dc4571 +P 088e476519c2c759ba9387cb18eaad7c042cc37e45e96237d3125ba33ee3633a +R ac29bfbe7732fa69155d4757aa0d3755 +U drh +Z ae23d3651ecb8ceaf7a4973c35e0c2db # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d45c550bf9..f3d1660e17 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -088e476519c2c759ba9387cb18eaad7c042cc37e45e96237d3125ba33ee3633a +9c9c19414ac243ce48a34bf13a08bff54a465e54a0c09ded50508b8d4bdba227 diff --git a/test/skipscan6.test b/test/skipscan6.test index 4f592bc0e0..a97f440eef 100644 --- a/test/skipscan6.test +++ b/test/skipscan6.test @@ -167,10 +167,10 @@ do_execsql_test 3.0 { INSERT INTO t2 SELECT * FROM t3; ANALYZE; - SELECT * FROM sqlite_stat1; + SELECT * FROM sqlite_stat1 ORDER BY +idx; } { - t2 t2_ba {100 20 1 1} t2 t2_a {100 1} + t2 t2_ba {100 20 1 1} t3 t3_a {100 1} t3 t3_ba {100 20 1 1} } From 9ef8399055aaf10f623be8b900ac0c895c783b9c Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 18 Feb 2025 01:16:26 +0000 Subject: [PATCH 40/54] Update path on the web server for test/snapshot instances of fiddle. FossilOrigin-Name: 57caa3136d1bfca06e4f2285734a4977b8d3fa1f75bf87453b975867e9de38fc --- ext/wasm/fiddle.make | 2 +- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ext/wasm/fiddle.make b/ext/wasm/fiddle.make index 2a43959e2b..8110384a6e 100644 --- a/ext/wasm/fiddle.make +++ b/ext/wasm/fiddle.make @@ -91,7 +91,7 @@ all: fiddle fiddle_remote ?= ifeq (,$(fiddle_remote)) ifneq (,$(wildcard /home/stephan)) - fiddle_remote = wh:www/wh/sqlite3/. + fiddle_remote = wh:www/wasm-testing/fiddle/. else ifneq (,$(wildcard /home/drh)) #fiddle_remote = if appropriate, add that user@host:/path here endif diff --git a/manifest b/manifest index 6b0a647388..a37fef62de 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\san\sORDER\sBY\sto\sa\stest\scase\sfor\sskip-scan\sto\smake\sthe\soutput\sconsistent. -D 2025-02-17T20:13:20.679 +C Update\spath\son\sthe\sweb\sserver\sfor\stest/snapshot\sinstances\sof\sfiddle. +D 2025-02-18T01:16:26.885 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -672,7 +672,7 @@ F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2 F ext/wasm/demo-worker1.js 08720227e98fa5b44761cf6e219269cee3e9dd0421d8d91459535da776950314 F ext/wasm/dist.make 92ef4ffe33022a50f92d602acabad10bd8dd91759f3eb7df27fc6d7d37072b96 F ext/wasm/example_extra_init.c 2347cd69d19d839ef4e5e77b7855103a7fe3ef2af86f2e8c95839afd8b05862f -F ext/wasm/fiddle.make d4969f0322a582c57a22ce3541f10a5b09a609d14eab32891f613f43b3c14d8b +F ext/wasm/fiddle.make c6d7a3d6cc03bb5f21acb295c1233820d0dbf5c6a89b28dc2e093edcc001c45a F ext/wasm/fiddle/fiddle-worker.js 850e66fce39b89d59e161d1abac43a181a4caa89ddeea162765d660277cd84ce F ext/wasm/fiddle/fiddle.js b444a5646a9aac9f3fc06c53d78af5e1912eb235d69a8e6010723e4eb0e9d4a1 F ext/wasm/fiddle/index.html c79b1741cbeba78f88af0a84cf5ec7de87a909a6a8d10a369b1f4824c66c2088 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 088e476519c2c759ba9387cb18eaad7c042cc37e45e96237d3125ba33ee3633a -R ac29bfbe7732fa69155d4757aa0d3755 -U drh -Z ae23d3651ecb8ceaf7a4973c35e0c2db +P 9c9c19414ac243ce48a34bf13a08bff54a465e54a0c09ded50508b8d4bdba227 +R c1357609bb5713a7e3d612d7117e08d1 +U stephan +Z d5c65d18a9c1aa9330f1639d76c6628b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f3d1660e17..4a2d06e29c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9c9c19414ac243ce48a34bf13a08bff54a465e54a0c09ded50508b8d4bdba227 +57caa3136d1bfca06e4f2285734a4977b8d3fa1f75bf87453b975867e9de38fc From eb3a069fc82e53a40ea63076d66ab113a3b2b0c6 Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 18 Feb 2025 15:11:30 +0000 Subject: [PATCH 41/54] Have SQLITE_FTS5_ENABLE_TEST_MI builds avoid reading the database schema from within sqlite3_open(). FossilOrigin-Name: 15dc524fd4113026cc542140c39c1c8f9e052d36946f0c599f282d9ac27efdab --- ext/fts5/fts5_main.c | 4 ++-- ext/fts5/fts5_test_mi.c | 32 ++++++++++++++++++++++---------- ext/fts5/test/fts5matchinfo.test | 22 ++++++++++++++++++++++ manifest | 18 +++++++++--------- manifest.uuid | 2 +- 5 files changed, 56 insertions(+), 22 deletions(-) diff --git a/ext/fts5/fts5_main.c b/ext/fts5/fts5_main.c index 9f504bb3a3..4d5e3cd4f3 100644 --- a/ext/fts5/fts5_main.c +++ b/ext/fts5/fts5_main.c @@ -3801,8 +3801,8 @@ static int fts5Init(sqlite3 *db){ ** its entry point to enable the matchinfo() demo. */ #ifdef SQLITE_FTS5_ENABLE_TEST_MI if( rc==SQLITE_OK ){ - extern int sqlite3Fts5TestRegisterMatchinfo(sqlite3*); - rc = sqlite3Fts5TestRegisterMatchinfo(db); + extern int sqlite3Fts5TestRegisterMatchinfoAPI(fts5_api*); + rc = sqlite3Fts5TestRegisterMatchinfoAPI(&pGlobal->api); } #endif diff --git a/ext/fts5/fts5_test_mi.c b/ext/fts5/fts5_test_mi.c index 6f2d6e7ea2..f56c890cd7 100644 --- a/ext/fts5/fts5_test_mi.c +++ b/ext/fts5/fts5_test_mi.c @@ -393,17 +393,13 @@ static void fts5MatchinfoFunc( } } -int sqlite3Fts5TestRegisterMatchinfo(sqlite3 *db){ - int rc; /* Return code */ - fts5_api *pApi; /* FTS5 API functions */ +/* +** Register "matchinfo" with global API object pApi. +*/ +int sqlite3Fts5TestRegisterMatchinfoAPI(fts5_api *pApi){ + int rc; - /* Extract the FTS5 API pointer from the database handle. The - ** fts5_api_from_db() function above is copied verbatim from the - ** FTS5 documentation. Refer there for details. */ - rc = fts5_api_from_db(db, &pApi); - if( rc!=SQLITE_OK ) return rc; - - /* If fts5_api_from_db() returns NULL, then either FTS5 is not registered + /* If fts5_api_from_db() returned NULL, then either FTS5 is not registered ** with this database handle, or an error (OOM perhaps?) has occurred. ** ** Also check that the fts5_api object is version 2 or newer. @@ -418,4 +414,20 @@ int sqlite3Fts5TestRegisterMatchinfo(sqlite3 *db){ return rc; } +/* +** Register "matchinfo" with database handle db. +*/ +int sqlite3Fts5TestRegisterMatchinfo(sqlite3 *db){ + int rc; /* Return code */ + fts5_api *pApi; /* FTS5 API functions */ + + /* Extract the FTS5 API pointer from the database handle. The + ** fts5_api_from_db() function above is copied verbatim from the + ** FTS5 documentation. Refer there for details. */ + rc = fts5_api_from_db(db, &pApi); + if( rc!=SQLITE_OK ) return rc; + + return sqlite3Fts5TestRegisterMatchinfoAPI(pApi); +} + #endif /* SQLITE_ENABLE_FTS5 */ diff --git a/ext/fts5/test/fts5matchinfo.test b/ext/fts5/test/fts5matchinfo.test index 93361a5fe7..f81b076c18 100644 --- a/ext/fts5/test/fts5matchinfo.test +++ b/ext/fts5/test/fts5matchinfo.test @@ -520,4 +520,26 @@ do_execsql_test 15.3 { {columnsize {1 1} columntext {c d} columntotalsize {2 2} poslist {} tokenize {c d} rowcount 2} } +#------------------------------------------------------------------------- +# +reset_db +do_execsql_test 16.0 { + CREATE TABLE t1(x); + BEGIN EXCLUSIVE; +} + +sqlite3 db2 test.db +do_test 16.1 { + catchsql { SELECT * FROM t1 } db2 +} {1 {database is locked}} + +do_execsql_test 16.2 { + ROLLBACK; +} + +do_test 16.3 { + catchsql { SELECT * FROM t1 } db2 +} {0 {}} + finish_test + diff --git a/manifest b/manifest index a37fef62de..f4faa2a67f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\spath\son\sthe\sweb\sserver\sfor\stest/snapshot\sinstances\sof\sfiddle. -D 2025-02-18T01:16:26.885 +C Have\sSQLITE_FTS5_ENABLE_TEST_MI\sbuilds\savoid\sreading\sthe\sdatabase\sschema\sfrom\nwithin\ssqlite3_open(). +D 2025-02-18T15:11:30.645 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -113,10 +113,10 @@ F ext/fts5/fts5_config.c e7d8dd062b44a66cd77e5a0f74f23a2354cd1f3f8575afb967b2773 F ext/fts5/fts5_expr.c 69b8d976058512c07dfe86e229521b7a871768157bd1607cedf1a5038dfd72c9 F ext/fts5/fts5_hash.c adda4272be401566a6e0ba1acbe70ee5cb97fce944bc2e04dc707152a0ec91b1 F ext/fts5/fts5_index.c b7827b32e0e1e1ff7d7cb27c5d0480426a01c8ec4e89fd7e106bb463e2b63dd1 -F ext/fts5/fts5_main.c 9a1daef7247f9b8a50b4159323e340efa6b0e4bea4fcd83580480f94d4f2c888 +F ext/fts5/fts5_main.c b0e95a793f3c649d313c536269403e1a413ee665223adb5f8196edd2bc1146f7 F ext/fts5/fts5_storage.c 1ad05dab4830a4e2eaf2900bb143477f93bc17437093582f36f4b818809e88d8 F ext/fts5/fts5_tcl.c 7fb5a3d3404099075aaa2457307cb459bbc257c0de3dbd52b1e80a5b503e0329 -F ext/fts5/fts5_test_mi.c 08c11ec968148d4cb4119d96d819f8c1f329812c568bac3684f5464be177d3ee +F ext/fts5/fts5_test_mi.c d35fdd50db99a775a040fb57127a45adc968e97da94ae784eec664256ac86db2 F ext/fts5/fts5_test_tok.c 3cb0a9b508b30d17ef025ccddd26ae3dc8ddffbe76c057616e59a9aa85d36f3b F ext/fts5/fts5_tokenize.c 49aea8cc400a690a6c4f83c4cedc67f4f8830c6789c4ee343404f62bcaebca7b F ext/fts5/fts5_unicode2.c 6f9b0fb79a8facaed76628ffd4eb9c16d7f2b84b52872784f617cf3422a9b043 @@ -203,7 +203,7 @@ F ext/fts5/test/fts5lastrowid.test f36298a1fb9f988bde060a274a7ce638faa9c38a31400 F ext/fts5/test/fts5leftjoin.test c0b4cafb9661379e576dc4405c0891d8fcc2782680740513c4d1fc114b43d4ad F ext/fts5/test/fts5limits.test 8ab67cf5d311c124b6ceb0062d0297767176df4572d955fce79fa43004dff01c F ext/fts5/test/fts5locale.test 83ba7ee12628b540d3098f39c39c1de0c0440eddff8f7512c8c698d0c4a3ae3c -F ext/fts5/test/fts5matchinfo.test 877520582feb86bbfd95ab780099bcba4526f18ac75ee34979144cf86ba3a5a3 +F ext/fts5/test/fts5matchinfo.test 7806f6d521bb49bcb54fff88a50f137866f7000c96ccfd28500caa47b63cb0aa F ext/fts5/test/fts5merge.test 2654df0bcdb2d117c2d38b6aeb0168061be01c643f9e9194b36c43a2970e8082 F ext/fts5/test/fts5merge2.test 3ebad1a59d6ad3fb66eff6523a09e95dc6367cbefb3cd73196801dea0425c8e2 F ext/fts5/test/fts5misc.test f4dee7da898d605a6488c5b7afaace3158ed6bb9addff78faa1b37b402b77fb9 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9c9c19414ac243ce48a34bf13a08bff54a465e54a0c09ded50508b8d4bdba227 -R c1357609bb5713a7e3d612d7117e08d1 -U stephan -Z d5c65d18a9c1aa9330f1639d76c6628b +P 57caa3136d1bfca06e4f2285734a4977b8d3fa1f75bf87453b975867e9de38fc +R 35202329cbe88699b6bddc518439e5e7 +U dan +Z 2607e4e091da584eea58069e1dc59b17 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 4a2d06e29c..1217ba4cdf 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -57caa3136d1bfca06e4f2285734a4977b8d3fa1f75bf87453b975867e9de38fc +15dc524fd4113026cc542140c39c1c8f9e052d36946f0c599f282d9ac27efdab From 2e132a4c04563e9fc0c3369e82564c77d8c53f94 Mon Sep 17 00:00:00 2001 From: stephan Date: Wed, 19 Feb 2025 13:02:23 +0000 Subject: [PATCH 42/54] Slight tweak to the CLI shell help output to help convey that it can accept multiple SQL arguments, as suggested in [forum:20e617feee|forum post 20e617feee]. FossilOrigin-Name: 82fc67070f9aff0065c07cbeed40f4321e03617bdc3e517adc58a2d96e6e3e49 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/shell.c.in | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index f4faa2a67f..b7a6cddd09 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Have\sSQLITE_FTS5_ENABLE_TEST_MI\sbuilds\savoid\sreading\sthe\sdatabase\sschema\sfrom\nwithin\ssqlite3_open(). -D 2025-02-18T15:11:30.645 +C Slight\stweak\sto\sthe\sCLI\sshell\shelp\soutput\sto\shelp\sconvey\sthat\sit\scan\saccept\smultiple\sSQL\sarguments,\sas\ssuggested\sin\s[forum:20e617feee|forum\spost\s20e617feee]. +D 2025-02-19T13:02:23.660 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -779,7 +779,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 626c24b258b111f75c22107aa5614ad89810df3026f5ca071116d3fe75925c75 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 57893cc8b099f231f7ed5b84faff14841f2aabb4776e32e17fae00aeae0a8993 -F src/shell.c.in b377a59822f207106424f08aead37e78b609222e98f86f04cc8a03563ccf3237 +F src/shell.c.in b6c1ef047b76b59db06cc9dcf56a5c65255891990893fb14ab99c7eb8f92879a F src/sqlite.h.in 8d4486fb28a90de818ac1e8c6206ea458e7de6bd8e0dfa3d554494f155be8c01 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 57caa3136d1bfca06e4f2285734a4977b8d3fa1f75bf87453b975867e9de38fc -R 35202329cbe88699b6bddc518439e5e7 -U dan -Z 2607e4e091da584eea58069e1dc59b17 +P 15dc524fd4113026cc542140c39c1c8f9e052d36946f0c599f282d9ac27efdab +R 5355147b27dea2558cd54c419c7d5a9d +U stephan +Z 46dc12b85b22276ab11cf09c637f56a9 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 1217ba4cdf..cfd1c85c6a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -15dc524fd4113026cc542140c39c1c8f9e052d36946f0c599f282d9ac27efdab +82fc67070f9aff0065c07cbeed40f4321e03617bdc3e517adc58a2d96e6e3e49 diff --git a/src/shell.c.in b/src/shell.c.in index fcc9316b00..2337504a64 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -12633,7 +12633,7 @@ static const char zOptions[] = #endif ; static void usage(int showDetail){ - sqlite3_fprintf(stderr,"Usage: %s [OPTIONS] [FILENAME [SQL]]\n" + sqlite3_fprintf(stderr,"Usage: %s [OPTIONS] [FILENAME [SQL...]]\n" "FILENAME is the name of an SQLite database. A new database is created\n" "if the file does not previously exist. Defaults to :memory:.\n", Argv0); if( showDetail ){ From eb0d2e7bc6b9ef56cea4e85cfb56b2d194befd5d Mon Sep 17 00:00:00 2001 From: stephan Date: Wed, 19 Feb 2025 13:05:33 +0000 Subject: [PATCH 43/54] Increase default CLI shell .prompt buffer length to 128 bytes, based on discussion in [forum:362f185a6aa|forum post 362f185a6aa]. FossilOrigin-Name: 628407f03d4bfb7499f0e6e2197089edf859380a3c4e6fecc517390327718141 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/shell.c.in | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index b7a6cddd09..e03870ce0a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Slight\stweak\sto\sthe\sCLI\sshell\shelp\soutput\sto\shelp\sconvey\sthat\sit\scan\saccept\smultiple\sSQL\sarguments,\sas\ssuggested\sin\s[forum:20e617feee|forum\spost\s20e617feee]. -D 2025-02-19T13:02:23.660 +C Increase\sdefault\sCLI\sshell\s.prompt\sbuffer\slength\sto\s128\sbytes,\sbased\son\sdiscussion\sin\s[forum:362f185a6aa|forum\spost\s362f185a6aa]. +D 2025-02-19T13:05:33.746 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -779,7 +779,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 626c24b258b111f75c22107aa5614ad89810df3026f5ca071116d3fe75925c75 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 57893cc8b099f231f7ed5b84faff14841f2aabb4776e32e17fae00aeae0a8993 -F src/shell.c.in b6c1ef047b76b59db06cc9dcf56a5c65255891990893fb14ab99c7eb8f92879a +F src/shell.c.in bf997e43faaa1ef0ff78d4d7b9be6a9430cf1edda9a47a14e7fef646fcb459af F src/sqlite.h.in 8d4486fb28a90de818ac1e8c6206ea458e7de6bd8e0dfa3d554494f155be8c01 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 15dc524fd4113026cc542140c39c1c8f9e052d36946f0c599f282d9ac27efdab -R 5355147b27dea2558cd54c419c7d5a9d +P 82fc67070f9aff0065c07cbeed40f4321e03617bdc3e517adc58a2d96e6e3e49 +R be54da7cd01ca59f1b81e516853a22f2 U stephan -Z 46dc12b85b22276ab11cf09c637f56a9 +Z 3cdd2336da3d5e5560137a38998c10e6 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index cfd1c85c6a..bfbc8a28b3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -82fc67070f9aff0065c07cbeed40f4321e03617bdc3e517adc58a2d96e6e3e49 +628407f03d4bfb7499f0e6e2197089edf859380a3c4e6fecc517390327718141 diff --git a/src/shell.c.in b/src/shell.c.in index 2337504a64..f12d360b9b 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -470,7 +470,7 @@ static char *Argv0; ** Prompt strings. Initialized in main. Settable with ** .prompt main continue */ -#define PROMPT_LEN_MAX 20 +#define PROMPT_LEN_MAX 128 /* First line prompt. default: "sqlite> " */ static char mainPrompt[PROMPT_LEN_MAX]; /* Continuation prompt. default: " ...> " */ From f8a9f455956933e08d7f5c5d7f409906c7391862 Mon Sep 17 00:00:00 2001 From: stephan Date: Thu, 20 Feb 2025 03:27:47 +0000 Subject: [PATCH 44/54] configure: when running proj-check-function-in-lib, strip -Werror from CFLAGS for the duration of the test. This enables CFLAGS='-Wall -Werror' and the like to be passed to configure without breaking these configure-time checks. FossilOrigin-Name: 4ae9d6c642295e3a0c1732dacf7c18ecacd39d3e74e38381ac5531c8396f5f1c --- autosetup/proj.tcl | 36 +++++++++++++++++++++++++++++++----- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 38 insertions(+), 12 deletions(-) diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index fdfbf3a5ed..c81fe910d0 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -197,16 +197,42 @@ proc proj-strip-hash-comments {val} { return $x } +######################################################################## +# @proj-cflags-without-werror +# +# Fetches [define $var], strips out any -Werror entries, and returns +# the new value. This is intended for temporarily stripping -Werror +# from CFLAGS or CPPFLAGS within the scope of a [define-push] block. +proc proj-cflags-without-werror {{var CFLAGS}} { + set rv {} + foreach f [get-define $var ""] { + switch -exact -- $f { + -Werror {} + default { lappend rv $f } + } + } + return [join $rv " "] +} + ######################################################################## # @proj-check-function-in-lib # -# A proxy for cc-check-function-in-lib which does not make any global -# changes to the LIBS define. Returns the result of -# cc-check-function-in-lib (i.e. true or false). The resulting linker -# flags are stored in the [define] named lib_${function}. +# A proxy for cc-check-function-in-lib with the following differences: +# +# - Does not make any global changes to the LIBS define. +# +# - Strips out -W... warning flags from CFLAGS before running the +# test, as these feature tests will often fail if -Werror is used. +# +# Returns the result of cc-check-function-in-lib (i.e. true or false). +# The resulting linker flags are stored in the [define] named +# lib_${function}. proc proj-check-function-in-lib {function libs {otherlibs {}}} { set found 0 - define-push {LIBS} { + define-push {LIBS CFLAGS} { + #puts "CFLAGS before=[get-define CFLAGS]" + define CFLAGS [proj-cflags-without-werror] + #puts "CFLAGS after =[get-define CFLAGS]" set found [cc-check-function-in-lib $function $libs $otherlibs] } return $found diff --git a/manifest b/manifest index e03870ce0a..820f3bc2dc 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Increase\sdefault\sCLI\sshell\s.prompt\sbuffer\slength\sto\s128\sbytes,\sbased\son\sdiscussion\sin\s[forum:362f185a6aa|forum\spost\s362f185a6aa]. -D 2025-02-19T13:05:33.746 +C configure:\swhen\srunning\sproj-check-function-in-lib,\sstrip\s-Werror\sfrom\sCFLAGS\sfor\sthe\sduration\sof\sthe\stest.\sThis\senables\sCFLAGS='-Wall\s-Werror'\sand\sthe\slike\sto\sbe\spassed\sto\sconfigure\swithout\sbreaking\sthese\sconfigure-time\schecks. +D 2025-02-20T03:27:47.397 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -49,7 +49,7 @@ F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1d F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f +F autosetup/proj.tcl 90cec210224dde699f3bee756d88c2477044f713db8a38112e695ec02e531eeb F autosetup/sqlite-config.tcl e1d65cc632e1de94ff39618ac82b649f2062f674ca36dae78ab3573cab096761 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 82fc67070f9aff0065c07cbeed40f4321e03617bdc3e517adc58a2d96e6e3e49 -R be54da7cd01ca59f1b81e516853a22f2 +P 628407f03d4bfb7499f0e6e2197089edf859380a3c4e6fecc517390327718141 +R 0566dfd2338327afb5cc1d164e7ce94d U stephan -Z 3cdd2336da3d5e5560137a38998c10e6 +Z b470bbb1231ec7883dd8df58ba06834f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index bfbc8a28b3..d915946f6d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -628407f03d4bfb7499f0e6e2197089edf859380a3c4e6fecc517390327718141 +4ae9d6c642295e3a0c1732dacf7c18ecacd39d3e74e38381ac5531c8396f5f1c From b42310a6b9a1b0635155de3a2c53aac4c73417a7 Mon Sep 17 00:00:00 2001 From: stephan Date: Thu, 20 Feb 2025 04:45:02 +0000 Subject: [PATCH 45/54] wasm makefile docs: make explicit that the node.js-for-node.js builds (as opposed to the node.js-for-browser builds) are both untested and unsupported. FossilOrigin-Name: e1f184889fef4603d61d306c8c0dc86df616290ccf73dbd871fa27bd99e5e5c9 --- ext/wasm/GNUmakefile | 3 ++- manifest | 13 ++++++------- manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index 572a3cd338..522ff1615a 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -136,8 +136,9 @@ JS_BUILD_NAMES := sqlite3 sqlite3-wasmfs # target of browsers. # # - node = for use by node.js for node.js, as opposed to by node.js on -# behalf o browser-side code (use bundler-friendly for that). Note +# behalf of browser-side code (use bundler-friendly for that). Note # that persistent storage (OPFS) is not available in these builds. +# These builds are UNTESTED and UNSUPPORTED! # JS_BUILD_MODES := vanilla esm bunder-friendly node diff --git a/manifest b/manifest index aa980f3b58..4343869548 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\spause/unpause\scapability\sto\sthe\sopfs-sahpool\sVFS,\sas\sdiscussed\sin\s[forum:fe8cdb8431c|forum\sthread\sfe8cdb8431c].\sSummary:\sthis\sgives\sclients\sa\sway\sto\seke\ssome\sdegree\sof\smulti-page/tab/Worker\sconcurrency\sout\sof\sthis\sVFS\sbut\srequires\sthat\scoordination\sto\sbe\simplemented\sclient-side,\se.g.\svia\sa\sSharedWorker\sor\sWebLocks. -D 2025-02-20T04:14:26.736 +C wasm\smakefile\sdocs:\smake\sexplicit\sthat\sthe\snode.js-for-node.js\sbuilds\s(as\sopposed\sto\sthe\snode.js-for-browser\sbuilds)\sare\sboth\suntested\sand\sunsupported. +D 2025-02-20T04:45:02.076 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -619,7 +619,7 @@ F ext/session/sqlite3session.c 52a680dbb03c4734748b215d95987fb4d95ab23baaf053a01 F ext/session/sqlite3session.h aa5de3ec8ef0e5313e9f65dafd69e8ba292d170f07b57da9200c040068dab061 F ext/session/test_session.c 12e0a2c15fd60f92da4bb29c697c9177ff0c0dbcdc5129a54c47e999f147937a F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c -F ext/wasm/GNUmakefile 7889f9c5bab69233a65109e2bd00d627cab7470060e1b13b37781ac1b127f6c6 +F ext/wasm/GNUmakefile afecad95600b0361865a81c4490743f54fd2a5a4db64e50b361a9db0cb0553f5 F ext/wasm/README-dist.txt f01081a850ce38a56706af6b481e3a7878e24e42b314cfcd4b129f0f8427066a F ext/wasm/README.md b89605f65661cf35bf034ff6d43e448cc169b8017fc105d498e33b81218b482c F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff @@ -2210,9 +2210,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 4ae9d6c642295e3a0c1732dacf7c18ecacd39d3e74e38381ac5531c8396f5f1c e205cdc468e02eefdeb8d391d921aa2d4d28a8b7b87036d6d937a9928261a413 -R 224600d4f738e50568ab6b26e5819abb -T +closed e205cdc468e02eefdeb8d391d921aa2d4d28a8b7b87036d6d937a9928261a413 Closed\sby\sintegrate-merge. +P b5dbd521951e129b4dec69f191a872500dbf387b34a8479ad58b053ffcccbab9 +R 9e14f25c151c1ed248cfdda16fbb7871 U stephan -Z 8b67a5570124816c376abd5faa1b9b7a +Z a5f06d7dda0edaff65b376e4feee5c8b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5a2129b963..cad68956a7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b5dbd521951e129b4dec69f191a872500dbf387b34a8479ad58b053ffcccbab9 +e1f184889fef4603d61d306c8c0dc86df616290ccf73dbd871fa27bd99e5e5c9 From 9e632f5512dd3de93d3db8fc73603943c2abdc77 Mon Sep 17 00:00:00 2001 From: stephan Date: Thu, 20 Feb 2025 05:39:18 +0000 Subject: [PATCH 46/54] wasm: do not build the (untested/unsupported) node-for-node build by default, to cut build time by about 15%. Adjacent cleanups in mkwasmbuilds.c. FossilOrigin-Name: e4539ebebd89840b76f5a0626393299100685a38f45546a0bf7a62e4df56f863 --- ext/wasm/GNUmakefile | 11 ++++---- ext/wasm/mkwasmbuilds.c | 62 ++++++++++++++++++++++++++++------------- manifest | 14 +++++----- manifest.uuid | 2 +- 4 files changed, 57 insertions(+), 32 deletions(-) diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index 522ff1615a..42fdb072d3 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -892,12 +892,13 @@ EXPORTED_FUNCTIONS.fiddle := $(dir.tmp)/EXPORTED_FUNCTIONS.fiddle ######################################################################## ######################################################################## # We have to ensure that we do not build $(sqlite3*.*js) in parallel -# because they all result in the creation of $(sqlite3.wasm). We have -# no way to build just a .[m]js file without also building the .wasm -# file because the generated .[m]js file has to include info about the -# imports needed by the wasm file, so they have to be built +# for any builds which result in the creation of $(sqlite3.wasm). We +# have no way to build just a .[m]js file without also building the +# .wasm file because the generated .[m]js file has to include info +# about the imports needed by the wasm file, so they have to be built # together. i.e. we're building $(sqlite3.wasm) multiple times, but -# that's unavoidable (and harmless, just a waste of build time). +# that's unavoidable (and harmless, but is a significant waste of +# build time). $(sqlite3.wasm): $(sqlite3.js) $(sqlite3.mjs): $(sqlite3.js) $(sqlite3-bundler-friendly.mjs): $(sqlite3.mjs) diff --git a/ext/wasm/mkwasmbuilds.c b/ext/wasm/mkwasmbuilds.c index 91c03b6d42..4910379101 100644 --- a/ext/wasm/mkwasmbuilds.c +++ b/ext/wasm/mkwasmbuilds.c @@ -135,6 +135,24 @@ static void mk_prologue(void){ } } +/* +** Flags for use with the 3rd argument to mk_pre_post() and +** mk_lib_mode(). +*/ +enum LibModeFlags { + /* Indicates an ESM module build. */ + LIBMODE_ESM = 0x01, + /* Indicates a "bundler-friendly" build mode. */ + LIBMODE_BUNDLER_FRIENDLY = 0x02 | LIBMODE_ESM, + /* Indicates to _not_ add this build to the 'all' target. */ + LIBMODE_DONT_ADD_TO_ALL = 0x04, + /* Indicates a node.js-for-node.js build (untested and + ** unsupported). */ + LIBMODE_NODEJS = 0x08, + /* Indicates a wasmfs build (untested and unsupported). */ + LIBMODE_WASMFS = 0x10 | LIBMODE_ESM +}; + /* ** Emits makefile code for setting up values for the --pre-js=FILE, ** --post-js=FILE, and --extern-post-js=FILE emcc flags, as well as @@ -142,6 +160,7 @@ static void mk_prologue(void){ */ static void mk_pre_post(const char *zName /* build name */, const char *zMode /* build mode */, + int flags /* LIBMODE_... mask */, const char *zCmppD /* optional -D flags for c-pp for the ** --pre/--post-js files. */){ pf("%s# Begin --pre/--post flags for %s-%s\n", zBanner, zNM); @@ -166,9 +185,10 @@ static void mk_pre_post(const char *zName /* build name */, pf("\tcp $(pre-js.js.%s-%s.intermediary) $@\n", zNM); /* Amend $(pre-js.js.zName-zMode) for all targets except the plain - ** "sqlite3" build... */ + ** "sqlite3" and the "sqlite3-wasmfs" builds... */ if( 0!=strcmp("sqlite3-wasmfs", zName) && 0!=strcmp("sqlite3", zName) ){ +#error "This part ^^^ is needs adapting for use with the LIBMODE_... flags" pf("\t@echo 'Module[xNameOfInstantiateWasm].uri = " "\"%s.wasm\";' >> $@\n", zName); } @@ -209,7 +229,7 @@ static void mk_pre_post(const char *zName /* build name */, static void mk_fiddle(){ int i = 0; - mk_pre_post("fiddle-module","vanilla", 0); + mk_pre_post("fiddle-module","vanilla", 0, 0); for( ; i < 2; ++i ){ const char *zTail = i ? ".debug" : ""; const char *zDir = i ? "$(dir.fiddle-debug)" : "$(dir.fiddle)"; @@ -257,7 +277,7 @@ static void mk_fiddle(){ */ static void mk_lib_mode(const char *zName /* build name */, const char *zMode /* build mode */, - int bIsEsm /* true only for ESM build */, + int flags /* LIBMODE_... mask */, const char *zApiJsOut /* name of generated sqlite3-api.js/.mjs */, const char *zJsOut /* name of generated sqlite3.js/.mjs */, const char *zCmppD /* extra -D flags for c-pp */, @@ -276,7 +296,7 @@ static void mk_lib_mode(const char *zName /* build name */, pf("%s# Begin build [%s-%s]\n", zBanner, zNM); pf("# zApiJsOut=%s\n# zJsOut=%s\n# zCmppD=%s\n", zApiJsOut, zJsOut, zCmppD); pf("$(info Setting up build [%s-%s]: %s)\n", zNM, zJsOut); - mk_pre_post(zNM, zCmppD); + mk_pre_post(zNM, flags, zCmppD); pf("\nemcc.flags.%s.%s ?=\n", zNM); if( zEmcc[0] ){ pf("emcc.flags.%s.%s += %s\n", zNM, zEmcc); @@ -303,13 +323,13 @@ static void mk_lib_mode(const char *zName /* build name */, pf("\t\t$(cflags.common) $(SQLITE_OPT) \\\n" "\t\t$(cflags.%s) $(cflags.%s.%s) \\\n" "\t\t$(cflags.wasm_extra_init) $(sqlite3-wasm.cfiles)\n", zName, zNM); - if( bIsEsm ){ + if( LIBMODE_ESM & flags ){ /* TODO? Replace this $(call) with the corresponding makefile ** code. OTOH, we also use this $(call) in the speedtest1-wasmfs ** build, which is not part of the rules emitted by this ** program. */ pf("\t@$(call SQLITE.CALL.xJS.ESM-EXPORT-DEFAULT,1,%d)\n", - 0==strcmp("sqlite3-wasmfs", zName) ? 1 : 0); + (LIBMODE_WASMFS & flags) ? 1 : 0); } pf("\t@chmod -x %s; \\\n" "\t\t$(maybe-wasm-strip) %s;\n", @@ -331,15 +351,15 @@ static void mk_lib_mode(const char *zName /* build name */, ** resulting .wasm file is identical for all builds for which zEmcc ** is empty. */ - if( 0==strcmp("bundler-friendly", zMode) - || 0==strcmp("node", zMode) ){ + if( (LIBMODE_BUNDLER_FRIENDLY & flags) + || (LIBMODE_NODEJS & flags) ){ pf("\t@echo 'Patching $@ for %s.wasm...'; \\\n", zName); pf("\t\trm -f %s; \\\n", zWasmOut); pf("\t\tsed -i -e 's/%s-%s.wasm/%s.wasm/g' $@ || exit;\n", /* ^^^^^^ reminder: Mac/BSD sed has no -i flag */ zNM, zName); pf("\t@ls -la $@\n"); - if( 0==strcmp("bundler-friendly", zMode) ){ + if( LIBMODE_BUNDLER_FRIENDLY & flags ){ /* Avoid a 3rd occurance of the bug fixed by 65798c09a00662a3, ** which was (in two cases) caused by makefile refactoring and ** not recognized until after a release was made with the broken @@ -352,9 +372,7 @@ static void mk_lib_mode(const char *zName /* build name */, }else{ pf("\t@ls -la %s $@\n", zWasmOut); } - if( 0!=strcmp("sqlite3-wasmfs", zName) ){ - /* The sqlite3-wasmfs build is optional and needs to be invoked - ** conditionally using info we don't have here. */ + if( 0==(LIBMODE_DONT_ADD_TO_ALL & flags) ){ pf("all: %s\n", zJsOut); } pf("# End build [%s-%s]%s", zNM, zBanner); @@ -366,22 +384,28 @@ int main(void){ mk_prologue(); mk_lib_mode("sqlite3", "vanilla", 0, "$(sqlite3-api.js)", "$(sqlite3.js)", 0, 0); - mk_lib_mode("sqlite3", "esm", 1, + mk_lib_mode("sqlite3", "esm", LIBMODE_ESM, "$(sqlite3-api.mjs)", "$(sqlite3.mjs)", "-Dtarget=es6-module", 0); - mk_lib_mode("sqlite3", "bundler-friendly", 1, - "$(sqlite3-api-bundler-friendly.mjs)", "$(sqlite3-bundler-friendly.mjs)", + mk_lib_mode("sqlite3", "bundler-friendly", LIBMODE_BUNDLER_FRIENDLY, + "$(sqlite3-api-bundler-friendly.mjs)", + "$(sqlite3-bundler-friendly.mjs)", "$(c-pp.D.sqlite3-esm) -Dtarget=es6-bundler-friendly", 0); - mk_lib_mode("sqlite3" , "node", 1, + mk_lib_mode("sqlite3" , "node", + LIBMODE_NODEJS | LIBMODE_DONT_ADD_TO_ALL, "$(sqlite3-api-node.mjs)", "$(sqlite3-node.mjs)", "$(c-pp.D.sqlite3-bundler-friendly) -Dtarget=node", 0); - mk_lib_mode("sqlite3-wasmfs", "esm" ,1, + mk_lib_mode("sqlite3-wasmfs", "esm" , + LIBMODE_WASMFS | LIBMODE_DONT_ADD_TO_ALL, + /* The sqlite3-wasmfs build is optional and needs to be invoked + ** conditionally using info we don't have here. */ "$(sqlite3-api-wasmfs.mjs)", "$(sqlite3-wasmfs.mjs)", "$(c-pp.D.sqlite3-bundler-friendly) -Dwasmfs", "-sEXPORT_ES6 -sUSE_ES6_IMPORT_META"); mk_fiddle(); - mk_pre_post("speedtest1","vanilla", 0); - mk_pre_post("speedtest1-wasmfs","esm", "$(c-pp.D.sqlite3-bundler-friendly) -Dwasmfs"); + mk_pre_post("speedtest1","vanilla", 0, 0); + mk_pre_post("speedtest1-wasmfs","esm", 0, + "$(c-pp.D.sqlite3-bundler-friendly) -Dwasmfs"); return rc; } diff --git a/manifest b/manifest index 4343869548..dac984b02e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C wasm\smakefile\sdocs:\smake\sexplicit\sthat\sthe\snode.js-for-node.js\sbuilds\s(as\sopposed\sto\sthe\snode.js-for-browser\sbuilds)\sare\sboth\suntested\sand\sunsupported. -D 2025-02-20T04:45:02.076 +C wasm:\sdo\snot\sbuild\sthe\s(untested/unsupported)\snode-for-node\sbuild\sby\sdefault,\sto\scut\sbuild\stime\sby\sabout\s15%.\sAdjacent\scleanups\sin\smkwasmbuilds.c. +D 2025-02-20T05:39:18.599 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -619,7 +619,7 @@ F ext/session/sqlite3session.c 52a680dbb03c4734748b215d95987fb4d95ab23baaf053a01 F ext/session/sqlite3session.h aa5de3ec8ef0e5313e9f65dafd69e8ba292d170f07b57da9200c040068dab061 F ext/session/test_session.c 12e0a2c15fd60f92da4bb29c697c9177ff0c0dbcdc5129a54c47e999f147937a F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c -F ext/wasm/GNUmakefile afecad95600b0361865a81c4490743f54fd2a5a4db64e50b361a9db0cb0553f5 +F ext/wasm/GNUmakefile c6a98150911c8f882aa75a9fbf148b124c59b22078799f9f9c6061bfbb128a33 F ext/wasm/README-dist.txt f01081a850ce38a56706af6b481e3a7878e24e42b314cfcd4b129f0f8427066a F ext/wasm/README.md b89605f65661cf35bf034ff6d43e448cc169b8017fc105d498e33b81218b482c F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff @@ -680,7 +680,7 @@ F ext/wasm/index-dist.html 56132399702b15d70c474c3f1952541e25cb0922942868f70daf1 F ext/wasm/index.html bcaa00eca521b372a6a62c7e7b17a870b0fcdf3e418a5921df1fd61e5344080d F ext/wasm/jaccwabyt/jaccwabyt.js 1264710db3cfbcb6887d95665b7aeba60c1126eaef789ca4cf1a4a17d5bc7f54 F ext/wasm/jaccwabyt/jaccwabyt.md 59a20df389abcc3606eb4eaea7fb7ba14504beb3e345dbea9b99a0618ba3bec8 -F ext/wasm/mkwasmbuilds.c baf6636e139e2c1e3b56e8dc26073ec80f6d14ae1876b023985315f43ccf312b +F ext/wasm/mkwasmbuilds.c 57ce3c6e30c17078586dde9b5dec946f6a2d08f195067d4b6feefbc0bf1e0a4b F ext/wasm/module-symbols.html dc476b403369b26a1a23773e13b80f41b9a49f0825e81435fe3600a7cfbbe337 F ext/wasm/scratchpad-wasmfs.html a3d7388f3c4b263676b58b526846e9d02dfcb4014ff29d3a5040935286af5b96 F ext/wasm/scratchpad-wasmfs.mjs 66034b9256b218de59248aad796760a1584c1dd842231505895eff00dbd57c63 @@ -2210,8 +2210,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b5dbd521951e129b4dec69f191a872500dbf387b34a8479ad58b053ffcccbab9 -R 9e14f25c151c1ed248cfdda16fbb7871 +P e1f184889fef4603d61d306c8c0dc86df616290ccf73dbd871fa27bd99e5e5c9 +R 84806d4092a27a5838a354dffcfb957d U stephan -Z a5f06d7dda0edaff65b376e4feee5c8b +Z 323bb73cbee281d90dd439bde340e242 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index cad68956a7..891b7eaeca 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e1f184889fef4603d61d306c8c0dc86df616290ccf73dbd871fa27bd99e5e5c9 +e4539ebebd89840b76f5a0626393299100685a38f45546a0bf7a62e4df56f863 From 2a300a2853cf0f460563ecd491ec89d5c3717756 Mon Sep 17 00:00:00 2001 From: stephan Date: Thu, 20 Feb 2025 16:45:45 +0000 Subject: [PATCH 47/54] Fix autoconf bundle to honor the --disable-static and --disable-shared flags, as reported in [forum:ae5bd8a84b|forum post ae5bd8a84b]. Problem introduced in 3.49.0. FossilOrigin-Name: 56027220cc15b69cb98ba5360ffd3718c997e10d51e30eebeff14f0dc358d103 --- autoconf/Makefile.in | 8 ++++++-- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in index d494e9d1e0..8a9c2c7b3f 100644 --- a/autoconf/Makefile.in +++ b/autoconf/Makefile.in @@ -149,11 +149,15 @@ $(libsqlite3.SO): sqlite3.o $(CC) -o $@ sqlite3.o $(LDFLAGS.shlib) \ $(LDFLAGS) $(LDFLAGS.libsqlite3) \ $(LDFLAGS.libsqlite3.os-specific) $(LDFLAGS.libsqlite3.soname) -all: $(libsqlite3.SO) +$(libsqlite3.SO)-1: $(libsqlite3.SO) +$(libsqlite3.SO)-0: +all: $(libsqlite3.SO)-$(ENABLE_LIB_SHARED) $(libsqlite3.LIB): sqlite3.o $(AR) $(AR.flags) $@ sqlite3.o -all: $(libsqlite3.LIB) +$(libsqlite3.LIB)-1: $(libsqlite3.LIB) +$(libsqlite3.LIB)-0: +all: $(libsqlite3.LIB)-$(ENABLE_LIB_STATIC) install-so-1: $(install-dir.lib) $(libsqlite3.SO) $(INSTALL) $(libsqlite3.SO) "$(install-dir.lib)" diff --git a/manifest b/manifest index dac984b02e..b3754afc40 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C wasm:\sdo\snot\sbuild\sthe\s(untested/unsupported)\snode-for-node\sbuild\sby\sdefault,\sto\scut\sbuild\stime\sby\sabout\s15%.\sAdjacent\scleanups\sin\smkwasmbuilds.c. -D 2025-02-20T05:39:18.599 +C Fix\sautoconf\sbundle\sto\shonor\sthe\s--disable-static\sand\s--disable-shared\sflags,\sas\sreported\sin\s[forum:ae5bd8a84b|forum\spost\sae5bd8a84b].\sProblem\sintroduced\sin\s3.49.0. +D 2025-02-20T16:45:45.335 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -16,7 +16,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 F auto.def eddf6aef976e2c1a56c0accc3244945e0b22ec6799074c40be160e5a9a5662b0 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac -F autoconf/Makefile.in 844bc155e1c02075821530b2b4d996ab3d162e647352bb6e2895f3d0e64ad988 +F autoconf/Makefile.in ed042ba44540e67e17b1e7bd787e8118a9d14664ba8049966ec9bc54a10676ce F autoconf/Makefile.msc 1249e425a24859c7b3f17575275247df9eec3bddc0d1d7e73941f1abdbb95a92 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 @@ -2210,8 +2210,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e1f184889fef4603d61d306c8c0dc86df616290ccf73dbd871fa27bd99e5e5c9 -R 84806d4092a27a5838a354dffcfb957d +P e4539ebebd89840b76f5a0626393299100685a38f45546a0bf7a62e4df56f863 +R 34877b8b42b297ff0e60f31b146ccdd9 U stephan -Z 323bb73cbee281d90dd439bde340e242 +Z 1623c39947cf064dc746ab5f77cf216c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 891b7eaeca..d46913efa2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e4539ebebd89840b76f5a0626393299100685a38f45546a0bf7a62e4df56f863 +56027220cc15b69cb98ba5360ffd3718c997e10d51e30eebeff14f0dc358d103 From a80089c5167856f0aadc9c878bd65843df724c06 Mon Sep 17 00:00:00 2001 From: stephan Date: Thu, 20 Feb 2025 17:14:40 +0000 Subject: [PATCH 48/54] configure: automatically fail the check for rpath on AIX systems and provide a --disable-rpath flag as a fallback for use on platforms which pass the configure-time rpath check but then fail at link-time. Based on discussion in [forum:ae5bd8a84b|forum thread ae5bd8a84b]. FossilOrigin-Name: a15e0f6802a5ba7bc5a7a70d6a162ea4548b49b132a5ac31263e64c388bbafcb --- auto.def | 2 +- autoconf/auto.def | 2 +- autosetup/proj.tcl | 18 ++++++++++++++---- autosetup/sqlite-config.tcl | 14 ++++++++++++++ manifest | 18 +++++++++--------- manifest.uuid | 2 +- 6 files changed, 40 insertions(+), 16 deletions(-) diff --git a/auto.def b/auto.def index 9df87f579a..84dfa824c2 100644 --- a/auto.def +++ b/auto.def @@ -59,7 +59,7 @@ proj-define-for-opt linemacros AMALGAMATION_LINE_MACROS \ define LINK_TOOLS_DYNAMICALLY [proj-opt-was-provided dynlink-tools] -proj-check-rpath +sqlite-handle-rpath sqlite-handle-soname sqlite-handle-debug sqlite-handle-tcl diff --git a/autoconf/auto.def b/autoconf/auto.def index 099b52aff7..069f3e931f 100644 --- a/autoconf/auto.def +++ b/autoconf/auto.def @@ -11,7 +11,7 @@ use sqlite-config sqlite-config-bootstrap autoconf sqlite-check-common-bins sqlite-check-common-system-deps -proj-check-rpath +sqlite-handle-rpath sqlite-handle-soname sqlite-setup-default-cflags sqlite-handle-debug diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index c81fe910d0..210c79b428 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -947,9 +947,20 @@ proc proj-check-emsdk {} { # # Achtung: we have seen platforms which report that a given option # checked here will work but then fails at build-time, and the current -# order of checks reflects that. +# order of checks reflects that. Similarly, platforms which are known +# to report success here but fail to handle this flag at link-time are +# special-cased here to behave as if the check failed. proc proj-check-rpath {} { - set rc 1 + switch -glob -- [get-define host] { + *-*-aix* { + # Skip this check on platform(s) where we know it to pass at + # this step but fail at build-time, as a workaround for + # https://sqlite.org/forum/forumpost/ae5bd8a84b until we can + # find a more reliable approach. + define LDFLAGS_RPATH "" + return 0 + } + } if {[proj-opt-was-provided libdir] || [proj-opt-was-provided exec-prefix]} { set lp "[get-define libdir]" @@ -971,10 +982,9 @@ proc proj-check-rpath {} { define LDFLAGS_RPATH "-Wl,-R$lp" } else { define LDFLAGS_RPATH "" - set rc 0 } } - return $rc + expr {"" ne [get-define LDFLAGS_RPATH]} } ######################################################################## diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 7d9a9ea84b..be2522fb12 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -244,6 +244,9 @@ proc sqlite-config-bootstrap {buildMode} { static-shell=1 => {Link the sqlite3 shell app against the DLL instead of embedding sqlite3.c} } {*} { + # rpath: https://sqlite.org/forum/forumpost/fa3a6ed858 + rpath=1 + => {Disable checking for rpath support} # soname: https://sqlite.org/src/forumpost/5a3b44f510df8ded soname:=legacy => {SONAME for libsqlite3.so. "none", or not using this flag, sets no @@ -644,6 +647,17 @@ proc sqlite-handle-debug {} { } } +######################################################################## +# If the --disable-rpath flag is used, this [define]s LDFLAGS_RPATH to +# an empty string, else it invokes [proj-check-rpath]. +proc sqlite-handle-rpath {} { + proj-if-opt-truthy rpath { + proj-check-rpath + } { + define LDFLAGS_RPATH "" + } +} + ######################################################################## # "soname" for libsqlite3.so. See discussion at: # https://sqlite.org/src/forumpost/5a3b44f510df8ded diff --git a/manifest b/manifest index b3754afc40..6e5b6edfe0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sautoconf\sbundle\sto\shonor\sthe\s--disable-static\sand\s--disable-shared\sflags,\sas\sreported\sin\s[forum:ae5bd8a84b|forum\spost\sae5bd8a84b].\sProblem\sintroduced\sin\s3.49.0. -D 2025-02-20T16:45:45.335 +C configure:\sautomatically\sfail\sthe\scheck\sfor\srpath\son\sAIX\ssystems\sand\sprovide\sa\s--disable-rpath\sflag\sas\sa\sfallback\sfor\suse\son\splatforms\swhich\spass\sthe\sconfigure-time\srpath\scheck\sbut\sthen\sfail\sat\slink-time.\sBased\son\sdiscussion\sin\s[forum:ae5bd8a84b|forum\sthread\sae5bd8a84b]. +D 2025-02-20T17:14:40.228 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -14,13 +14,13 @@ F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 -F auto.def eddf6aef976e2c1a56c0accc3244945e0b22ec6799074c40be160e5a9a5662b0 +F auto.def 9e4315ae57d558c033a7bfb1f3ba0e9e0117147516b8c78c06276663b83b8cad F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac F autoconf/Makefile.in ed042ba44540e67e17b1e7bd787e8118a9d14664ba8049966ec9bc54a10676ce F autoconf/Makefile.msc 1249e425a24859c7b3f17575275247df9eec3bddc0d1d7e73941f1abdbb95a92 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 -F autoconf/auto.def 3a318c4898024b35ed61a4876a42e3dcc313f93bd8486874d1ad498b88643d1a +F autoconf/auto.def 64c1a116162da18783a5467b49e539538f7013ea50ae192f182987b5c2f66f9e F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 @@ -49,8 +49,8 @@ F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1d F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl 90cec210224dde699f3bee756d88c2477044f713db8a38112e695ec02e531eeb -F autosetup/sqlite-config.tcl e1d65cc632e1de94ff39618ac82b649f2062f674ca36dae78ab3573cab096761 +F autosetup/proj.tcl 57dadc3b9a1e88e8450d1e81b2fdb22d3abf3862f22730cec4441ee346c95d8e +F autosetup/sqlite-config.tcl 87732c140cce3327b709d1f7746c999149500fd28682dff384da58af68c844b0 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2210,8 +2210,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e4539ebebd89840b76f5a0626393299100685a38f45546a0bf7a62e4df56f863 -R 34877b8b42b297ff0e60f31b146ccdd9 +P 56027220cc15b69cb98ba5360ffd3718c997e10d51e30eebeff14f0dc358d103 +R f3ae16535d715f2c6ddf37b01c3a97d9 U stephan -Z 1623c39947cf064dc746ab5f77cf216c +Z e0fc1942290bf1287975667fbad9ae43 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d46913efa2..72543de028 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -56027220cc15b69cb98ba5360ffd3718c997e10d51e30eebeff14f0dc358d103 +a15e0f6802a5ba7bc5a7a70d6a162ea4548b49b132a5ac31263e64c388bbafcb From 220260b8965eb264cab8cb5ee42baacb08ef1eb4 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 21 Feb 2025 03:19:21 +0000 Subject: [PATCH 49/54] configure: in several places where support for -Wl,... linker flags are checked, ensure that the check invokes the linker (not just the compiler) to avoid false positives. This allows us to remove the AIX-specific handling and --disable-rpath bits added in [a15e0f680], as well as make several similar checks more robust. FossilOrigin-Name: 4e81e2c707a954dcda6219dc94e2b96dd0c9907bd4beab28adad51d488b7d739 --- auto.def | 2 +- autoconf/auto.def | 2 +- autosetup/proj.tcl | 20 ++------------------ autosetup/sqlite-config.tcl | 30 +++++++++++------------------- manifest | 18 +++++++++--------- manifest.uuid | 2 +- 6 files changed, 25 insertions(+), 49 deletions(-) diff --git a/auto.def b/auto.def index 84dfa824c2..9df87f579a 100644 --- a/auto.def +++ b/auto.def @@ -59,7 +59,7 @@ proj-define-for-opt linemacros AMALGAMATION_LINE_MACROS \ define LINK_TOOLS_DYNAMICALLY [proj-opt-was-provided dynlink-tools] -sqlite-handle-rpath +proj-check-rpath sqlite-handle-soname sqlite-handle-debug sqlite-handle-tcl diff --git a/autoconf/auto.def b/autoconf/auto.def index 069f3e931f..099b52aff7 100644 --- a/autoconf/auto.def +++ b/autoconf/auto.def @@ -11,7 +11,7 @@ use sqlite-config sqlite-config-bootstrap autoconf sqlite-check-common-bins sqlite-check-common-system-deps -sqlite-handle-rpath +proj-check-rpath sqlite-handle-soname sqlite-setup-default-cflags sqlite-handle-debug diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index 210c79b428..c11b05d5f7 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -944,23 +944,7 @@ proc proj-check-emsdk {} { # --exec-prefix=... or --libdir=... are explicitly passed to # configure then [get-define libdir] is used (noting that it derives # from exec-prefix by default). -# -# Achtung: we have seen platforms which report that a given option -# checked here will work but then fails at build-time, and the current -# order of checks reflects that. Similarly, platforms which are known -# to report success here but fail to handle this flag at link-time are -# special-cased here to behave as if the check failed. proc proj-check-rpath {} { - switch -glob -- [get-define host] { - *-*-aix* { - # Skip this check on platform(s) where we know it to pass at - # this step but fail at build-time, as a workaround for - # https://sqlite.org/forum/forumpost/ae5bd8a84b until we can - # find a more reliable approach. - define LDFLAGS_RPATH "" - return 0 - } - } if {[proj-opt-was-provided libdir] || [proj-opt-was-provided exec-prefix]} { set lp "[get-define libdir]" @@ -971,7 +955,7 @@ proc proj-check-rpath {} { # CFLAGS or LIBS or whatever it is that cc-check-flags updates) then # downstream tests may fail because the resulting rpath gets # implicitly injected into them. - cc-with {} { + cc-with {-link 1} { if {[cc-check-flags "-rpath $lp"]} { define LDFLAGS_RPATH "-rpath $lp" } elseif {[cc-check-flags "-Wl,-rpath,$lp"]} { @@ -1001,7 +985,7 @@ proc proj-check-rpath {} { # potentially avoid some end-user confusion by using their own lib's # name here (which shows up in the "checking..." output). proc proj-check-soname {{libname "libfoo.so.0"}} { - cc-with {} { + cc-with {-link 1} { if {[cc-check-flags "-Wl,-soname,${libname}"]} { define LDFLAGS_SONAME_PREFIX "-Wl,-soname," return 1 diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index be2522fb12..856be4cabc 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -244,9 +244,6 @@ proc sqlite-config-bootstrap {buildMode} { static-shell=1 => {Link the sqlite3 shell app against the DLL instead of embedding sqlite3.c} } {*} { - # rpath: https://sqlite.org/forum/forumpost/fa3a6ed858 - rpath=1 - => {Disable checking for rpath support} # soname: https://sqlite.org/src/forumpost/5a3b44f510df8ded soname:=legacy => {SONAME for libsqlite3.so. "none", or not using this flag, sets no @@ -647,17 +644,6 @@ proc sqlite-handle-debug {} { } } -######################################################################## -# If the --disable-rpath flag is used, this [define]s LDFLAGS_RPATH to -# an empty string, else it invokes [proj-check-rpath]. -proc sqlite-handle-rpath {} { - proj-if-opt-truthy rpath { - proj-check-rpath - } { - define LDFLAGS_RPATH "" - } -} - ######################################################################## # "soname" for libsqlite3.so. See discussion at: # https://sqlite.org/src/forumpost/5a3b44f510df8ded @@ -1240,7 +1226,7 @@ proc sqlite-check-mac-cversion {} { define LDFLAGS_MAC_CVERSION "" set rc 0 if {[proj-looks-like-mac]} { - cc-with {} { + cc-with {-link 1} { # These version numbers are historical libtool-defined values, not # library-defined ones if {[cc-check-flags "-Wl,-current_version,9.6.0"] @@ -1264,16 +1250,19 @@ proc sqlite-check-mac-cversion {} { # (e.g. mingw). Returns 1 if supported, else 0. # # If the configure flag --out-implib is not used then this is a no-op. -# The feature is specifically opt-in because on some platforms the -# feature test will pass but using that flag will fail at link-time -# (e.g. OpenBSD). +# If that flag is used but the capability is not available, a fatal +# error is triggered. +# +# This feature is specifically opt-in because it's supported on far +# more platforms than actually need it and enabling it causes creation +# of libsqlite3.so.a files which are unnecessary in most environments. # # Added in response to: https://sqlite.org/forum/forumpost/0c7fc097b2 proc sqlite-check-out-implib {} { define LDFLAGS_OUT_IMPLIB "" set rc 0 if {[proj-opt-was-provided out-implib]} { - cc-with {} { + cc-with {-link 1} { set dll "libsqlite3[get-define TARGET_DLLEXT]" set flags "-Wl,--out-implib,${dll}.a" if {[cc-check-flags $flags]} { @@ -1281,6 +1270,9 @@ proc sqlite-check-out-implib {} { set rc 1 } } + if {!$rc} { + user-error "--out-implib is not supported on this platform" + } } return $rc } diff --git a/manifest b/manifest index 6e5b6edfe0..89f3436486 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C configure:\sautomatically\sfail\sthe\scheck\sfor\srpath\son\sAIX\ssystems\sand\sprovide\sa\s--disable-rpath\sflag\sas\sa\sfallback\sfor\suse\son\splatforms\swhich\spass\sthe\sconfigure-time\srpath\scheck\sbut\sthen\sfail\sat\slink-time.\sBased\son\sdiscussion\sin\s[forum:ae5bd8a84b|forum\sthread\sae5bd8a84b]. -D 2025-02-20T17:14:40.228 +C configure:\sin\sseveral\splaces\swhere\ssupport\sfor\s-Wl,...\slinker\sflags\sare\schecked,\sensure\sthat\sthe\scheck\sinvokes\sthe\slinker\s(not\sjust\sthe\scompiler)\sto\savoid\sfalse\spositives.\sThis\sallows\sus\sto\sremove\sthe\sAIX-specific\shandling\sand\s--disable-rpath\sbits\sadded\sin\s[a15e0f680],\sas\swell\sas\smake\sseveral\ssimilar\schecks\smore\srobust. +D 2025-02-21T03:19:21.417 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -14,13 +14,13 @@ F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 -F auto.def 9e4315ae57d558c033a7bfb1f3ba0e9e0117147516b8c78c06276663b83b8cad +F auto.def eddf6aef976e2c1a56c0accc3244945e0b22ec6799074c40be160e5a9a5662b0 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac F autoconf/Makefile.in ed042ba44540e67e17b1e7bd787e8118a9d14664ba8049966ec9bc54a10676ce F autoconf/Makefile.msc 1249e425a24859c7b3f17575275247df9eec3bddc0d1d7e73941f1abdbb95a92 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 -F autoconf/auto.def 64c1a116162da18783a5467b49e539538f7013ea50ae192f182987b5c2f66f9e +F autoconf/auto.def 3a318c4898024b35ed61a4876a42e3dcc313f93bd8486874d1ad498b88643d1a F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 @@ -49,8 +49,8 @@ F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1d F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl 57dadc3b9a1e88e8450d1e81b2fdb22d3abf3862f22730cec4441ee346c95d8e -F autosetup/sqlite-config.tcl 87732c140cce3327b709d1f7746c999149500fd28682dff384da58af68c844b0 +F autosetup/proj.tcl cd6134e98d06ab4ae3be746d185dcdbf5180bfa049fe46a6726e703f56ea2f9c +F autosetup/sqlite-config.tcl 9d1e3bbc561af5f8705f96c0f48252112d3e2d3356383f5529f7f9f7b51afb65 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2210,8 +2210,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 56027220cc15b69cb98ba5360ffd3718c997e10d51e30eebeff14f0dc358d103 -R f3ae16535d715f2c6ddf37b01c3a97d9 +P a15e0f6802a5ba7bc5a7a70d6a162ea4548b49b132a5ac31263e64c388bbafcb +R 42c23a2d2b7be27c2c7a4de01b0af4e3 U stephan -Z e0fc1942290bf1287975667fbad9ae43 +Z 369390f432e27c3785cf51965afea95c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 72543de028..b9eb88d3ff 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a15e0f6802a5ba7bc5a7a70d6a162ea4548b49b132a5ac31263e64c388bbafcb +4e81e2c707a954dcda6219dc94e2b96dd0c9907bd4beab28adad51d488b7d739 From ce25007db8df01e3271486574d520d4dea4cf97a Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 21 Feb 2025 17:03:22 +0000 Subject: [PATCH 50/54] Detect when a UNIQUE or PRIMARY KEY on a WITHOUT ROWID table would need to use more than SQLITE_LIMIT_COLUMN columns and raise an error. Also include some unrelated compiler warning fixes. FossilOrigin-Name: d7729dbbf231d57cbcaaa5004d0a9c4957f112dd6520052995b232aa521c0ca3 --- manifest | 34 +++++++++++++++++----------------- manifest.uuid | 2 +- src/alter.c | 34 +++++++++++++++++++++------------- src/build.c | 22 +++++++++++++++++----- src/expr.c | 2 +- src/insert.c | 2 +- src/parse.y | 4 ++-- src/select.c | 12 ++++++------ src/sqliteInt.h | 10 +++++----- src/sqliteLimit.h | 6 ++++-- src/status.c | 7 ++++--- src/window.c | 2 +- test/without_rowid1.test | 20 ++++++++++++++++++++ 13 files changed, 100 insertions(+), 57 deletions(-) diff --git a/manifest b/manifest index 89f3436486..bb9dfef35a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C configure:\sin\sseveral\splaces\swhere\ssupport\sfor\s-Wl,...\slinker\sflags\sare\schecked,\sensure\sthat\sthe\scheck\sinvokes\sthe\slinker\s(not\sjust\sthe\scompiler)\sto\savoid\sfalse\spositives.\sThis\sallows\sus\sto\sremove\sthe\sAIX-specific\shandling\sand\s--disable-rpath\sbits\sadded\sin\s[a15e0f680],\sas\swell\sas\smake\sseveral\ssimilar\schecks\smore\srobust. -D 2025-02-21T03:19:21.417 +C Detect\swhen\sa\sUNIQUE\sor\sPRIMARY\sKEY\son\sa\sWITHOUT\sROWID\stable\swould\sneed\nto\suse\smore\sthan\sSQLITE_LIMIT_COLUMN\scolumns\sand\sraise\san\serror.\nAlso\sinclude\ssome\sunrelated\scompiler\swarning\sfixes. +D 2025-02-21T17:03:22.433 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -715,7 +715,7 @@ F mptest/multiwrite01.test dab5c5f8f9534971efce679152c5146da265222d F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b F sqlite3.1 acdff36db796e2d00225b911d3047d580cd136547298435426ce9d40347973cc F sqlite3.pc.in 0977c03a4da7c4204bd60e784a0efb8d51a190448aba78a4e973fe7192bdaf03 -F src/alter.c 1751e231d8385067fa0d0145f0d461a092db6bd3d7edbfc3172db625aceccd9a +F src/alter.c 04cad1defb7262937e586b0529f3a524ac825aa283341e326546cf08de35b209 F src/analyze.c 6d27b425a16817975e6a4f8501e531d13dd1bf4b53bff2329dbc1f301aeef82d F src/attach.c c36d9d82811e2274bd06bf3b34459e36d8ae8a7f32efa5cbf3f890eef08a9987 F src/auth.c 54ab9c6c5803b47c0d45b76ce27eff22a03b4b1f767c5945a3a4eb13aa4c78dc @@ -725,14 +725,14 @@ F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522 F src/btree.c 9316859aa5f14bde4a3719ffb1570219e51c5de433221e38b87ea19db868aedf F src/btree.h 18e5e7b2124c23426a283523e5f31a4bff029131b795bb82391f9d2f3136fc50 F src/btreeInt.h 98aadb6dcb77b012cab2574d6a728fad56b337fc946839b9898c4b4c969e30b6 -F src/build.c 2fa35745a279e2a17eec6df67a3cd35d456c136a7f5c75e80bdd6c5658423b60 +F src/build.c c2bcfc7e5072a743a051699f06329ee206299729adf4323fed9be8aa2d64af73 F src/callback.c acae8c8dddda41ee85cfdf19b926eefe830f371069f8aadca3aa39adf5b1c859 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/date.c 842c08ac143a56a627b05ac51d68624f2b7b03e3b4cba596205e735eed64ee57 F src/dbpage.c 2e677acb658a29965e55398bbc61161cb7819da538057c8032adac7ab8e4a8c0 F src/dbstat.c 73362c0df0f40ad5523a6f5501224959d0976757b511299bf892313e79d14f5c F src/delete.c 03a77ba20e54f0f42ebd8eddf15411ed6bdb06a2c472ac4b6b336521bf7cea42 -F src/expr.c 6e0635f3e3761f368d10e77d26d29a1a521ab208f1be66e84c13354ffbcf5ad2 +F src/expr.c 6769d3f0ca9b1792e883e3ff21fdc5ca0033cece65571ebbf9d8b8fe2f47cd27 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c 928ed2517e8732113d2b9821aa37af639688d752f4ea9ac6e0e393d713eeb76f F src/func.c 6c8b7bbdc5b588f3cfc79ed5effcfd3031758f5034c464fcd8891e8010b4d317 @@ -741,7 +741,7 @@ F src/hash.c 73934a7f7ab1cb110614a9388cb516893b0cf5b7b69e4fd1a0780ac4ce166be7 F src/hash.h 46b92795a95bfefb210f52f0c316e9d7cdbcdd7e7fcfb0d8be796d3a5767cddf F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6 F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 -F src/insert.c 05e04ef637cbc0dccb9a5c5d188a5a2608891e554c8ec17c7a71afe2cf896a06 +F src/insert.c a5f0366266be993ebf533808f22cb7a788624805b55bc45424ceed3f48c54a16 F src/json.c 5abb5cb782e74451a8882f6b7ee4d5e629246642262660bd1980a5e1b796258d F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 7432c944ff197046d67a1207790a1b13eec4548c85a9457eb0896bb3641dfb36 @@ -771,7 +771,7 @@ F src/os_win.c 2423a45e70c2cda01bfc84106f7e9f34feb1add42121ab2e35a67ba24589ac52 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a F src/pager.c 8d73e7a0ebbecd8bb4996ff285cc055cec56b7e3edb5a4609d0748e0fa39d28a F src/pager.h 6137149346e6c8a3ddc1eeb40aee46381e9bc8b0fcc6dda8a1efde993c2275b8 -F src/parse.y f84673f1454e2bcf517623d4346e67fb2d73e57826ea103681ad5848238f6029 +F src/parse.y 4e62b0b301673d404b8aff7c9d84ee8636e5ff59f45c90cdce4c8845a1289837 F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484 F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5 F src/pcache1.c 78d4935e510f7bed0fdd1a3f742c0e663b36a795f9dc7411161dc22bdae1245e @@ -781,14 +781,14 @@ F src/printf.c b9ac740dfaf68552f5da1266be28ae2824b53a6b73d93425f7c6b2ef62457cbb F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 626c24b258b111f75c22107aa5614ad89810df3026f5ca071116d3fe75925c75 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 -F src/select.c 57893cc8b099f231f7ed5b84faff14841f2aabb4776e32e17fae00aeae0a8993 +F src/select.c a076f7db3a0fcbd9f710d7746cfc07e0b3baadee45eb3136bedc29c598ef8f1c F src/shell.c.in bf997e43faaa1ef0ff78d4d7b9be6a9430cf1edda9a47a14e7fef646fcb459af F src/sqlite.h.in 8d4486fb28a90de818ac1e8c6206ea458e7de6bd8e0dfa3d554494f155be8c01 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 -F src/sqliteInt.h 020aff180111b7dfe5bbdf8e59e8595c195b956488e9ca955f876cb7482e6de5 -F src/sqliteLimit.h 1bbdbf72bd0411d003267ffebc59a262f061df5653027a75627d03f48ca30523 -F src/status.c cb11f8589a6912af2da3bb1ec509a94dd8ef27df4d4c1a97e0bcf2309ece972b +F src/sqliteInt.h a5c850981cff99331b2ed48d519fb54a47f5f91c680e2cab64d91e259685de69 +F src/sqliteLimit.h b963c1e8c48791cc5cf733bb33e4741d0fbb7d0650cc2344cce5e4c17be4e8fd +F src/status.c 0e72e4f6be6ccfde2488eb63210297e75f569f3ce9920f6c3d77590ec6ce5ffd F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 F src/tclsqlite.c 5c1e367e26711044730c93d4b81312170918a8d1fe811f45be740ab48f7de8c1 F src/tclsqlite.h 65e2c761446e1c9fa0342b7d2612a703483643c8b6a316d12a65b745a4727395 @@ -869,7 +869,7 @@ F src/where.c 09dc313e7223ca1217c39c7026b00f16ff449a8323511a762fcba7863a00f4cd F src/whereInt.h d20cddddb1d61b18d5cb1fcfa9b77fbeebbc4afe44d996e603452a23b3009ee1 F src/wherecode.c 5baa06f0daae7d38aca1d4814030b82ad4f127fe6bad18f0644776a474f6088b F src/whereexpr.c 2415c8eee5ff89a8b709d7d83d71c1ff986cd720d0520057e1d8a5371339012a -F src/window.c 2bf01f9941a64fbcead61a0e3cb5db3fca5094b30d2ff0d23274c2a81d2e2385 +F src/window.c d01227141f622f24fbe36ca105fbe6ef023f9fd98f1ccd65da95f88886565db5 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/affinity2.test ce1aafc86e110685b324e9a763eab4f2a73f737842ec3b687bd965867de90627 F test/affinity3.test f094773025eddf31135c7ad4cde722b7696f8eb07b97511f98585addf2a510a9 @@ -2095,7 +2095,7 @@ F test/with4.test 257be66c0c67fee1defbbac0f685c3465e2cad037f21ce65f23f86084f1982 F test/with5.test 6248213c41fab36290b5b73aa3f937309dfba337004d9d8434c3fabc8c7d4be8 F test/with6.test 281e4861b5e517f6c3c2f08517a520c1e2ee7c11966545d3901f258a4fe8ef76 F test/withM.test 693b61765f2b387b5e3e24a4536e2e82de15ff64 -F test/without_rowid1.test a5210b8770dc4736bca4e74bc96588f43025ad03ad6a80f885afd36d9890e217 +F test/without_rowid1.test 7120af676485e68930d3e513d083f3644622893477901f55eec954387125d550 F test/without_rowid2.test af260339f79d13cb220288b67cd287fbcf81ad99 F test/without_rowid3.test 39ab0dd773eaa62e59b17093f875327630f54c4145458f6d2b053d68d4b2f67b F test/without_rowid4.test 4e08bcbaee0399f35d58b5581881e7a6243d458a @@ -2210,8 +2210,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P a15e0f6802a5ba7bc5a7a70d6a162ea4548b49b132a5ac31263e64c388bbafcb -R 42c23a2d2b7be27c2c7a4de01b0af4e3 -U stephan -Z 369390f432e27c3785cf51965afea95c +P 4e81e2c707a954dcda6219dc94e2b96dd0c9907bd4beab28adad51d488b7d739 +R 92107357485b715229de5818697d5fcf +U drh +Z 4c75b5945df64c93f9907a88e623cba4 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index b9eb88d3ff..6c0f837bd5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4e81e2c707a954dcda6219dc94e2b96dd0c9907bd4beab28adad51d488b7d739 +d7729dbbf231d57cbcaaa5004d0a9c4957f112dd6520052995b232aa521c0ca3 diff --git a/src/alter.c b/src/alter.c index 5f706b513f..3c8a6c3a18 100644 --- a/src/alter.c +++ b/src/alter.c @@ -531,13 +531,13 @@ void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){ assert( pNew->nCol>0 ); nAlloc = (((pNew->nCol-1)/8)*8)+8; assert( nAlloc>=pNew->nCol && nAlloc%8==0 && nAlloc-pNew->nCol<8 ); - pNew->aCol = (Column*)sqlite3DbMallocZero(db, sizeof(Column)*nAlloc); + pNew->aCol = (Column*)sqlite3DbMallocZero(db, sizeof(Column)*(u32)nAlloc); pNew->zName = sqlite3MPrintf(db, "sqlite_altertab_%s", pTab->zName); if( !pNew->aCol || !pNew->zName ){ assert( db->mallocFailed ); goto exit_begin_add_column; } - memcpy(pNew->aCol, pTab->aCol, sizeof(Column)*pNew->nCol); + memcpy(pNew->aCol, pTab->aCol, sizeof(Column)*(size_t)pNew->nCol); for(i=0; inCol; i++){ Column *pCol = &pNew->aCol[i]; pCol->zCnName = sqlite3DbStrDup(db, pCol->zCnName); @@ -1144,7 +1144,13 @@ static int renameParseSql( if( sqlite3StrNICmp(zSql,"CREATE ",7)!=0 ){ return SQLITE_CORRUPT_BKPT; } - db->init.iDb = bTemp ? 1 : sqlite3FindDbName(db, zDb); + if( bTemp ){ + db->init.iDb = 1; + }else{ + int iDb = sqlite3FindDbName(db, zDb); + assert( iDb>=0 && iDb<=0xff ); + db->init.iDb = (u8)iDb; + } p->eParseMode = PARSE_MODE_RENAME; p->db = db; p->nQueryLoop = 1; @@ -1211,10 +1217,11 @@ static int renameEditSql( nQuot = sqlite3Strlen30(zQuot)-1; } - assert( nQuot>=nNew ); - zOut = sqlite3DbMallocZero(db, nSql + pRename->nList*nQuot + 1); + assert( nQuot>=nNew && nSql>0 && nNew>0 ); + zOut = sqlite3DbMallocZero(db, (u64)(nSql + pRename->nList*nQuot + 1)); }else{ - zOut = (char*)sqlite3DbMallocZero(db, (nSql*2+1) * 3); + assert( nSql>0 ); + zOut = (char*)sqlite3DbMallocZero(db, (u64)(nSql*2+1) * 3); if( zOut ){ zBuf1 = &zOut[nSql*2+1]; zBuf2 = &zOut[nSql*4+2]; @@ -1226,16 +1233,17 @@ static int renameEditSql( ** with the new column name, or with single-quoted versions of themselves. ** All that remains is to construct and return the edited SQL string. */ if( zOut ){ - int nOut = nSql; - memcpy(zOut, zSql, nSql); + i64 nOut = nSql; + assert( nSql>0 ); + memcpy(zOut, zSql, (size_t)nSql); while( pRename->pList ){ int iOff; /* Offset of token to replace in zOut */ - u32 nReplace; + i64 nReplace; const char *zReplace; RenameToken *pBest = renameColumnTokenNext(pRename); if( zNew ){ - if( bQuote==0 && sqlite3IsIdChar(*pBest->t.z) ){ + if( bQuote==0 && sqlite3IsIdChar(*(u8*)pBest->t.z) ){ nReplace = nNew; zReplace = zNew; }else{ @@ -1547,7 +1555,7 @@ static void renameColumnFunc( if( sParse.pNewTable ){ if( IsView(sParse.pNewTable) ){ Select *pSelect = sParse.pNewTable->u.view.pSelect; - pSelect->selFlags &= ~SF_View; + pSelect->selFlags &= ~(u32)SF_View; sParse.rc = SQLITE_OK; sqlite3SelectPrep(&sParse, pSelect, 0); rc = (db->mallocFailed ? SQLITE_NOMEM : sParse.rc); @@ -1765,7 +1773,7 @@ static void renameTableFunc( sNC.pParse = &sParse; assert( pSelect->selFlags & SF_View ); - pSelect->selFlags &= ~SF_View; + pSelect->selFlags &= ~(u32)SF_View; sqlite3SelectPrep(&sParse, pTab->u.view.pSelect, &sNC); if( sParse.nErr ){ rc = sParse.rc; @@ -1938,7 +1946,7 @@ static void renameQuotefixFunc( if( sParse.pNewTable ){ if( IsView(sParse.pNewTable) ){ Select *pSelect = sParse.pNewTable->u.view.pSelect; - pSelect->selFlags &= ~SF_View; + pSelect->selFlags &= ~(u32)SF_View; sParse.rc = SQLITE_OK; sqlite3SelectPrep(&sParse, pSelect, 0); rc = (db->mallocFailed ? SQLITE_NOMEM : sParse.rc); diff --git a/src/build.c b/src/build.c index 986201bfb4..18bf27b833 100644 --- a/src/build.c +++ b/src/build.c @@ -1067,10 +1067,16 @@ Index *sqlite3PrimaryKeyIndex(Table *pTab){ ** find the (first) offset of that column in index pIdx. Or return -1 ** if column iCol is not used in index pIdx. */ -i16 sqlite3TableColumnToIndex(Index *pIdx, i16 iCol){ +i16 sqlite3TableColumnToIndex(Index *pIdx, int iCol){ int i; + i16 iCol16; + assert( iCol>=(-1) && iCol<=SQLITE_MAX_COLUMN ); + assert( pIdx->nColumn<=SQLITE_MAX_COLUMN ); + iCol16 = iCol; for(i=0; inColumn; i++){ - if( iCol==pIdx->aiColumn[i] ) return i; + if( iCol16==pIdx->aiColumn[i] ){ + return i; + } } return -1; } @@ -2167,10 +2173,16 @@ static char *createTableStmt(sqlite3 *db, Table *p){ ** Resize an Index object to hold N columns total. Return SQLITE_OK ** on success and SQLITE_NOMEM on an OOM error. */ -static int resizeIndexObject(sqlite3 *db, Index *pIdx, int N){ +static int resizeIndexObject(Parse *pParse, Index *pIdx, int N){ char *zExtra; int nByte; + sqlite3 *db; if( pIdx->nColumn>=N ) return SQLITE_OK; + db = pParse->db; + if( N>db->aLimit[SQLITE_LIMIT_COLUMN] ){ + sqlite3ErrorMsg(pParse, "too many columns on %s", pIdx->zName); + return SQLITE_ERROR; + } assert( pIdx->isResized==0 ); nByte = (sizeof(char*) + sizeof(LogEst) + sizeof(i16) + 1)*N; zExtra = sqlite3DbMallocZero(db, nByte); @@ -2440,7 +2452,7 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ pIdx->nColumn = pIdx->nKeyCol; continue; } - if( resizeIndexObject(db, pIdx, pIdx->nKeyCol+n) ) return; + if( resizeIndexObject(pParse, pIdx, pIdx->nKeyCol+n) ) return; for(i=0, j=pIdx->nKeyCol; inKeyCol, pPk, i) ){ testcase( hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ); @@ -2464,7 +2476,7 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ if( !hasColumn(pPk->aiColumn, nPk, i) && (pTab->aCol[i].colFlags & COLFLAG_VIRTUAL)==0 ) nExtra++; } - if( resizeIndexObject(db, pPk, nPk+nExtra) ) return; + if( resizeIndexObject(pParse, pPk, nPk+nExtra) ) return; for(i=0, j=nPk; inCol; i++){ if( !hasColumn(pPk->aiColumn, j, i) && (pTab->aCol[i].colFlags & COLFLAG_VIRTUAL)==0 diff --git a/src/expr.c b/src/expr.c index 0f86e126de..f6b5729b4b 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1963,7 +1963,7 @@ Select *sqlite3SelectDup(sqlite3 *db, const Select *pDup, int flags){ pNew->pLimit = sqlite3ExprDup(db, p->pLimit, flags); pNew->iLimit = 0; pNew->iOffset = 0; - pNew->selFlags = p->selFlags & ~SF_UsesEphemeral; + pNew->selFlags = p->selFlags & ~(u32)SF_UsesEphemeral; pNew->addrOpenEphm[0] = -1; pNew->addrOpenEphm[1] = -1; pNew->nSelectRow = p->nSelectRow; diff --git a/src/insert.c b/src/insert.c index c1ca1897ed..7dc9bfd8b1 100644 --- a/src/insert.c +++ b/src/insert.c @@ -693,7 +693,7 @@ Select *sqlite3MultiValues(Parse *pParse, Select *pLeft, ExprList *pRow){ f = (f & pLeft->selFlags); } pSelect = sqlite3SelectNew(pParse, pRow, 0, 0, 0, 0, 0, f, 0); - pLeft->selFlags &= ~SF_MultiValue; + pLeft->selFlags &= ~(u32)SF_MultiValue; if( pSelect ){ pSelect->op = TK_ALL; pSelect->pPrior = pLeft; diff --git a/src/parse.y b/src/parse.y index 76c9a8e4ed..65a15f8c49 100644 --- a/src/parse.y +++ b/src/parse.y @@ -617,8 +617,8 @@ selectnowith(A) ::= selectnowith(A) multiselect_op(Y) oneselect(Z). { if( pRhs ){ pRhs->op = (u8)Y; pRhs->pPrior = pLhs; - if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue; - pRhs->selFlags &= ~SF_MultiValue; + if( ALWAYS(pLhs) ) pLhs->selFlags &= ~(u32)SF_MultiValue; + pRhs->selFlags &= ~(u32)SF_MultiValue; if( Y!=TK_ALL ) pParse->hasCompound = 1; }else{ sqlite3SelectDelete(pParse->db, pLhs); diff --git a/src/select.c b/src/select.c index e47a9b6be2..e7db195333 100644 --- a/src/select.c +++ b/src/select.c @@ -5646,7 +5646,7 @@ static int convertCompoundSelectToSubquery(Walker *pWalker, Select *p){ #ifndef SQLITE_OMIT_WINDOWFUNC p->pWinDefn = 0; #endif - p->selFlags &= ~SF_Compound; + p->selFlags &= ~(u32)SF_Compound; assert( (p->selFlags & SF_Converted)==0 ); p->selFlags |= SF_Converted; assert( pNew->pPrior!=0 ); @@ -7252,7 +7252,7 @@ static int countOfViewOptimization(Parse *pParse, Select *p){ pSub->pPrior = 0; pSub->pNext = 0; pSub->selFlags |= SF_Aggregate; - pSub->selFlags &= ~SF_Compound; + pSub->selFlags &= ~(u32)SF_Compound; pSub->nSelectRow = 0; sqlite3ParserAddCleanup(pParse, sqlite3ExprListDeleteGeneric, pSub->pEList); pTerm = pPrior ? sqlite3ExprDup(db, pCount, 0) : pCount; @@ -7267,7 +7267,7 @@ static int countOfViewOptimization(Parse *pParse, Select *p){ pSub = pPrior; } p->pEList->a[0].pExpr = pExpr; - p->selFlags &= ~SF_Aggregate; + p->selFlags &= ~(u32)SF_Aggregate; #if TREETRACE_ENABLED if( sqlite3TreeTrace & 0x200 ){ @@ -7474,7 +7474,7 @@ int sqlite3Select( testcase( pParse->earlyCleanup ); p->pOrderBy = 0; } - p->selFlags &= ~SF_Distinct; + p->selFlags &= ~(u32)SF_Distinct; p->selFlags |= SF_NoopOrderBy; } sqlite3SelectPrep(pParse, p, 0); @@ -7513,7 +7513,7 @@ int sqlite3Select( ** and leaving this flag set can cause errors if a compound sub-query ** in p->pSrc is flattened into this query and this function called ** again as part of compound SELECT processing. */ - p->selFlags &= ~SF_UFSrcCheck; + p->selFlags &= ~(u32)SF_UFSrcCheck; } if( pDest->eDest==SRT_Output ){ @@ -8002,7 +8002,7 @@ int sqlite3Select( && p->pWin==0 #endif ){ - p->selFlags &= ~SF_Distinct; + p->selFlags &= ~(u32)SF_Distinct; pGroupBy = p->pGroupBy = sqlite3ExprListDup(db, pEList, 0); if( pGroupBy ){ for(i=0; inExpr; i++){ diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 6ebd8eb4fe..d4b9983091 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -3097,10 +3097,10 @@ struct Expr { /* Macros can be used to test, set, or clear bits in the ** Expr.flags field. */ -#define ExprHasProperty(E,P) (((E)->flags&(P))!=0) -#define ExprHasAllProperty(E,P) (((E)->flags&(P))==(P)) -#define ExprSetProperty(E,P) (E)->flags|=(P) -#define ExprClearProperty(E,P) (E)->flags&=~(P) +#define ExprHasProperty(E,P) (((E)->flags&(u32)(P))!=0) +#define ExprHasAllProperty(E,P) (((E)->flags&(u32)(P))==(u32)(P)) +#define ExprSetProperty(E,P) (E)->flags|=(u32)(P) +#define ExprClearProperty(E,P) (E)->flags&=~(u32)(P) #define ExprAlwaysTrue(E) (((E)->flags&(EP_OuterON|EP_IsTrue))==EP_IsTrue) #define ExprAlwaysFalse(E) (((E)->flags&(EP_OuterON|EP_IsFalse))==EP_IsFalse) #define ExprIsFullSize(E) (((E)->flags&(EP_Reduced|EP_TokenOnly))==0) @@ -4908,7 +4908,7 @@ void sqlite3SubqueryColumnTypes(Parse*,Table*,Select*,char); Table *sqlite3ResultSetOfSelect(Parse*,Select*,char); void sqlite3OpenSchemaTable(Parse *, int); Index *sqlite3PrimaryKeyIndex(Table*); -i16 sqlite3TableColumnToIndex(Index*, i16); +i16 sqlite3TableColumnToIndex(Index*, int); #ifdef SQLITE_OMIT_GENERATED_COLUMNS # define sqlite3TableColumnToStorage(T,X) (X) /* No-op pass-through */ # define sqlite3StorageColumnToTable(T,X) (X) /* No-op pass-through */ diff --git a/src/sqliteLimit.h b/src/sqliteLimit.h index 620b0f8e5a..0d15b31822 100644 --- a/src/sqliteLimit.h +++ b/src/sqliteLimit.h @@ -36,14 +36,16 @@ ** * Terms in the GROUP BY or ORDER BY clauses of a SELECT statement. ** * Terms in the VALUES clause of an INSERT statement ** -** The hard upper limit here is 32676. Most database people will +** The hard upper limit here is 32767. Most database people will ** tell you that in a well-normalized database, you usually should ** not have more than a dozen or so columns in any table. And if ** that is the case, there is no point in having more than a few ** dozen values in any of the other situations described above. */ -#ifndef SQLITE_MAX_COLUMN +#if !defined(SQLITE_MAX_COLUMN) # define SQLITE_MAX_COLUMN 2000 +#elif SQLITE_MAX_COLUMN>32767 +# error SQLITE_MAX_COLUMN may not exceed 32767 #endif /* diff --git a/src/status.c b/src/status.c index a462c94293..b0a47c7f85 100644 --- a/src/status.c +++ b/src/status.c @@ -192,8 +192,9 @@ int sqlite3LookasideUsed(sqlite3 *db, int *pHighwater){ nInit += countLookasideSlots(db->lookaside.pSmallInit); nFree += countLookasideSlots(db->lookaside.pSmallFree); #endif /* SQLITE_OMIT_TWOSIZE_LOOKASIDE */ - if( pHighwater ) *pHighwater = db->lookaside.nSlot - nInit; - return db->lookaside.nSlot - (nInit+nFree); + assert( db->lookaside.nSlot >= nInit+nFree ); + if( pHighwater ) *pHighwater = (int)(db->lookaside.nSlot - nInit); + return (int)(db->lookaside.nSlot - (nInit+nFree)); } /* @@ -246,7 +247,7 @@ int sqlite3_db_status( assert( (op-SQLITE_DBSTATUS_LOOKASIDE_HIT)>=0 ); assert( (op-SQLITE_DBSTATUS_LOOKASIDE_HIT)<3 ); *pCurrent = 0; - *pHighwater = db->lookaside.anStat[op - SQLITE_DBSTATUS_LOOKASIDE_HIT]; + *pHighwater = (int)db->lookaside.anStat[op-SQLITE_DBSTATUS_LOOKASIDE_HIT]; if( resetFlag ){ db->lookaside.anStat[op - SQLITE_DBSTATUS_LOOKASIDE_HIT] = 0; } diff --git a/src/window.c b/src/window.c index 8373e36413..948b0728af 100644 --- a/src/window.c +++ b/src/window.c @@ -995,7 +995,7 @@ int sqlite3WindowRewrite(Parse *pParse, Select *p){ p->pWhere = 0; p->pGroupBy = 0; p->pHaving = 0; - p->selFlags &= ~SF_Aggregate; + p->selFlags &= ~(u32)SF_Aggregate; p->selFlags |= SF_WinRewrite; /* Create the ORDER BY clause for the sub-select. This is the concatenation diff --git a/test/without_rowid1.test b/test/without_rowid1.test index 3c33f733a1..0095fab0c0 100644 --- a/test/without_rowid1.test +++ b/test/without_rowid1.test @@ -487,4 +487,24 @@ ifcapable altertable { SELECT name FROM sqlite_sequence ORDER BY +name; } {a c0 c2} } + +# Ensure that the number of columns in an index on a WITHOUT ROWID +# table does not exceed SQLITE_LIMIT_COLUMN. +# +reset_db +sqlite3_limit db SQLITE_LIMIT_COLUMN 8 +do_catchsql_test 16.1 { + CREATE TABLE t1( + c1,c2,c3,c4,c5,c6,c7,c8, + PRIMARY KEY(c1,c2,c1 COLLATE NOCASE) + ) WITHOUT ROWID; +} {1 {too many columns on sqlite_autoindex_t1_1}} +do_catchsql_test 16.2 { + CREATE TABLE t1( + c1,c2,c3,c4,c5,c6,c7,c8, + PRIMARY KEY(c1,c2), + UNIQUE(c3,c4,c5,c6,c7,c8,c3 COLLATE nocase) + ) WITHOUT ROWID; +} {1 {too many columns on sqlite_autoindex_t1_2}} + finish_test From d9959bf48b13bffda4c073de17eb13752b9cb5c9 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 21 Feb 2025 20:22:56 +0000 Subject: [PATCH 51/54] Makefile-internal var renaming in prep for pending portability-related changes in the handling of DLLs. No functional/build interface changes. FossilOrigin-Name: ebf41fc90aa9fb1bb96239145c0cdd06eced391499975c71734610996d088641 --- autoconf/Makefile.in | 54 ++++++++++++++-------------- main.mk | 84 +++++++++++++++++++++++++------------------- manifest | 16 ++++----- manifest.uuid | 2 +- 4 files changed, 84 insertions(+), 72 deletions(-) diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in index 8a9c2c7b3f..5a357dc9e7 100644 --- a/autoconf/Makefile.in +++ b/autoconf/Makefile.in @@ -143,15 +143,15 @@ sqlite3.o: $(TOP)/sqlite3.h $(TOP)/sqlite3.c $(CC) -c $(TOP)/sqlite3.c -o $@ $(CFLAGS) $(CFLAGS.libsqlite3) libsqlite3.LIB = libsqlite3$(T.lib) -libsqlite3.SO = libsqlite3$(T.dll) +libsqlite3.DLL = libsqlite3$(T.dll) -$(libsqlite3.SO): sqlite3.o +$(libsqlite3.DLL): sqlite3.o $(CC) -o $@ sqlite3.o $(LDFLAGS.shlib) \ $(LDFLAGS) $(LDFLAGS.libsqlite3) \ $(LDFLAGS.libsqlite3.os-specific) $(LDFLAGS.libsqlite3.soname) -$(libsqlite3.SO)-1: $(libsqlite3.SO) -$(libsqlite3.SO)-0: -all: $(libsqlite3.SO)-$(ENABLE_LIB_SHARED) +$(libsqlite3.DLL)-1: $(libsqlite3.DLL) +$(libsqlite3.DLL)-0: +all: $(libsqlite3.DLL)-$(ENABLE_LIB_SHARED) $(libsqlite3.LIB): sqlite3.o $(AR) $(AR.flags) $@ sqlite3.o @@ -159,39 +159,39 @@ $(libsqlite3.LIB)-1: $(libsqlite3.LIB) $(libsqlite3.LIB)-0: all: $(libsqlite3.LIB)-$(ENABLE_LIB_STATIC) -install-so-1: $(install-dir.lib) $(libsqlite3.SO) - $(INSTALL) $(libsqlite3.SO) "$(install-dir.lib)" - @if [ -f $(libsqlite3.SO).a ]; then \ - $(INSTALL) $(libsqlite3.SO).a "$(install-dir.lib)"; \ +install-so-1: $(install-dir.lib) $(libsqlite3.DLL) + $(INSTALL) $(libsqlite3.DLL) "$(install-dir.lib)" + @if [ -f $(libsqlite3.DLL).a ]; then \ + $(INSTALL) $(libsqlite3.DLL).a "$(install-dir.lib)"; \ fi - @echo "Setting up $(libsqlite3.SO) version symlinks..."; \ + @echo "Setting up $(libsqlite3.DLL) version symlinks..."; \ if [ x.dll = x$(T.dll) ]; then \ echo "No library symlinks needed on this platform"; \ elif [ x.dylib = x$(T.dll) ]; then \ cd "$(install-dir.lib)" || exit $$?; \ rm -f libsqlite3.0$(T.dll) libsqlite3.$(PACKAGE_VERSION)$(T.dll) || exit $$?; \ dllname=libsqlite3.$(PACKAGE_VERSION)$(T.dll); \ - mv $(libsqlite3.SO) $$dllname || exit $$?; \ - ln -s $$dllname $(libsqlite3.SO) || exit $$?; \ + mv $(libsqlite3.DLL) $$dllname || exit $$?; \ + ln -s $$dllname $(libsqlite3.DLL) || exit $$?; \ ln -s $$dllname libsqlite3.0$(T.dll) || exit $$?; \ - ls -la $$dllname $(libsqlite3.SO) libsqlite3.0$(T.dll); \ + ls -la $$dllname $(libsqlite3.DLL) libsqlite3.0$(T.dll); \ else \ cd "$(install-dir.lib)" || exit $$?; \ - rm -f $(libsqlite3.SO).0 $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ - mv $(libsqlite3.SO) $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ - ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO) || exit $$?; \ - ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0 || exit $$?; \ - ls -la $(libsqlite3.SO) $(libsqlite3.SO).[a03]*; \ - if [ -e $(libsqlite3.SO).0.8.6 ]; then \ + rm -f $(libsqlite3.DLL).0 $(libsqlite3.DLL).$(PACKAGE_VERSION) || exit $$?; \ + mv $(libsqlite3.DLL) $(libsqlite3.DLL).$(PACKAGE_VERSION) || exit $$?; \ + ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL) || exit $$?; \ + ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL).0 || exit $$?; \ + ls -la $(libsqlite3.DLL) $(libsqlite3.DLL).[a03]*; \ + if [ -e $(libsqlite3.DLL).0.8.6 ]; then \ echo "ACHTUNG: legacy libtool-compatible install found. Re-linking it..."; \ - rm -f libsqlite3.la $(libsqlite3.SO).0.8.6 || exit $$?; \ - ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0.8.6 || exit $$?; \ - ls -la $(libsqlite3.SO).0.8.6; \ + rm -f libsqlite3.la $(libsqlite3.DLL).0.8.6 || exit $$?; \ + ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL).0.8.6 || exit $$?; \ + ls -la $(libsqlite3.DLL).0.8.6; \ elif [ x1 = "x$(INSTALL_SO_086_LINK)" ]; then \ echo "ACHTUNG: installing legacy libtool-style links because INSTALL_SO_086_LINK=1"; \ - rm -f libsqlite3.la $(libsqlite3.SO).0.8.6 || exit $$?; \ - ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0.8.6 || exit $$?; \ - ls -la $(libsqlite3.SO).0.8.6; \ + rm -f libsqlite3.la $(libsqlite3.DLL).0.8.6 || exit $$?; \ + ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL).0.8.6 || exit $$?; \ + ls -la $(libsqlite3.DLL).0.8.6; \ fi; \ fi @@ -213,7 +213,7 @@ ENABLE_STATIC_SHELL = @ENABLE_STATIC_SHELL@ sqlite3-shell-link-flags.1 = $(TOP)/sqlite3.c $(LDFLAGS.libsqlite3) sqlite3-shell-link-flags.0 = -L. -lsqlite3 $(LDFLAGS.zlib) sqlite3-shell-deps.1 = $(TOP)/sqlite3.c -sqlite3-shell-deps.0 = $(libsqlite3.SO) +sqlite3-shell-deps.0 = $(libsqlite3.DLL) sqlite3$(T.exe): $(TOP)/shell.c $(sqlite3-shell-deps.$(ENABLE_STATIC_SHELL)) $(CC) -o $@ \ $(TOP)/shell.c $(sqlite3-shell-link-flags.$(ENABLE_STATIC_SHELL)) \ @@ -241,7 +241,7 @@ install: install-man1 clean: rm -f *.o sqlite3$(T.exe) - rm -f $(libsqlite3.LIB) $(libsqlite3.SO) $(libsqlite3.SO).a + rm -f $(libsqlite3.LIB) $(libsqlite3.DLL) $(libsqlite3.DLL).a distclean: clean rm -f jimsh0$(T.exe) config.* sqlite3.pc sqlite_cfg.h Makefile diff --git a/main.mk b/main.mk index 6081fbdfd8..9cc31a8fa8 100644 --- a/main.mk +++ b/main.mk @@ -191,13 +191,13 @@ INSTALL ?= install # # $(ENABLE_SHARED) = # -# 1 if libsqlite3.$(T.dll) should be built. +# 1 if libsqlite3$(T.dll) should be built. # ENABLE_SHARED ?= 1 # # $(ENABLE_STATIC) = # -# 1 if libsqlite3.$(T.lib) should be built. Some components, +# 1 if libsqlite3$(T.lib) should be built. Some components, # e.g. libtclsqlite3 and some test apps, implicitly require the static # library and will ignore this preference. # @@ -220,7 +220,7 @@ USE_AMALGAMATION ?= 1 # may require that the user specifically prepend "." to their # $LD_LIBRARY_PATH so that the dynamic linker does not pick up a # libsqlite3.so from outside the source tree. Alternately, symlinking -# the in-build-tree $(libsqlite3.SO) to some dir in the system's +# the in-build-tree $(libsqlite3.DLL) to some dir in the system's # library path will work for giving the apps access to the in-tree # DLL. # @@ -1052,8 +1052,20 @@ T.link.tcl = $(T.tcl.env.source); $(T.link) cp fts5.c fts5.h tsrc touch .target_source +# +# libsqlite3.DLL.basename = the base name of the resulting DLL. This +# is typically libsqlite3 but varies wildly on Unix-like Windows +# environments (msys, cygwin, and friends). +# +libsqlite3.DLL.basename ?= libsqlite3 +# +# libsqlite3.LIB => the static library +# libsqlite3.LIB = libsqlite3$(T.lib) -libsqlite3.SO = libsqlite3$(T.dll) +# +# libsqlite3.LIB => the DLL library +# +libsqlite3.DLL = $(libsqlite3.DLL.basename)$(T.dll) # Rules to build the LEMON compiler generator # @@ -1360,9 +1372,9 @@ tclsqlite-shell.o: $(T.tcl.env.sh) $(TOP)/src/tclsqlite.c $(DEPS_OBJ_COMMON) tclsqlite-stubs.o: $(T.tcl.env.sh) $(TOP)/src/tclsqlite.c $(DEPS_OBJ_COMMON) $(T.compile.tcl) -DUSE_TCL_STUBS=1 -o $@ -c $(TOP)/src/tclsqlite.c $$TCL_INCLUDE_SPEC -tclsqlite3$(T.exe): $(T.tcl.env.sh) tclsqlite-shell.o $(libsqlite3.SO) +tclsqlite3$(T.exe): $(T.tcl.env.sh) tclsqlite-shell.o $(libsqlite3.DLL) $(T.link.tcl) -o $@ tclsqlite-shell.o \ - $(libsqlite3.SO) $$TCL_INCLUDE_SPEC $$TCL_LIB_SPEC \ + $(libsqlite3.DLL) $$TCL_INCLUDE_SPEC $$TCL_LIB_SPEC \ $(LDFLAGS.libsqlite3) tclsqlite3$(T.exe)-1: tclsqlite3$(T.exe) tclsqlite3$(T.exe)-0 tclsqlite3$(T.exe)-: @@ -1418,17 +1430,17 @@ all: lib # # Dynamic libsqlite3 # -$(libsqlite3.SO): $(LIBOBJ) +$(libsqlite3.DLL): $(LIBOBJ) $(T.link.shared) -o $@ $(LIBOBJ) $(LDFLAGS.libsqlite3) \ $(LDFLAGS.libsqlite3.os-specific) $(LDFLAGS.libsqlite3.soname) -$(libsqlite3.SO)-1: $(libsqlite3.SO) -$(libsqlite3.SO)-0 $(libsqlite3.SO)-: -so: $(libsqlite3.SO)-$(ENABLE_SHARED) +$(libsqlite3.DLL)-1: $(libsqlite3.DLL) +$(libsqlite3.DLL)-0 $(libsqlite3.DLL)-: +so: $(libsqlite3.DLL)-$(ENABLE_SHARED) all: so # -# On most Unix-like platforms, install the $(libsqlite3.SO) as -# $(libsqlite3.SO).$(PACKAGE_VERSION) and create symlinks which point +# On most Unix-like platforms, install the $(libsqlite3.DLL) as +# $(libsqlite3.DLL).$(PACKAGE_VERSION) and create symlinks which point # to it: # # - libsqlite3.so.$(PACKAGE_VERSION) @@ -1459,7 +1471,7 @@ all: so # 1) If libsqlite3.so.0.8.6 is found in the target installation # directory then it is re-linked to point to the newer-style # names. We cannot retain both the old and new installation because -# they both share the high-level name $(libsqlite3.SO). The +# they both share the high-level name $(libsqlite3.DLL). The # down-side of this is that it may upset packaging tools when we # replace libsqlite3.so (from a legacy package) with a new symlink. # @@ -1473,39 +1485,39 @@ all: so # In either case, libsqlite3.la, if found, is deleted because it would # contain stale state, refering to non-libtool-generated libraries. # -install-so-1: $(install-dir.lib) $(libsqlite3.SO) - $(INSTALL) $(libsqlite3.SO) "$(install-dir.lib)" - @if [ -f $(libsqlite3.SO).a ]; then \ - $(INSTALL) $(libsqlite3.SO).a "$(install-dir.lib)"; \ +install-so-1: $(install-dir.lib) $(libsqlite3.DLL) + $(INSTALL) $(libsqlite3.DLL) "$(install-dir.lib)" + @if [ -f $(libsqlite3.DLL).a ]; then \ + $(INSTALL) $(libsqlite3.DLL).a "$(install-dir.lib)"; \ fi - @echo "Setting up $(libsqlite3.SO) version symlinks..."; \ + @echo "Setting up $(libsqlite3.DLL) version symlinks..."; \ if [ x.dll = x$(T.dll) ]; then \ echo "No library symlinks needed on this platform"; \ elif [ x.dylib = x$(T.dll) ]; then \ cd "$(install-dir.lib)" || exit $$?; \ rm -f libsqlite3.0$(T.dll) libsqlite3.$(PACKAGE_VERSION)$(T.dll) || exit $$?; \ dllname=libsqlite3.$(PACKAGE_VERSION)$(T.dll); \ - mv $(libsqlite3.SO) $$dllname || exit $$?; \ - ln -s $$dllname $(libsqlite3.SO) || exit $$?; \ + mv $(libsqlite3.DLL) $$dllname || exit $$?; \ + ln -s $$dllname $(libsqlite3.DLL) || exit $$?; \ ln -s $$dllname libsqlite3.0$(T.dll) || exit $$?; \ - ls -la $$dllname $(libsqlite3.SO) libsqlite3.0$(T.dll); \ + ls -la $$dllname $(libsqlite3.DLL) libsqlite3.0$(T.dll); \ else \ cd "$(install-dir.lib)" || exit $$?; \ - rm -f $(libsqlite3.SO).0 $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ - mv $(libsqlite3.SO) $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ - ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO) || exit $$?; \ - ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0 || exit $$?; \ - ls -la $(libsqlite3.SO) $(libsqlite3.SO).[a03]*; \ - if [ -e $(libsqlite3.SO).0.8.6 ]; then \ + rm -f $(libsqlite3.DLL).0 $(libsqlite3.DLL).$(PACKAGE_VERSION) || exit $$?; \ + mv $(libsqlite3.DLL) $(libsqlite3.DLL).$(PACKAGE_VERSION) || exit $$?; \ + ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL) || exit $$?; \ + ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL).0 || exit $$?; \ + ls -la $(libsqlite3.DLL) $(libsqlite3.DLL).[a03]*; \ + if [ -e $(libsqlite3.DLL).0.8.6 ]; then \ echo "ACHTUNG: legacy libtool-compatible install found. Re-linking it..."; \ - rm -f libsqlite3.la $(libsqlite3.SO).0.8.6 || exit $$?; \ - ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0.8.6 || exit $$?; \ - ls -la $(libsqlite3.SO).0.8.6; \ + rm -f libsqlite3.la $(libsqlite3.DLL).0.8.6 || exit $$?; \ + ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL).0.8.6 || exit $$?; \ + ls -la $(libsqlite3.DLL).0.8.6; \ elif [ x1 = "x$(INSTALL_SO_086_LINK)" ]; then \ echo "ACHTUNG: installing legacy libtool-style links because INSTALL_SO_086_LINK=1"; \ - rm -f libsqlite3.la $(libsqlite3.SO).0.8.6 || exit $$?; \ - ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0.8.6 || exit $$?; \ - ls -la $(libsqlite3.SO).0.8.6; \ + rm -f libsqlite3.la $(libsqlite3.DLL).0.8.6 || exit $$?; \ + ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL).0.8.6 || exit $$?; \ + ls -la $(libsqlite3.DLL).0.8.6; \ fi; \ fi @@ -1804,7 +1816,7 @@ sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl \ # sqlite3_analyzer.flags.1 = -L. -lsqlite3 sqlite3_analyzer.flags.0 = $(LDFLAGS.libsqlite3) -sqlite3_analyzer.deps.1 = $(libsqlite3.SO) +sqlite3_analyzer.deps.1 = $(libsqlite3.DLL) sqlite3_analyzer.deps.0 = sqlite3_analyzer$(T.exe): $(T.tcl.env.sh) sqlite3_analyzer.c \ $(sqlite3_analyzer.deps.$(LINK_TOOLS_DYNAMICALLY)) @@ -2051,7 +2063,7 @@ install: install-shell-$(HAVE_WASI_SDK) # sqldiff.0.deps = $(TOP)/tool/sqldiff.c $(TOP)/ext/misc/sqlite3_stdio.h sqlite3.o sqlite3.h sqldiff.0.rules = $(T.link) -o $@ $(TOP)/tool/sqldiff.c sqlite3.o $(LDFLAGS.libsqlite3) -sqldiff.1.deps = $(TOP)/tool/sqldiff.c $(TOP)/ext/misc/sqlite3_stdio.h $(libsqlite3.SO) +sqldiff.1.deps = $(TOP)/tool/sqldiff.c $(TOP)/ext/misc/sqlite3_stdio.h $(libsqlite3.DLL) sqldiff.1.rules = $(T.link) -o $@ $(TOP)/tool/sqldiff.c -L. -lsqlite3 $(LDFLAGS.configure) sqldiff$(T.exe): $(sqldiff.$(LINK_TOOLS_DYNAMICALLY).deps) $(sqldiff.$(LINK_TOOLS_DYNAMICALLY).rules) @@ -2344,7 +2356,7 @@ tidy: tidy-. rm -f lemon$(B.exe) sqlite*.tar.gz rm -f mkkeywordhash$(B.exe) mksourceid$(B.exe) rm -f parse.* fts5parse.* - rm -f $(libsqlite3.SO) $(libsqlite3.LIB) $(libtclsqlite3.SO) $(libsqlite3.SO).a + rm -f $(libsqlite3.DLL) $(libsqlite3.LIB) $(libtclsqlite3.SO) $(libsqlite3.DLL).a rm -f tclsqlite3$(T.exe) $(TESTPROGS) rm -f LogEst$(T.exe) fts3view$(T.exe) rollback-test$(T.exe) showdb$(T.exe) rm -f showjournal$(T.exe) showstat4$(T.exe) showwal$(T.exe) speedtest1$(T.exe) diff --git a/manifest b/manifest index bb9dfef35a..0a89891bbe 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Detect\swhen\sa\sUNIQUE\sor\sPRIMARY\sKEY\son\sa\sWITHOUT\sROWID\stable\swould\sneed\nto\suse\smore\sthan\sSQLITE_LIMIT_COLUMN\scolumns\sand\sraise\san\serror.\nAlso\sinclude\ssome\sunrelated\scompiler\swarning\sfixes. -D 2025-02-21T17:03:22.433 +C Makefile-internal\svar\srenaming\sin\sprep\sfor\spending\sportability-related\schanges\sin\sthe\shandling\sof\sDLLs.\sNo\sfunctional/build\sinterface\schanges. +D 2025-02-21T20:22:56.972 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -16,7 +16,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 F auto.def eddf6aef976e2c1a56c0accc3244945e0b22ec6799074c40be160e5a9a5662b0 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac -F autoconf/Makefile.in ed042ba44540e67e17b1e7bd787e8118a9d14664ba8049966ec9bc54a10676ce +F autoconf/Makefile.in d376f623fa747798e40f7fcb23f9392e4f87610daa8425673ab83a8f33578b65 F autoconf/Makefile.msc 1249e425a24859c7b3f17575275247df9eec3bddc0d1d7e73941f1abdbb95a92 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 @@ -705,7 +705,7 @@ F ext/wasm/tests/opfs/sahpool/sahpool-pausing.js f264925cfc82155de38cecb3d204c36 F ext/wasm/tests/opfs/sahpool/sahpool-worker.js bd25a43fc2ab2d1bafd8f2854ad3943ef673f7c3be03e95ecf1612ff6e8e2a61 F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk 323e71cd79e49c9e33d39b6558694a71c08973d9ac3ee4f211aa32e58bd876f5 +F main.mk 53df76bae4f2538a086fa39b6eb9a4238b9551895b2bde3b14187fa246ca0336 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2210,8 +2210,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 4e81e2c707a954dcda6219dc94e2b96dd0c9907bd4beab28adad51d488b7d739 -R 92107357485b715229de5818697d5fcf -U drh -Z 4c75b5945df64c93f9907a88e623cba4 +P d7729dbbf231d57cbcaaa5004d0a9c4957f112dd6520052995b232aa521c0ca3 +R 9fa57efe9e24b037978a77954d886617 +U stephan +Z 3e199b62ebb0fe5383698c3c45ceb587 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 6c0f837bd5..e261d3c10b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d7729dbbf231d57cbcaaa5004d0a9c4957f112dd6520052995b232aa521c0ca3 +ebf41fc90aa9fb1bb96239145c0cdd06eced391499975c71734610996d088641 From cc803b209f2ffa9dcaad43c37eb8ccafaed199bd Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 21 Feb 2025 20:35:37 +0000 Subject: [PATCH 52/54] The number of declared columns in an index is limited to SQLITE_LIMIT_COLUMN. But the actual number of columns in the implementation might need to be twice as much to account for the primary key at the end. Ensure that the code is able to deal with this. This is a correction to check-in [d7729dbbf231d57c]. FossilOrigin-Name: 5822feec43be9352fd87bf9968c39c0218e01ab5fe3ba50431ae21cba79e6c89 --- manifest | 22 +++++++++++----------- manifest.uuid | 2 +- src/build.c | 23 ++++++++++++----------- src/sqliteInt.h | 6 +++--- src/sqliteLimit.h | 6 ++++++ src/where.c | 2 ++ test/without_rowid1.test | 19 ++++++++++++++----- 7 files changed, 49 insertions(+), 31 deletions(-) diff --git a/manifest b/manifest index 0a89891bbe..eb3b50595e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Makefile-internal\svar\srenaming\sin\sprep\sfor\spending\sportability-related\schanges\sin\sthe\shandling\sof\sDLLs.\sNo\sfunctional/build\sinterface\schanges. -D 2025-02-21T20:22:56.972 +C The\snumber\sof\sdeclared\scolumns\sin\san\sindex\sis\slimited\sto\sSQLITE_LIMIT_COLUMN.\nBut\sthe\sactual\snumber\sof\scolumns\sin\sthe\simplementation\smight\sneed\sto\sbe\ntwice\sas\smuch\sto\saccount\sfor\sthe\sprimary\skey\sat\sthe\send.\s\sEnsure\sthat\sthe\ncode\sis\sable\sto\sdeal\swith\sthis.\s\sThis\sis\sa\scorrection\sto\ncheck-in\s[d7729dbbf231d57c]. +D 2025-02-21T20:35:37.743 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -725,7 +725,7 @@ F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522 F src/btree.c 9316859aa5f14bde4a3719ffb1570219e51c5de433221e38b87ea19db868aedf F src/btree.h 18e5e7b2124c23426a283523e5f31a4bff029131b795bb82391f9d2f3136fc50 F src/btreeInt.h 98aadb6dcb77b012cab2574d6a728fad56b337fc946839b9898c4b4c969e30b6 -F src/build.c c2bcfc7e5072a743a051699f06329ee206299729adf4323fed9be8aa2d64af73 +F src/build.c 20793695ef64d2d0c147501e37f344f828f09f16d346a987b516316186030996 F src/callback.c acae8c8dddda41ee85cfdf19b926eefe830f371069f8aadca3aa39adf5b1c859 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/date.c 842c08ac143a56a627b05ac51d68624f2b7b03e3b4cba596205e735eed64ee57 @@ -786,8 +786,8 @@ F src/shell.c.in bf997e43faaa1ef0ff78d4d7b9be6a9430cf1edda9a47a14e7fef646fcb459a F src/sqlite.h.in 8d4486fb28a90de818ac1e8c6206ea458e7de6bd8e0dfa3d554494f155be8c01 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 -F src/sqliteInt.h a5c850981cff99331b2ed48d519fb54a47f5f91c680e2cab64d91e259685de69 -F src/sqliteLimit.h b963c1e8c48791cc5cf733bb33e4741d0fbb7d0650cc2344cce5e4c17be4e8fd +F src/sqliteInt.h e74f0ea0bc4d3c16afd5004557b264137d6f1d61d2a1ff2a49877b0589945462 +F src/sqliteLimit.h 6d817c28a8f19af95e6f4921933b7fbbca48a962bce0eb0ec81e8bb3ef38e68b F src/status.c 0e72e4f6be6ccfde2488eb63210297e75f569f3ce9920f6c3d77590ec6ce5ffd F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 F src/tclsqlite.c 5c1e367e26711044730c93d4b81312170918a8d1fe811f45be740ab48f7de8c1 @@ -865,7 +865,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/wal.c cefdffc112c767c79596d9c0d15cb4de27071132e9b8a0fce323b140cd4af683 F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452 F src/walker.c d5006d6b005e4ea7302ad390957a8d41ed83faa177e412f89bc5600a7462a014 -F src/where.c 09dc313e7223ca1217c39c7026b00f16ff449a8323511a762fcba7863a00f4cd +F src/where.c 12cca5dfbe96e2589f951c43c0720fc58e52611787c37d85a0d9c10376202e8b F src/whereInt.h d20cddddb1d61b18d5cb1fcfa9b77fbeebbc4afe44d996e603452a23b3009ee1 F src/wherecode.c 5baa06f0daae7d38aca1d4814030b82ad4f127fe6bad18f0644776a474f6088b F src/whereexpr.c 2415c8eee5ff89a8b709d7d83d71c1ff986cd720d0520057e1d8a5371339012a @@ -2095,7 +2095,7 @@ F test/with4.test 257be66c0c67fee1defbbac0f685c3465e2cad037f21ce65f23f86084f1982 F test/with5.test 6248213c41fab36290b5b73aa3f937309dfba337004d9d8434c3fabc8c7d4be8 F test/with6.test 281e4861b5e517f6c3c2f08517a520c1e2ee7c11966545d3901f258a4fe8ef76 F test/withM.test 693b61765f2b387b5e3e24a4536e2e82de15ff64 -F test/without_rowid1.test 7120af676485e68930d3e513d083f3644622893477901f55eec954387125d550 +F test/without_rowid1.test 545a98bde0dc641cce8d361cd589677a70561f36f9033ae48de8ae37418d6ce2 F test/without_rowid2.test af260339f79d13cb220288b67cd287fbcf81ad99 F test/without_rowid3.test 39ab0dd773eaa62e59b17093f875327630f54c4145458f6d2b053d68d4b2f67b F test/without_rowid4.test 4e08bcbaee0399f35d58b5581881e7a6243d458a @@ -2210,8 +2210,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d7729dbbf231d57cbcaaa5004d0a9c4957f112dd6520052995b232aa521c0ca3 -R 9fa57efe9e24b037978a77954d886617 -U stephan -Z 3e199b62ebb0fe5383698c3c45ceb587 +P ebf41fc90aa9fb1bb96239145c0cdd06eced391499975c71734610996d088641 +R ea801290870a4070bffe00dffce34b68 +U drh +Z e1106d68193ec85ec463ffb759ee622e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index e261d3c10b..83f71c4a07 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ebf41fc90aa9fb1bb96239145c0cdd06eced391499975c71734610996d088641 +5822feec43be9352fd87bf9968c39c0218e01ab5fe3ba50431ae21cba79e6c89 diff --git a/src/build.c b/src/build.c index 18bf27b833..907494b193 100644 --- a/src/build.c +++ b/src/build.c @@ -1067,7 +1067,7 @@ Index *sqlite3PrimaryKeyIndex(Table *pTab){ ** find the (first) offset of that column in index pIdx. Or return -1 ** if column iCol is not used in index pIdx. */ -i16 sqlite3TableColumnToIndex(Index *pIdx, int iCol){ +int sqlite3TableColumnToIndex(Index *pIdx, int iCol){ int i; i16 iCol16; assert( iCol>=(-1) && iCol<=SQLITE_MAX_COLUMN ); @@ -2175,16 +2175,15 @@ static char *createTableStmt(sqlite3 *db, Table *p){ */ static int resizeIndexObject(Parse *pParse, Index *pIdx, int N){ char *zExtra; - int nByte; + u64 nByte; sqlite3 *db; if( pIdx->nColumn>=N ) return SQLITE_OK; db = pParse->db; - if( N>db->aLimit[SQLITE_LIMIT_COLUMN] ){ - sqlite3ErrorMsg(pParse, "too many columns on %s", pIdx->zName); - return SQLITE_ERROR; - } + assert( N>0 ); + assert( N <= SQLITE_MAX_COLUMN*2 /* tag-20250221-1 */ ); + testcase( N==2*pParse->db->aLimit[SQLITE_LIMIT_COLUMN] ); assert( pIdx->isResized==0 ); - nByte = (sizeof(char*) + sizeof(LogEst) + sizeof(i16) + 1)*N; + nByte = (sizeof(char*) + sizeof(LogEst) + sizeof(i16) + 1)*(u64)N; zExtra = sqlite3DbMallocZero(db, nByte); if( zExtra==0 ) return SQLITE_NOMEM_BKPT; memcpy(zExtra, pIdx->azColl, sizeof(char*)*pIdx->nColumn); @@ -2198,7 +2197,7 @@ static int resizeIndexObject(Parse *pParse, Index *pIdx, int N){ zExtra += sizeof(i16)*N; memcpy(zExtra, pIdx->aSortOrder, pIdx->nColumn); pIdx->aSortOrder = (u8*)zExtra; - pIdx->nColumn = N; + pIdx->nColumn = (u16)N; /* See tag-20250221-1 above for proof of safety */ pIdx->isResized = 1; return SQLITE_OK; } @@ -3860,13 +3859,14 @@ static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){ */ Index *sqlite3AllocateIndexObject( sqlite3 *db, /* Database connection */ - i16 nCol, /* Total number of columns in the index */ + int nCol, /* Total number of columns in the index */ int nExtra, /* Number of bytes of extra space to alloc */ char **ppExtra /* Pointer to the "extra" space */ ){ Index *p; /* Allocated index object */ i64 nByte; /* Bytes of space for Index object + arrays */ + assert( nCol <= 2*db->aLimit[SQLITE_LIMIT_COLUMN] ); nByte = ROUND8(sizeof(Index)) + /* Index structure */ ROUND8(sizeof(char*)*nCol) + /* Index.azColl */ ROUND8(sizeof(LogEst)*(nCol+1) + /* Index.aiRowLogEst */ @@ -3879,8 +3879,9 @@ Index *sqlite3AllocateIndexObject( p->aiRowLogEst = (LogEst*)pExtra; pExtra += sizeof(LogEst)*(nCol+1); p->aiColumn = (i16*)pExtra; pExtra += sizeof(i16)*nCol; p->aSortOrder = (u8*)pExtra; - p->nColumn = nCol; - p->nKeyCol = nCol - 1; + assert( nCol>0 ); + p->nColumn = (u16)nCol; + p->nKeyCol = (u16)(nCol - 1); *ppExtra = ((char*)p) + nByte; } return p; diff --git a/src/sqliteInt.h b/src/sqliteInt.h index d4b9983091..de3ce7aa29 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -2759,7 +2759,7 @@ struct Index { Pgno tnum; /* DB Page containing root of this index */ LogEst szIdxRow; /* Estimated average row size in bytes */ u16 nKeyCol; /* Number of columns forming the key */ - u16 nColumn; /* Number of columns stored in the index */ + u16 nColumn; /* Nr columns in btree. Can be 2*Table.nCol */ u8 onError; /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */ unsigned idxType:2; /* 0:Normal 1:UNIQUE, 2:PRIMARY KEY, 3:IPK */ unsigned bUnordered:1; /* Use this index for == or IN queries only */ @@ -4908,7 +4908,7 @@ void sqlite3SubqueryColumnTypes(Parse*,Table*,Select*,char); Table *sqlite3ResultSetOfSelect(Parse*,Select*,char); void sqlite3OpenSchemaTable(Parse *, int); Index *sqlite3PrimaryKeyIndex(Table*); -i16 sqlite3TableColumnToIndex(Index*, int); +int sqlite3TableColumnToIndex(Index*, int); #ifdef SQLITE_OMIT_GENERATED_COLUMNS # define sqlite3TableColumnToStorage(T,X) (X) /* No-op pass-through */ # define sqlite3StorageColumnToTable(T,X) (X) /* No-op pass-through */ @@ -5006,7 +5006,7 @@ void sqlite3SrcListAssignCursors(Parse*, SrcList*); void sqlite3IdListDelete(sqlite3*, IdList*); void sqlite3ClearOnOrUsing(sqlite3*, OnOrUsing*); void sqlite3SrcListDelete(sqlite3*, SrcList*); -Index *sqlite3AllocateIndexObject(sqlite3*,i16,int,char**); +Index *sqlite3AllocateIndexObject(sqlite3*,int,int,char**); void sqlite3CreateIndex(Parse*,Token*,Token*,SrcList*,ExprList*,int,Token*, Expr*, int, int, u8); void sqlite3DropIndex(Parse*, SrcList*, int); diff --git a/src/sqliteLimit.h b/src/sqliteLimit.h index 0d15b31822..ec774889b5 100644 --- a/src/sqliteLimit.h +++ b/src/sqliteLimit.h @@ -41,6 +41,12 @@ ** not have more than a dozen or so columns in any table. And if ** that is the case, there is no point in having more than a few ** dozen values in any of the other situations described above. +** +** An index can only have SQLITE_MAX_COLUMN columns from the user +** point of view, but the underlying b-tree that implements the index +** might have up to twice as many columns in a WITHOUT ROWID table, +** since must also store the primary key at the end. Hence the +** column count for Index is u16 instead of i16. */ #if !defined(SQLITE_MAX_COLUMN) # define SQLITE_MAX_COLUMN 2000 diff --git a/src/where.c b/src/where.c index 5cb52b8adb..1275250067 100644 --- a/src/where.c +++ b/src/where.c @@ -1104,6 +1104,8 @@ static SQLITE_NOINLINE void constructAutomaticIndex( } /* Construct the Index object to describe this index */ + assert( nKeyCol <= pTable->nCol + MAX(0, pTable->nCol - BMS + 1) ); + /* ^-- This guarantees that the number of index columns will fit in the u16 */ pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+HasRowid(pTable), 0, &zNotUsed); if( pIdx==0 ) goto end_auto_index_create; diff --git a/test/without_rowid1.test b/test/without_rowid1.test index 0095fab0c0..5d0bc81105 100644 --- a/test/without_rowid1.test +++ b/test/without_rowid1.test @@ -493,18 +493,27 @@ ifcapable altertable { # reset_db sqlite3_limit db SQLITE_LIMIT_COLUMN 8 -do_catchsql_test 16.1 { +do_execsql_test 16.1 { CREATE TABLE t1( c1,c2,c3,c4,c5,c6,c7,c8, PRIMARY KEY(c1,c2,c1 COLLATE NOCASE) ) WITHOUT ROWID; -} {1 {too many columns on sqlite_autoindex_t1_1}} -do_catchsql_test 16.2 { - CREATE TABLE t1( +} {} +do_execsql_test 16.2 { + CREATE TABLE t2( + c1,c2,c3,c4,c5,c6,c7,c8, + PRIMARY KEY(c1 COLLATE nocase,c1 COLLATE rtrim, + c2 COLLATE nocase,c2 COLLATE rtrim, + c3 COLLATE nocase,c3 COLLATE rtrim, + c4 COLLATE nocase,c4 COLLATE rtrim) + ) WITHOUT ROWID; +} {} +do_execsql_test 16.3 { + CREATE TABLE t3( c1,c2,c3,c4,c5,c6,c7,c8, PRIMARY KEY(c1,c2), UNIQUE(c3,c4,c5,c6,c7,c8,c3 COLLATE nocase) ) WITHOUT ROWID; -} {1 {too many columns on sqlite_autoindex_t1_2}} +} {} finish_test From 447f1c231284a8aad15350b67f42a9a417fc5ade Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 22 Feb 2025 11:40:29 +0000 Subject: [PATCH 53/54] Fix an incorrect assert added by [d7729dbbf231d57c]. FossilOrigin-Name: eeea11278bdebe336f0c30fbad79e30e3456ab67dae46abdd5f9951ea1b61bed --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/alter.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index eb3b50595e..18e40f74c5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C The\snumber\sof\sdeclared\scolumns\sin\san\sindex\sis\slimited\sto\sSQLITE_LIMIT_COLUMN.\nBut\sthe\sactual\snumber\sof\scolumns\sin\sthe\simplementation\smight\sneed\sto\sbe\ntwice\sas\smuch\sto\saccount\sfor\sthe\sprimary\skey\sat\sthe\send.\s\sEnsure\sthat\sthe\ncode\sis\sable\sto\sdeal\swith\sthis.\s\sThis\sis\sa\scorrection\sto\ncheck-in\s[d7729dbbf231d57c]. -D 2025-02-21T20:35:37.743 +C Fix\san\sincorrect\sassert\sadded\sby\s[d7729dbbf231d57c]. +D 2025-02-22T11:40:29.226 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -715,7 +715,7 @@ F mptest/multiwrite01.test dab5c5f8f9534971efce679152c5146da265222d F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b F sqlite3.1 acdff36db796e2d00225b911d3047d580cd136547298435426ce9d40347973cc F sqlite3.pc.in 0977c03a4da7c4204bd60e784a0efb8d51a190448aba78a4e973fe7192bdaf03 -F src/alter.c 04cad1defb7262937e586b0529f3a524ac825aa283341e326546cf08de35b209 +F src/alter.c 918875586d26036ee06532dd80b83032a34330da00337877d52eda3fa5054d9f F src/analyze.c 6d27b425a16817975e6a4f8501e531d13dd1bf4b53bff2329dbc1f301aeef82d F src/attach.c c36d9d82811e2274bd06bf3b34459e36d8ae8a7f32efa5cbf3f890eef08a9987 F src/auth.c 54ab9c6c5803b47c0d45b76ce27eff22a03b4b1f767c5945a3a4eb13aa4c78dc @@ -2210,8 +2210,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ebf41fc90aa9fb1bb96239145c0cdd06eced391499975c71734610996d088641 -R ea801290870a4070bffe00dffce34b68 +P 5822feec43be9352fd87bf9968c39c0218e01ab5fe3ba50431ae21cba79e6c89 +R 0951bff81e7aa0574e1251461ca59296 U drh -Z e1106d68193ec85ec463ffb759ee622e +Z cf8ddfba345e5495dfdc5bc22e0f71a8 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 83f71c4a07..9c95d8c898 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5822feec43be9352fd87bf9968c39c0218e01ab5fe3ba50431ae21cba79e6c89 +eeea11278bdebe336f0c30fbad79e30e3456ab67dae46abdd5f9951ea1b61bed diff --git a/src/alter.c b/src/alter.c index 3c8a6c3a18..43b266790d 100644 --- a/src/alter.c +++ b/src/alter.c @@ -1217,7 +1217,7 @@ static int renameEditSql( nQuot = sqlite3Strlen30(zQuot)-1; } - assert( nQuot>=nNew && nSql>0 && nNew>0 ); + assert( nQuot>=nNew && nSql>=0 && nNew>=0 ); zOut = sqlite3DbMallocZero(db, (u64)(nSql + pRename->nList*nQuot + 1)); }else{ assert( nSql>0 ); From c071c47b51f39e2a186dbb87e1b7347d5590986d Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 22 Feb 2025 16:44:14 +0000 Subject: [PATCH 54/54] Tamp down various harmless compiler warnings. Use "int" in places instead of "u16" or "i16" since the compiler complains less and generates faster code. FossilOrigin-Name: 742827f049768c4f69ccdfaadfad339aaad3bc126d3a68b90cfea01d825bf7ce --- manifest | 22 +++++++-------- manifest.uuid | 2 +- src/alter.c | 10 ++++--- src/analyze.c | 2 +- src/bitvec.c | 6 ++--- src/btmutex.c | 2 +- src/btree.c | 73 +++++++++++++++++++++++++++++--------------------- src/btreeInt.h | 6 +++++ 8 files changed, 71 insertions(+), 52 deletions(-) diff --git a/manifest b/manifest index 18e40f74c5..f2b2a13a57 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\san\sincorrect\sassert\sadded\sby\s[d7729dbbf231d57c]. -D 2025-02-22T11:40:29.226 +C Tamp\sdown\svarious\sharmless\scompiler\swarnings.\s\sUse\s"int"\sin\splaces\sinstead\nof\s"u16"\sor\s"i16"\ssince\sthe\scompiler\scomplains\sless\sand\sgenerates\sfaster\ncode. +D 2025-02-22T16:44:14.174 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -715,16 +715,16 @@ F mptest/multiwrite01.test dab5c5f8f9534971efce679152c5146da265222d F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b F sqlite3.1 acdff36db796e2d00225b911d3047d580cd136547298435426ce9d40347973cc F sqlite3.pc.in 0977c03a4da7c4204bd60e784a0efb8d51a190448aba78a4e973fe7192bdaf03 -F src/alter.c 918875586d26036ee06532dd80b83032a34330da00337877d52eda3fa5054d9f -F src/analyze.c 6d27b425a16817975e6a4f8501e531d13dd1bf4b53bff2329dbc1f301aeef82d +F src/alter.c 0d2122ade76617b7cca383428d0881a9821ef8ddaf9cce6ff91d69a215614b95 +F src/analyze.c 13895d4da6ac857d95d3291dc607d492eba3ea1cbc3bc04baaa0383fbc1bb3d4 F src/attach.c c36d9d82811e2274bd06bf3b34459e36d8ae8a7f32efa5cbf3f890eef08a9987 F src/auth.c 54ab9c6c5803b47c0d45b76ce27eff22a03b4b1f767c5945a3a4eb13aa4c78dc F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523 -F src/bitvec.c d64aa60cd5f2721ebd6c155b3ac5ff7342086bead485239d57342cdfdccb9f50 -F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522 -F src/btree.c 9316859aa5f14bde4a3719ffb1570219e51c5de433221e38b87ea19db868aedf +F src/bitvec.c 782cc29b42b47e7ec6348eb0aaf9ffe60063f498387e7249f458d445af4b53e9 +F src/btmutex.c 30dada73a819a1ef5b7583786370dce1842e12e1ad941e4d05ac29695528daea +F src/btree.c 00fcee37947641f48d4b529d96143e74d056b7afa8f26d61292c90ee59c056b2 F src/btree.h 18e5e7b2124c23426a283523e5f31a4bff029131b795bb82391f9d2f3136fc50 -F src/btreeInt.h 98aadb6dcb77b012cab2574d6a728fad56b337fc946839b9898c4b4c969e30b6 +F src/btreeInt.h 9c0f9ea5c9b5f4dcaea18111d43efe95f2ac276cd86d770dce10fd99ccc93886 F src/build.c 20793695ef64d2d0c147501e37f344f828f09f16d346a987b516316186030996 F src/callback.c acae8c8dddda41ee85cfdf19b926eefe830f371069f8aadca3aa39adf5b1c859 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e @@ -2210,8 +2210,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 5822feec43be9352fd87bf9968c39c0218e01ab5fe3ba50431ae21cba79e6c89 -R 0951bff81e7aa0574e1251461ca59296 +P eeea11278bdebe336f0c30fbad79e30e3456ab67dae46abdd5f9951ea1b61bed +R 8078ee78be0e4d7d18ee35dbad7406fe U drh -Z cf8ddfba345e5495dfdc5bc22e0f71a8 +Z 2ee0c7ad1f2d8a9853a04c1df0464ab5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9c95d8c898..5eab3882ff 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -eeea11278bdebe336f0c30fbad79e30e3456ab67dae46abdd5f9951ea1b61bed +742827f049768c4f69ccdfaadfad339aaad3bc126d3a68b90cfea01d825bf7ce diff --git a/src/alter.c b/src/alter.c index 43b266790d..8192571662 100644 --- a/src/alter.c +++ b/src/alter.c @@ -1261,14 +1261,15 @@ static int renameEditSql( memcpy(zBuf1, pBest->t.z, pBest->t.n); zBuf1[pBest->t.n] = 0; sqlite3Dequote(zBuf1); - sqlite3_snprintf(nSql*2, zBuf2, "%Q%s", zBuf1, + assert( nSql < 0x15555554 /* otherwise malloc would have failed */ ); + sqlite3_snprintf((int)(nSql*2), zBuf2, "%Q%s", zBuf1, pBest->t.z[pBest->t.n]=='\'' ? " " : "" ); zReplace = zBuf2; nReplace = sqlite3Strlen30(zReplace); } - iOff = pBest->t.z - zSql; + iOff = (int)(pBest->t.z - zSql); if( pBest->t.n!=nReplace ){ memmove(&zOut[iOff + nReplace], &zOut[iOff + pBest->t.n], nOut - (iOff + pBest->t.n) @@ -1294,11 +1295,12 @@ static int renameEditSql( ** Set all pEList->a[].fg.eEName fields in the expression-list to val. */ static void renameSetENames(ExprList *pEList, int val){ + assert( val==ENAME_NAME || val==ENAME_TAB || val==ENAME_SPAN ); if( pEList ){ int i; for(i=0; inExpr; i++){ assert( val==ENAME_NAME || pEList->a[i].fg.eEName==ENAME_NAME ); - pEList->a[i].fg.eEName = val; + pEList->a[i].fg.eEName = val&0x3; } } } @@ -2045,7 +2047,7 @@ static void renameTableTest( if( zDb && zInput ){ int rc; Parse sParse; - int flags = db->flags; + u64 flags = db->flags; if( bNoDQS ) db->flags &= ~(SQLITE_DqsDML|SQLITE_DqsDDL); rc = renameParseSql(&sParse, zDb, db, zInput, bTemp); db->flags |= (flags & (SQLITE_DqsDML|SQLITE_DqsDDL)); diff --git a/src/analyze.c b/src/analyze.c index 58cea90caa..8ca0e3e74c 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -443,7 +443,7 @@ static void statInit( p->db = db; p->nEst = sqlite3_value_int64(argv[2]); p->nRow = 0; - p->nLimit = sqlite3_value_int64(argv[3]); + p->nLimit = sqlite3_value_int(argv[3]); p->nCol = nCol; p->nKeyCol = nKeyCol; p->nSkipAhead = 0; diff --git a/src/bitvec.c b/src/bitvec.c index 32bfade115..30c4dc7b8e 100644 --- a/src/bitvec.c +++ b/src/bitvec.c @@ -67,7 +67,7 @@ ** no fewer collisions than the no-op *1. */ #define BITVEC_HASH(X) (((X)*1)%BITVEC_NINT) -#define BITVEC_NPTR (BITVEC_USIZE/sizeof(Bitvec *)) +#define BITVEC_NPTR ((u32)(BITVEC_USIZE/sizeof(Bitvec *))) /* @@ -250,7 +250,7 @@ void sqlite3BitvecClear(Bitvec *p, u32 i, void *pBuf){ } } if( p->iSize<=BITVEC_NBIT ){ - p->u.aBitmap[i/BITVEC_SZELEM] &= ~(1 << (i&(BITVEC_SZELEM-1))); + p->u.aBitmap[i/BITVEC_SZELEM] &= ~(BITVEC_TELEM)(1<<(i&(BITVEC_SZELEM-1))); }else{ unsigned int j; u32 *aiValues = pBuf; @@ -301,7 +301,7 @@ u32 sqlite3BitvecSize(Bitvec *p){ ** individual bits within V. */ #define SETBIT(V,I) V[I>>3] |= (1<<(I&7)) -#define CLEARBIT(V,I) V[I>>3] &= ~(1<<(I&7)) +#define CLEARBIT(V,I) V[I>>3] &= ~(BITVEC_TELEM)(1<<(I&7)) #define TESTBIT(V,I) (V[I>>3]&(1<<(I&7)))!=0 /* diff --git a/src/btmutex.c b/src/btmutex.c index 232831e037..620047c151 100644 --- a/src/btmutex.c +++ b/src/btmutex.c @@ -185,7 +185,7 @@ int sqlite3BtreeHoldsMutex(Btree *p){ */ static void SQLITE_NOINLINE btreeEnterAll(sqlite3 *db){ int i; - int skipOk = 1; + u8 skipOk = 1; Btree *p; assert( sqlite3_mutex_held(db->mutex) ); for(i=0; inDb; i++){ diff --git a/src/btree.c b/src/btree.c index 97fbdf8d21..1bd59a1b1f 100644 --- a/src/btree.c +++ b/src/btree.c @@ -1019,7 +1019,7 @@ void sqlite3BtreeCursorHint(BtCursor *pCur, int eHintType, ...){ */ void sqlite3BtreeCursorHintFlags(BtCursor *pCur, unsigned x){ assert( x==BTREE_SEEK_EQ || x==BTREE_BULKLOAD || x==0 ); - pCur->hints = x; + pCur->hints = (u8)x; } @@ -1213,14 +1213,15 @@ static SQLITE_NOINLINE void btreeParseCellAdjustSizeForOverflow( static int btreePayloadToLocal(MemPage *pPage, i64 nPayload){ int maxLocal; /* Maximum amount of payload held locally */ maxLocal = pPage->maxLocal; + assert( nPayload>=0 ); if( nPayload<=maxLocal ){ - return nPayload; + return (int)nPayload; }else{ int minLocal; /* Minimum amount of payload held locally */ int surplus; /* Overflow payload available for local storage */ minLocal = pPage->minLocal; - surplus = minLocal + (nPayload - minLocal)%(pPage->pBt->usableSize-4); - return ( surplus <= maxLocal ) ? surplus : minLocal; + surplus = (int)(minLocal +(nPayload - minLocal)%(pPage->pBt->usableSize-4)); + return (surplus <= maxLocal) ? surplus : minLocal; } } @@ -1330,11 +1331,13 @@ static void btreeParseCellPtr( pInfo->pPayload = pIter; testcase( nPayload==pPage->maxLocal ); testcase( nPayload==(u32)pPage->maxLocal+1 ); + assert( nPayload>=0 ); + assert( pPage->maxLocal <= BT_MAX_LOCAL ); if( nPayload<=pPage->maxLocal ){ /* This is the (easy) common case where the entire payload fits ** on the local page. No overflow is required. */ - pInfo->nSize = nPayload + (u16)(pIter - pCell); + pInfo->nSize = (u16)nPayload + (u16)(pIter - pCell); if( pInfo->nSize<4 ) pInfo->nSize = 4; pInfo->nLocal = (u16)nPayload; }else{ @@ -1367,11 +1370,13 @@ static void btreeParseCellPtrIndex( pInfo->pPayload = pIter; testcase( nPayload==pPage->maxLocal ); testcase( nPayload==(u32)pPage->maxLocal+1 ); + assert( nPayload>=0 ); + assert( pPage->maxLocal <= BT_MAX_LOCAL ); if( nPayload<=pPage->maxLocal ){ /* This is the (easy) common case where the entire payload fits ** on the local page. No overflow is required. */ - pInfo->nSize = nPayload + (u16)(pIter - pCell); + pInfo->nSize = (u16)nPayload + (u16)(pIter - pCell); if( pInfo->nSize<4 ) pInfo->nSize = 4; pInfo->nLocal = (u16)nPayload; }else{ @@ -1910,14 +1915,14 @@ static SQLITE_INLINE int allocateSpace(MemPage *pPage, int nByte, int *pIdx){ ** at the end of the page. So do additional corruption checks inside this ** routine and return SQLITE_CORRUPT if any problems are found. */ -static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){ - u16 iPtr; /* Address of ptr to next freeblock */ - u16 iFreeBlk; /* Address of the next freeblock */ +static int freeSpace(MemPage *pPage, int iStart, int iSize){ + int iPtr; /* Address of ptr to next freeblock */ + int iFreeBlk; /* Address of the next freeblock */ u8 hdr; /* Page header size. 0 or 100 */ - u8 nFrag = 0; /* Reduction in fragmentation */ - u16 iOrigSize = iSize; /* Original value of iSize */ - u16 x; /* Offset to cell content area */ - u32 iEnd = iStart + iSize; /* First byte past the iStart buffer */ + int nFrag = 0; /* Reduction in fragmentation */ + int iOrigSize = iSize; /* Original value of iSize */ + int x; /* Offset to cell content area */ + int iEnd = iStart + iSize; /* First byte past the iStart buffer */ unsigned char *data = pPage->aData; /* Page content */ u8 *pTmp; /* Temporary ptr into data[] */ @@ -1944,7 +1949,7 @@ static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){ } iPtr = iFreeBlk; } - if( iFreeBlk>pPage->pBt->usableSize-4 ){ /* TH3: corrupt081.100 */ + if( iFreeBlk>(int)pPage->pBt->usableSize-4 ){ /* TH3: corrupt081.100 */ return SQLITE_CORRUPT_PAGE(pPage); } assert( iFreeBlk>iPtr || iFreeBlk==0 || CORRUPT_DB ); @@ -1959,7 +1964,7 @@ static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){ nFrag = iFreeBlk - iEnd; if( iEnd>iFreeBlk ) return SQLITE_CORRUPT_PAGE(pPage); iEnd = iFreeBlk + get2byte(&data[iFreeBlk+2]); - if( iEnd > pPage->pBt->usableSize ){ + if( iEnd > (int)pPage->pBt->usableSize ){ return SQLITE_CORRUPT_PAGE(pPage); } iSize = iEnd - iStart; @@ -1980,7 +1985,7 @@ static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){ } } if( nFrag>data[hdr+7] ) return SQLITE_CORRUPT_PAGE(pPage); - data[hdr+7] -= nFrag; + data[hdr+7] -= (u8)nFrag; } pTmp = &data[hdr+5]; x = get2byte(pTmp); @@ -2001,7 +2006,8 @@ static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){ /* Insert the new freeblock into the freelist */ put2byte(&data[iPtr], iStart); put2byte(&data[iStart], iFreeBlk); - put2byte(&data[iStart+2], iSize); + assert( iSize>=0 && iSize<=0xffff ); + put2byte(&data[iStart+2], (u16)iSize); } pPage->nFree += iOrigSize; return SQLITE_OK; @@ -2227,7 +2233,7 @@ static int btreeInitPage(MemPage *pPage){ assert( pBt->pageSize>=512 && pBt->pageSize<=65536 ); pPage->maskPage = (u16)(pBt->pageSize - 1); pPage->nOverflow = 0; - pPage->cellOffset = pPage->hdrOffset + 8 + pPage->childPtrSize; + pPage->cellOffset = (u16)(pPage->hdrOffset + 8 + pPage->childPtrSize); pPage->aCellIdx = data + pPage->childPtrSize + 8; pPage->aDataEnd = pPage->aData + pBt->pageSize; pPage->aDataOfst = pPage->aData + pPage->childPtrSize; @@ -2261,8 +2267,8 @@ static int btreeInitPage(MemPage *pPage){ static void zeroPage(MemPage *pPage, int flags){ unsigned char *data = pPage->aData; BtShared *pBt = pPage->pBt; - u8 hdr = pPage->hdrOffset; - u16 first; + int hdr = pPage->hdrOffset; + int first; assert( sqlite3PagerPagenumber(pPage->pDbPage)==pPage->pgno || CORRUPT_DB ); assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage ); @@ -2279,7 +2285,7 @@ static void zeroPage(MemPage *pPage, int flags){ put2byte(&data[hdr+5], pBt->usableSize); pPage->nFree = (u16)(pBt->usableSize - first); decodeFlags(pPage, flags); - pPage->cellOffset = first; + pPage->cellOffset = (u16)first; pPage->aDataEnd = &data[pBt->pageSize]; pPage->aCellIdx = &data[first]; pPage->aDataOfst = &data[pPage->childPtrSize]; @@ -3065,7 +3071,7 @@ int sqlite3BtreeSetPageSize(Btree *p, int pageSize, int nReserve, int iFix){ BtShared *pBt = p->pBt; assert( nReserve>=0 && nReserve<=255 ); sqlite3BtreeEnter(p); - pBt->nReserveWanted = nReserve; + pBt->nReserveWanted = (u8)nReserve; x = pBt->pageSize - pBt->usableSize; if( nReservebtsFlags & BTS_PAGESIZE_FIXED ){ @@ -3171,7 +3177,7 @@ int sqlite3BtreeSecureDelete(Btree *p, int newFlag){ assert( BTS_FAST_SECURE==(BTS_OVERWRITE|BTS_SECURE_DELETE) ); if( newFlag>=0 ){ p->pBt->btsFlags &= ~BTS_FAST_SECURE; - p->pBt->btsFlags |= BTS_SECURE_DELETE*newFlag; + p->pBt->btsFlags |= (u16)(BTS_SECURE_DELETE*newFlag); } b = (p->pBt->btsFlags & BTS_FAST_SECURE)/BTS_SECURE_DELETE; sqlite3BtreeLeave(p); @@ -7619,7 +7625,8 @@ static int rebuildPage( } /* The pPg->nFree field is now set incorrectly. The caller will fix it. */ - pPg->nCell = nCell; + assert( nCell < 10922 ); + pPg->nCell = (u16)nCell; pPg->nOverflow = 0; put2byte(&aData[hdr+1], 0); @@ -7866,9 +7873,13 @@ static int editPage( if( pageInsertArray( pPg, pBegin, &pData, pCellptr, iNew+nCell, nNew-nCell, pCArray - ) ) goto editpage_fail; + ) + ){ + goto editpage_fail; + } - pPg->nCell = nNew; + assert( nNew < 10922 ); + pPg->nCell = (u16)nNew; pPg->nOverflow = 0; put2byte(&aData[hdr+3], pPg->nCell); @@ -8177,7 +8188,7 @@ static int balance_nonroot( int pageFlags; /* Value of pPage->aData[0] */ int iSpace1 = 0; /* First unused byte of aSpace1[] */ int iOvflSpace = 0; /* First unused byte of aOvflSpace[] */ - int szScratch; /* Size of scratch memory requested */ + u64 szScratch; /* Size of scratch memory requested */ MemPage *apOld[NB]; /* pPage and up to two siblings */ MemPage *apNew[NB+2]; /* pPage and up to NB siblings after balancing */ u8 *pRight; /* Location in parent of right-sibling pointer */ @@ -9462,7 +9473,7 @@ int sqlite3BtreeInsert( if( pCur->info.nKey==pX->nKey ){ BtreePayload x2; x2.pData = pX->pKey; - x2.nData = pX->nKey; + x2.nData = (int)pX->nKey; assert( pX->nKey<=0x7fffffff ); x2.nZero = 0; return btreeOverwriteCell(pCur, &x2); } @@ -9643,7 +9654,7 @@ int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 iKey){ getCellInfo(pSrc); if( pSrc->info.nPayload<0x80 ){ - *(aOut++) = pSrc->info.nPayload; + *(aOut++) = (u8)pSrc->info.nPayload; }else{ aOut += sqlite3PutVarint(aOut, pSrc->info.nPayload); } @@ -9656,7 +9667,7 @@ int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 iKey){ nRem = pSrc->info.nPayload; if( nIn==nRem && nInpPage->maxLocal ){ memcpy(aOut, aIn, nIn); - pBt->nPreformatSize = nIn + (aOut - pBt->pTmpSpace); + pBt->nPreformatSize = nIn + (int)(aOut - pBt->pTmpSpace); return SQLITE_OK; }else{ int rc = SQLITE_OK; @@ -9668,7 +9679,7 @@ int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 iKey){ u32 nOut; /* Size of output buffer aOut[] */ nOut = btreePayloadToLocal(pDest->pPage, pSrc->info.nPayload); - pBt->nPreformatSize = nOut + (aOut - pBt->pTmpSpace); + pBt->nPreformatSize = (int)nOut + (int)(aOut - pBt->pTmpSpace); if( nOutinfo.nPayload ){ pPgnoOut = &aOut[nOut]; pBt->nPreformatSize += 4; diff --git a/src/btreeInt.h b/src/btreeInt.h index 1213297253..17e3a1add5 100644 --- a/src/btreeInt.h +++ b/src/btreeInt.h @@ -496,6 +496,12 @@ struct CellInfo { */ #define BTCURSOR_MAX_DEPTH 20 +/* +** Maximum amount of storage local to a database page, regardless of +** page size. +*/ +#define BT_MAX_LOCAL 65501 /* 65536 - 35 */ + /* ** A cursor is a pointer to a particular entry within a particular ** b-tree within a database file.