From 0cd38cd2b9adb966e4ff02596526725311fadf64 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 27 Jan 2023 01:33:12 +0000 Subject: [PATCH 01/65] Beginnings of a bundler-friendly build of sqlite3.mjs. Not yet ready for downstream testing. FossilOrigin-Name: 4271bf5f41df091696f1dcfc4ffe7a60d24066fc75c896941e0b56de95fe5f89 --- ext/wasm/GNUmakefile | 88 ++++++++++++++++++++------- ext/wasm/api/extern-post-js.c-pp.js | 5 ++ ext/wasm/api/pre-js.c-pp.js | 13 ++-- ext/wasm/api/sqlite3-vfs-opfs.c-pp.js | 4 +- ext/wasm/dist.make | 2 + manifest | 23 ++++--- manifest.uuid | 2 +- 7 files changed, 98 insertions(+), 39 deletions(-) diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index f391868d48..4c2a336f44 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -37,6 +37,15 @@ # - wasm-strip for release builds: https://github.com/WebAssembly/wabt # - InfoZip for 'dist' zip file ######################################################################## +# +# Significant TODOs for this build include, but are not necessarily +# limited to: +# +# 1) Consolidate the code generation for sqlite3*.*js into a script +# which generates the makefile code, rather than using $(call) and +# $(eval), or at least centralize the setup of the numerous vars +# related to each build variant (vanilla, esm, bundler-friendly). +# SHELL := $(shell which bash 2>/dev/null) MAKEFILE := $(lastword $(MAKEFILE_LIST)) CLEAN_FILES := @@ -228,6 +237,7 @@ CLEAN_FILES += $(2) endef c-pp.D.vanilla ?= c-pp.D.esm ?= -Dtarget=es6-module +c-pp.D.bundler-friendly ?= -Dtarget=es6-module -Dtarget=es6-bundler-friendly # /end C-PP.FILTER ######################################################################## @@ -355,9 +365,11 @@ $(sqlite3-api.js.in): $(sqlite3-api.jses) $(MAKEFILE) # for real-life clients. sqlite3-api.js := $(dir.dout)/sqlite3-api.js sqlite3-api.mjs := $(dir.dout)/sqlite3-api.mjs +sqlite3-api-bundler-friendly.mjs := $(dir.dout)/sqlite3-api-bundler-friendly.mjs $(eval $(call C-PP.FILTER, $(sqlite3-api.js.in), $(sqlite3-api.js))) $(eval $(call C-PP.FILTER, $(sqlite3-api.js.in), $(sqlite3-api.mjs), $(c-pp.D.esm))) -all: $(sqlite3-api.js) $(sqlite3-api.mjs) +$(eval $(call C-PP.FILTER, $(sqlite3-api.js.in), $(sqlite3-api-bundler-friendly.mjs), $(c-pp.D.bundler-friendly))) +all: $(sqlite3-api.js) $(sqlite3-api.mjs) $(sqlite3-api-bundler-friendly.mjs) $(sqlite3-api-build-version.js): $(bin.version-info) $(MAKEFILE) @echo "Making $@..." @@ -374,7 +386,7 @@ $(sqlite3-license-version.js): $(sqlite3.h) $(sqlite3-license-version-header.js) cat $(sqlite3-license-version-header.js); \ echo '/*'; \ echo '** This code was built from sqlite3 version...'; \ - echo "** "; \ + echo "**"; \ awk -e '/define SQLITE_VERSION/{$$1=""; print "**" $$0}' \ -e '/define SQLITE_SOURCE_ID/{$$1=""; print "**" $$0}' $(sqlite3.h); \ echo '*/'; \ @@ -385,13 +397,16 @@ $(sqlite3-license-version.js): $(sqlite3.h) $(sqlite3-license-version-header.js) # the generated emscripten module file. The following rules generate # various versions of those files for the vanilla and ESM builds. pre-js.js.in := $(dir.api)/pre-js.c-pp.js -pre-js.js.esm := $(dir.tmp)/pre-js.esm.js pre-js.js.vanilla := $(dir.tmp)/pre-js.vanilla.js +pre-js.js.esm := $(dir.tmp)/pre-js.esm.js +pre-js.js.bundler-friendly := $(dir.tmp)/pre-js.bundler-friendly.js $(eval $(call C-PP.FILTER,$(pre-js.js.in),$(pre-js.js.vanilla),$(c-pp.D.vanilla))) $(eval $(call C-PP.FILTER,$(pre-js.js.in),$(pre-js.js.esm),$(c-pp.D.esm))) +$(eval $(call C-PP.FILTER,$(pre-js.js.in),$(pre-js.js.bundler-friendly),$(c-pp.D.bundler-friendly))) post-js.js.in := $(dir.tmp)/post-js.c-pp.js post-js.js.vanilla := $(dir.tmp)/post-js.vanilla.js post-js.js.esm := $(dir.tmp)/post-js.esm.js +post-js.js.bundler-friendly := $(dir.tmp)/post-js.bundler-friendly.js post-jses.js := \ $(dir.api)/post-js-header.js \ $(sqlite3-api.js.in) \ @@ -405,6 +420,7 @@ $(post-js.js.in): $(post-jses.js) $(MAKEFILE) done > $@ $(eval $(call C-PP.FILTER,$(post-js.js.in),$(post-js.js.vanilla),$(c-pp.D.vanilla))) $(eval $(call C-PP.FILTER,$(post-js.js.in),$(post-js.js.esm),$(c-pp.D.esm))) +$(eval $(call C-PP.FILTER,$(post-js.js.in),$(post-js.js.bundler-friendly),$(c-pp.D.bundler-friendly))) # extern-post-js* and extern-pre-js* are files for use with # Emscripten's --extern-pre-js and --extern-post-js flags. These @@ -412,8 +428,10 @@ $(eval $(call C-PP.FILTER,$(post-js.js.in),$(post-js.js.esm),$(c-pp.D.esm))) extern-post-js.js.in := $(dir.api)/extern-post-js.c-pp.js extern-post-js.js.vanilla := $(dir.tmp)/extern-post-js.vanilla.js extern-post-js.js.esm := $(dir.tmp)/extern-post-js.esm.js +extern-post-js.js.bundler-friendly := $(dir.tmp)/extern-post-js.bundler-friendly.js $(eval $(call C-PP.FILTER,$(extern-post-js.js.in),$(extern-post-js.js.vanilla),$(c-pp.D.vanilla))) $(eval $(call C-PP.FILTER,$(extern-post-js.js.in),$(extern-post-js.js.esm),$(c-pp.D.esm))) +$(eval $(call C-PP.FILTER,$(extern-post-js.js.in),$(extern-post-js.js.bundler-friendly),$(c-pp.D.bundler-friendly))) extern-pre-js.js := $(dir.api)/extern-pre-js.js # Emscripten flags for --[extern-][pre|post]-js=... for the @@ -428,6 +446,10 @@ pre-post-common.flags.esm := \ $(pre-post-common.flags) \ --post-js=$(post-js.js.esm) \ --extern-post-js=$(extern-post-js.js.esm) +pre-post-common.flags.bundler-friendly := \ + $(pre-post-common.flags) \ + --post-js=$(post-js.js.bundler-friendly) \ + --extern-post-js=$(extern-post-js.js.bundler-friendly) # pre-post-jses.deps.* = a list of dependencies for the # --[extern-][pre/post]-js files. @@ -436,14 +458,16 @@ pre-post-jses.deps.vanilla := $(pre-post-jses.deps.common) \ $(post-js.js.vanilla) $(extern-post-js.js.vanilla) pre-post-jses.deps.esm := $(pre-post-jses.deps.common) \ $(post-js.js.esm) $(extern-post-js.js.esm) +pre-post-jses.deps.bundler-friendly := $(pre-post-jses.deps.common) \ + $(post-js.js.bundler-friendly) $(extern-post-js.js.bundler-friendly) ######################################################################## # call-make-pre-js is a $(call)able which creates rules for # pre-js-$(1).js. $1 = the base name of the JS file on whose behalf -# this pre-js is for. $2 is the build mode: one of (vanilla, esm). -# This sets up --[extern-][pre/post]-js flags in -# $(pre-post-$(1).flags.$(2)) and dependencies in -# $(pre-post-$(1).deps.$(2)). +# this pre-js is for (one of: sqlite3, sqlite3-wasm). $2 is the build +# mode: one of (vanilla, esm, bundler-friendly). This sets up +# --[extern-][pre/post]-js flags in $(pre-post-$(1).flags.$(2)) and +# dependencies in $(pre-post-$(1).deps.$(2)). define call-make-pre-js pre-post-$(1).flags.$(2) ?= $$(dir.tmp)/pre-js-$(1)-$(2).js: $$(pre-js.js.$(2)) $$(MAKEFILE) @@ -595,6 +619,7 @@ emcc.jsflags += -sLLD_REPORT_UNDEFINED sqlite3.js := $(dir.dout)/sqlite3.js sqlite3.mjs := $(dir.dout)/sqlite3.mjs +sqlite3-bundler-friendly.mjs := $(dir.dout)/sqlite3-bundler-friendly.mjs # Undocumented Emscripten feature: if the target file extension is # "mjs", it defaults to ES6 module builds: # https://github.com/emscripten-core/emscripten/issues/14383 @@ -607,13 +632,16 @@ sqlite3-wasm.c := $(dir.api)/sqlite3-wasm.c # instead of building a shared copy of sqlite3-wasm.o. $(eval $(call call-make-pre-js,sqlite3,vanilla)) $(eval $(call call-make-pre-js,sqlite3,esm)) -$(sqlite3.js) $(sqlite3.mjs): $(MAKEFILE) $(sqlite3-wasm.c) \ - $(EXPORTED_FUNCTIONS.api) +$(eval $(call call-make-pre-js,sqlite3,bundler-friendly)) +$(sqlite3.js) $(sqlite3.mjs) $(sqlite3-bundler-friendly.mjs): \ + $(MAKEFILE) $(sqlite3-wasm.c) $(EXPORTED_FUNCTIONS.api) $(sqlite3.js): $(pre-post-sqlite3.deps.vanilla) $(sqlite3.mjs): $(pre-post-sqlite3.deps.esm) +$(sqlite3-bundler-friendly.mjs): $(pre-post-sqlite3.deps.bundler-friendly) ######################################################################## # SQLITE3.xJS.RECIPE = the $(call)able recipe body for $(sqlite3.js) -# and $(sqlite3.mjs). $1 = one of (vanilla, esm). +# and $(sqlite3.mjs). $1 = one of (vanilla, esm). $2 must be 1 for +# ES6-style builds, 0 for other builds. # # Reminder for ESM builds: even if we use -sEXPORT_ES6=0, emcc _still_ # adds: @@ -622,17 +650,18 @@ $(sqlite3.mjs): $(pre-post-sqlite3.deps.esm) # # when building *.mjs, which is bad because we need to export an # overwritten version of that function and cannot "export default" -# twice. Because of this, we have to sed $(sqlite3.mjs) to remove the -# _first_ instance (only) of /^export default/. +# twice. Because of this, we have to sed *.mjs to remove the _first_ +# instance (only) of /^export default/. # # Upstream RFE: # https://github.com/emscripten-core/emscripten/issues/18237 ######################################################################## # SQLITE3.xJS.EXPORT-DEFAULT is part of SQLITE3[-WASMFS].xJS.RECIPE, -# factored into a separate piece to avoid code duplication. $1 is -# the build mode: one of (vanilla, esm). +# factored into a separate piece to avoid code duplication. $1 is 1 if +# the build mode needs this workaround (esm, bundler-friendly) and 0 +# if not (vanilla). define SQLITE3.xJS.ESM-EXPORT-DEFAULT -if [ esm = $(1) ]; then \ +if [ x1 = x$(1) ]; then \ echo "Fragile workaround for an Emscripten annoyance. See SQLITE3.xJS.RECIPE."; \ sed -i -e '0,/^export default/{/^export default/d;}' $@ || exit $$?; \ if ! grep -q '^export default' $@; then \ @@ -647,30 +676,41 @@ define SQLITE3.xJS.RECIPE $(emcc.jsflags) \ $(pre-post-sqlite3.flags.$(1)) $(emcc.flags.sqlite3.$(1)) \ $(cflags.common) $(SQLITE_OPT) $(sqlite3-wasm.c) - @$(call SQLITE3.xJS.ESM-EXPORT-DEFAULT,$(1)) + @$(call SQLITE3.xJS.ESM-EXPORT-DEFAULT,$(2)) + @if [ bundler-friendly = $(1) ]; then \ + echo "Patching sqlite3-bundler-friendly.js for sqlite3.wasm..."; \ + rm -f $(dir.dout)/sqlite3-bundler-friendly.wasm; \ + sed -i -e 's/sqlite3-bundler-friendly.wasm/sqlite3.wasm/g' $@ || exit $$?; \ + fi chmod -x $(sqlite3.wasm) $(maybe-wasm-strip) $(sqlite3.wasm) @ls -la $@ $(sqlite3.wasm) endef emcc.flags.sqlite3.vanilla := emcc.flags.sqlite3.esm := -sEXPORT_ES6 -sUSE_ES6_IMPORT_META +emcc.flags.sqlite3.bundler-friendly := $(emcc.flags.sqlite3.esm) $(sqlite3.js): - $(call SQLITE3.xJS.RECIPE,vanilla) + $(call SQLITE3.xJS.RECIPE,vanilla,0) $(sqlite3.mjs): - $(call SQLITE3.xJS.RECIPE,esm) + $(call SQLITE3.xJS.RECIPE,esm,1) +$(sqlite3-bundler-friendly.mjs): + $(call SQLITE3.xJS.RECIPE,bundler-friendly,1) ######################################################################## # We have to ensure that we do not build both $(sqlite3.js) and # $(sqlite3.mjs) in parallel because both result in the creation of # $(sqlite3.wasm). We have no(?) way to build just the .mjs file # without also building the .wasm file. i.e. we're building -# $(sqlite3.wasm) twice, but that's apparently unavoidable (and -# harmless, just a waste of build time). +# $(sqlite3.wasm) multiple times, but that's apparently unavoidable +# (and harmless, just a waste of build time). $(sqlite3.wasm): $(sqlite3.js) $(sqlite3.mjs): $(sqlite3.js) -CLEAN_FILES += $(sqlite3.js) $(sqlite3.mjs) $(sqlite3.wasm) -all: $(sqlite3.js) $(sqlite3.mjs) +$(sqlite3-bundler-friendly.mjs): $(sqlite3.js) +CLEAN_FILES += $(sqlite3.js) $(sqlite3.mjs) $(sqlite3-bundler-friendly.mjs) \ + $(sqlite3.wasm) +all: $(sqlite3.js) $(sqlite3.mjs) $(sqlite3-bundler-friendly.mjs) quick: $(sqlite3.js) quick: $(sqlite3.mjs) # for the sake of the snapshot build +quick: $(sqlite3-bundler-friendly.mjs) # for the sake of the snapshot build # End main $(sqlite3.js) build ######################################################################## @@ -780,7 +820,7 @@ CLEAN_FILES += $(speedtest1.js) $(speedtest1.wasm) # 4) Load sqlite3 as an ESM worker. (Not all browsers support this.) # # To that end, we require two separate builds of tester1.js: -# +# # tester1.js: cases 1 and 2 # tester1.mjs: cases 3 and 4 # @@ -790,6 +830,8 @@ $(eval $(call C-PP.FILTER,tester1.c-pp.js,tester1.mjs,$(c-pp.D.esm))) $(eval $(call C-PP.FILTER,tester1.c-pp.html,tester1.html)) $(eval $(call C-PP.FILTER,tester1.c-pp.html,tester1-esm.html,$(c-pp.D.esm))) tester1: tester1.js tester1.mjs tester1.html tester1-esm.html +# Note that we do not include $(sqlite3-bundler-friendly.mjs) in this +# because bundlers are client-specific. all quick: tester1 ######################################################################## diff --git a/ext/wasm/api/extern-post-js.c-pp.js b/ext/wasm/api/extern-post-js.c-pp.js index 2258697944..87d99eabaa 100644 --- a/ext/wasm/api/extern-post-js.c-pp.js +++ b/ext/wasm/api/extern-post-js.c-pp.js @@ -105,6 +105,10 @@ const toExportForES6 = document?.currentScript?.src); } } +//#ifnot target=es6-module +// Emscripten does not inject these module-loader bits in ES6 module +// build and including them here breaks JS bundlers, so elide them +// from ES6 builds. /* Replace the various module exports performed by the Emscripten glue... */ if (typeof exports === 'object' && typeof module === 'object'){ @@ -114,6 +118,7 @@ const toExportForES6 = } /* AMD modules get injected in a way we cannot override, so we can't handle those here. */ +//#endif // !target=es6-module return self.sqlite3InitModule /* required for ESM */; })(); //#if target=es6-module diff --git a/ext/wasm/api/pre-js.c-pp.js b/ext/wasm/api/pre-js.c-pp.js index 2e2fe66bc9..d1ee3be198 100644 --- a/ext/wasm/api/pre-js.c-pp.js +++ b/ext/wasm/api/pre-js.c-pp.js @@ -29,7 +29,12 @@ sqlite3InitModuleState.debugModule('self.location =',self.location); 4) If none of the above apply, (prefix+path) is returned. */ Module['locateFile'] = function(path, prefix) { -//#if target=es6-module +//#if target=es6-bundler-friendly + // TEMPORARY KLUDGE to work around a c-pp nested blocks bug which is + // currently eluding a fix. We really should have (#ifnot + // target=es6-bundler-friendly) around this whole function. + return new URL('sqlite3.wasm', import.meta.url).href; +//#elif target=es6-module return new URL(path, import.meta.url).href; //#else 'use strict'; @@ -51,7 +56,7 @@ Module['locateFile'] = function(path, prefix) { "result =", theFile ); return theFile; -//#endif /* SQLITE_JS_EMS */ +//#endif //target=es6-module }.bind(sqlite3InitModuleState); /** @@ -62,7 +67,7 @@ Module['locateFile'] = function(path, prefix) { In such builds we must disable this. */ -const xNameOfInstantiateWasm = true +const xNameOfInstantiateWasm = false ? 'instantiateWasm' : 'emscripten-bug-17951'; Module[xNameOfInstantiateWasm] = function callee(imports,onSuccess){ @@ -102,4 +107,4 @@ Module[xNameOfInstantiateWasm] = function callee(imports,onSuccess){ Module[xNameOfInstantiateWasm].uri = 'sqlite3.wasm'; /* END FILE: api/pre-js.js, noting that the build process may add a line after this one to change the above .uri to a build-specific - one. */ + one. *//* END FILE: api/pre-js.js */ diff --git a/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js b/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js index 2ded905ad5..451f0019c2 100644 --- a/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js +++ b/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js @@ -198,7 +198,9 @@ const installOpfsVfs = function callee(options){ return promiseReject_(err); }; const W = -//#if target=es6-module +//#if target=es6-bundler-friendly + new Worker(new URL("sqlite3-opfs-async-proxy.js", import.meta.url)); +//#elif target=es6-module new Worker(new URL(options.proxyUri, import.meta.url)); //#else new Worker(options.proxyUri); diff --git a/ext/wasm/dist.make b/ext/wasm/dist.make index 8b1a2d4f1c..ffc2613703 100644 --- a/ext/wasm/dist.make +++ b/ext/wasm/dist.make @@ -84,6 +84,8 @@ dist: \ > $(dist-dir.jswasm)/$(notdir $(sqlite3.js)) @$(bin.stripccomments) -k -k < $(sqlite3.mjs) \ > $(dist-dir.jswasm)/$(notdir $(sqlite3.mjs)) + @$(bin.stripccomments) -k -k < $(sqlite3-bundler-friendly.mjs) \ + > $(dist-dir.jswasm)/$(notdir $(sqlite3-bundler-friendly.mjs)) @cp -p $(dist.common.extras) $(dist-dir.common) @set -e; \ vnum=$$($(bin.version-info) --download-version); \ diff --git a/manifest b/manifest index 79a76316b2..cd30a76777 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C End-of-line\swhitespace\scleanups\sand\sdoc\stypo\sfixes.\sNo\scode\schanges. -D 2023-01-26T20:08:59.766 +C Beginnings\sof\sa\sbundler-friendly\sbuild\sof\ssqlite3.mjs.\sNot\syet\sready\sfor\sdownstream\stesting. +D 2023-01-27T01:33:12.220 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -466,17 +466,17 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c -F ext/wasm/GNUmakefile 4ce83fdda22c6fde2bd311e87d6bec7469ca3859e758d1f34cd601e64c539efa +F ext/wasm/GNUmakefile 9685958e3c5942c50f16fadbb0c2377252689c52e022a8c1897ad5c4cf751298 F ext/wasm/README-dist.txt dab111337028af58ec11cb35c2e1a82398217c399c7499fefab0509a0499a5d7 F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9 F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287 F ext/wasm/api/README.md 77a2f1f2fc60a35def7455dffc8d3f2c56385d6ac5c6cecc60fa938252ea2c54 -F ext/wasm/api/extern-post-js.c-pp.js 8923f76c3d2213159e12d641dc750523ead5c848185dc4996fae5cc12397f88d +F ext/wasm/api/extern-post-js.c-pp.js 9c1f67c368660cb14b6ddee0ed7c87c70594a41c2a0adc7005016feda6c0cbdb F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41 F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08902f15c34720ee4a1 F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b35ff3ed9cfd281a62 -F ext/wasm/api/pre-js.c-pp.js b88499dc303c21fc3f55f2c364a0f814f587b60a95784303881169f9e91c1d5f +F ext/wasm/api/pre-js.c-pp.js 26be645141fe11e614acb1bca777c2e6374680d503a276d96afb9df7939ba5d3 F ext/wasm/api/sqlite3-api-cleanup.js 680d5ccfff54459db136a49b2199d9f879c8405d9c99af1dda0cc5e7c29056f4 F ext/wasm/api/sqlite3-api-glue.js 0a93e58aabf52b32ddccbb107a1fd4552f2505e103ab63396c4d0a0743704785 F ext/wasm/api/sqlite3-api-oo1.js e9fba119e9b1716b3f731838ed1ab18741401bcf4c51d2a4a6e9d1d23cf9d771 @@ -485,7 +485,7 @@ F ext/wasm/api/sqlite3-api-worker1.js c9ef8865f072e61251260b218aa4ed614a21a25e9e F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3 F ext/wasm/api/sqlite3-opfs-async-proxy.js 7795b84b66a7a8dedc791340709b310bb497c3c72a80bef364fa2a58e2ddae3f F ext/wasm/api/sqlite3-v-helper.js 6f6c3e390a72e08b0a5b16a0d567d7af3c04d172831853a29d72a6f1dd40ff24 -F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 50e4f6103dc65556e3e040f9e80eb8f14bfc6f979fa018952859f7755e201b27 +F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js a10bdc9695dcf453e120970a5de8a3e61db4e4047d0a7cc5a6d63dfe7ae87f4e F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9 F ext/wasm/api/sqlite3-wasm.c 76625a70937a8522d014ef686c32db5b53a3ee61850323f5c601d2ac39fe52fe F ext/wasm/api/sqlite3-worker1-promiser.js 0c7a9826dbf82a5ed4e4f7bf7816e825a52aff253afbf3350431f5773faf0e4b @@ -506,7 +506,7 @@ F ext/wasm/demo-worker1-promiser.html 1de7c248c7c2cfd4a5783d2aa154bce62d74c6de98 F ext/wasm/demo-worker1-promiser.js b99c550763fa792c204e9a7cceadd976004036d9fc3e22fab7051712e30d207d F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2eb1ab2c68ef5d F ext/wasm/demo-worker1.js a619adffc98b75b66c633b00f747b856449a134a9a0357909287d80a182d70fa -F ext/wasm/dist.make 5523b02e824db5ab8176e3eedc2e709fe1204d8f4d6e52e8321cdf6830114b72 +F ext/wasm/dist.make b50668a4f79d4464a59c3378b6b53968bb0652a06737b1e0b07544458de28f3d F ext/wasm/fiddle.make d5308b5c35f691758ef20badd25f91f3780b20415760daf0d98afbe4f24921b9 F ext/wasm/fiddle/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d69513dd6ef1f289ada3f F ext/wasm/fiddle/fiddle-worker.js b4a0c8ab6c0983218543ca771c45f6075449f63a1dcf290ae5a681b2cba8800d @@ -2044,8 +2044,11 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P f51406e3bf92f2b46f13d08fb7c7fe7683feba68b5a8fa18f6f6b8845662deac -R c978e0ce582e6e1cfdd4ca23d28f0447 +P bdfd72a083fadd724030c4c89adae71426e1ddd402c6bc5abf40801ecf3253cf +R 1d25c63e8015d3a2077316f9c5633e5e +T *branch * js-bundler-friendly +T *sym-js-bundler-friendly * +T -sym-trunk * Cancelled\sby\sbranch. U stephan -Z 71857224353d5c38a14866ad03e5be27 +Z da3be54ec4b55cd9837defeb06176624 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 1dfea574f9..da2a6bc40e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -bdfd72a083fadd724030c4c89adae71426e1ddd402c6bc5abf40801ecf3253cf \ No newline at end of file +4271bf5f41df091696f1dcfc4ffe7a60d24066fc75c896941e0b56de95fe5f89 \ No newline at end of file From 67bfea4ea6fb3bba1425079301727d350132cde0 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 27 Jan 2023 02:21:16 +0000 Subject: [PATCH 02/65] Resolve a nested if-block bug in ext/wasm/c-pp.c which caused output after a nested block to be unduly elided. Remove a kludge, added in the previous check-in, which worked around that bug. FossilOrigin-Name: 7a026a4b24d57c1b0970923b972dd42c3f1bb5b282f908079075468b2e1bf601 --- ext/wasm/api/pre-js.c-pp.js | 11 ++++------- ext/wasm/c-pp.c | 39 +++++++++++++++++++++---------------- manifest | 17 +++++++--------- manifest.uuid | 2 +- 4 files changed, 34 insertions(+), 35 deletions(-) diff --git a/ext/wasm/api/pre-js.c-pp.js b/ext/wasm/api/pre-js.c-pp.js index d1ee3be198..772601f428 100644 --- a/ext/wasm/api/pre-js.c-pp.js +++ b/ext/wasm/api/pre-js.c-pp.js @@ -10,6 +10,7 @@ const sqlite3InitModuleState = self.sqlite3InitModuleState || Object.create(null delete self.sqlite3InitModuleState; sqlite3InitModuleState.debugModule('self.location =',self.location); +//#ifnot target=es6-bundler-friendly /** This custom locateFile() tries to figure out where to load `path` from. The intent is to provide a way for foo/bar/X.js loaded from a @@ -29,12 +30,7 @@ sqlite3InitModuleState.debugModule('self.location =',self.location); 4) If none of the above apply, (prefix+path) is returned. */ Module['locateFile'] = function(path, prefix) { -//#if target=es6-bundler-friendly - // TEMPORARY KLUDGE to work around a c-pp nested blocks bug which is - // currently eluding a fix. We really should have (#ifnot - // target=es6-bundler-friendly) around this whole function. - return new URL('sqlite3.wasm', import.meta.url).href; -//#elif target=es6-module +//#if target=es6-module return new URL(path, import.meta.url).href; //#else 'use strict'; @@ -58,6 +54,7 @@ Module['locateFile'] = function(path, prefix) { return theFile; //#endif //target=es6-module }.bind(sqlite3InitModuleState); +//#endif //ifnot target=es6-bundler-friendly /** Bug warning: a custom Module.instantiateWasm() does not work @@ -107,4 +104,4 @@ Module[xNameOfInstantiateWasm] = function callee(imports,onSuccess){ Module[xNameOfInstantiateWasm].uri = 'sqlite3.wasm'; /* END FILE: api/pre-js.js, noting that the build process may add a line after this one to change the above .uri to a build-specific - one. *//* END FILE: api/pre-js.js */ + one. */ diff --git a/ext/wasm/c-pp.c b/ext/wasm/c-pp.c index 881c009acb..c439a0d091 100644 --- a/ext/wasm/c-pp.c +++ b/ext/wasm/c-pp.c @@ -51,10 +51,10 @@ ** ** Design note: this code makes use of sqlite3. Though not _strictly_ ** needed in order to implement it, this tool was specifically created -** for potential use with the sqlite3 project's own JavaScript code, -** so there's no reason not to make use of it to do some of the heavy -** lifting. It does not require any cutting-edge sqlite3 features and -** should be usable with any version which supports `WITHOUT ROWID`. +** for use with the sqlite3 project's own JavaScript code, so there's +** no reason not to make use of it to do some of the heavy lifting. It +** does not require any cutting-edge sqlite3 features and should be +** usable with any version which supports `WITHOUT ROWID`. ** ** Author(s): ** @@ -603,18 +603,9 @@ void g_stderr(char const *zFmt, ...){ va_end(va); } -#if 0 -void cmpp_t_outf(CmppTokenizer * t, char const *zFmt, ...){ - if(!CT_skip(t)){ - va_list va; - va_start(va, zFmt); - vfprintf(g.out.pFile, zFmt, va); - va_end(va); - } -} -#endif - void cmpp_t_out(CmppTokenizer * t, void const *z, unsigned int n){ + g_debug(3,("CT_skipLevel() ?= %d\n",CT_skipLevel(t))); + g_debug(3,("CT_skip() ?= %d\n",CT_skip(t))); if(!CT_skip(t)){ if(1!=fwrite(z, n, 1, g.out.pFile)){ int const err = errno; @@ -631,18 +622,28 @@ void CmppLevel_push(CmppTokenizer * const t){ g.zDelim, CmppLevel_Max); } pPrev = &CT_level(t); + g_debug(3,("push from tokenizer level=%u flags=%04x\n", t->level.ndx, pPrev->flags)); p = &t->level.stack[++t->level.ndx]; *p = CmppLevel_empty; p->token = t->token; p->flags = (CmppLevel_F_INHERIT_MASK & pPrev->flags); if(CLvl_skip(pPrev)) p->flags |= CmppLevel_F_ELIDE; + g_debug(3,("push to tokenizer level=%u flags=%04x\n", t->level.ndx, p->flags)); } void CmppLevel_pop(CmppTokenizer * const t){ if(!t->level.ndx){ fatal("Internal error: CmppLevel_pop() at the top of the stack"); } + g_debug(3,("pop from tokenizer level=%u, flags=%04x skipLevel?=%d\n", t->level.ndx, + t->level.stack[t->level.ndx].flags, CT_skipLevel(t))); + g_debug(3,("CT_skipLevel() ?= %d\n",CT_skipLevel(t))); + g_debug(3,("CT_skip() ?= %d\n",CT_skip(t))); t->level.stack[t->level.ndx--] = CmppLevel_empty; + g_debug(3,("pop to tokenizer level=%u, flags=%04x\n", t->level.ndx, + t->level.stack[t->level.ndx].flags)); + g_debug(3,("CT_skipLevel() ?= %d\n",CT_skipLevel(t))); + g_debug(3,("CT_skip() ?= %d\n",CT_skip(t))); } CmppLevel * CmppLevel_get(CmppTokenizer * const t){ @@ -776,7 +777,7 @@ int db_define_has(const char * zName){ assert(SQLITE_DONE==rc); rc = 0; } - g_debug(1,("define has [%s] = %d\n",zName, rc)); + g_debug(1,("defined [%s] ?= %d\n",zName, rc)); sqlite3_clear_bindings(g.stmt.defHas); sqlite3_reset(g.stmt.defHas); return rc; @@ -1220,10 +1221,11 @@ static void cmpp_kwd_if(CmppKeyword const * pKw, CmppTokenizer *t){ if(TT_IfNot==pKw->ttype || TT_ElifNot==pKw->ttype) buul = !buul; if(buul){ CT_pstate(t) = tmpState = TS_IfPassed; - CT_skipLevel(t) = 0; + CT_skipLevel(t) = 0; }else{ CT_pstate(t) = TS_If /* also for TT_IfNot, TT_Elif, TT_ElifNot */; CT_skipLevel(t) = 1; + g_debug(3,("setting CT_skipLevel = 1 @ level %d\n", t->level.ndx)); } if(TT_If==pKw->ttype || TT_IfNot==pKw->ttype){ unsigned const lvlIf = t->level.ndx; @@ -1234,10 +1236,13 @@ static void cmpp_kwd_if(CmppKeyword const * pKw, CmppTokenizer *t){ assert(TT_EndIf == t->token.ttype); break; } +#if 0 if(TS_IfPassed==tmpState){ tmpState = TS_Start; t->level.stack[lvlIf].flags |= CmppLevel_F_ELIDE; + g_debug(1,("Setting ELIDE for TS_IfPassed @ lv %d (lvlIf=%d)\n", t->level.ndx, lvlIf)); } +#endif } if(lvlIf <= t->level.ndx){ cmpp_kwd__err_prefix(pKw, t, NULL); diff --git a/manifest b/manifest index cd30a76777..b13782660d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Beginnings\sof\sa\sbundler-friendly\sbuild\sof\ssqlite3.mjs.\sNot\syet\sready\sfor\sdownstream\stesting. -D 2023-01-27T01:33:12.220 +C Resolve\sa\snested\sif-block\sbug\sin\sext/wasm/c-pp.c\swhich\scaused\soutput\safter\sa\snested\sblock\sto\sbe\sunduly\selided.\sRemove\sa\skludge,\sadded\sin\sthe\sprevious\scheck-in,\swhich\sworked\saround\sthat\sbug. +D 2023-01-27T02:21:16.305 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -476,7 +476,7 @@ F ext/wasm/api/extern-post-js.c-pp.js 9c1f67c368660cb14b6ddee0ed7c87c70594a41c2a F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41 F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08902f15c34720ee4a1 F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b35ff3ed9cfd281a62 -F ext/wasm/api/pre-js.c-pp.js 26be645141fe11e614acb1bca777c2e6374680d503a276d96afb9df7939ba5d3 +F ext/wasm/api/pre-js.c-pp.js 109d3afcdf6203a39fe79a2d7e0e1e5f93ea672ae00578fd4ec4f6fe19b484cc F ext/wasm/api/sqlite3-api-cleanup.js 680d5ccfff54459db136a49b2199d9f879c8405d9c99af1dda0cc5e7c29056f4 F ext/wasm/api/sqlite3-api-glue.js 0a93e58aabf52b32ddccbb107a1fd4552f2505e103ab63396c4d0a0743704785 F ext/wasm/api/sqlite3-api-oo1.js e9fba119e9b1716b3f731838ed1ab18741401bcf4c51d2a4a6e9d1d23cf9d771 @@ -492,7 +492,7 @@ F ext/wasm/api/sqlite3-worker1-promiser.js 0c7a9826dbf82a5ed4e4f7bf7816e825a52af F ext/wasm/api/sqlite3-worker1.js 9d3d3dfc70bff8998c1d8ff6d881cf1c3d52468d635417f02796151fe6b31cd7 F ext/wasm/batch-runner.html 4deeed44fe41496dc6898d9fb17938ea3291f40f4bfb977e29d0cef96fbbe4c8 F ext/wasm/batch-runner.js 0dad6a02ad796f1003d3b7048947d275c4d6277f63767b8e685c27df8fdac93e -F ext/wasm/c-pp.c 92285f7bce67ed7b7020b40fde8ed0982c442b63dc33df9dfd4b658d4a6c0779 +F ext/wasm/c-pp.c 6d80d8569d85713effe8b0818a3cf51dc779e3f0bf8dc88771b8998552ee25b4 F ext/wasm/common/SqliteTestUtil.js d8bf97ecb0705a2299765c8fc9e11b1a5ac7f10988bbf375a6558b7ca287067b F ext/wasm/common/emscripten.css 11bd104b6c0d597c67d40cc8ecc0a60dae2b965151e3b6a37fa5708bac3acd15 F ext/wasm/common/testing.css 0ff15602a3ab2bad8aef2c3bd120c7ee3fd1c2054ad2ace7e214187ae68d926f @@ -2044,11 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P bdfd72a083fadd724030c4c89adae71426e1ddd402c6bc5abf40801ecf3253cf -R 1d25c63e8015d3a2077316f9c5633e5e -T *branch * js-bundler-friendly -T *sym-js-bundler-friendly * -T -sym-trunk * Cancelled\sby\sbranch. +P 4271bf5f41df091696f1dcfc4ffe7a60d24066fc75c896941e0b56de95fe5f89 +R 94f2cf8a092efa28759f003587a957ce U stephan -Z da3be54ec4b55cd9837defeb06176624 +Z 16fc9ca50b1409b7eeea4546395ed5b7 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index da2a6bc40e..a9f598354e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4271bf5f41df091696f1dcfc4ffe7a60d24066fc75c896941e0b56de95fe5f89 \ No newline at end of file +7a026a4b24d57c1b0970923b972dd42c3f1bb5b282f908079075468b2e1bf601 \ No newline at end of file From a0013fbe879fb59843c69610af56b5b9141c9614 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 27 Jan 2023 03:18:16 +0000 Subject: [PATCH 03/65] More work on creating a separate sqlite3.js build which is hopefully friendly to JS bundlers. FossilOrigin-Name: b7b896fb448a7f46eb88eadadb1359255aec637a384cabcdd526276a02f4f0b4 --- ext/wasm/GNUmakefile | 4 +++- ext/wasm/api/extern-post-js.c-pp.js | 15 ++++++++++++--- ext/wasm/api/pre-js.c-pp.js | 5 ++++- ext/wasm/api/sqlite3-vfs-opfs.c-pp.js | 21 ++++++++++++++------- ext/wasm/api/sqlite3-worker1-promiser.js | 4 ++++ ext/wasm/api/sqlite3-worker1.js | 4 ++++ manifest | 22 +++++++++++----------- manifest.uuid | 2 +- 8 files changed, 53 insertions(+), 24 deletions(-) diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index 4c2a336f44..fa46c9633a 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -704,7 +704,9 @@ $(sqlite3-bundler-friendly.mjs): # (and harmless, just a waste of build time). $(sqlite3.wasm): $(sqlite3.js) $(sqlite3.mjs): $(sqlite3.js) -$(sqlite3-bundler-friendly.mjs): $(sqlite3.js) +$(sqlite3-bundler-friendly.mjs): $(sqlite3.mjs) +# maintenance reminder: the deps on ^^^ must all be such that they are +# never built in parallel. CLEAN_FILES += $(sqlite3.js) $(sqlite3.mjs) $(sqlite3-bundler-friendly.mjs) \ $(sqlite3.wasm) all: $(sqlite3.js) $(sqlite3.mjs) $(sqlite3-bundler-friendly.mjs) diff --git a/ext/wasm/api/extern-post-js.c-pp.js b/ext/wasm/api/extern-post-js.c-pp.js index 87d99eabaa..691ad76858 100644 --- a/ext/wasm/api/extern-post-js.c-pp.js +++ b/ext/wasm/api/extern-post-js.c-pp.js @@ -45,14 +45,23 @@ const toExportForES6 = moduleScript: self?.document?.currentScript, isWorker: ('undefined' !== typeof WorkerGlobalScope), location: self.location, - urlParams: new URL(self.location.href).searchParams + urlParams: +//#if target=es6-bundler-friendly + undefined +//#else + new URL(self.location.href).searchParams +//#endif }); initModuleState.debugModule = - (new URL(self.location.href).searchParams).has('sqlite3.debugModule') +//#if target=es6-bundler-friendly + ()=>{} +//#else + (new URL(self.location.href).searchParams).has('sqlite3.debugModule') ? (...args)=>console.warn('sqlite3.debugModule:',...args) : ()=>{}; +//#endif - if(initModuleState.urlParams.has('sqlite3.dir')){ + if(initModuleState.urlParams && initModuleState.urlParams.has('sqlite3.dir')){ initModuleState.sqlite3Dir = initModuleState.urlParams.get('sqlite3.dir') +'/'; }else if(initModuleState.moduleScript){ const li = initModuleState.moduleScript.src.split('/'); diff --git a/ext/wasm/api/pre-js.c-pp.js b/ext/wasm/api/pre-js.c-pp.js index 772601f428..c27c2fe0dc 100644 --- a/ext/wasm/api/pre-js.c-pp.js +++ b/ext/wasm/api/pre-js.c-pp.js @@ -6,7 +6,10 @@ */ // See notes in extern-post-js.js -const sqlite3InitModuleState = self.sqlite3InitModuleState || Object.create(null); +const sqlite3InitModuleState = self.sqlite3InitModuleState + || Object.assign(Object.create(null),{ + debugModule: ()=>{} + }); delete self.sqlite3InitModuleState; sqlite3InitModuleState.debugModule('self.location =',self.location); diff --git a/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js b/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js index 451f0019c2..aeda62aa2e 100644 --- a/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js +++ b/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js @@ -100,13 +100,20 @@ const installOpfsVfs = function callee(options){ if(!options || 'object'!==typeof options){ options = Object.create(null); } - const urlParams = new URL(self.location.href).searchParams; - if(undefined===options.verbose){ - options.verbose = urlParams.has('opfs-verbose') - ? (+urlParams.get('opfs-verbose') || 2) : 1; - } - if(undefined===options.sanityChecks){ - options.sanityChecks = urlParams.has('opfs-sanity-check'); + const urlParams = +//#if target=es6-bundler-friendly + undefined; +//#else + new URL(self.location.href).searchParams; +//#endif + if(urlParams){ + if(undefined===options.verbose){ + options.verbose = urlParams.has('opfs-verbose') + ? (+urlParams.get('opfs-verbose') || 2) : 1; + } + if(undefined===options.sanityChecks){ + options.sanityChecks = urlParams.has('opfs-sanity-check'); + } } if(undefined===options.proxyUri){ options.proxyUri = callee.defaultProxyUri; diff --git a/ext/wasm/api/sqlite3-worker1-promiser.js b/ext/wasm/api/sqlite3-worker1-promiser.js index 7360512d49..1689d34802 100644 --- a/ext/wasm/api/sqlite3-worker1-promiser.js +++ b/ext/wasm/api/sqlite3-worker1-promiser.js @@ -238,6 +238,9 @@ self.sqlite3Worker1Promiser = function callee(config = callee.defaultConfig){ }/*sqlite3Worker1Promiser()*/; self.sqlite3Worker1Promiser.defaultConfig = { worker: function(){ +//#if target=es6-bundler-friendly + return new Worker("sqlite3-worker1.js"); +//#else let theJs = "sqlite3-worker1.js"; if(this.currentScript){ const src = this.currentScript.src.split('/'); @@ -252,6 +255,7 @@ self.sqlite3Worker1Promiser.defaultConfig = { } } return new Worker(theJs + self.location.search); +//#endif }.bind({ currentScript: self?.document?.currentScript }), diff --git a/ext/wasm/api/sqlite3-worker1.js b/ext/wasm/api/sqlite3-worker1.js index 4ff19b8880..9e9c3ac426 100644 --- a/ext/wasm/api/sqlite3-worker1.js +++ b/ext/wasm/api/sqlite3-worker1.js @@ -33,6 +33,9 @@ */ "use strict"; (()=>{ +//#if target=es6-bundler-friendly + importScripts('sqlite3.js'); +//#else const urlParams = new URL(self.location.href).searchParams; let theJs = 'sqlite3.js'; if(urlParams.has('sqlite3.dir')){ @@ -40,6 +43,7 @@ } //console.warn("worker1 theJs =",theJs); importScripts(theJs); +//#endif sqlite3InitModule().then((sqlite3)=>{ sqlite3.initWorker1API(); }); diff --git a/manifest b/manifest index b13782660d..aecad7464c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Resolve\sa\snested\sif-block\sbug\sin\sext/wasm/c-pp.c\swhich\scaused\soutput\safter\sa\snested\sblock\sto\sbe\sunduly\selided.\sRemove\sa\skludge,\sadded\sin\sthe\sprevious\scheck-in,\swhich\sworked\saround\sthat\sbug. -D 2023-01-27T02:21:16.305 +C More\swork\son\screating\sa\sseparate\ssqlite3.js\sbuild\swhich\sis\shopefully\sfriendly\sto\sJS\sbundlers. +D 2023-01-27T03:18:16.304 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -466,17 +466,17 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c -F ext/wasm/GNUmakefile 9685958e3c5942c50f16fadbb0c2377252689c52e022a8c1897ad5c4cf751298 +F ext/wasm/GNUmakefile e1bd4abe13929dbc4fd9da06d189c61d28fc7a539b2cab942f6300172539d8a5 F ext/wasm/README-dist.txt dab111337028af58ec11cb35c2e1a82398217c399c7499fefab0509a0499a5d7 F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9 F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287 F ext/wasm/api/README.md 77a2f1f2fc60a35def7455dffc8d3f2c56385d6ac5c6cecc60fa938252ea2c54 -F ext/wasm/api/extern-post-js.c-pp.js 9c1f67c368660cb14b6ddee0ed7c87c70594a41c2a0adc7005016feda6c0cbdb +F ext/wasm/api/extern-post-js.c-pp.js ea549ffcdd3f116de5b4cc08a428e0a91052c341b51b37f158747285f9ef2fe8 F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41 F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08902f15c34720ee4a1 F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b35ff3ed9cfd281a62 -F ext/wasm/api/pre-js.c-pp.js 109d3afcdf6203a39fe79a2d7e0e1e5f93ea672ae00578fd4ec4f6fe19b484cc +F ext/wasm/api/pre-js.c-pp.js 86b2909e07690792ecf14892e6ee4d2ea0b2d6bf8567ad3d549a8cc2e30828a0 F ext/wasm/api/sqlite3-api-cleanup.js 680d5ccfff54459db136a49b2199d9f879c8405d9c99af1dda0cc5e7c29056f4 F ext/wasm/api/sqlite3-api-glue.js 0a93e58aabf52b32ddccbb107a1fd4552f2505e103ab63396c4d0a0743704785 F ext/wasm/api/sqlite3-api-oo1.js e9fba119e9b1716b3f731838ed1ab18741401bcf4c51d2a4a6e9d1d23cf9d771 @@ -485,11 +485,11 @@ F ext/wasm/api/sqlite3-api-worker1.js c9ef8865f072e61251260b218aa4ed614a21a25e9e F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3 F ext/wasm/api/sqlite3-opfs-async-proxy.js 7795b84b66a7a8dedc791340709b310bb497c3c72a80bef364fa2a58e2ddae3f F ext/wasm/api/sqlite3-v-helper.js 6f6c3e390a72e08b0a5b16a0d567d7af3c04d172831853a29d72a6f1dd40ff24 -F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js a10bdc9695dcf453e120970a5de8a3e61db4e4047d0a7cc5a6d63dfe7ae87f4e +F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js bae9c4c40991a550450bb89dc34e6e1e1e875ae230ccdce3dbb99515517d3361 F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9 F ext/wasm/api/sqlite3-wasm.c 76625a70937a8522d014ef686c32db5b53a3ee61850323f5c601d2ac39fe52fe -F ext/wasm/api/sqlite3-worker1-promiser.js 0c7a9826dbf82a5ed4e4f7bf7816e825a52aff253afbf3350431f5773faf0e4b -F ext/wasm/api/sqlite3-worker1.js 9d3d3dfc70bff8998c1d8ff6d881cf1c3d52468d635417f02796151fe6b31cd7 +F ext/wasm/api/sqlite3-worker1-promiser.js f10c3ecd9df06f6320073c2ce230a7ed7c56034d8b88c1e57095f2a97faf423a +F ext/wasm/api/sqlite3-worker1.js 77b3835192469e9da23926ec8f78fb0b114a51d048dc54388709ac22b5c5f0a0 F ext/wasm/batch-runner.html 4deeed44fe41496dc6898d9fb17938ea3291f40f4bfb977e29d0cef96fbbe4c8 F ext/wasm/batch-runner.js 0dad6a02ad796f1003d3b7048947d275c4d6277f63767b8e685c27df8fdac93e F ext/wasm/c-pp.c 6d80d8569d85713effe8b0818a3cf51dc779e3f0bf8dc88771b8998552ee25b4 @@ -2044,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 4271bf5f41df091696f1dcfc4ffe7a60d24066fc75c896941e0b56de95fe5f89 -R 94f2cf8a092efa28759f003587a957ce +P 7a026a4b24d57c1b0970923b972dd42c3f1bb5b282f908079075468b2e1bf601 +R 102faa857a2d0d2c23a0f1e8d23a4eac U stephan -Z 16fc9ca50b1409b7eeea4546395ed5b7 +Z 7417462f84e9f6b455bd391f77e8f338 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index a9f598354e..91de4dbda9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7a026a4b24d57c1b0970923b972dd42c3f1bb5b282f908079075468b2e1bf601 \ No newline at end of file +b7b896fb448a7f46eb88eadadb1359255aec637a384cabcdd526276a02f4f0b4 \ No newline at end of file From c64a3fa6c626aa56809592cd8f4fcef21d3300ad Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 27 Jan 2023 05:14:34 +0000 Subject: [PATCH 04/65] Work around upstream emscripten 3.1.31 bug [https://github.com/emscripten-core/emscripten/issues/18609]. FossilOrigin-Name: fa784101775b795077a23c211b5b16f51ad5a13967c284511f310dfcbfa9f77a --- ext/wasm/api/sqlite3-api-worker1.js | 14 +++++++------- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ext/wasm/api/sqlite3-api-worker1.js b/ext/wasm/api/sqlite3-api-worker1.js index 250b6fcdf7..58b9b00918 100644 --- a/ext/wasm/api/sqlite3-api-worker1.js +++ b/ext/wasm/api/sqlite3-api-worker1.js @@ -1,4 +1,4 @@ -/* +/** 2022-07-22 The author disclaims copyright to this source code. In place of a @@ -10,12 +10,12 @@ *********************************************************************** - This file implements the initializer for the sqlite3 "Worker API - #1", a very basic DB access API intended to be scripted from a main - window thread via Worker-style messages. Because of limitations in - that type of communication, this API is minimalistic and only - capable of serving relatively basic DB requests (e.g. it cannot - process nested query loops concurrently). + This file implements the initializer for SQLite's "Worker API #1", a + very basic DB access API intended to be scripted from a main window + thread via Worker-style messages. Because of limitations in that + type of communication, this API is minimalistic and only capable of + serving relatively basic DB requests (e.g. it cannot process nested + query loops concurrently). This file requires that the core C-style sqlite3 API and OO API #1 have been loaded. diff --git a/manifest b/manifest index aecad7464c..fc03db56d3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C More\swork\son\screating\sa\sseparate\ssqlite3.js\sbuild\swhich\sis\shopefully\sfriendly\sto\sJS\sbundlers. -D 2023-01-27T03:18:16.304 +C Work\saround\supstream\semscripten\s3.1.31\sbug\s[https://github.com/emscripten-core/emscripten/issues/18609]. +D 2023-01-27T05:14:34.038 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -481,7 +481,7 @@ F ext/wasm/api/sqlite3-api-cleanup.js 680d5ccfff54459db136a49b2199d9f879c8405d9c F ext/wasm/api/sqlite3-api-glue.js 0a93e58aabf52b32ddccbb107a1fd4552f2505e103ab63396c4d0a0743704785 F ext/wasm/api/sqlite3-api-oo1.js e9fba119e9b1716b3f731838ed1ab18741401bcf4c51d2a4a6e9d1d23cf9d771 F ext/wasm/api/sqlite3-api-prologue.js 69a74f2777aaafafc07ad2c922674fe3197ef63c921a3262b4772f937e7eb14a -F ext/wasm/api/sqlite3-api-worker1.js c9ef8865f072e61251260b218aa4ed614a21a25e9e3cc6f22acf81794d32fc0b +F ext/wasm/api/sqlite3-api-worker1.js c462199c40358f00f93e326206bddc756c52b93f2cb60ffb63f54fe4f9a9e977 F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3 F ext/wasm/api/sqlite3-opfs-async-proxy.js 7795b84b66a7a8dedc791340709b310bb497c3c72a80bef364fa2a58e2ddae3f F ext/wasm/api/sqlite3-v-helper.js 6f6c3e390a72e08b0a5b16a0d567d7af3c04d172831853a29d72a6f1dd40ff24 @@ -2044,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 7a026a4b24d57c1b0970923b972dd42c3f1bb5b282f908079075468b2e1bf601 -R 102faa857a2d0d2c23a0f1e8d23a4eac +P b7b896fb448a7f46eb88eadadb1359255aec637a384cabcdd526276a02f4f0b4 +R 652518ccc6e34aeabd9f5e7c9c0f903b U stephan -Z 7417462f84e9f6b455bd391f77e8f338 +Z 9f5aabec0ec6e83053759380211a0e0c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 91de4dbda9..1ff4d9398a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b7b896fb448a7f46eb88eadadb1359255aec637a384cabcdd526276a02f4f0b4 \ No newline at end of file +fa784101775b795077a23c211b5b16f51ad5a13967c284511f310dfcbfa9f77a \ No newline at end of file From 9dc093d095646688dfa35ea19497fc8429793e3b Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 27 Jan 2023 07:53:49 +0000 Subject: [PATCH 05/65] Work around a JS null pointer deref which could be triggered from the dev console, but not (it seems) from client-side code. FossilOrigin-Name: eabb551b8b3d33fc3a327ecf7225436a3a3f616901e22c868fd76a5e3adc7b3f --- ext/wasm/api/pre-js.c-pp.js | 4 +++- manifest | 13 ++++++------- manifest.uuid | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ext/wasm/api/pre-js.c-pp.js b/ext/wasm/api/pre-js.c-pp.js index 2e2fe66bc9..5d8e58864b 100644 --- a/ext/wasm/api/pre-js.c-pp.js +++ b/ext/wasm/api/pre-js.c-pp.js @@ -6,7 +6,9 @@ */ // See notes in extern-post-js.js -const sqlite3InitModuleState = self.sqlite3InitModuleState || Object.create(null); +const sqlite3InitModuleState = self.sqlite3InitModuleState || Object.assign(Object.create(null),{ + debugModule: ()=>{} +}); delete self.sqlite3InitModuleState; sqlite3InitModuleState.debugModule('self.location =',self.location); diff --git a/manifest b/manifest index f9d1a9c1c5..51290c24c5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Cherrypick\s[fa784101775b7|emscripten\sticket\s#18609\sworkaround]\sinto\strunk. -D 2023-01-27T05:17:10.270 +C Work\saround\sa\sJS\snull\spointer\sderef\swhich\scould\sbe\striggered\sfrom\sthe\sdev\sconsole,\sbut\snot\s(it\sseems)\sfrom\sclient-side\scode. +D 2023-01-27T07:53:49.223 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -476,7 +476,7 @@ F ext/wasm/api/extern-post-js.c-pp.js 8923f76c3d2213159e12d641dc750523ead5c84818 F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41 F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08902f15c34720ee4a1 F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b35ff3ed9cfd281a62 -F ext/wasm/api/pre-js.c-pp.js b88499dc303c21fc3f55f2c364a0f814f587b60a95784303881169f9e91c1d5f +F ext/wasm/api/pre-js.c-pp.js f060b108d0960798c0aa0688392a3c1a58a2e3c942f3560de1c4a7a1aa7af433 F ext/wasm/api/sqlite3-api-cleanup.js 680d5ccfff54459db136a49b2199d9f879c8405d9c99af1dda0cc5e7c29056f4 F ext/wasm/api/sqlite3-api-glue.js 0a93e58aabf52b32ddccbb107a1fd4552f2505e103ab63396c4d0a0743704785 F ext/wasm/api/sqlite3-api-oo1.js e9fba119e9b1716b3f731838ed1ab18741401bcf4c51d2a4a6e9d1d23cf9d771 @@ -2044,9 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P bdfd72a083fadd724030c4c89adae71426e1ddd402c6bc5abf40801ecf3253cf -Q +fa784101775b795077a23c211b5b16f51ad5a13967c284511f310dfcbfa9f77a -R f546cb30f93859da1452256662a169a1 +P 9a26fae545b9c97129893b83ff97e62b1c477eccd1379af1dce4a3cc4fa9f932 +R 560e84c2bc8da2b503677492471b2550 U stephan -Z 2937fe2d7bb3aa79ea588267ef9524d2 +Z 0160fcb66fc2ca1e2a8d2a4c14f5953b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index ca24ae6feb..1b37954ec2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9a26fae545b9c97129893b83ff97e62b1c477eccd1379af1dce4a3cc4fa9f932 \ No newline at end of file +eabb551b8b3d33fc3a327ecf7225436a3a3f616901e22c868fd76a5e3adc7b3f \ No newline at end of file From aca8ce1535dcd030ac994a306e78b7588ffe95ac Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 27 Jan 2023 17:14:55 +0000 Subject: [PATCH 06/65] Extract emcc version in JS build and use it to conditionally set build flags. Initially a workaround for [https://github.com/emscripten-core/emscripten/issues/18610|Emscripten ticket #18610] but may have other uses. FossilOrigin-Name: 3773934e91c20ca2433cc414aaba75de9a4a4318fd1126fb781dba510ddefd94 --- ext/wasm/GNUmakefile | 16 ++++++++++++++-- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index fa46c9633a..143ee8b9f1 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -59,6 +59,13 @@ emcc.bin ?= $(word 1,$(wildcard $(EMSDK_HOME)/upstream/emscripten/emcc) $(shell ifeq (,$(emcc.bin)) $(error Cannot find emcc.) endif +emcc.version := $(shell "$(emcc.bin)" --version | sed -n 1p \ + | sed -e 's/^.* \([3-9][^ ]*\) .*$$/\1/;') +ifeq (,$(emcc.version)) + $(warning Cannot determine emcc version. This might unduly impact build flags.) +else + $(info using emcc version [$(emcc.version)]) +endif wasm-strip ?= $(shell which wasm-strip 2>/dev/null) ifeq (,$(filter clean,$(MAKECMDGOALS))) @@ -501,7 +508,6 @@ emcc.cflags := emcc.cflags += -std=c99 -fPIC # -------------^^^^^^^^ we need c99 for $(sqlite3-wasm.c). emcc.cflags += -I. -I$(dir.top) - ######################################################################## # emcc flags specific to building .js/.wasm files... emcc.jsflags := -fPIC @@ -509,7 +515,6 @@ emcc.jsflags += --minify 0 emcc.jsflags += --no-entry emcc.jsflags += -sWASM_BIGINT=$(emcc.WASM_BIGINT) emcc.jsflags += -sMODULARIZE -emcc.jsflags += -sSTRICT_JS emcc.jsflags += -sDYNAMIC_EXECUTION=0 emcc.jsflags += -sNO_POLYFILL emcc.jsflags += -sEXPORTED_FUNCTIONS=@$(EXPORTED_FUNCTIONS.api) @@ -519,6 +524,13 @@ emcc.exportedRuntimeMethods := \ emcc.jsflags += $(emcc.exportedRuntimeMethods) emcc.jsflags += -sUSE_CLOSURE_COMPILER=0 emcc.jsflags += -sIMPORTED_MEMORY +ifeq (3.1.31,$(emcc.version)) + emcc.jsflags += -sSTRICT_JS=0 + $(warning Disabling -sSTRICT_JS for emcc $(emcc.version): \ + https://github.com/emscripten-core/emscripten/issues/18610) +else + emcc.jsflags += -sSTRICT_JS=1 +endif emcc.environment := -sENVIRONMENT=web,worker ######################################################################## # -sINITIAL_MEMORY: How much memory we need to start with is governed diff --git a/manifest b/manifest index fc03db56d3..fd21e7b6dc 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Work\saround\supstream\semscripten\s3.1.31\sbug\s[https://github.com/emscripten-core/emscripten/issues/18609]. -D 2023-01-27T05:14:34.038 +C Extract\semcc\sversion\sin\sJS\sbuild\sand\suse\sit\sto\sconditionally\sset\sbuild\sflags.\sInitially\sa\sworkaround\sfor\s[https://github.com/emscripten-core/emscripten/issues/18610|Emscripten\sticket\s#18610]\sbut\smay\shave\sother\suses. +D 2023-01-27T17:14:55.199 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -466,7 +466,7 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c -F ext/wasm/GNUmakefile e1bd4abe13929dbc4fd9da06d189c61d28fc7a539b2cab942f6300172539d8a5 +F ext/wasm/GNUmakefile 31cf62436f306eed8c8aa66991653395f62e52af7ad21a0de02f7d780cb8c398 F ext/wasm/README-dist.txt dab111337028af58ec11cb35c2e1a82398217c399c7499fefab0509a0499a5d7 F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9 F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab @@ -2044,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b7b896fb448a7f46eb88eadadb1359255aec637a384cabcdd526276a02f4f0b4 -R 652518ccc6e34aeabd9f5e7c9c0f903b +P fa784101775b795077a23c211b5b16f51ad5a13967c284511f310dfcbfa9f77a +R 3675add13eb3ce53caed9c7b4b0b8fb4 U stephan -Z 9f5aabec0ec6e83053759380211a0e0c +Z e36df8532ba6c8eb3243e966cb4c4025 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 1ff4d9398a..df7e52ee6d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fa784101775b795077a23c211b5b16f51ad5a13967c284511f310dfcbfa9f77a \ No newline at end of file +3773934e91c20ca2433cc414aaba75de9a4a4318fd1126fb781dba510ddefd94 \ No newline at end of file From cf73cb2fbc2a552bc66d7f0caabfeddf46cb29bd Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 27 Jan 2023 17:19:30 +0000 Subject: [PATCH 07/65] Cherrypick [3773934e91c20ca243] into trunk. FossilOrigin-Name: 50cf4300a6a92302010fa4a7662db82bf55180a4930771f0d3c07e558bc87e7d --- ext/wasm/GNUmakefile | 16 ++++++++++++++-- manifest | 13 +++++++------ manifest.uuid | 2 +- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index f391868d48..eef6902d62 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -50,6 +50,13 @@ emcc.bin ?= $(word 1,$(wildcard $(EMSDK_HOME)/upstream/emscripten/emcc) $(shell ifeq (,$(emcc.bin)) $(error Cannot find emcc.) endif +emcc.version := $(shell "$(emcc.bin)" --version | sed -n 1p \ + | sed -e 's/^.* \([3-9][^ ]*\) .*$$/\1/;') +ifeq (,$(emcc.version)) + $(warning Cannot determine emcc version. This might unduly impact build flags.) +else + $(info using emcc version [$(emcc.version)]) +endif wasm-strip ?= $(shell which wasm-strip 2>/dev/null) ifeq (,$(filter clean,$(MAKECMDGOALS))) @@ -477,7 +484,6 @@ emcc.cflags := emcc.cflags += -std=c99 -fPIC # -------------^^^^^^^^ we need c99 for $(sqlite3-wasm.c). emcc.cflags += -I. -I$(dir.top) - ######################################################################## # emcc flags specific to building .js/.wasm files... emcc.jsflags := -fPIC @@ -485,7 +491,6 @@ emcc.jsflags += --minify 0 emcc.jsflags += --no-entry emcc.jsflags += -sWASM_BIGINT=$(emcc.WASM_BIGINT) emcc.jsflags += -sMODULARIZE -emcc.jsflags += -sSTRICT_JS emcc.jsflags += -sDYNAMIC_EXECUTION=0 emcc.jsflags += -sNO_POLYFILL emcc.jsflags += -sEXPORTED_FUNCTIONS=@$(EXPORTED_FUNCTIONS.api) @@ -495,6 +500,13 @@ emcc.exportedRuntimeMethods := \ emcc.jsflags += $(emcc.exportedRuntimeMethods) emcc.jsflags += -sUSE_CLOSURE_COMPILER=0 emcc.jsflags += -sIMPORTED_MEMORY +ifeq (3.1.31,$(emcc.version)) + emcc.jsflags += -sSTRICT_JS=0 + $(warning Disabling -sSTRICT_JS for emcc $(emcc.version): \ + https://github.com/emscripten-core/emscripten/issues/18610) +else + emcc.jsflags += -sSTRICT_JS=1 +endif emcc.environment := -sENVIRONMENT=web,worker ######################################################################## # -sINITIAL_MEMORY: How much memory we need to start with is governed diff --git a/manifest b/manifest index 51290c24c5..25fd792232 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Work\saround\sa\sJS\snull\spointer\sderef\swhich\scould\sbe\striggered\sfrom\sthe\sdev\sconsole,\sbut\snot\s(it\sseems)\sfrom\sclient-side\scode. -D 2023-01-27T07:53:49.223 +C Cherrypick\s[3773934e91c20ca243]\sinto\strunk. +D 2023-01-27T17:19:30.435 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -466,7 +466,7 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c -F ext/wasm/GNUmakefile 4ce83fdda22c6fde2bd311e87d6bec7469ca3859e758d1f34cd601e64c539efa +F ext/wasm/GNUmakefile 217dcb2e3058d7554c46a6e8c89fdb28006c2278206e3e9572ce52030736a5a6 F ext/wasm/README-dist.txt dab111337028af58ec11cb35c2e1a82398217c399c7499fefab0509a0499a5d7 F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9 F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab @@ -2044,8 +2044,9 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 9a26fae545b9c97129893b83ff97e62b1c477eccd1379af1dce4a3cc4fa9f932 -R 560e84c2bc8da2b503677492471b2550 +P eabb551b8b3d33fc3a327ecf7225436a3a3f616901e22c868fd76a5e3adc7b3f +Q +3773934e91c20ca2433cc414aaba75de9a4a4318fd1126fb781dba510ddefd94 +R 1cf9f93fc162d1085b11c39fbf5b9e62 U stephan -Z 0160fcb66fc2ca1e2a8d2a4c14f5953b +Z 35eb683fd2e66a13e0456c98ff3a4371 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 1b37954ec2..f4626601bf 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -eabb551b8b3d33fc3a327ecf7225436a3a3f616901e22c868fd76a5e3adc7b3f \ No newline at end of file +50cf4300a6a92302010fa4a7662db82bf55180a4930771f0d3c07e558bc87e7d \ No newline at end of file From 6a3e2d377607ac7a8a3584a34ed7c22b665daacb Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 27 Jan 2023 19:56:40 +0000 Subject: [PATCH 08/65] Add a feature idea note to DB.exec(), derived from a forum discussion. FossilOrigin-Name: 792f43209c4b6e85386b6b3906814b7f2ad310d50ba563b3fd1cb37e55adf8db --- ext/wasm/api/sqlite3-api-oo1.js | 5 ++++- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ext/wasm/api/sqlite3-api-oo1.js b/ext/wasm/api/sqlite3-api-oo1.js index ba210e7f99..fddd7b38e3 100644 --- a/ext/wasm/api/sqlite3-api-oo1.js +++ b/ext/wasm/api/sqlite3-api-oo1.js @@ -183,7 +183,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ checkSqlite3Rc( pDb, capi.sqlite3_exec(pDb, postInitSql, 0, 0, 0) ); - } + } }catch(e){ this.close(); throw e; @@ -791,6 +791,9 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ - `callback` and `resultRows`: permit an array entries with semantics similar to those described for `bind` above. + - If passed neither a callback nor returnValue but is passed a + rowMode, default to returning the result set. + */ exec: function(/*(sql [,obj]) || (obj)*/){ affirmDbOpen(this); diff --git a/manifest b/manifest index fd21e7b6dc..c19a076175 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Extract\semcc\sversion\sin\sJS\sbuild\sand\suse\sit\sto\sconditionally\sset\sbuild\sflags.\sInitially\sa\sworkaround\sfor\s[https://github.com/emscripten-core/emscripten/issues/18610|Emscripten\sticket\s#18610]\sbut\smay\shave\sother\suses. -D 2023-01-27T17:14:55.199 +C Add\sa\sfeature\sidea\snote\sto\sDB.exec(),\sderived\sfrom\sa\sforum\sdiscussion. +D 2023-01-27T19:56:40.990 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -479,7 +479,7 @@ F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b F ext/wasm/api/pre-js.c-pp.js 86b2909e07690792ecf14892e6ee4d2ea0b2d6bf8567ad3d549a8cc2e30828a0 F ext/wasm/api/sqlite3-api-cleanup.js 680d5ccfff54459db136a49b2199d9f879c8405d9c99af1dda0cc5e7c29056f4 F ext/wasm/api/sqlite3-api-glue.js 0a93e58aabf52b32ddccbb107a1fd4552f2505e103ab63396c4d0a0743704785 -F ext/wasm/api/sqlite3-api-oo1.js e9fba119e9b1716b3f731838ed1ab18741401bcf4c51d2a4a6e9d1d23cf9d771 +F ext/wasm/api/sqlite3-api-oo1.js a3892fd79070d8c947205d8b90d8218cdb12e7fd5027dced5805dd387b590a36 F ext/wasm/api/sqlite3-api-prologue.js 69a74f2777aaafafc07ad2c922674fe3197ef63c921a3262b4772f937e7eb14a F ext/wasm/api/sqlite3-api-worker1.js c462199c40358f00f93e326206bddc756c52b93f2cb60ffb63f54fe4f9a9e977 F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3 @@ -2044,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P fa784101775b795077a23c211b5b16f51ad5a13967c284511f310dfcbfa9f77a -R 3675add13eb3ce53caed9c7b4b0b8fb4 +P 3773934e91c20ca2433cc414aaba75de9a4a4318fd1126fb781dba510ddefd94 +R c10dcf005f6c888521bd65824a3df6ca U stephan -Z e36df8532ba6c8eb3243e966cb4c4025 +Z 96645cafa741bd6b03c389427ea21748 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index df7e52ee6d..60da4aa3a1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3773934e91c20ca2433cc414aaba75de9a4a4318fd1126fb781dba510ddefd94 \ No newline at end of file +792f43209c4b6e85386b6b3906814b7f2ad310d50ba563b3fd1cb37e55adf8db \ No newline at end of file From 844e7183ae9a373d8c7cefc3b667bff030f03108 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 27 Jan 2023 19:59:46 +0000 Subject: [PATCH 09/65] Do not try to run rbu tests with builds that do not support rbu. FossilOrigin-Name: c74ad902e3bbfc28d6b30a37f3791176d64cdd8fd5950f1d1749541e244a0494 --- ext/rbu/rbu1.test | 1 + ext/rbu/rbu10.test | 7 +-- ext/rbu/rbu11.test | 6 +-- ext/rbu/rbu12.test | 6 +-- ext/rbu/rbu13.test | 6 +-- ext/rbu/rbu14.test | 6 +-- ext/rbu/rbu3.test | 6 +-- ext/rbu/rbu5.test | 1 + ext/rbu/rbu6.test | 6 +-- ext/rbu/rbu7.test | 6 +-- ext/rbu/rbu8.test | 6 +-- ext/rbu/rbu9.test | 6 +-- ext/rbu/rbuA.test | 6 +-- ext/rbu/rbuB.test | 1 + ext/rbu/rbuC.test | 1 + ext/rbu/rbubusy.test | 1 + ext/rbu/rbucollate.test | 1 + ext/rbu/rbucrash.test | 6 +-- ext/rbu/rbucrash2.test | 6 +-- ext/rbu/rbudiff.test | 7 ++- ext/rbu/rbudor.test | 6 +-- ext/rbu/rbuexlock.test | 1 + ext/rbu/rbuexpr.test | 1 + ext/rbu/rbufault.test | 6 +-- ext/rbu/rbufault2.test | 6 +-- ext/rbu/rbufault3.test | 1 + ext/rbu/rbufault4.test | 6 +-- ext/rbu/rbufts.test | 6 +-- ext/rbu/rbumisc.test | 1 + ext/rbu/rbumulti.test | 1 + ext/rbu/rbupartial.test | 1 + ext/rbu/rbupass.test | 1 + ext/rbu/rbuprogress.test | 1 + ext/rbu/rburename.test | 1 + ext/rbu/rburesume.test | 1 + ext/rbu/rbusave.test | 6 +-- ext/rbu/rbusplit.test | 1 + ext/rbu/rbutemplimit.test | 1 + ext/rbu/rbuvacuum.test | 1 + ext/rbu/rbuvacuum2.test | 1 + ext/rbu/rbuvacuum3.test | 1 + ext/rbu/rbuvacuum4.test | 1 + manifest | 97 +++++++++++++++++++-------------------- manifest.uuid | 2 +- 44 files changed, 112 insertions(+), 131 deletions(-) diff --git a/ext/rbu/rbu1.test b/ext/rbu/rbu1.test index 9237dbcea7..2c3860e808 100644 --- a/ext/rbu/rbu1.test +++ b/ext/rbu/rbu1.test @@ -11,6 +11,7 @@ # source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbu1 db close diff --git a/ext/rbu/rbu10.test b/ext/rbu/rbu10.test index aa4db8a29f..7f75dbfa76 100644 --- a/ext/rbu/rbu10.test +++ b/ext/rbu/rbu10.test @@ -10,13 +10,10 @@ #*********************************************************************** # -if {![info exists testdir]} { - set testdir [file join [file dirname [info script]] .. .. test] -} -source $testdir/tester.tcl +source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbu10 - #-------------------------------------------------------------------- # Test that UPDATE commands work even if the input columns are in a # different order to the output columns. diff --git a/ext/rbu/rbu11.test b/ext/rbu/rbu11.test index 5a4219b001..4b711721ef 100644 --- a/ext/rbu/rbu11.test +++ b/ext/rbu/rbu11.test @@ -10,10 +10,8 @@ #*********************************************************************** # -if {![info exists testdir]} { - set testdir [file join [file dirname [info script]] .. .. test] -} -source $testdir/tester.tcl +source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbu11 diff --git a/ext/rbu/rbu12.test b/ext/rbu/rbu12.test index 7816bfe89f..6e27ba692e 100644 --- a/ext/rbu/rbu12.test +++ b/ext/rbu/rbu12.test @@ -10,10 +10,8 @@ #*********************************************************************** # -if {![info exists testdir]} { - set testdir [file join [file dirname [info script]] .. .. test] -} -source $testdir/tester.tcl +source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } source $testdir/lock_common.tcl set ::testprefix rbu12 diff --git a/ext/rbu/rbu13.test b/ext/rbu/rbu13.test index 624c587cc3..45b84f2b1d 100644 --- a/ext/rbu/rbu13.test +++ b/ext/rbu/rbu13.test @@ -13,10 +13,8 @@ # for UPDATE statements. This tests RBU's internal UPDATE statement cache. # -if {![info exists testdir]} { - set testdir [file join [file dirname [info script]] .. .. test] -} -source $testdir/tester.tcl +source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } source $testdir/lock_common.tcl set ::testprefix rbu13 diff --git a/ext/rbu/rbu14.test b/ext/rbu/rbu14.test index 07f6784094..18114ec7a9 100644 --- a/ext/rbu/rbu14.test +++ b/ext/rbu/rbu14.test @@ -13,10 +13,8 @@ # table. # -if {![info exists testdir]} { - set testdir [file join [file dirname [info script]] .. .. test] -} -source $testdir/tester.tcl +source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } source $testdir/lock_common.tcl set ::testprefix rbu14 diff --git a/ext/rbu/rbu3.test b/ext/rbu/rbu3.test index da87561fbb..fe2afdc059 100644 --- a/ext/rbu/rbu3.test +++ b/ext/rbu/rbu3.test @@ -10,10 +10,8 @@ #*********************************************************************** # -if {![info exists testdir]} { - set testdir [file join [file dirname [info script]] .. .. test] -} -source $testdir/tester.tcl +source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbu3 diff --git a/ext/rbu/rbu5.test b/ext/rbu/rbu5.test index 3696dfb874..02ecf6be16 100644 --- a/ext/rbu/rbu5.test +++ b/ext/rbu/rbu5.test @@ -13,6 +13,7 @@ # source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbu5 diff --git a/ext/rbu/rbu6.test b/ext/rbu/rbu6.test index bb5b17f425..cddd938703 100644 --- a/ext/rbu/rbu6.test +++ b/ext/rbu/rbu6.test @@ -13,10 +13,8 @@ # outcome of some other client writing to the database while an RBU update # is being applied. -if {![info exists testdir]} { - set testdir [file join [file dirname [info script]] .. .. test] -} -source $testdir/tester.tcl +source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbu6 proc setup_test {} { diff --git a/ext/rbu/rbu7.test b/ext/rbu/rbu7.test index 1e3bc174dd..e8ec0343db 100644 --- a/ext/rbu/rbu7.test +++ b/ext/rbu/rbu7.test @@ -13,10 +13,8 @@ # -if {![info exists testdir]} { - set testdir [file join [file dirname [info script]] .. .. test] -} -source $testdir/tester.tcl +source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbu7 # Test index: diff --git a/ext/rbu/rbu8.test b/ext/rbu/rbu8.test index c0ccd8c5eb..86e931482e 100644 --- a/ext/rbu/rbu8.test +++ b/ext/rbu/rbu8.test @@ -12,10 +12,8 @@ # Test the rbu_delta() feature. # -if {![info exists testdir]} { - set testdir [file join [file dirname [info script]] .. .. test] -} -source $testdir/tester.tcl +source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbu8 do_execsql_test 1.0 { diff --git a/ext/rbu/rbu9.test b/ext/rbu/rbu9.test index 0efdc1dde5..fe808b3ac6 100644 --- a/ext/rbu/rbu9.test +++ b/ext/rbu/rbu9.test @@ -12,10 +12,8 @@ # Test RBU with virtual tables. And tables with no PRIMARY KEY declarations. # -if {![info exists testdir]} { - set testdir [file join [file dirname [info script]] .. .. test] -} -source $testdir/tester.tcl +source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbu9 ifcapable !fts3 { diff --git a/ext/rbu/rbuA.test b/ext/rbu/rbuA.test index 642caca196..cdc0c8040b 100644 --- a/ext/rbu/rbuA.test +++ b/ext/rbu/rbuA.test @@ -14,10 +14,8 @@ # a wal mode database via RBU. # -if {![info exists testdir]} { - set testdir [file join [file dirname [info script]] .. .. test] -} -source $testdir/tester.tcl +source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbuA set db_sql { diff --git a/ext/rbu/rbuB.test b/ext/rbu/rbuB.test index 6eb917e57d..fca755a4b6 100644 --- a/ext/rbu/rbuB.test +++ b/ext/rbu/rbuB.test @@ -12,6 +12,7 @@ # source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbuB db close diff --git a/ext/rbu/rbuC.test b/ext/rbu/rbuC.test index ff3d4d5075..430b14418e 100644 --- a/ext/rbu/rbuC.test +++ b/ext/rbu/rbuC.test @@ -13,6 +13,7 @@ # source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbuC #------------------------------------------------------------------------- diff --git a/ext/rbu/rbubusy.test b/ext/rbu/rbubusy.test index 8cc47db8f9..088711405a 100644 --- a/ext/rbu/rbubusy.test +++ b/ext/rbu/rbubusy.test @@ -12,6 +12,7 @@ # source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbubusy db close diff --git a/ext/rbu/rbucollate.test b/ext/rbu/rbucollate.test index ccc0976247..52f6ba373f 100644 --- a/ext/rbu/rbucollate.test +++ b/ext/rbu/rbucollate.test @@ -11,6 +11,7 @@ # source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbucollate ifcapable !icu_collations { diff --git a/ext/rbu/rbucrash.test b/ext/rbu/rbucrash.test index 34ac2c86fe..c2132bc3d3 100644 --- a/ext/rbu/rbucrash.test +++ b/ext/rbu/rbucrash.test @@ -10,10 +10,8 @@ #*********************************************************************** # -if {![info exists testdir]} { - set testdir [file join [file dirname [info script]] .. .. test] -} -source $testdir/tester.tcl +source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbucrash db close diff --git a/ext/rbu/rbucrash2.test b/ext/rbu/rbucrash2.test index 9ff6eba4f2..683de88492 100644 --- a/ext/rbu/rbucrash2.test +++ b/ext/rbu/rbucrash2.test @@ -10,10 +10,8 @@ #*********************************************************************** # -if {![info exists testdir]} { - set testdir [file join [file dirname [info script]] .. .. test] -} -source $testdir/tester.tcl +source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbucrash2 db close diff --git a/ext/rbu/rbudiff.test b/ext/rbu/rbudiff.test index 5c2bf9bee7..b165cf2be7 100644 --- a/ext/rbu/rbudiff.test +++ b/ext/rbu/rbudiff.test @@ -12,10 +12,9 @@ # Tests for the [sqldiff --rbu] command. # # -if {![info exists testdir]} { - set testdir [file join [file dirname [info script]] .. .. test] -} -source $testdir/tester.tcl + +source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set testprefix rbudiff set PROG [test_find_sqldiff] diff --git a/ext/rbu/rbudor.test b/ext/rbu/rbudor.test index df4d934de7..684b43a946 100644 --- a/ext/rbu/rbudor.test +++ b/ext/rbu/rbudor.test @@ -13,10 +13,8 @@ # enabled by SQLITE_DIRECT_OVERFLOW_READ - Direct Overflow Read. # -if {![info exists testdir]} { - set testdir [file join [file dirname [info script]] .. .. test] -} -source $testdir/tester.tcl +source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbudor set bigA [string repeat a 5000] diff --git a/ext/rbu/rbuexlock.test b/ext/rbu/rbuexlock.test index eddcdc115f..570489cbc7 100644 --- a/ext/rbu/rbuexlock.test +++ b/ext/rbu/rbuexlock.test @@ -11,6 +11,7 @@ # source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbuexlock db close diff --git a/ext/rbu/rbuexpr.test b/ext/rbu/rbuexpr.test index a392c4ed8c..724a0f131f 100644 --- a/ext/rbu/rbuexpr.test +++ b/ext/rbu/rbuexpr.test @@ -11,6 +11,7 @@ # source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbuexpr db close diff --git a/ext/rbu/rbufault.test b/ext/rbu/rbufault.test index 247a991899..fb3efb972e 100644 --- a/ext/rbu/rbufault.test +++ b/ext/rbu/rbufault.test @@ -10,10 +10,8 @@ #*********************************************************************** # -if {![info exists testdir]} { - set testdir [file join [file dirname [info script]] .. .. test] -} -source $testdir/tester.tcl +source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } source $testdir/malloc_common.tcl set ::testprefix rbufault diff --git a/ext/rbu/rbufault2.test b/ext/rbu/rbufault2.test index 36f2b6b6f2..4bf53a17fe 100644 --- a/ext/rbu/rbufault2.test +++ b/ext/rbu/rbufault2.test @@ -10,10 +10,8 @@ #*********************************************************************** # -if {![info exists testdir]} { - set testdir [file join [file dirname [info script]] .. .. test] -} -source $testdir/tester.tcl +source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } source $testdir/malloc_common.tcl set ::testprefix rbufault2 diff --git a/ext/rbu/rbufault3.test b/ext/rbu/rbufault3.test index 4f690284a2..b7ba54f6a6 100644 --- a/ext/rbu/rbufault3.test +++ b/ext/rbu/rbufault3.test @@ -13,6 +13,7 @@ # source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } source $testdir/malloc_common.tcl set ::testprefix rbufault3 diff --git a/ext/rbu/rbufault4.test b/ext/rbu/rbufault4.test index 551b8b2b6f..f4207c162e 100644 --- a/ext/rbu/rbufault4.test +++ b/ext/rbu/rbufault4.test @@ -10,10 +10,8 @@ #*********************************************************************** # -if {![info exists testdir]} { - set testdir [file join [file dirname [info script]] .. .. test] -} -source $testdir/tester.tcl +source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } source $testdir/malloc_common.tcl set ::testprefix rbufault4 diff --git a/ext/rbu/rbufts.test b/ext/rbu/rbufts.test index 95d4e75c52..8424c95708 100644 --- a/ext/rbu/rbufts.test +++ b/ext/rbu/rbufts.test @@ -13,10 +13,8 @@ # contains tests to ensure that RBU works with FTS tables. # -if {![info exists testdir]} { - set testdir [file join [file dirname [info script]] .. .. test] -} -source $testdir/tester.tcl +source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbufts ifcapable !fts3 { diff --git a/ext/rbu/rbumisc.test b/ext/rbu/rbumisc.test index c2a3906c09..6b89150bce 100644 --- a/ext/rbu/rbumisc.test +++ b/ext/rbu/rbumisc.test @@ -11,6 +11,7 @@ # source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbumisc db close diff --git a/ext/rbu/rbumulti.test b/ext/rbu/rbumulti.test index 727d5e992d..95c4fee703 100644 --- a/ext/rbu/rbumulti.test +++ b/ext/rbu/rbumulti.test @@ -16,6 +16,7 @@ # source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbumulti db close diff --git a/ext/rbu/rbupartial.test b/ext/rbu/rbupartial.test index d6cd7330fe..c8c476a1f9 100644 --- a/ext/rbu/rbupartial.test +++ b/ext/rbu/rbupartial.test @@ -11,6 +11,7 @@ # source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbupartial db close diff --git a/ext/rbu/rbupass.test b/ext/rbu/rbupass.test index 044a3f2eb8..8bebe074bd 100644 --- a/ext/rbu/rbupass.test +++ b/ext/rbu/rbupass.test @@ -11,6 +11,7 @@ # source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbupass if {[info commands register_demovfs]==""} { diff --git a/ext/rbu/rbuprogress.test b/ext/rbu/rbuprogress.test index bf37b4e505..513ccdbbe4 100644 --- a/ext/rbu/rbuprogress.test +++ b/ext/rbu/rbuprogress.test @@ -11,6 +11,7 @@ # source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbuprogress diff --git a/ext/rbu/rburename.test b/ext/rbu/rburename.test index 2275396bca..fb9d83ea19 100644 --- a/ext/rbu/rburename.test +++ b/ext/rbu/rburename.test @@ -12,6 +12,7 @@ # source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rburename diff --git a/ext/rbu/rburesume.test b/ext/rbu/rburesume.test index 82c8c66b95..fdbd214213 100644 --- a/ext/rbu/rburesume.test +++ b/ext/rbu/rburesume.test @@ -16,6 +16,7 @@ # source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rburesume forcedelete test.db-shm test.db-oal diff --git a/ext/rbu/rbusave.test b/ext/rbu/rbusave.test index 210d7b545a..79b49de513 100644 --- a/ext/rbu/rbusave.test +++ b/ext/rbu/rbusave.test @@ -10,10 +10,8 @@ #*********************************************************************** # -if {![info exists testdir]} { - set testdir [file join [file dirname [info script]] .. .. test] -} -source $testdir/tester.tcl +source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbusave do_execsql_test 1.0 { diff --git a/ext/rbu/rbusplit.test b/ext/rbu/rbusplit.test index 34fef38677..b28f0c0da9 100644 --- a/ext/rbu/rbusplit.test +++ b/ext/rbu/rbusplit.test @@ -12,6 +12,7 @@ # source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbusplit db close diff --git a/ext/rbu/rbutemplimit.test b/ext/rbu/rbutemplimit.test index 2acba3624c..3ca9c64d81 100644 --- a/ext/rbu/rbutemplimit.test +++ b/ext/rbu/rbutemplimit.test @@ -12,6 +12,7 @@ # TESTRUNNER: slow source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbutemplimit db close diff --git a/ext/rbu/rbuvacuum.test b/ext/rbu/rbuvacuum.test index 1785f529b1..4ed71c2665 100644 --- a/ext/rbu/rbuvacuum.test +++ b/ext/rbu/rbuvacuum.test @@ -15,6 +15,7 @@ # source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set ::testprefix rbuvacuum foreach step {0 1} { diff --git a/ext/rbu/rbuvacuum2.test b/ext/rbu/rbuvacuum2.test index d4f7c52328..eed8ea1ae4 100644 --- a/ext/rbu/rbuvacuum2.test +++ b/ext/rbu/rbuvacuum2.test @@ -15,6 +15,7 @@ # source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } foreach {step} {0 1} { foreach {ttt state} { diff --git a/ext/rbu/rbuvacuum3.test b/ext/rbu/rbuvacuum3.test index 7e1e337f3c..98fb25fc04 100644 --- a/ext/rbu/rbuvacuum3.test +++ b/ext/rbu/rbuvacuum3.test @@ -15,6 +15,7 @@ # source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set testprefix rbuvacuum3 do_execsql_test 1.0 { diff --git a/ext/rbu/rbuvacuum4.test b/ext/rbu/rbuvacuum4.test index 5cf33d6765..269bd2152f 100644 --- a/ext/rbu/rbuvacuum4.test +++ b/ext/rbu/rbuvacuum4.test @@ -15,6 +15,7 @@ # source [file join [file dirname [info script]] rbu_common.tcl] +ifcapable !rbu { finish_test ; return } set testprefix rbuvacuum4 set step 1 diff --git a/manifest b/manifest index 25fd792232..6460dfef0a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Cherrypick\s[3773934e91c20ca243]\sinto\strunk. -D 2023-01-27T17:19:30.435 +C Do\snot\stry\sto\srun\srbu\stests\swith\sbuilds\sthat\sdo\snot\ssupport\srbu. +D 2023-01-27T19:59:46.779 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -318,49 +318,49 @@ F ext/misc/wholenumber.c a838d1bea913c514ff316c69695efbb49ea3b8cb37d22afc57f73b6 F ext/misc/zipfile.c f98239261488397618ce4754c500626d1de20cd2d44bf2f2d571d7ddaab668a7 F ext/misc/zorder.c b0ff58fa643afa1d846786d51ea8d5c4b6b35aa0254ab5a82617db92f3adda64 F ext/rbu/rbu.c 801450b24eaf14440d8fd20385aacc751d5c9d6123398df41b1b5aa804bf4ce8 -F ext/rbu/rbu1.test c62904bd9526dcdc3496a21199aaf14ae191bbadbf67f076bf16be6b3f2115c2 -F ext/rbu/rbu10.test 06d2bc934a03a0978e750cc9c95b419d9b0bcbec1fc77128e33e377c3a73240b -F ext/rbu/rbu11.test 5c834cf491086b45e071eabf71f708febc143e86a384a92de69e0b1a4cace144 -F ext/rbu/rbu12.test 29f8b2118f6c96fac3755bd6d2b55c2db24f878b1f11fbfbe294f3a230a3dcdc -F ext/rbu/rbu13.test 1285298e3360ec74511764841b3c174dcfe21da2f618c22febf1a20abd0365c2 -F ext/rbu/rbu14.test 4a7bf0b3a4516d3ab0bc0ba4ceb53eb7e3324147ccda152e561060f659dbba31 -F ext/rbu/rbu3.test d6c6cc7a1326e8e23b9820f30bd3054f22092e503fadfd2a660ae006653f6d80 -F ext/rbu/rbu5.test 724b38ea5f722e3d22dc76343860bd998bb676c3f78c4bc8175df5c5d7720e23 -F ext/rbu/rbu6.test 401064236d3cf86b7edc01c586d7c5554f48553946fbfa1a3af35d7e47dce9e3 -F ext/rbu/rbu7.test ae25f47b56f178197fc1098537a35a39176cc73d1629b03dc9d795929fc36ec2 -F ext/rbu/rbu8.test b98a6fc58ead84a0e6ddee775b9702cd981f318d5d4fd1d4df0fa0c40db7251b -F ext/rbu/rbu9.test 0e4d985e25620d61920597e8ea69c871c9e8c1f5a0be2ae9fa70bb641d74378c -F ext/rbu/rbuA.test b34a90cb495682c25b5fc03a9d5e7a4fc99541c29256f25e2e2a4f6542b4f5b3 -F ext/rbu/rbuB.test 8d1f141711be8122739853d876af4306bc756d925499577f9b917ec1f1c5ae65 -F ext/rbu/rbuC.test 80f1cc2fb74f44b1128fd0ed8eedab3a76fefeb72a947860e2869ef76fc8dc6b +F ext/rbu/rbu1.test c62d9bfdd988cd0a30fa84e6f9a733f540e1d16d3e0cde4ee744aeadbaef334a +F ext/rbu/rbu10.test 66b20eb97e9d923f3cd69a882c57eb6c945b19d7f1ceaa7712e1b02fae3793c2 +F ext/rbu/rbu11.test 34134e9331f2a6d29770cd4594e54ad92e007f0f6bca4ee12cddee113c61f60e +F ext/rbu/rbu12.test 3b18fa8b712274551c438acf4b71f6fbcebe71c09d0bc1058d3ec99c4e5c59bd +F ext/rbu/rbu13.test 67bae3f17fa6b74c8853b25804e7f5345926af42bc80a10b0c433ba9e54b87a6 +F ext/rbu/rbu14.test 3aa8202b181e25112fb80e7fe9e9f409d7d191d09f732bcb53fbd200d384bb63 +F ext/rbu/rbu3.test 76152c3601e6a0a39cebd37945bb79f7bd1061462053a3899432bd089c6ae15b +F ext/rbu/rbu5.test 29a4bd5261f1df259d598e8792607643861ba476c607343c68310bfd94919263 +F ext/rbu/rbu6.test 6966b6c734ee50279ecf59bc32c7b2bcfb972e91a3303e120bc31ca4ea28edd2 +F ext/rbu/rbu7.test 92938c6b0b0e7d268a75b5744fd4ea023f8f3da5d46c3764c625564d7001c7b8 +F ext/rbu/rbu8.test 2aba6914d3fc47565ac2a3de49fde4fe2f5181af449cd5443f0576ab0a92bc79 +F ext/rbu/rbu9.test f37042dee2caf1551d3ad462670189f05677c242510a5c0f8dd650750cb5426a +F ext/rbu/rbuA.test 94759f2117d5932bfff0b60405d5644665e2216254625be68998f055fd6b580a +F ext/rbu/rbuB.test 1e7641ec8c8eafc21fdaaa983ef04d999fa0a9b83d88175f561184a19dfdaa8c +F ext/rbu/rbuC.test 2e1cd0d85a7576b97c1919fa6d3697b6d40ed2acf626da99f8abf90a7b946f37 F ext/rbu/rbu_common.tcl 60d904133ff843fe72cc0514e9dd2486707181e6e0fbab20979da28c48d21de9 -F ext/rbu/rbubusy.test f38ef557358564491b8a2ee70e4cad31e40fcea57a16f27bc56ba40a59bbde50 -F ext/rbu/rbucollate.test cac528a9a46318cba42e61258bb42660bbbf4fdb9a8c863de5a54ad0c658d197 -F ext/rbu/rbucrash.test 000981a1fe8a6e4d9a684232f6a129e66a3ef595f5ed74655e2f9c68ffa613b4 -F ext/rbu/rbucrash2.test efa143cc94228eb0266d3f1abfbee60a5838a84cef7cc3fcb8c145b74d96fd41 -F ext/rbu/rbudiff.test abe895a8d479e4d33acb40e244e3d8e2cd25f55a18dfa8b9f83e13d00073f600 -F ext/rbu/rbudor.test e3e8623926012f43eebe51fedf06a102df2640750d971596b052495f2536db20 -F ext/rbu/rbuexlock.test 4634a5526d02bf80b0c563f95774bd5af5783e3219ddeb30e413753c9a65510c -F ext/rbu/rbuexpr.test 10d0420537c3bc7666e576d72adeffe7e86cfbb00dcc30aa9ce096c042415190 -F ext/rbu/rbufault.test 2d7f567b79d558f6e093c58808cab4354f8a174e3802f69e7790a9689b3c09f8 -F ext/rbu/rbufault2.test c81327a3ac2c385b9b954db3644d4e0df93eeebfc3de9f1f29975a1e73fd3d0c -F ext/rbu/rbufault3.test b2fcc9db5c982b869f67d1d4688d8cb515d5b92f58011fff95665f2e62cec179 -F ext/rbu/rbufault4.test 03d2849c3df7d7bd14a622e789ff049e5080edd34a79cd432e01204db2a5930a -F ext/rbu/rbufts.test 0ae8d1da191c75bd776b86e24456db0fb6e97b7c944259fae5407ea55d23c31d -F ext/rbu/rbumisc.test 329986cf5dd51890c4eb906c2f960ebb773a79a64bed90f506b7c417825b37eb -F ext/rbu/rbumulti.test bf28c1486b45215f5bf877cc560a4ddf50d22c4ed2ae267482bcf4af285bb115 -F ext/rbu/rbupartial.test f25df014b8dbe3c5345851fba6e66f79ab237f57dc201b2d5f0dbae658ae5a4c -F ext/rbu/rbupass.test 1a8f635a9f6026f905a952e70a081811d8042de28165099d874832c1bf49d4b9 -F ext/rbu/rbuprogress.test 857cf1f8166c83ef977edb9ef4fc42d80f71fbd798652b46ae2f3a7031870f8d -F ext/rbu/rburename.test a9b4aea612352b74c45de1757edd2ecb2079348b1d4cc734572dc29e55b1b376 -F ext/rbu/rburesume.test c46a77f031cbaec58abf0edbafbf75190cbafd3b941ed081cb6626ebb3e8230c -F ext/rbu/rbusave.test f4190a1a86fccf84f723af5c93813365ae33feda35845ba107b59683d1cdd926 -F ext/rbu/rbusplit.test b37e7b40b38760881dc9c854bd40b4744c6b6cd74990754eca3bda0f407051e8 -F ext/rbu/rbutemplimit.test 8d18f1c7e8a04814d9dbe36f75f0d8921bcca00c18901d518bce5fc6bc98b877 -F ext/rbu/rbuvacuum.test 55e101e90168c2b31df6c9638fe73dc7f7cc666b6142266d1563697d79f73534 -F ext/rbu/rbuvacuum2.test 2643b58f4d8d3573db0f93faae18805a35ab162b4c55ff6b656062ff432ed55b -F ext/rbu/rbuvacuum3.test 8addd82e4b83b4c93fa47428eae4fd0dbf410f8512c186f38e348feb49ba03dc -F ext/rbu/rbuvacuum4.test a78898e438a44803eb2bc897ba3323373c9f277418e2d6d76e90f2f1dbccfd10 +F ext/rbu/rbubusy.test 8ab40abb9b3210a453aa25971c64adbb1ff0f764eaf9c38e137482a63fd45b91 +F ext/rbu/rbucollate.test 559b5b877d61b2a7b7a7a49ad8cde5d21658c19d34fd2811f946ee5df6cb475b +F ext/rbu/rbucrash.test c6440ae5803676f357b579dea260c894f23081f6fc8befdbc9fd081990f52507 +F ext/rbu/rbucrash2.test d63c10195f2bbf7d7ec2248740dcc6171ecc2693080cfb65976c35f477120ac8 +F ext/rbu/rbudiff.test b0865fe535942d89795126087001be751fc0d2fa0ca667a59446cca027471eb9 +F ext/rbu/rbudor.test b77e10326ef3660e19d103bf1739ac52baf9e6a2486f631b8b369468adcaa37e +F ext/rbu/rbuexlock.test a6c135766e0cafa221ec69fa5c019beab2aad208750d3aa8c734d7260e01a4fe +F ext/rbu/rbuexpr.test 85effe05ee50594df27a903c48aa9b192bd26045a5be95d10f1a5495232dea15 +F ext/rbu/rbufault.test 9bc7538e4b02817d898b15ab590acb9648e2a6eb53dd1d3848c417f5980a107b +F ext/rbu/rbufault2.test 411469c638073bd6523f069bcaee07b413127f3f233de34756ebcf5a2a0ce566 +F ext/rbu/rbufault3.test d9042c8840eb92cca1f9552388f799f0ccca024ed5b8d9bb9c78f38d39a1f339 +F ext/rbu/rbufault4.test 778c73137822e12ddbf54da248c9b2be59b0580c4202c052fa07787ae493f04a +F ext/rbu/rbufts.test b4db0a6d89905d356cecb6f9f2fe7e4848da6b3b276b73b8689ce96301c2810c +F ext/rbu/rbumisc.test db67696663760aa4093f451ebeddc953a8d33ee9571a5651dff48d0597b7a812 +F ext/rbu/rbumulti.test e8891a63b078253d34e0cdee0ed7446808daa4138cfc7dbd0e359c50967e4351 +F ext/rbu/rbupartial.test bffeb40fe14906ab6f90286ae3913f8aa4b35a5b2de03f24ea2fcf80ee6f2b24 +F ext/rbu/rbupass.test c21e13b78ea62bf70850ee79ef96bfcbe203d7ccc2de83c35d452723328d20f0 +F ext/rbu/rbuprogress.test 3a0344032b7f62ae172cf1f4da52caa753bcf535bf73341ab23b3929a217d79b +F ext/rbu/rburename.test 6d9b4efbe537e221700db15903cd11b17cb0c97eaa6584baf01aac9664937462 +F ext/rbu/rburesume.test 9caa95842fd4a35c3e8aeb5ca83e638fa357f51a774d6a0487ada1122ab39612 +F ext/rbu/rbusave.test 323ad16da4492e173e99bd77397807d911e8b69df08318224bb748a5b955689f +F ext/rbu/rbusplit.test eb20a264b7681613db6cbf031c93b2f50addec89cd437ab737304eb143cd34a8 +F ext/rbu/rbutemplimit.test 6b4ac534ffdd0133c627ebb15b1abe449f941b088e985152133cdbdc1b489966 +F ext/rbu/rbuvacuum.test 36aa4024b226b13e47ab20f27aa5a239ba3eb1b0385c24d09507bd3f4c2a9ca4 +F ext/rbu/rbuvacuum2.test 851c5163261c2057adb5265f06240b37a52a18c2383fca17d0a3013f05261a6d +F ext/rbu/rbuvacuum3.test fbea74f2c316911c1983db06566d55fca4e270fdc731f62299417087362fb704 +F ext/rbu/rbuvacuum4.test 834e9d6c7cb46237493ec16489c0478ec4aedadf9396973f1fec93acb725ba25 F ext/rbu/sqlite3rbu.c 348bb6251e6ec459de102f8b2dd50789a98643ef7a28e56e4c787ac9659c15ea F ext/rbu/sqlite3rbu.h 9d923eb135c5d04aa6afd7c39ca47b0d1d0707c100e02f19fdde6a494e414304 F ext/rbu/test_rbu.c ee6ede75147bc081fe9bc3931e6b206277418d14d3fbceea6fdc6216d9b47055 @@ -2044,9 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P eabb551b8b3d33fc3a327ecf7225436a3a3f616901e22c868fd76a5e3adc7b3f -Q +3773934e91c20ca2433cc414aaba75de9a4a4318fd1126fb781dba510ddefd94 -R 1cf9f93fc162d1085b11c39fbf5b9e62 -U stephan -Z 35eb683fd2e66a13e0456c98ff3a4371 +P 50cf4300a6a92302010fa4a7662db82bf55180a4930771f0d3c07e558bc87e7d +R 6fb23e5232bbb2d103c92c941058e228 +U dan +Z 4b65d980220a15831da00c2a768596a3 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f4626601bf..be80e330fe 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -50cf4300a6a92302010fa4a7662db82bf55180a4930771f0d3c07e558bc87e7d \ No newline at end of file +c74ad902e3bbfc28d6b30a37f3791176d64cdd8fd5950f1d1749541e244a0494 \ No newline at end of file From f92b006a6ed7b9be3614bb8d31ec40a7dfeaa3b7 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 27 Jan 2023 20:15:48 +0000 Subject: [PATCH 10/65] Add an assert() to help static analyzers. FossilOrigin-Name: e446c8b4aa2ffe075f9c289c771d62a414661c3ffe6abae5649c50af8e32fab6 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/btree.c | 4 +++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 6460dfef0a..04c121fbc0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Do\snot\stry\sto\srun\srbu\stests\swith\sbuilds\sthat\sdo\snot\ssupport\srbu. -D 2023-01-27T19:59:46.779 +C Add\san\sassert()\sto\shelp\sstatic\sanalyzers. +D 2023-01-27T20:15:48.669 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -559,7 +559,7 @@ F src/auth.c f4fa91b6a90bbc8e0d0f738aa284551739c9543a367071f55574681e0f24f8cf F src/backup.c a2891172438e385fdbe97c11c9745676bec54f518d4447090af97189fd8e52d7 F src/bitvec.c 7c849aac407230278445cb069bebc5f89bf2ddd87c5ed9459b070a9175707b3d F src/btmutex.c 6ffb0a22c19e2f9110be0964d0731d2ef1c67b5f7fabfbaeb7b9dabc4b7740ca -F src/btree.c 8b776a47d1e791ca78b539b8356cf32e449a613201cf64b87e7f01c62f79bd1b +F src/btree.c 2f012aea074de6319c191cbf5c45034de79bf1c762826e381b1cf75421d8d831 F src/btree.h aa354b9bad4120af71e214666b35132712b8f2ec11869cb2315c52c81fad45cc F src/btreeInt.h 06bb2c1a07172d5a1cd27a2a5d617b93b1e976c5873709c31964786f86365a6e F src/build.c c55ab6d1b089ceef57160e840f05f692955ac90944c3d04fcf01d97fd7bfd08d @@ -2044,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 50cf4300a6a92302010fa4a7662db82bf55180a4930771f0d3c07e558bc87e7d -R 6fb23e5232bbb2d103c92c941058e228 -U dan -Z 4b65d980220a15831da00c2a768596a3 +P c74ad902e3bbfc28d6b30a37f3791176d64cdd8fd5950f1d1749541e244a0494 +R 57fbc0d68a554ca6b628d676f2d12d96 +U drh +Z 7ac7eacb05727f391b6a985bf9bb5add # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index be80e330fe..e4d2a92b82 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c74ad902e3bbfc28d6b30a37f3791176d64cdd8fd5950f1d1749541e244a0494 \ No newline at end of file +e446c8b4aa2ffe075f9c289c771d62a414661c3ffe6abae5649c50af8e32fab6 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index fae5725360..4fbe0b3dbc 100644 --- a/src/btree.c +++ b/src/btree.c @@ -10410,7 +10410,9 @@ static void checkList( ** lower 16 bits are the index of the last byte of that range. */ static void btreeHeapInsert(u32 *aHeap, u32 x){ - u32 j, i = ++aHeap[0]; + u32 j, i; + assert( aHeap!=0 ); + i = ++aHeap[0]; aHeap[i] = x; while( (j = i/2)>0 && aHeap[j]>aHeap[i] ){ x = aHeap[j]; From 69141f52be6368d3510b551c74029e3600b6f4c2 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 27 Jan 2023 20:25:39 +0000 Subject: [PATCH 11/65] Update ext/wasm/README-dist.txt for the bundler-friendly build. FossilOrigin-Name: 6a5c4f6b19aa0704efe7f789102f757a1ed05d6542f37c7aa37a4439783944a3 --- ext/wasm/README-dist.txt | 34 +++++++++++++++++++++++++++------- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/ext/wasm/README-dist.txt b/ext/wasm/README-dist.txt index 909a5ebbe0..db0862628b 100644 --- a/ext/wasm/README-dist.txt +++ b/ext/wasm/README-dist.txt @@ -4,19 +4,39 @@ Main project page: https://sqlite.org Documentation: https://sqlite.org/wasm -This archive contains the sqlite3.js, sqlite3.mjs, and sqlite3.wasm -files which make up the sqlite3 WASM/JS build. +This archive contains the following deliverables for the WASM/JS +build: -The jswasm directory contains the core sqlite3 deliverables and the -top-level directory contains demonstration and test applications. +- jswasm/sqlite3.js is the canonical "vanilla JS" version. -Browsers will not serve WASM files from file:// URLs, so the demo/test -apps require a web server and that server must include the following -headers in its response when serving the files: +- jswasm/sqlite3.mjs is the same but in ES6 module form + +- jswasm/sqlite3-bundler-friendly.mjs is the same as the ES6 module + with small tweaks to make it compatible with "bundler" tools + commonly seen in node.js-based projects. + +- jswasm/sqlite3.wasm is the binary WASM file imported by all of the + above-listed JS files. + +- The jswasm directory additionally contains a number of supplemental + JS files which cannot be bundled directly with the main JS files + but are necessary for certain usages. + +- The top-level directory contains various demonstration and test + applications for sqlite3.js and sqlite3.mjs. + sqlite3-bundler-friendly.mjs requires client-side build tools to make + use of and is not demonstrated here. + +Browsers will not serve WASM files from file:// URLs, so the test and +demonstration apps require a web server and that server must include +the following headers in its response when serving the files: Cross-Origin-Opener-Policy: same-origin Cross-Origin-Embedder-Policy: require-corp +The core library will function without those headers but certain +features, most notably OPFS storage, will not be available. + One simple way to get the demo apps up and running on Unix-style systems is to install althttpd (https://sqlite.org/althttpd) and run: diff --git a/manifest b/manifest index c19a076175..8335468752 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\sfeature\sidea\snote\sto\sDB.exec(),\sderived\sfrom\sa\sforum\sdiscussion. -D 2023-01-27T19:56:40.990 +C Update\sext/wasm/README-dist.txt\sfor\sthe\sbundler-friendly\sbuild. +D 2023-01-27T20:25:39.859 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -467,7 +467,7 @@ F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c F ext/wasm/GNUmakefile 31cf62436f306eed8c8aa66991653395f62e52af7ad21a0de02f7d780cb8c398 -F ext/wasm/README-dist.txt dab111337028af58ec11cb35c2e1a82398217c399c7499fefab0509a0499a5d7 +F ext/wasm/README-dist.txt 4a1db3677d0341a12434d1fd6c97aae2f96785d734641407a201b719f5d94f44 F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9 F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287 @@ -2044,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3773934e91c20ca2433cc414aaba75de9a4a4318fd1126fb781dba510ddefd94 -R c10dcf005f6c888521bd65824a3df6ca +P 792f43209c4b6e85386b6b3906814b7f2ad310d50ba563b3fd1cb37e55adf8db +R 6dd48572fe63ddeb1a6c689b0b2a68d4 U stephan -Z 96645cafa741bd6b03c389427ea21748 +Z 5f5447f2e7e7b095c0a2cbaeda82b72d # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 60da4aa3a1..ccc5178417 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -792f43209c4b6e85386b6b3906814b7f2ad310d50ba563b3fd1cb37e55adf8db \ No newline at end of file +6a5c4f6b19aa0704efe7f789102f757a1ed05d6542f37c7aa37a4439783944a3 \ No newline at end of file From cfd01014d0b5657a8b48d4c828405703cce9e941 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 27 Jan 2023 23:10:10 +0000 Subject: [PATCH 12/65] Fix compiler warning in base85.c. FossilOrigin-Name: bd9613fd63193bd6b33798d83f0ef21987ba468b53d13a25a31cb9e9e5f20562 --- ext/misc/base85.c | 3 ++- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ext/misc/base85.c b/ext/misc/base85.c index 0191368741..5ec136dbc6 100644 --- a/ext/misc/base85.c +++ b/ext/misc/base85.c @@ -171,7 +171,8 @@ static char* toBase85( u8 *pIn, int nbIn, char *pOut, char *pSep ){ int nCol = 0; while( nbIn >= 4 ){ int nco = 5; - unsigned long qbv = (pIn[0]<<24)|(pIn[1]<<16)|(pIn[2]<<8)|pIn[3]; + unsigned long qbv = (((unsigned long)pIn[0])<<24) | + (pIn[1]<<16) | (pIn[2]<<8) | pIn[3]; while( nco > 0 ){ unsigned nqv = (unsigned)(qbv/85UL); unsigned char dv = qbv - 85UL*nqv; diff --git a/manifest b/manifest index 04c121fbc0..4b7e12a3aa 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\san\sassert()\sto\shelp\sstatic\sanalyzers. -D 2023-01-27T20:15:48.669 +C Fix\scompiler\swarning\sin\sbase85.c. +D 2023-01-27T23:10:10.479 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -264,7 +264,7 @@ F ext/misc/amatch.c e3ad5532799cee9a97647f483f67f43b38796b84b5a8c60594fe782a4338 F ext/misc/anycollseq.c 5ffdfde9829eeac52219136ad6aa7cd9a4edb3b15f4f2532de52f4a22525eddb F ext/misc/appendvfs.c 9642c7a194a2a25dca7ad3e36af24a0a46d7702168c4ad7e59c9f9b0e16a3824 F ext/misc/base64.c d43d2b209c8ab70ca3f860104bb353b0f52a1c5462a2466140025c954e4f3ea7 x -F ext/misc/base85.c 4b53d66c50e120e8697dd2a8ea6ddbc8750a4a1f6bcc6e0b7202a3998b0852bc +F ext/misc/base85.c 77dfd5813d23ea561d0348f922583888e78f8eaeb2b9a4a28226d092389890b8 F ext/misc/basexx.c 5e859e1820620aa8080fb9145eb47089de426ae808f6abb01a8e12921c3a8e67 F ext/misc/blobio.c a867c4c4617f6ec223a307ebfe0eabb45e0992f74dd47722b96f3e631c0edb2a F ext/misc/btreeinfo.c d28ce349b40054eaa9473e835837bad7a71deec33ba13e39f963d50933bfa0f9 @@ -2044,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c74ad902e3bbfc28d6b30a37f3791176d64cdd8fd5950f1d1749541e244a0494 -R 57fbc0d68a554ca6b628d676f2d12d96 +P e446c8b4aa2ffe075f9c289c771d62a414661c3ffe6abae5649c50af8e32fab6 +R d679b1424ddaeb09fc6eeb6c565e2751 U drh -Z 7ac7eacb05727f391b6a985bf9bb5add +Z 0e1eac878e4ebdd2f0ed91103111d8aa # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index e4d2a92b82..fea530843c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e446c8b4aa2ffe075f9c289c771d62a414661c3ffe6abae5649c50af8e32fab6 \ No newline at end of file +bd9613fd63193bd6b33798d83f0ef21987ba468b53d13a25a31cb9e9e5f20562 \ No newline at end of file From e84454ff16acf8da0814dfb334e0b6628293ae81 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 28 Jan 2023 05:09:26 +0000 Subject: [PATCH 13/65] Enhance oo1.DB.exec() to simplify returning whole result sets. FossilOrigin-Name: 7b168ee2af09f04b41a6ef4c14ccaddc0c9b0bfe9dc1e6a86d8f5317606bd78d --- ext/wasm/api/sqlite3-api-oo1.js | 14 +++++++++----- ext/wasm/tester1.c-pp.js | 18 +++++++++++++++--- ext/wasm/tests/opfs/concurrency/index.html | 5 ++--- manifest | 17 ++++++++--------- manifest.uuid | 2 +- 5 files changed, 35 insertions(+), 21 deletions(-) diff --git a/ext/wasm/api/sqlite3-api-oo1.js b/ext/wasm/api/sqlite3-api-oo1.js index fddd7b38e3..26aa80f723 100644 --- a/ext/wasm/api/sqlite3-api-oo1.js +++ b/ext/wasm/api/sqlite3-api-oo1.js @@ -422,6 +422,10 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ default: toss3("Invalid returnValue value:",opt.returnValue); } + if(!opt.callback && !opt.returnValue && undefined!==opt.rowMode){ + if(!opt.resultRows) opt.resultRows = []; + out.returnVal = ()=>opt.resultRows; + } if(opt.callback || opt.resultRows){ switch((undefined===opt.rowMode) ? 'array' : opt.rowMode) { @@ -770,8 +774,11 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ - `returnValue`: is a string specifying what this function should return: - A) The default value is `"this"`, meaning that the - DB object itself should be returned. + A) The default value is (usually) `"this"`, meaning that the + DB object itself should be returned. The exceptions is if + the caller passes neither of `callback` nor `returnValue` + but does pass an explicit `rowMode` then the default + `returnValue` is `"resultRows"`, described below. B) `"resultRows"` means to return the value of the `resultRows` option. If `resultRows` is not set, this @@ -791,9 +798,6 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ - `callback` and `resultRows`: permit an array entries with semantics similar to those described for `bind` above. - - If passed neither a callback nor returnValue but is passed a - rowMode, default to returning the result set. - */ exec: function(/*(sql [,obj]) || (obj)*/){ affirmDbOpen(this); diff --git a/ext/wasm/tester1.c-pp.js b/ext/wasm/tester1.c-pp.js index dca5331370..86ec87b73d 100644 --- a/ext/wasm/tester1.c-pp.js +++ b/ext/wasm/tester1.c-pp.js @@ -1412,14 +1412,26 @@ self.sqlite3InitModule = sqlite3InitModule; db.selectValue("SELECT "+Number.MIN_SAFE_INTEGER)). assert(Number.MAX_SAFE_INTEGER === db.selectValue("SELECT "+Number.MAX_SAFE_INTEGER)); - counter = 0; - db.exec({ + let rv = db.exec({ sql: "SELECT a FROM t", callback: ()=>(1===++counter), }); - T.assert(2===counter, + T.assert(db === rv) + .assert(2===counter, "Expecting exec step() loop to stop if callback returns false."); + /** If exec() is passed neither callback nor returnValue but + is passed an explicit rowMode then the default returnValue + is the whole result set, as if an empty resultRows option + had been passed. */ + rv = db.exec({ + sql: "SELECT -1 UNION ALL SELECT -2 UNION ALL SELECT -3 ORDER BY 1 DESC", + rowMode: 0 + }); + T.assert(Array.isArray(rv)).assert(3===rv.length) + .assert(-1===rv[0]).assert(-3===rv[2]); + rv = db.exec("SELECT 1 WHERE 0",{rowMode: 0}); + T.assert(Array.isArray(rv)).assert(0===rv.length); if(wasm.bigIntEnabled && haveWasmCTests()){ const mI = wasm.xCall('sqlite3_wasm_test_int64_max'); const b = BigInt(Number.MAX_SAFE_INTEGER * 2); diff --git a/ext/wasm/tests/opfs/concurrency/index.html b/ext/wasm/tests/opfs/concurrency/index.html index 9a826c6e13..595ab24529 100644 --- a/ext/wasm/tests/opfs/concurrency/index.html +++ b/ext/wasm/tests/opfs/concurrency/index.html @@ -26,9 +26,8 @@ workload with interval=N (milliseconds). Set the number of worker iterations with iterations=N. Enable OPFS VFS verbosity with verbose=1-3 (output - goes to the dev console). Enable/disable "unlock ASAP" mode - (higher concurrency, lower speed) - with unlock-asap=0-1. + goes to the dev console). Disable/enable "unlock ASAP" mode + (higher concurrency, lower speed) with unlock-asap=0-1.

Achtung: if it does not start to do anything within a couple of seconds, check the dev console: Chrome sometimes fails to load diff --git a/manifest b/manifest index 5c62a39f76..dba0c8dd58 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sJS\sbundler-friendly\sJS\sbuild.\sMinor\stest\scode\scleanups. -D 2023-01-28T04:20:46.205 +C Enhance\soo1.DB.exec()\sto\ssimplify\sreturning\swhole\sresult\ssets. +D 2023-01-28T05:09:26.765 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -479,7 +479,7 @@ F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b F ext/wasm/api/pre-js.c-pp.js 9ece5de1bb0509f0a8a360712fcc9c1291b9516c0be5bd66acedd6edbcec37a1 F ext/wasm/api/sqlite3-api-cleanup.js 680d5ccfff54459db136a49b2199d9f879c8405d9c99af1dda0cc5e7c29056f4 F ext/wasm/api/sqlite3-api-glue.js 0a93e58aabf52b32ddccbb107a1fd4552f2505e103ab63396c4d0a0743704785 -F ext/wasm/api/sqlite3-api-oo1.js a3892fd79070d8c947205d8b90d8218cdb12e7fd5027dced5805dd387b590a36 +F ext/wasm/api/sqlite3-api-oo1.js f85f4f939f67217d75898e3a32944dd8ae17f11c9a357e78a116150d038c0377 F ext/wasm/api/sqlite3-api-prologue.js 69a74f2777aaafafc07ad2c922674fe3197ef63c921a3262b4772f937e7eb14a F ext/wasm/api/sqlite3-api-worker1.js c462199c40358f00f93e326206bddc756c52b93f2cb60ffb63f54fe4f9a9e977 F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3 @@ -530,8 +530,8 @@ F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555 F ext/wasm/test-opfs-vfs.js f09266873e1a34d9bdb6d3981ec8c9e382f31f215c9fd2f9016d2394b8ae9b7b F ext/wasm/tester1-worker.html 258d08f1ba9cc2d455958751e26be833893cf9ff7853e9436e593e1f778a386b F ext/wasm/tester1.c-pp.html 1c1bc78b858af2019e663b1a31e76657b73dc24bede28ca92fbe917c3a972af2 -F ext/wasm/tester1.c-pp.js f199ef496aec40a7ddedcc84f996117c911eac36d377913993d3f0261f9427ac -F ext/wasm/tests/opfs/concurrency/index.html 86d8ac435074d1e7007b91105f4897f368c165e8cecb6a9aa3d81f5cf5dcbe70 +F ext/wasm/tester1.c-pp.js 483fc1393bff4d06e696e6b72ebd1daedb71a46e81cd33d9ede9ca2b5fb76f68 +F ext/wasm/tests/opfs/concurrency/index.html 0802373d57034d51835ff6041cda438c7a982deea6079efd98098d3e42fbcbc1 F ext/wasm/tests/opfs/concurrency/test.js a98016113eaf71e81ddbf71655aa29b0fed9a8b79a3cdd3620d1658eb1cc9a5d F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd72273503ae7d5 @@ -2044,9 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P bd9613fd63193bd6b33798d83f0ef21987ba468b53d13a25a31cb9e9e5f20562 6a5c4f6b19aa0704efe7f789102f757a1ed05d6542f37c7aa37a4439783944a3 -R 7e285c57f9c962c0e3cd104712b20885 -T +closed 6a5c4f6b19aa0704efe7f789102f757a1ed05d6542f37c7aa37a4439783944a3 Closed\sby\sintegrate-merge. +P 24d3a53dea5e596230558e233cbbd9d0288b4c394cd5ea7b650fd99bff4cde2e +R 32ae67991ccd2fab1735177a69f90f3b U stephan -Z 04a00083266e19e010eadc8bb14898d9 +Z eea3cf1aefbfbb83af8cc08b772c2cf0 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9b1cb2f613..ccd158bf86 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -24d3a53dea5e596230558e233cbbd9d0288b4c394cd5ea7b650fd99bff4cde2e \ No newline at end of file +7b168ee2af09f04b41a6ef4c14ccaddc0c9b0bfe9dc1e6a86d8f5317606bd78d \ No newline at end of file From 919fe5bac6bf273d0b90332916521d25c6c07097 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 28 Jan 2023 09:11:08 +0000 Subject: [PATCH 14/65] Overhaul ext/wasm/GNUmakefile to consolidate what amounts to much copy/paste/slightly-edit duplication into a single function, called once per distinctive build mode (vanilla, ESM, bundler-friendly). FossilOrigin-Name: 168e5a93013d8650c180e19788e5f301b5d5ae8501d0ce728004fd750ca9e682 --- ext/wasm/GNUmakefile | 375 ++++++++++++++++++++----------------------- manifest | 12 +- manifest.uuid | 2 +- 3 files changed, 183 insertions(+), 206 deletions(-) diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index 78e34eb192..018d7edd53 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -249,21 +249,9 @@ $(2): $(1) $$(MAKEFILE) $$(bin.c-pp) $$(bin.c-pp) -f $(1) -o $$@ $(3) CLEAN_FILES += $(2) endef -c-pp.D.vanilla := -c-pp.D.esm := -Dtarget=es6-module -c-pp.D.bundler-friendly := $(c-pp.D.esm) -Dtarget=es6-bundler-friendly -# The various -D... values used by the sources include: -# -# -Dtarget=es6-module: intended for plain ESM module build. -# -# -Dtarget=es6-module -Dtarget=es6-bundler-friendly: intended for -# "bundler-friendly" ESM module build. These have some restrictions -# on how URL() objects are constructed in some contexts. -# # /end C-PP.FILTER ######################################################################## - # cflags.common = C compiler flags for all builds cflags.common := -I. -I.. -I$(dir.top) # emcc.WASM_BIGINT = 1 for BigInt (C int64) support, else 0. The API @@ -353,6 +341,27 @@ $(foreach X,$(SOAP.js) $(sqlite3-worker1.js) $(sqlite3-worker1-promiser.js),\ all quick: $(sqlite3-api.ext.jses) q: quick +######################################################################## +# $(sqlite3-api*.*js) contain the core library code but not the +# Emscripten-related glue which deals with loading sqlite3.wasm. In +# theory they can be used by arbitrary build environments and WASM +# loaders, but in practice that breaks down because the WASM loader +# has to be able to provide all of the necessary "imports" to +# sqlite3.wasm, and that list of imports is unknown until sqlite3.wasm +# is compiled, at which point Emscripten sets up the imports +# appropriately. Abstractly speaking, it's impossible for other build +# environments to know exactly which imports are needed and provide +# them. Tools like wasm-objdump can be used to find the list of +# imports but it's questionable whether a non-Emscripten tool could +# realistically use that info to provide proper implementations. +# Sidebar: some of the imports are used soley by the Emscripten glue, +# which the sqlite3 JS code does not rely on. +# +# We build $(sqlite3-api*.*) "because we can" and because it might be +# a useful point of experimentation for some clients, but the +# above-described caveat may well make them unusable for real-life +# clients. +# # sqlite3-api.js.in = the generated sqlite3-api.js before it gets # preprocessed. It contains all of $(sqlite3-api.jses) but none of the # Emscripten-specific headers and footers. @@ -365,150 +374,6 @@ $(sqlite3-api.js.in): $(sqlite3-api.jses) $(MAKEFILE) echo "/* END FILE: $$i */"; \ done > $@ -######################################################################## -# $(sqlite3-api.js) and $(sqlite3-api.mjs) (ES6 module) contain the -# core library code but not the Emscripten-related glue which deals -# with loading sqlite3.wasm. In theory they can be used by arbitrary -# build environments and WASM loaders, but in practice that breaks -# down because the WASM loader has to be able to provide all of the -# necessary "imports" to sqlite3.wasm, and that list of imports is -# unknown until sqlite3.wasm is compiled, at which point Emscripten -# sets up the imports appropriately. Abstractly speaking, it's -# impossible for other build environments to know exactly which -# imports are needed and provide them. Tools like wasm-objdump can be -# used to find the list of imports but it's questionable whether a -# non-Emscripten tool could realistically use that info to provide -# proper implementations. Sidebar: some of the imports are used soley -# by the Emscripten glue, which the sqlite3 JS code does not rely on. -# -# We build $(sqlite3-api.js) and $(sqlite3-api.mjs) "because we can" -# and because it might be a useful point of experimentation for some -# clients, but the above-described caveat may well make them unusable -# for real-life clients. -sqlite3-api.js := $(dir.dout)/sqlite3-api.js -sqlite3-api.mjs := $(dir.dout)/sqlite3-api.mjs -sqlite3-api-bundler-friendly.mjs := $(dir.dout)/sqlite3-api-bundler-friendly.mjs -$(eval $(call C-PP.FILTER, $(sqlite3-api.js.in), $(sqlite3-api.js))) -$(eval $(call C-PP.FILTER, $(sqlite3-api.js.in), $(sqlite3-api.mjs), $(c-pp.D.esm))) -$(eval $(call C-PP.FILTER, $(sqlite3-api.js.in), $(sqlite3-api-bundler-friendly.mjs), $(c-pp.D.bundler-friendly))) -all: $(sqlite3-api.js) $(sqlite3-api.mjs) $(sqlite3-api-bundler-friendly.mjs) - -$(sqlite3-api-build-version.js): $(bin.version-info) $(MAKEFILE) - @echo "Making $@..." - @{ \ - echo 'self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){'; \ - echo -n ' sqlite3.version = '; \ - $(bin.version-info) --json; \ - echo ';'; \ - echo '});'; \ - } > $@ -$(sqlite3-license-version.js): $(sqlite3.h) $(sqlite3-license-version-header.js) \ - $(MAKEFILE) - @echo "Making $@..."; { \ - cat $(sqlite3-license-version-header.js); \ - echo '/*'; \ - echo '** This code was built from sqlite3 version...'; \ - echo "**"; \ - awk -e '/define SQLITE_VERSION/{$$1=""; print "**" $$0}' \ - -e '/define SQLITE_SOURCE_ID/{$$1=""; print "**" $$0}' $(sqlite3.h); \ - echo '*/'; \ - } > $@ - -######################################################################## -# --post-js and --pre-js are emcc flags we use to append/prepend JS to -# the generated emscripten module file. The following rules generate -# various versions of those files for the vanilla and ESM builds. -pre-js.js.in := $(dir.api)/pre-js.c-pp.js -pre-js.js.vanilla := $(dir.tmp)/pre-js.vanilla.js -pre-js.js.esm := $(dir.tmp)/pre-js.esm.js -pre-js.js.bundler-friendly := $(dir.tmp)/pre-js.bundler-friendly.js -$(eval $(call C-PP.FILTER,$(pre-js.js.in),$(pre-js.js.vanilla),$(c-pp.D.vanilla))) -$(eval $(call C-PP.FILTER,$(pre-js.js.in),$(pre-js.js.esm),$(c-pp.D.esm))) -$(eval $(call C-PP.FILTER,$(pre-js.js.in),$(pre-js.js.bundler-friendly),$(c-pp.D.bundler-friendly))) -post-js.js.in := $(dir.tmp)/post-js.c-pp.js -post-js.js.vanilla := $(dir.tmp)/post-js.vanilla.js -post-js.js.esm := $(dir.tmp)/post-js.esm.js -post-js.js.bundler-friendly := $(dir.tmp)/post-js.bundler-friendly.js -post-jses.js := \ - $(dir.api)/post-js-header.js \ - $(sqlite3-api.js.in) \ - $(dir.api)/post-js-footer.js -$(post-js.js.in): $(post-jses.js) $(MAKEFILE) - @echo "Making $@..." - @for i in $(post-jses.js); do \ - echo "/* BEGIN FILE: $$i */"; \ - cat $$i; \ - echo "/* END FILE: $$i */"; \ - done > $@ -$(eval $(call C-PP.FILTER,$(post-js.js.in),$(post-js.js.vanilla),$(c-pp.D.vanilla))) -$(eval $(call C-PP.FILTER,$(post-js.js.in),$(post-js.js.esm),$(c-pp.D.esm))) -$(eval $(call C-PP.FILTER,$(post-js.js.in),$(post-js.js.bundler-friendly),$(c-pp.D.bundler-friendly))) - -# extern-post-js* and extern-pre-js* are files for use with -# Emscripten's --extern-pre-js and --extern-post-js flags. These -# rules make different copies for the vanilla and ESM builds. -extern-post-js.js.in := $(dir.api)/extern-post-js.c-pp.js -extern-post-js.js.vanilla := $(dir.tmp)/extern-post-js.vanilla.js -extern-post-js.js.esm := $(dir.tmp)/extern-post-js.esm.js -extern-post-js.js.bundler-friendly := $(dir.tmp)/extern-post-js.bundler-friendly.js -$(eval $(call C-PP.FILTER,$(extern-post-js.js.in),$(extern-post-js.js.vanilla),$(c-pp.D.vanilla))) -$(eval $(call C-PP.FILTER,$(extern-post-js.js.in),$(extern-post-js.js.esm),$(c-pp.D.esm))) -$(eval $(call C-PP.FILTER,$(extern-post-js.js.in),$(extern-post-js.js.bundler-friendly),$(c-pp.D.bundler-friendly))) -extern-pre-js.js := $(dir.api)/extern-pre-js.js - -# Emscripten flags for --[extern-][pre|post]-js=... for the -# various builds. -pre-post-common.flags := \ - --extern-pre-js=$(sqlite3-license-version.js) -pre-post-common.flags.vanilla := \ - $(pre-post-common.flags) \ - --post-js=$(post-js.js.vanilla) \ - --extern-post-js=$(extern-post-js.js.vanilla) -pre-post-common.flags.esm := \ - $(pre-post-common.flags) \ - --post-js=$(post-js.js.esm) \ - --extern-post-js=$(extern-post-js.js.esm) -pre-post-common.flags.bundler-friendly := \ - $(pre-post-common.flags) \ - --post-js=$(post-js.js.bundler-friendly) \ - --extern-post-js=$(extern-post-js.js.bundler-friendly) - -# pre-post-jses.deps.* = a list of dependencies for the -# --[extern-][pre/post]-js files. -pre-post-jses.deps.common := $(extern-pre-js.js) $(sqlite3-license-version.js) -pre-post-jses.deps.vanilla := $(pre-post-jses.deps.common) \ - $(post-js.js.vanilla) $(extern-post-js.js.vanilla) -pre-post-jses.deps.esm := $(pre-post-jses.deps.common) \ - $(post-js.js.esm) $(extern-post-js.js.esm) -pre-post-jses.deps.bundler-friendly := $(pre-post-jses.deps.common) \ - $(post-js.js.bundler-friendly) $(extern-post-js.js.bundler-friendly) - -######################################################################## -# call-make-pre-js is a $(call)able which creates rules for -# pre-js-$(1).js. $1 = the base name of the JS file on whose behalf -# this pre-js is for (one of: sqlite3, sqlite3-wasm). $2 is the build -# mode: one of (vanilla, esm, bundler-friendly). This sets up -# --[extern-][pre/post]-js flags in $(pre-post-$(1).flags.$(2)) and -# dependencies in $(pre-post-$(1).deps.$(2)). -define call-make-pre-js -pre-post-$(1).flags.$(2) ?= -$$(dir.tmp)/pre-js-$(1)-$(2).js: $$(pre-js.js.$(2)) $$(MAKEFILE) - cp $$(pre-js.js.$(2)) $$@ - @if [ sqlite3-wasmfs = $(1) ]; then \ - echo "delete Module[xNameOfInstantiateWasm] /*for WASMFS build*/;"; \ - elif [ sqlite3 != $(1) ]; then \ - echo "Module[xNameOfInstantiateWasm].uri = '$(1).wasm';"; \ - fi >> $$@ -pre-post-$(1).deps.$(2) := \ - $$(pre-post-jses.deps.$(2)) \ - $$(dir.tmp)/pre-js-$(1)-$(2).js -pre-post-$(1).flags.$(2) += \ - $$(pre-post-common.flags.$(2)) \ - --pre-js=$$(dir.tmp)/pre-js-$(1)-$(2).js -endef -# /post-js and pre-js -######################################################################## - ######################################################################## # emcc flags for .c/.o/.wasm/.js. emcc.flags := @@ -632,7 +497,6 @@ emcc.jsflags += -sLLD_REPORT_UNDEFINED # such constructs are found all over the place in the source code. ######################################################################## - ######################################################################## # -sSINGLE_FILE: # https://github.com/emscripten-core/emscripten/blob/main/src/settings.js @@ -644,9 +508,74 @@ emcc.jsflags += -sLLD_REPORT_UNDEFINED # -g3 debugging info, _huge_. ######################################################################## -sqlite3.js := $(dir.dout)/sqlite3.js -sqlite3.mjs := $(dir.dout)/sqlite3.mjs -sqlite3-bundler-friendly.mjs := $(dir.dout)/sqlite3-bundler-friendly.mjs +$(sqlite3-api-build-version.js): $(bin.version-info) $(MAKEFILE) + @echo "Making $@..." + @{ \ + echo 'self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){'; \ + echo -n ' sqlite3.version = '; \ + $(bin.version-info) --json; \ + echo ';'; \ + echo '});'; \ + } > $@ +$(sqlite3-license-version.js): $(sqlite3.h) $(sqlite3-license-version-header.js) \ + $(MAKEFILE) + @echo "Making $@..."; { \ + cat $(sqlite3-license-version-header.js); \ + echo '/*'; \ + echo '** This code was built from sqlite3 version...'; \ + echo "**"; \ + awk -e '/define SQLITE_VERSION/{$$1=""; print "**" $$0}' \ + -e '/define SQLITE_SOURCE_ID/{$$1=""; print "**" $$0}' $(sqlite3.h); \ + echo "**"; \ + echo "** Using the Emscripten SDK version $(emcc.version)."; \ + echo '*/'; \ + } > $@ + +######################################################################## +# --post-js and --pre-js are emcc flags we use to append/prepend JS to +# the generated emscripten module file. These rules set up the core +# pre/post files for use by the various builds. +pre-js.js.in := $(dir.api)/pre-js.c-pp.js +post-js.js.in := $(dir.tmp)/post-js.c-pp.js +post-jses.js := \ + $(dir.api)/post-js-header.js \ + $(sqlite3-api.js.in) \ + $(dir.api)/post-js-footer.js +$(post-js.js.in): $(post-jses.js) $(MAKEFILE) + @echo "Making $@..." + @for i in $(post-jses.js); do \ + echo "/* BEGIN FILE: $$i */"; \ + cat $$i; \ + echo "/* END FILE: $$i */"; \ + done > $@ + + +######################################################################## +# call-make-pre-post is a $(call)able which creates rules for +# pre-js-$(1).js. $1 = the base name of the JS file on whose behalf +# this pre-js is for (one of: sqlite3, sqlite3-wasmfs). $2 is the build +# mode: one of (vanilla, esm, bundler-friendly). This sets up +# --[extern-][pre/post]-js flags in $(pre-post-$(1).flags.$(2)) and +# dependencies in $(pre-post-$(1).deps.$(2)). +define call-make-pre-post +pre-post-$(1).flags.$(2) ?= +$$(dir.tmp)/pre-js-$(1)-$(2).js: $$(pre-js.js.$(2)) $$(MAKEFILE) + cp $$(pre-js.js.$(2)) $$@ + @if [ sqlite3-wasmfs = $(1) ]; then \ + echo "delete Module[xNameOfInstantiateWasm] /*for WASMFS build*/;"; \ + elif [ sqlite3 != $(1) ]; then \ + echo "Module[xNameOfInstantiateWasm].uri = '$(1).wasm';"; \ + fi >> $$@ +pre-post-$(1).deps.$(2) := \ + $$(pre-post-jses.deps.$(2)) \ + $$(dir.tmp)/pre-js-$(1)-$(2).js +pre-post-$(1).flags.$(2) += \ + $$(pre-post-common.flags.$(2)) \ + --pre-js=$$(dir.tmp)/pre-js-$(1)-$(2).js +endef +# /post-js and pre-js +######################################################################## + # Undocumented Emscripten feature: if the target file extension is # "mjs", it defaults to ES6 module builds: # https://github.com/emscripten-core/emscripten/issues/14383 @@ -657,14 +586,6 @@ sqlite3-wasm.c := $(dir.api)/sqlite3-wasm.c # enough to the target speed requirements that the 500ms makes a # difference. Thus we build all binaries against sqlite3-wasm.c # instead of building a shared copy of sqlite3-wasm.o. -$(eval $(call call-make-pre-js,sqlite3,vanilla)) -$(eval $(call call-make-pre-js,sqlite3,esm)) -$(eval $(call call-make-pre-js,sqlite3,bundler-friendly)) -$(sqlite3.js) $(sqlite3.mjs) $(sqlite3-bundler-friendly.mjs): \ - $(MAKEFILE) $(sqlite3-wasm.c) $(EXPORTED_FUNCTIONS.api) -$(sqlite3.js): $(pre-post-sqlite3.deps.vanilla) -$(sqlite3.mjs): $(pre-post-sqlite3.deps.esm) -$(sqlite3-bundler-friendly.mjs): $(pre-post-sqlite3.deps.bundler-friendly) ######################################################################## # SQLITE3.xJS.RECIPE = the $(call)able recipe body for $(sqlite3.js) # and $(sqlite3.mjs). $1 = one of (vanilla, esm). $2 must be 1 for @@ -697,31 +618,94 @@ if [ x1 = x$(1) ]; then \ fi; \ fi endef -define SQLITE3.xJS.RECIPE - @echo "Building $@ ..." - $(emcc.bin) -o $@ $(emcc_opt_full) $(emcc.flags) \ - $(emcc.jsflags) \ - $(pre-post-sqlite3.flags.$(1)) $(emcc.flags.sqlite3.$(1)) \ - $(cflags.common) $(SQLITE_OPT) $(sqlite3-wasm.c) - @$(call SQLITE3.xJS.ESM-EXPORT-DEFAULT,$(2)) + +# extern-post-js* and extern-pre-js* are files for use with +# Emscripten's --extern-pre-js and --extern-post-js flags. +extern-pre-js.js := $(dir.api)/extern-pre-js.js +extern-post-js.js.in := $(dir.api)/extern-post-js.c-pp.js +# Emscripten flags for --[extern-][pre|post]-js=... for the +# various builds. +pre-post-common.flags := \ + --extern-pre-js=$(sqlite3-license-version.js) +# pre-post-jses.deps.* = a list of dependencies for the +# --[extern-][pre/post]-js files. +pre-post-jses.deps.common := $(extern-pre-js.js) $(sqlite3-license-version.js) +######################################################################## +# SETUP_LIB_BUILD_MODE is a $(call)'able which sets up numerous pieces +# for one of the build modes (vanilla, esm, bundler-friendly). +# +# $1 = build mode name +# $2 = 1 for ESM build mode, else 0 +# $3 = resulting sqlite-api JS/MJS file +# $4 = resulting JS/MJS file +# $5 = -D... flags for $(bin.c-pp) +# $6 = emcc -sXYZ flags +define SETUP_LIB_BUILD_MODE +$(info Setting up build [$(1)]: $(4)) +c-pp.D.$(1) := $(5) +pre-js.js.$(1) := $$(dir.api)/pre-js.$(1).js +$$(eval $$(call C-PP.FILTER,$$(pre-js.js.in),$$(pre-js.js.$(1)),$$(c-pp.D.$(1)))) +post-js.js.$(1) := $$(dir.tmp)/post-js.$(1).js +$$(eval $$(call C-PP.FILTER,$$(post-js.js.in),$$(post-js.js.$(1)),$$(c-pp.D.$(1)))) +extern-post-js.js.$(1) := $$(dir.tmp)/extern-post-js.$(1).js +$$(eval $$(call C-PP.FILTER,$$(extern-post-js.js.in),$$(extern-post-js.js.$(1)),$$(c-pp.D.$(1)))) +pre-post-common.flags.$(1) := \ + $$(pre-post-common.flags) \ + --post-js=$$(post-js.js.$(1)) \ + --extern-post-js=$$(extern-post-js.js.$(1)) +pre-post-jses.deps.$(1) := $$(pre-post-jses.deps.common) \ + $$(post-js.js.$(1)) $$(extern-post-js.js.$(1)) +$$(eval $$(call call-make-pre-post,sqlite3,$(1))) +emcc.flags.sqlite3.$(1) := $(6) +$$(eval $$(call C-PP.FILTER, $$(sqlite3-api.js.in), $(3), $(5))) +$(4): $(3) +$(4): $(3) $$(MAKEFILE) $$(sqlite3-wasm.c) $$(EXPORTED_FUNCTIONS.api) $$(pre-post-sqlite3.deps.$(1)) + @echo "Building $$@ ..." + $$(emcc.bin) -o $$@ $$(emcc_opt_full) $$(emcc.flags) \ + $$(emcc.jsflags) \ + $$(pre-post-sqlite3.flags.$(1)) $$(emcc.flags.sqlite3.$(1)) \ + $$(cflags.common) $$(SQLITE_OPT) $$(sqlite3-wasm.c) + @$$(call SQLITE3.xJS.ESM-EXPORT-DEFAULT,$(2)) @if [ bundler-friendly = $(1) ]; then \ - echo "Patching sqlite3-bundler-friendly.js for sqlite3.wasm..."; \ - rm -f $(dir.dout)/sqlite3-bundler-friendly.wasm; \ - sed -i -e 's/sqlite3-bundler-friendly.wasm/sqlite3.wasm/g' $@ || exit $$?; \ + echo "Patching $(3) for sqlite3.wasm..."; \ + rm -f $$(dir.dout)/sqlite3-bundler-friendly.wasm; \ + sed -i -e 's/sqlite3-bundler-friendly.wasm/sqlite3.wasm/g' $$@ || exit $$$$?; \ fi - chmod -x $(sqlite3.wasm) - $(maybe-wasm-strip) $(sqlite3.wasm) - @ls -la $@ $(sqlite3.wasm) + chmod -x $$(sqlite3.wasm) + $$(maybe-wasm-strip) $$(sqlite3.wasm) + @ls -la $@ $$(sqlite3.wasm) +all: $(4) +quick: $(4) +CLEAN_FILES += $(3) $(4) endef -emcc.flags.sqlite3.vanilla := -emcc.flags.sqlite3.esm := -sEXPORT_ES6 -sUSE_ES6_IMPORT_META -emcc.flags.sqlite3.bundler-friendly := $(emcc.flags.sqlite3.esm) -$(sqlite3.js): - $(call SQLITE3.xJS.RECIPE,vanilla,0) -$(sqlite3.mjs): - $(call SQLITE3.xJS.RECIPE,esm,1) -$(sqlite3-bundler-friendly.mjs): - $(call SQLITE3.xJS.RECIPE,bundler-friendly,1) +# ^^^ /SETUP_LIB_BUILD_MODE +######################################################################## +sqlite3-api.js := $(dir.dout)/sqlite3-api.js +sqlite3.js := $(dir.dout)/sqlite3.js +sqlite3-api.mjs := $(dir.dout)/sqlite3-api.mjs +sqlite3.mjs := $(dir.dout)/sqlite3.mjs +sqlite3-api-bundler-friendly.mjs := $(dir.dout)/sqlite3-api-bundler-friendly.mjs +sqlite3-bundler-friendly.mjs := $(dir.dout)/sqlite3-bundler-friendly.mjs +# Maintenance reminder: careful not to introduce spaces around args $1, $2 +#$(info $(call SETUP_LIB_BUILD_MODE,vanilla,0, $(sqlite3-api.js), $(sqlite3.js))) +$(eval $(call SETUP_LIB_BUILD_MODE,vanilla,0, $(sqlite3-api.js), $(sqlite3.js))) +$(eval $(call SETUP_LIB_BUILD_MODE,esm,1, $(sqlite3-api.mjs), $(sqlite3.mjs), \ + -Dtarget=es6-module, -sEXPORT_ES6 -sUSE_ES6_IMPORT_META)) +$(eval $(call SETUP_LIB_BUILD_MODE,bundler-friendly,1,\ + $(sqlite3-api-bundler-friendly.mjs),$(sqlite3-bundler-friendly.mjs),\ + $(c-pp.D.esm) -Dtarget=es6-bundler-friendly, $(emcc.flags.sqlite3.esm))) +# The various -D... values used by *.c-pp.js include: +# +# -Dtarget=es6-module: for all ESM module builds +# +# -Dtarget=es6-module -Dtarget=es6-bundler-friendly: intended for +# "bundler-friendly" ESM module build. These have some restrictions +# on how URL() objects are constructed in some contexts: URLs which +# refer to files which are part of this project must be references +# as string literals so that bundlers' static-analysis tools can +# find those files and include them in their bundles. +# +######################################################################## ######################################################################## # We have to ensure that we do not build both $(sqlite3.js) and # $(sqlite3.mjs) in parallel because both result in the creation of @@ -734,14 +718,7 @@ $(sqlite3.mjs): $(sqlite3.js) $(sqlite3-bundler-friendly.mjs): $(sqlite3.mjs) # maintenance reminder: the deps on ^^^ must all be such that they are # never built in parallel. -CLEAN_FILES += $(sqlite3.js) $(sqlite3.mjs) $(sqlite3-bundler-friendly.mjs) \ - $(sqlite3.wasm) -all: $(sqlite3.js) $(sqlite3.mjs) $(sqlite3-bundler-friendly.mjs) -quick: $(sqlite3.js) -quick: $(sqlite3.mjs) # for the sake of the snapshot build -quick: $(sqlite3-bundler-friendly.mjs) # for the sake of the snapshot build -# End main $(sqlite3.js) build -######################################################################## +CLEAN_FILES += $(sqlite3.wasm) ######################################################################## # batch-runner.js is part of one of the test apps which reads in SQL @@ -818,7 +795,7 @@ speedtest1.js := $(dir.dout)/speedtest1.js speedtest1.wasm := $(dir.dout)/speedtest1.wasm cflags.speedtest1 := $(cflags.common) -DSQLITE_SPEEDTEST1_WASM speedtest1.cses := $(speedtest1.c) $(sqlite3-wasm.c) -$(eval $(call call-make-pre-js,speedtest1,vanilla)) +$(eval $(call call-make-pre-post,speedtest1,vanilla)) $(speedtest1.js): $(MAKEFILE) $(speedtest1.cses) \ $(pre-post-speedtest1.deps.vanilla) \ $(EXPORTED_FUNCTIONS.speedtest1) diff --git a/manifest b/manifest index dba0c8dd58..723b0f765d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhance\soo1.DB.exec()\sto\ssimplify\sreturning\swhole\sresult\ssets. -D 2023-01-28T05:09:26.765 +C Overhaul\sext/wasm/GNUmakefile\sto\sconsolidate\swhat\samounts\sto\smuch\scopy/paste/slightly-edit\sduplication\sinto\sa\ssingle\sfunction,\scalled\sonce\sper\sdistinctive\sbuild\smode\s(vanilla,\sESM,\sbundler-friendly). +D 2023-01-28T09:11:08.421 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -466,7 +466,7 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c -F ext/wasm/GNUmakefile 8d82b51a23f9c84c770abd72f18d95a95044a03a216e0246ebd1b3668619c77e +F ext/wasm/GNUmakefile a32c527fb162489266c11cfbb3f0d02e9140c3e88ce884cdc1a8a79477b3cf06 F ext/wasm/README-dist.txt 4a1db3677d0341a12434d1fd6c97aae2f96785d734641407a201b719f5d94f44 F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9 F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab @@ -2044,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 24d3a53dea5e596230558e233cbbd9d0288b4c394cd5ea7b650fd99bff4cde2e -R 32ae67991ccd2fab1735177a69f90f3b +P 7b168ee2af09f04b41a6ef4c14ccaddc0c9b0bfe9dc1e6a86d8f5317606bd78d +R 89098a85baa5f167018e750de6e19924 U stephan -Z eea3cf1aefbfbb83af8cc08b772c2cf0 +Z 698b42e1629b67c07c9d270103d0775e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index ccd158bf86..a7acc799ab 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7b168ee2af09f04b41a6ef4c14ccaddc0c9b0bfe9dc1e6a86d8f5317606bd78d \ No newline at end of file +168e5a93013d8650c180e19788e5f301b5d5ae8501d0ce728004fd750ca9e682 \ No newline at end of file From c7170350d7f7c04ec520c5fdbafeabb9eeae7cd7 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 28 Jan 2023 09:51:41 +0000 Subject: [PATCH 15/65] Makefile doc touchups - no code/build changes. FossilOrigin-Name: 3458a481b9ee391122dba531358d664d5219ce4a58cbce93d07df57cc64dc2c7 --- ext/wasm/GNUmakefile | 34 ++++++++++++++-------------------- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 21 insertions(+), 27 deletions(-) diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index 018d7edd53..92173e79f1 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -582,14 +582,15 @@ endef sqlite3.wasm := $(dir.dout)/sqlite3.wasm sqlite3-wasm.c := $(dir.api)/sqlite3-wasm.c # sqlite3-wasm.o vs sqlite3-wasm.c: building against the latter -# (predictably) results in a slightly faster binary, but we're close +# (predictably) results in a slightly faster binary. We're close # enough to the target speed requirements that the 500ms makes a -# difference. Thus we build all binaries against sqlite3-wasm.c -# instead of building a shared copy of sqlite3-wasm.o. +# difference, so we build all binaries against sqlite3-wasm.c instead +# of building a shared copy of sqlite3-wasm.o to link against. ######################################################################## -# SQLITE3.xJS.RECIPE = the $(call)able recipe body for $(sqlite3.js) -# and $(sqlite3.mjs). $1 = one of (vanilla, esm). $2 must be 1 for -# ES6-style builds, 0 for other builds. +# SQLITE3.xJS.EXPORT-DEFAULT is part of SQLITE3-WASMFS.xJS.RECIPE and +# SETUP_LIB_BUILD_MODE, factored into a separate piece to avoid code +# duplication. $1 is 1 if the build mode needs this workaround (esm, +# bundler-friendly) and 0 if not (vanilla). # # Reminder for ESM builds: even if we use -sEXPORT_ES6=0, emcc _still_ # adds: @@ -603,11 +604,6 @@ sqlite3-wasm.c := $(dir.api)/sqlite3-wasm.c # # Upstream RFE: # https://github.com/emscripten-core/emscripten/issues/18237 -######################################################################## -# SQLITE3.xJS.EXPORT-DEFAULT is part of SQLITE3[-WASMFS].xJS.RECIPE, -# factored into a separate piece to avoid code duplication. $1 is 1 if -# the build mode needs this workaround (esm, bundler-friendly) and 0 -# if not (vanilla). define SQLITE3.xJS.ESM-EXPORT-DEFAULT if [ x1 = x$(1) ]; then \ echo "Fragile workaround for an Emscripten annoyance. See SQLITE3.xJS.RECIPE."; \ @@ -707,17 +703,16 @@ $(eval $(call SETUP_LIB_BUILD_MODE,bundler-friendly,1,\ # ######################################################################## ######################################################################## -# We have to ensure that we do not build both $(sqlite3.js) and -# $(sqlite3.mjs) in parallel because both result in the creation of -# $(sqlite3.wasm). We have no(?) way to build just the .mjs file -# without also building the .wasm file. i.e. we're building -# $(sqlite3.wasm) multiple times, but that's apparently unavoidable -# (and harmless, just a waste of build time). +# We have to ensure that we do not build both $(sqlite3*.*js) in +# parallel because both result in the creation of $(sqlite3.wasm). We +# have no way to build just the .mjs file without also building the +# .wasm file because the generated .mjs 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). $(sqlite3.wasm): $(sqlite3.js) $(sqlite3.mjs): $(sqlite3.js) $(sqlite3-bundler-friendly.mjs): $(sqlite3.mjs) -# maintenance reminder: the deps on ^^^ must all be such that they are -# never built in parallel. CLEAN_FILES += $(sqlite3.wasm) ######################################################################## @@ -755,7 +750,6 @@ emcc.speedtest1 += -sALLOW_MEMORY_GROWTH emcc.speedtest1 += -sINITIAL_MEMORY=$(emcc.INITIAL_MEMORY.$(emcc.INITIAL_MEMORY)) emcc.speedtest1.common += -sINVOKE_RUN=0 emcc.speedtest1.common += --no-entry -#emcc.speedtest1.common += -flto emcc.speedtest1.common += -sABORTING_MALLOC emcc.speedtest1.common += -sSTRICT_JS emcc.speedtest1.common += -sMODULARIZE diff --git a/manifest b/manifest index 723b0f765d..2da9056d6d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Overhaul\sext/wasm/GNUmakefile\sto\sconsolidate\swhat\samounts\sto\smuch\scopy/paste/slightly-edit\sduplication\sinto\sa\ssingle\sfunction,\scalled\sonce\sper\sdistinctive\sbuild\smode\s(vanilla,\sESM,\sbundler-friendly). -D 2023-01-28T09:11:08.421 +C Makefile\sdoc\stouchups\s-\sno\scode/build\schanges. +D 2023-01-28T09:51:41.063 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -466,7 +466,7 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c -F ext/wasm/GNUmakefile a32c527fb162489266c11cfbb3f0d02e9140c3e88ce884cdc1a8a79477b3cf06 +F ext/wasm/GNUmakefile 6fee35e99b82c948a1a4675bb4d1d037800c2171274bd8ab3779fac53aca6d1a F ext/wasm/README-dist.txt 4a1db3677d0341a12434d1fd6c97aae2f96785d734641407a201b719f5d94f44 F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9 F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab @@ -2044,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 7b168ee2af09f04b41a6ef4c14ccaddc0c9b0bfe9dc1e6a86d8f5317606bd78d -R 89098a85baa5f167018e750de6e19924 +P 168e5a93013d8650c180e19788e5f301b5d5ae8501d0ce728004fd750ca9e682 +R 63fed4ef637e391371d6a01d8747792f U stephan -Z 698b42e1629b67c07c9d270103d0775e +Z ef029a1e60dbc16f9c5e60c686e321d3 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index a7acc799ab..499905f2a1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -168e5a93013d8650c180e19788e5f301b5d5ae8501d0ce728004fd750ca9e682 \ No newline at end of file +3458a481b9ee391122dba531358d664d5219ce4a58cbce93d07df57cc64dc2c7 \ No newline at end of file From 54c9250b09c18507b0a169200219b2d351f6865f Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 28 Jan 2023 16:37:30 +0000 Subject: [PATCH 16/65] Update sqllimits1.test to account for the fact that if an odd value is specified as the length in bytes of a utf-16 string, it is truncated to the largest smaller even number. FossilOrigin-Name: 74508470c4caff04638e750cd84073f3137b8a9f72c6fe390a279da7b1c13398 --- manifest | 14 ++++++------ manifest.uuid | 2 +- test/sqllimits1.test | 54 +++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 61 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 2da9056d6d..2df45c6199 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Makefile\sdoc\stouchups\s-\sno\scode/build\schanges. -D 2023-01-28T09:51:41.063 +C Update\ssqllimits1.test\sto\saccount\sfor\sthe\sfact\sthat\sif\san\sodd\svalue\sis\sspecified\sas\sthe\slength\sin\sbytes\sof\sa\sutf-16\sstring,\sit\sis\struncated\sto\sthe\slargest\ssmaller\seven\snumber. +D 2023-01-28T16:37:30.454 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -1524,7 +1524,7 @@ F test/spellfix2.test dfc8f519a3fc204cb2dfa8b4f29821ae90f6f8c3 F test/spellfix3.test 0f9efaaa502a0e0a09848028518a6fb096c8ad33 F test/spellfix4.test 51c7c26514ade169855c66bcf130bd5acfb4d7fd090cc624645ab275ae6a41fb F test/sqldiff1.test 182058e09c7082de5c6a470ff9c291337bbeb650052c2cc68fbb3d7e25861d91 -F test/sqllimits1.test 69d110987dbdb4bea9dbc3f151c93b4697ae6cd7e6c3a519119dc1140c8607fd +F test/sqllimits1.test b28e5cc8d337aaf290614d96a47e8fbfb720bb7ad35620c9d5432996fd413ac4 F test/sqllog.test 6af6cb0b09f4e44e1917e06ce85be7670302517a F test/startup.c 1beb5ca66fcc0fce95c3444db9d1674f90fc605499a574ae2434dcfc10d22805 F test/stat.test 123212a20ceb496893d5254a5f6c76442ce549fdc08d1702d8288a2bbaac8408 @@ -2044,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 168e5a93013d8650c180e19788e5f301b5d5ae8501d0ce728004fd750ca9e682 -R 63fed4ef637e391371d6a01d8747792f -U stephan -Z ef029a1e60dbc16f9c5e60c686e321d3 +P 3458a481b9ee391122dba531358d664d5219ce4a58cbce93d07df57cc64dc2c7 +R df4d514a8cefe2ba4ba7ec67cb263215 +U dan +Z 6dd497de705b6f37d14013dd4a408f6f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 499905f2a1..36a4397e7f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3458a481b9ee391122dba531358d664d5219ce4a58cbce93d07df57cc64dc2c7 \ No newline at end of file +74508470c4caff04638e750cd84073f3137b8a9f72c6fe390a279da7b1c13398 \ No newline at end of file diff --git a/test/sqllimits1.test b/test/sqllimits1.test index 1c3f66b7fa..f16208f234 100644 --- a/test/sqllimits1.test +++ b/test/sqllimits1.test @@ -16,6 +16,7 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl +set testprefix sqllimits1 # Verify that the default per-connection limits are the same as # the compile-time hard limits. @@ -347,7 +348,7 @@ do_test sqllimits1-5.14.6 { } {SQLITE_TOOBIG} ifcapable utf16 { do_test sqllimits1-5.14.7 { - catch {sqlite3_bind_text16 $::STMT 1 $::str1 $np1} res + catch {sqlite3_bind_text16 $::STMT 1 $::str1 [expr $np1+1]} res set res } {SQLITE_TOOBIG} } @@ -923,4 +924,55 @@ do_catchsql_test sqllimits1-18.2 { UNION VALUES(11); } {1 {too many terms in compound SELECT}} +#------------------------------------------------------------------------- +# +reset_db +ifcapable utf16 { + do_execsql_test 19.0 { + PRAGMA encoding = 'utf16'; + } + set bigstr [string repeat abcdefghij 5000] + set bigstr16 [encoding convertto unicode $bigstr] + + do_test 19.1 { + string length $bigstr16 + } {100000} + + do_test 19.2 { + set ::stmt [sqlite3_prepare db "SELECT length( ? )" -1 TAIL] + sqlite3_bind_text16 $::stmt 1 $bigstr16 100000 + sqlite3_step $::stmt + set val [sqlite3_column_int $::stmt 0] + sqlite3_finalize $::stmt + set val + } {50000} + + sqlite3_limit db SQLITE_LIMIT_LENGTH 100000 + + do_test 19.3 { + set ::stmt [sqlite3_prepare db "SELECT length( ? )" -1 TAIL] + sqlite3_bind_text16 $::stmt 1 $bigstr16 100000 + sqlite3_step $::stmt + set val [sqlite3_column_int $::stmt 0] + sqlite3_finalize $::stmt + set val + } {50000} + + sqlite3_limit db SQLITE_LIMIT_LENGTH 99999 + + do_test 19.4 { + set ::stmt [sqlite3_prepare db "SELECT length( ? )" -1 TAIL] + list [catch { sqlite3_bind_text16 $::stmt 1 $bigstr16 100000 } msg] $msg + } {1 SQLITE_TOOBIG} + sqlite3_finalize $::stmt + + sqlite3_limit db SQLITE_LIMIT_LENGTH 100000 + + do_test 19.5 { + set ::stmt [sqlite3_prepare db "SELECT length( ? )" -1 TAIL] + list [catch { sqlite3_bind_text16 $::stmt 1 $bigstr16 100002 } msg] $msg + } {1 SQLITE_TOOBIG} + sqlite3_finalize $::stmt +} + finish_test From 20438431c88c2852a501765c7dbb57c3fc5f45ed Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 28 Jan 2023 17:37:37 +0000 Subject: [PATCH 17/65] Fix a problem causing "PRAGMA quick_check" to return spurious corruption errors for a WITHOUT ROWID for which all columns are either virtual or part of the primary key, and for which the order of the columns in the primary key definition is different from the order in the table. FossilOrigin-Name: a7530f897127f35a212db6557edbcbbb286cc0e094754c1c1b74ce8dbf724470 --- manifest | 13 +++++++------ manifest.uuid | 2 +- src/pragma.c | 19 ++++++++++++++----- test/quickcheck.test | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 12 deletions(-) create mode 100644 test/quickcheck.test diff --git a/manifest b/manifest index 2df45c6199..4d88d8d4a4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\ssqllimits1.test\sto\saccount\sfor\sthe\sfact\sthat\sif\san\sodd\svalue\sis\sspecified\sas\sthe\slength\sin\sbytes\sof\sa\sutf-16\sstring,\sit\sis\struncated\sto\sthe\slargest\ssmaller\seven\snumber. -D 2023-01-28T16:37:30.454 +C Fix\sa\sproblem\scausing\s"PRAGMA\squick_check"\sto\sreturn\sspurious\scorruption\serrors\sfor\sa\sWITHOUT\sROWID\sfor\swhich\sall\scolumns\sare\seither\svirtual\sor\spart\sof\sthe\sprimary\skey,\sand\sfor\swhich\sthe\sorder\sof\sthe\scolumns\sin\sthe\sprimary\skey\sdefinition\sis\sdifferent\sfrom\sthe\sorder\sin\sthe\stable. +D 2023-01-28T17:37:37.660 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -613,7 +613,7 @@ F src/parse.y 8e67d820030d2655b9942ffe61c1e7e6b96cea2f2f72183533299393907d0564 F src/pcache.c f4268f7f73c6a3db12ce22fd25bc68dc42315d19599414ab1207d7cf32f79197 F src/pcache.h 4f87acd914cef5016fae3030343540d75f5b85a1877eed1a2a19b9f284248586 F src/pcache1.c dee95e3cd2b61e6512dc814c5ab76d5eb36f0bfc9441dbb4260fccc0d12bbddc -F src/pragma.c 23e74aaa441a03e6d97098db5883f53ee50cc50d294ecefb916437b8484012b3 +F src/pragma.c 82d5090a35eac75876d3b41f48d06b2370553c9576bf2942233c462e03eb94c9 F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7 F src/prepare.c ce87a08cfddd45a147150db34190b1986f2d4a0e0828858cb6bd908c78fb02e3 F src/printf.c ff4b05e38bf928ff1b80d3dda4f977b10fe39ecbfe69c018224c7e5594fb2455 @@ -1388,6 +1388,7 @@ F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc F test/pushdown.test f270b8071c02efc218430e0d388c155e1962eaa1d3a3ab186dd38ad6d7e178a4 F test/queryonly.test 5f653159e0f552f0552d43259890c1089391dcca F test/quick.test 1681febc928d686362d50057c642f77a02c62e57 +F test/quickcheck.test f86b25b33455af0189b4d3fe7bd6e553115e80b2d7ec9bbe9a6b37fce0881bfe F test/quota-glob.test 32901e9eed6705d68ca3faee2a06b73b57cb3c26 F test/quota.test bfb269ce81ea52f593f9648316cd5013d766dd2a F test/quota2.test 7dc12e08b11cbc4c16c9ba2aa2e040ea8d8ab4b8 @@ -2044,8 +2045,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3458a481b9ee391122dba531358d664d5219ce4a58cbce93d07df57cc64dc2c7 -R df4d514a8cefe2ba4ba7ec67cb263215 +P 74508470c4caff04638e750cd84073f3137b8a9f72c6fe390a279da7b1c13398 +R bd3038bc22be97846ba0cea160d15dc3 U dan -Z 6dd497de705b6f37d14013dd4a408f6f +Z be0e76aa8633e358a87d4d35c141ada3 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 36a4397e7f..ee3c2b5a3e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -74508470c4caff04638e750cd84073f3137b8a9f72c6fe390a279da7b1c13398 \ No newline at end of file +a7530f897127f35a212db6557edbcbbb286cc0e094754c1c1b74ce8dbf724470 \ No newline at end of file diff --git a/src/pragma.c b/src/pragma.c index 527b2a734c..522a12d331 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -1785,12 +1785,21 @@ void sqlite3Pragma( ** will also prepopulate the cursor column cache that is used ** by the OP_IsType code, so it is a required step. */ - mxCol = pTab->nCol-1; - while( mxCol>=0 - && ((pTab->aCol[mxCol].colFlags & COLFLAG_VIRTUAL)!=0 - || pTab->iPKey==mxCol) ) mxCol--; + assert( !IsVirtual(pTab) ); + if( HasRowid(pTab) ){ + mxCol = -1; + for(j=0; jnCol; j++){ + if( (pTab->aCol[j].colFlags & COLFLAG_VIRTUAL)==0 ) mxCol++; + } + if( mxCol==pTab->iPKey ) mxCol--; + }else{ + /* COLFLAG_VIRTUAL columns are not included in the WITHOUT ROWID + ** PK index column-count, so there is no need to account for them + ** in this case. */ + mxCol = sqlite3PrimaryKeyIndex(pTab)->nColumn-1; + } if( mxCol>=0 ){ - sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, mxCol, 3); + sqlite3VdbeAddOp3(v, OP_Column, iDataCur, mxCol, 3); sqlite3VdbeTypeofColumn(v, 3); } diff --git a/test/quickcheck.test b/test/quickcheck.test new file mode 100644 index 0000000000..94016e845f --- /dev/null +++ b/test/quickcheck.test @@ -0,0 +1,34 @@ +# 2023 January 28 +# +# 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. +# +#*********************************************************************** +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl +set testprefix quickcheck + +do_execsql_test 1.0 { + CREATE TABLE t1( + a INTEGER NOT NULL, b INTEGER NOT NULL, c AS (a+1), + PRIMARY KEY(b, a) + ) WITHOUT ROWID; + + INSERT INTO t1 VALUES(1, 2); + INSERT INTO t1 VALUES(3, 4); +} + +do_execsql_test 1.1 { + PRAGMA quick_check +} { + ok +} + +finish_test + From 8cc8d36e4cd9b7a437b42f5a0a8f3763062813c5 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 28 Jan 2023 21:01:33 +0000 Subject: [PATCH 18/65] Show more details about the SrcItem.fg field in tree-trace output. FossilOrigin-Name: 3d05dddd0bc826a73a8cecd6b116168082fb46b6e4868d03438c0a5a546d2f97 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/treeview.c | 7 +++++++ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 4d88d8d4a4..06a3b193ba 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\scausing\s"PRAGMA\squick_check"\sto\sreturn\sspurious\scorruption\serrors\sfor\sa\sWITHOUT\sROWID\sfor\swhich\sall\scolumns\sare\seither\svirtual\sor\spart\sof\sthe\sprimary\skey,\sand\sfor\swhich\sthe\sorder\sof\sthe\scolumns\sin\sthe\sprimary\skey\sdefinition\sis\sdifferent\sfrom\sthe\sorder\sin\sthe\stable. -D 2023-01-28T17:37:37.660 +C Show\smore\sdetails\sabout\sthe\sSrcItem.fg\sfield\sin\stree-trace\soutput. +D 2023-01-28T21:01:33.369 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -685,7 +685,7 @@ F src/test_window.c cdae419fdcea5bad6dcd9368c685abdad6deb59e9fc8b84b153de513d394 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c F src/tokenize.c 1305797eab3542a0896b552c6e7669c972c1468e11e92b370533c1f37a37082b -F src/treeview.c 29b1dc7e0f84ba090734febe27393d4719682af0cae1b902d5ebf0236ecebea4 +F src/treeview.c fccf3b8c517c1f55cb380c1522febe6921fcb2bd800c16c78cab571d0eb0ccbd F src/trigger.c 5e68b790f022b8dafbfb0eb244786512a95c9575fc198719d2557d73e5795858 F src/update.c f118e51768d2c1309e3c81e9f91141b22b8a1339cbc5969b1b2d810feaa25b22 F src/upsert.c 5303dc6c518fa7d4b280ec65170f465c7a70b7ac2b22491598f6d0b4875b3145 @@ -2045,8 +2045,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 74508470c4caff04638e750cd84073f3137b8a9f72c6fe390a279da7b1c13398 -R bd3038bc22be97846ba0cea160d15dc3 -U dan -Z be0e76aa8633e358a87d4d35c141ada3 +P a7530f897127f35a212db6557edbcbbb286cc0e094754c1c1b74ce8dbf724470 +R 92c8f8e400ced672286c461a5d51f1a5 +U drh +Z b3d362fa27b1bfd30226a85010f3f7a0 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index ee3c2b5a3e..c6abe9a9a7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a7530f897127f35a212db6557edbcbbb286cc0e094754c1c1b74ce8dbf724470 \ No newline at end of file +3d05dddd0bc826a73a8cecd6b116168082fb46b6e4868d03438c0a5a546d2f97 \ No newline at end of file diff --git a/src/treeview.c b/src/treeview.c index 9df16a12bf..9f630b1561 100644 --- a/src/treeview.c +++ b/src/treeview.c @@ -218,6 +218,13 @@ void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc){ if( pItem->fg.isOn || (pItem->fg.isUsing==0 && pItem->u3.pOn!=0) ){ sqlite3_str_appendf(&x, " ON"); } + if( pItem->fg.isTabFunc ) sqlite3_str_appendf(&x, " isTabFunc"); + if( pItem->fg.isCorrelated ) sqlite3_str_appendf(&x, " isCorrelated"); + if( pItem->fg.isMaterialized ) sqlite3_str_appendf(&x, " isMaterialized"); + if( pItem->fg.viaCoroutine ) sqlite3_str_appendf(&x, " viaCoroutine"); + if( pItem->fg.notCte ) sqlite3_str_appendf(&x, " notCte"); + if( pItem->fg.isNestedFrom ) sqlite3_str_appendf(&x, " isNestedFrom"); + sqlite3StrAccumFinish(&x); sqlite3TreeViewItem(pView, zLine, inSrc-1); n = 0; From 05a377fd466f7546f8ed979925a2c5bfeb6f70ed Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 28 Jan 2023 21:06:15 +0000 Subject: [PATCH 19/65] Do not assume that sub-queries that contain window functions are uncorrelated. FossilOrigin-Name: f27804484df57de76be9dbd1a9e5869916617684ee407101c978df7da30b34ac --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/window.c | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 06a3b193ba..99b0ff4c5e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Show\smore\sdetails\sabout\sthe\sSrcItem.fg\sfield\sin\stree-trace\soutput. -D 2023-01-28T21:01:33.369 +C Do\snot\sassume\sthat\ssub-queries\sthat\scontain\swindow\sfunctions\sare\suncorrelated. +D 2023-01-28T21:06:15.825 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -711,7 +711,7 @@ F src/where.c e75ca01cc4025c0023a4e32c137ad933ecaf1d5fbaf9f88ffae7db216ac2f762 F src/whereInt.h e25203e5bfee149f5f1225ae0166cfb4f1e65490c998a024249e98bb0647377c F src/wherecode.c 76bca3379219880d2527493b71a3be49e696f75396d3481e4de5d4ceec7886b2 F src/whereexpr.c 7c5671a04b00c876bec5e99fd4e6f688065feb4773160fbf76fd7900d2901777 -F src/window.c 9ea4dc243420e029586c8e1ed5929fad2eae438279341ae9defc66e8f905aabc +F src/window.c 76a27cff9ea2ded0c2c3527187029259440fabcc4cc4c07b11d942c78494a614 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/affinity2.test ce1aafc86e110685b324e9a763eab4f2a73f737842ec3b687bd965867de90627 F test/affinity3.test f094773025eddf31135c7ad4cde722b7696f8eb07b97511f98585addf2a510a9 @@ -2045,8 +2045,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P a7530f897127f35a212db6557edbcbbb286cc0e094754c1c1b74ce8dbf724470 -R 92c8f8e400ced672286c461a5d51f1a5 -U drh -Z b3d362fa27b1bfd30226a85010f3f7a0 +P 3d05dddd0bc826a73a8cecd6b116168082fb46b6e4868d03438c0a5a546d2f97 +R 15c7aa257d7f9f8322c2cff93b9d4aee +U dan +Z b5cdea142483e57c2a66955139fc295d # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index c6abe9a9a7..b782372af7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3d05dddd0bc826a73a8cecd6b116168082fb46b6e4868d03438c0a5a546d2f97 \ No newline at end of file +f27804484df57de76be9dbd1a9e5869916617684ee407101c978df7da30b34ac \ No newline at end of file diff --git a/src/window.c b/src/window.c index 8dd35ee30b..56de38ba39 100644 --- a/src/window.c +++ b/src/window.c @@ -1079,6 +1079,7 @@ int sqlite3WindowRewrite(Parse *pParse, Select *p){ if( p->pSrc ){ Table *pTab2; p->pSrc->a[0].pSelect = pSub; + p->pSrc->a[0].fg.isCorrelated = 1; sqlite3SrcListAssignCursors(pParse, p->pSrc); pSub->selFlags |= SF_Expanded|SF_OrderByReqd; pTab2 = sqlite3ResultSetOfSelect(pParse, pSub, SQLITE_AFF_NONE); From 2f5330036d19b0dcbf82f7a29c6192ce7ca9df93 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 29 Jan 2023 05:09:39 +0000 Subject: [PATCH 20/65] Correct the handling of the worker1 and promiser JS files in the face of the bundler-friendly changes. Those files require separate, bundler-friendly copies. FossilOrigin-Name: 9062b31174618c0e67e86441e14eac420c734a0cc321f7eebc7d89ff8a449c10 --- ext/wasm/GNUmakefile | 27 ++++++++++++++++++++++++--- ext/wasm/README-dist.txt | 9 ++++++--- ext/wasm/dist.make | 22 +++++++++++++++------- ext/wasm/index.html | 2 +- manifest | 20 ++++++++++---------- manifest.uuid | 2 +- 6 files changed, 57 insertions(+), 25 deletions(-) diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index 92173e79f1..7ffd866f24 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -327,8 +327,6 @@ sqlite3-api.jses += $(dir.api)/sqlite3-api-cleanup.js # "External" API files which are part of our distribution # but not part of the sqlite3-api.js amalgamation. SOAP.js := $(dir.api)/sqlite3-opfs-async-proxy.js -sqlite3-worker1.js := $(dir.api)/sqlite3-worker1.js -sqlite3-worker1-promiser.js := $(dir.api)/sqlite3-worker1-promiser.js # COPY_XAPI = a $(call)able function to copy $1 to $(dir.dout), where # $1 must be one of the "external" JS API files. define COPY_XAPI @@ -336,7 +334,7 @@ sqlite3-api.ext.jses += $$(dir.dout)/$$(notdir $(1)) $$(dir.dout)/$$(notdir $(1)): $(1) $$(MAKEFILE) cp $$< $$@ endef -$(foreach X,$(SOAP.js) $(sqlite3-worker1.js) $(sqlite3-worker1-promiser.js),\ +$(foreach X,$(SOAP.js),\ $(eval $(call COPY_XAPI,$(X)))) all quick: $(sqlite3-api.ext.jses) q: quick @@ -715,6 +713,29 @@ $(sqlite3.mjs): $(sqlite3.js) $(sqlite3-bundler-friendly.mjs): $(sqlite3.mjs) CLEAN_FILES += $(sqlite3.wasm) +######################################################################## +# We need separate copies of certain supplementary JS files for the +# bundler-friendly build. Concretely, any supplemental JS files which +# themselves use importScripts() or Workers or URL() constructors +# which refer to other in-tree (m)JS files quire a bundler-friendly +# copy. +sqlite3-worker1.js.in := $(dir.api)/sqlite3-worker1.c-pp.js +sqlite3-worker1-promiser.js.in := $(dir.api)/sqlite3-worker1-promiser.c-pp.js +sqlite3-worker1.js := $(dir.dout)/sqlite3-worker1.js +sqlite3-worker1-promiser.js := $(dir.dout)/sqlite3-worker1-promiser.js +sqlite3-worker1-bundler-friendly.js := $(dir.dout)/sqlite3-worker1-bundler-friendly.js +sqlite3-worker1-promiser-bundler-friendly.js := $(dir.dout)/sqlite3-worker1-promiser-bundler-friendly.js +$(eval $(call C-PP.FILTER,$(sqlite3-worker1.js.in),$(sqlite3-worker1.js))) +$(eval $(call C-PP.FILTER,$(sqlite3-worker1.js.in),$(sqlite3-worker1-bundler-friendly.js),\ + $(c-pp.D.bundler-friendly))) +$(eval $(call C-PP.FILTER,$(sqlite3-worker1-promiser.js.in),$(sqlite3-worker1-promiser.js))) +$(eval $(call C-PP.FILTER,$(sqlite3-worker1-promiser.js.in),\ + $(sqlite3-worker1-promiser-bundler-friendly.js),\ + $(c-pp.D.bundler-friendly))) +$(sqlite3-bundler-friendly.mjs): $(sqlite3-worker1-bundler-friendly.js) \ + $(sqlite3-worker1-promiser-bundler-friendly.js) +$(sqlite3.js) $(sqlite3.mjs): $(sqlite3-worker1.js) $(sqlite3-worker1-promiser.js) + ######################################################################## # batch-runner.js is part of one of the test apps which reads in SQL # dumps generated by $(speedtest1) and executes them. diff --git a/ext/wasm/README-dist.txt b/ext/wasm/README-dist.txt index db0862628b..6656a2072a 100644 --- a/ext/wasm/README-dist.txt +++ b/ext/wasm/README-dist.txt @@ -11,9 +11,12 @@ build: - jswasm/sqlite3.mjs is the same but in ES6 module form -- jswasm/sqlite3-bundler-friendly.mjs is the same as the ES6 module - with small tweaks to make it compatible with "bundler" tools - commonly seen in node.js-based projects. +- jswasm/*-bundler-friendly.js and .mjs are variants which are + intended to be compatible with "bundler" tools commonly seen in + node.js-based projects. Projects using such tools should use those + variants, where available, instead of files without the + "-bundler-friendly" suffix. Some files do not have separate + variants. - jswasm/sqlite3.wasm is the binary WASM file imported by all of the above-listed JS files. diff --git a/ext/wasm/dist.make b/ext/wasm/dist.make index ffc2613703..d2fa920be7 100644 --- a/ext/wasm/dist.make +++ b/ext/wasm/dist.make @@ -56,6 +56,18 @@ dist.common.extras := \ $(dir.common)/SqliteTestUtil.js .PHONY: dist snapshot +define DIST_STRIP_COMMENTS +# $1 = source js file +# $2 = flags for $(bin.stripcomments) +$(bin.stripccomments) $(2) < $(1) > $(dist-dir.jswasm)/$(notdir $(1)); +endef +# STRIP_K1.js = list of JS files which need to be passed through +# $(bin.stripcomments) with a single -k flag. +STRIP_K1.js := $(sqlite3-worker1.js) $(sqlite3-worker1-promiser.js) \ + $(sqlite3-worker1-bundler-friendly.js) $(sqlite3-worker1-promiser-bundler-friendly.js) +# STRIP_K2.js = list of JS files which need to be passed through +# $(bin.stripcomments) with two -k flags. +STRIP_K2.js := $(sqlite3.js) $(sqlite3.mjs) $(sqlite3-bundler-friendly.mjs) ######################################################################## # dist: create the end-user deliverable archive. # @@ -71,7 +83,7 @@ dist.common.extras := \ # target name equal to the archive name. dist: \ $(bin.stripccomments) $(bin.version-info) \ - $(dist.build) \ + $(dist.build) $(STRIP_K1.js) $(STRIP_K2.js) \ $(MAKEFILE) $(MAKEFILE.dist) @echo "Making end-user deliverables..." @rm -fr $(dist-dir.top) @@ -80,12 +92,8 @@ dist: \ @cp -p README-dist.txt $(dist-dir.top)/README.txt @cp -p index-dist.html $(dist-dir.top)/index.html @cp -p $(dist.jswasm.extras) $(dist-dir.jswasm) - @$(bin.stripccomments) -k -k < $(sqlite3.js) \ - > $(dist-dir.jswasm)/$(notdir $(sqlite3.js)) - @$(bin.stripccomments) -k -k < $(sqlite3.mjs) \ - > $(dist-dir.jswasm)/$(notdir $(sqlite3.mjs)) - @$(bin.stripccomments) -k -k < $(sqlite3-bundler-friendly.mjs) \ - > $(dist-dir.jswasm)/$(notdir $(sqlite3-bundler-friendly.mjs)) + $(foreach JS,$(STRIP_K1.js),$(call DIST_STRIP_COMMENTS,$(JS),-k)) + $(foreach JS,$(STRIP_K2.js),$(call DIST_STRIP_COMMENTS,$(JS),-k -k)) @cp -p $(dist.common.extras) $(dist-dir.common) @set -e; \ vnum=$$($(bin.version-info) --download-version); \ diff --git a/ext/wasm/index.html b/ext/wasm/index.html index 767cc5e74a..969d9553eb 100644 --- a/ext/wasm/index.html +++ b/ext/wasm/index.html @@ -131,7 +131,7 @@ diff --git a/manifest b/manifest index 99b0ff4c5e..6275e3d92e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Do\snot\sassume\sthat\ssub-queries\sthat\scontain\swindow\sfunctions\sare\suncorrelated. -D 2023-01-28T21:06:15.825 +C Correct\sthe\shandling\sof\sthe\sworker1\sand\spromiser\sJS\sfiles\sin\sthe\sface\sof\sthe\sbundler-friendly\schanges.\sThose\sfiles\srequire\sseparate,\sbundler-friendly\scopies. +D 2023-01-29T05:09:39.456 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -466,8 +466,8 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c -F ext/wasm/GNUmakefile 6fee35e99b82c948a1a4675bb4d1d037800c2171274bd8ab3779fac53aca6d1a -F ext/wasm/README-dist.txt 4a1db3677d0341a12434d1fd6c97aae2f96785d734641407a201b719f5d94f44 +F ext/wasm/GNUmakefile 5418b4702f4ad0f2162a7e0d128042e8d9219827e3d36978bd2dd6e26ce8f68e +F ext/wasm/README-dist.txt 6382cb9548076fca472fb3330bbdba3a55c1ea0b180ff9253f084f07ff383576 F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9 F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287 @@ -506,14 +506,14 @@ F ext/wasm/demo-worker1-promiser.html 1de7c248c7c2cfd4a5783d2aa154bce62d74c6de98 F ext/wasm/demo-worker1-promiser.js b99c550763fa792c204e9a7cceadd976004036d9fc3e22fab7051712e30d207d F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2eb1ab2c68ef5d F ext/wasm/demo-worker1.js a619adffc98b75b66c633b00f747b856449a134a9a0357909287d80a182d70fa -F ext/wasm/dist.make b50668a4f79d4464a59c3378b6b53968bb0652a06737b1e0b07544458de28f3d +F ext/wasm/dist.make 836176877b8d4ae1d4217dcc1f3c057c7d7c5546df012532b9f5ff83061b24fd F ext/wasm/fiddle.make d5308b5c35f691758ef20badd25f91f3780b20415760daf0d98afbe4f24921b9 F ext/wasm/fiddle/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d69513dd6ef1f289ada3f F ext/wasm/fiddle/fiddle-worker.js b4a0c8ab6c0983218543ca771c45f6075449f63a1dcf290ae5a681b2cba8800d F ext/wasm/fiddle/fiddle.js 974b995119ac443685d7d94d3b3c58c6a36540e9eb3fed7069d5653284071715 F ext/wasm/fiddle/index.html 5daf54e8f3d7777cbb1ca4f93affe28858dbfff25841cb4ab81d694efed28ec2 F ext/wasm/index-dist.html c806b6005145b71d64240606e9c6e0bf56878ee8829c66fe7486cebf34b0e6b1 -F ext/wasm/index.html cc8b174ff01be282b399e64b58bdf3c921d7020da5d4e22e88bbbb4a6787a209 +F ext/wasm/index.html 6b7139e64eef500aee9315deac5e4ac84ef31453aaf053b794bb0505859dcde5 F ext/wasm/jaccwabyt/jaccwabyt.js 06f2ef1ad640c26c593def3d960336e9bb789819b920516480895c38ed5f58fa F ext/wasm/jaccwabyt/jaccwabyt.md 37911f00db12cbcca73aa1ed72594430365f30aafae2fa9c886961de74e5e0eb F ext/wasm/module-symbols.html 841de62fc198988b8330e238c260e70ec93028b096e1a1234db31b187a899d10 @@ -2045,8 +2045,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3d05dddd0bc826a73a8cecd6b116168082fb46b6e4868d03438c0a5a546d2f97 -R 15c7aa257d7f9f8322c2cff93b9d4aee -U dan -Z b5cdea142483e57c2a66955139fc295d +P f27804484df57de76be9dbd1a9e5869916617684ee407101c978df7da30b34ac +R 667e12e7399fd0840589fd5b12faf9a7 +U stephan +Z 6f0092c7605698427bc685848784d5f5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index b782372af7..6a5ce342cf 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f27804484df57de76be9dbd1a9e5869916617684ee407101c978df7da30b34ac \ No newline at end of file +9062b31174618c0e67e86441e14eac420c734a0cc321f7eebc7d89ff8a449c10 \ No newline at end of file From 26c7cff254b09285c41e82656f5fa53cd7ce95f8 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 29 Jan 2023 06:01:32 +0000 Subject: [PATCH 21/65] Two JS file renames which got inadvertently undone while setting up [9062b31174618c0e]. Cosmetic cleanups in ext/wasm/dist.make. FossilOrigin-Name: 0c2fde767f77d6204e95737edd573f42d72e956a3c20ea7e4daeff906657bbe5 --- ...miser.js => sqlite3-worker1-promiser.c-pp.js} | 0 ...qlite3-worker1.js => sqlite3-worker1.c-pp.js} | 0 ext/wasm/dist.make | 13 ++++++++----- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 5 files changed, 17 insertions(+), 14 deletions(-) rename ext/wasm/api/{sqlite3-worker1-promiser.js => sqlite3-worker1-promiser.c-pp.js} (100%) rename ext/wasm/api/{sqlite3-worker1.js => sqlite3-worker1.c-pp.js} (100%) diff --git a/ext/wasm/api/sqlite3-worker1-promiser.js b/ext/wasm/api/sqlite3-worker1-promiser.c-pp.js similarity index 100% rename from ext/wasm/api/sqlite3-worker1-promiser.js rename to ext/wasm/api/sqlite3-worker1-promiser.c-pp.js diff --git a/ext/wasm/api/sqlite3-worker1.js b/ext/wasm/api/sqlite3-worker1.c-pp.js similarity index 100% rename from ext/wasm/api/sqlite3-worker1.js rename to ext/wasm/api/sqlite3-worker1.c-pp.js diff --git a/ext/wasm/dist.make b/ext/wasm/dist.make index d2fa920be7..7073c24b78 100644 --- a/ext/wasm/dist.make +++ b/ext/wasm/dist.make @@ -56,10 +56,13 @@ dist.common.extras := \ $(dir.common)/SqliteTestUtil.js .PHONY: dist snapshot +# DIST_STRIP_COMMENTS $(call)able to be used in stripping C-style +# from the dist copies of certain files. +# +# $1 = source js file +# $2 = flags for $(bin.stripcomments) define DIST_STRIP_COMMENTS -# $1 = source js file -# $2 = flags for $(bin.stripcomments) -$(bin.stripccomments) $(2) < $(1) > $(dist-dir.jswasm)/$(notdir $(1)); +$(bin.stripccomments) $(2) < $(1) > $(dist-dir.jswasm)/$(notdir $(1)) || exit; endef # STRIP_K1.js = list of JS files which need to be passed through # $(bin.stripcomments) with a single -k flag. @@ -92,8 +95,8 @@ dist: \ @cp -p README-dist.txt $(dist-dir.top)/README.txt @cp -p index-dist.html $(dist-dir.top)/index.html @cp -p $(dist.jswasm.extras) $(dist-dir.jswasm) - $(foreach JS,$(STRIP_K1.js),$(call DIST_STRIP_COMMENTS,$(JS),-k)) - $(foreach JS,$(STRIP_K2.js),$(call DIST_STRIP_COMMENTS,$(JS),-k -k)) + @$(foreach JS,$(STRIP_K1.js),$(call DIST_STRIP_COMMENTS,$(JS),-k)) + @$(foreach JS,$(STRIP_K2.js),$(call DIST_STRIP_COMMENTS,$(JS),-k -k)) @cp -p $(dist.common.extras) $(dist-dir.common) @set -e; \ vnum=$$($(bin.version-info) --download-version); \ diff --git a/manifest b/manifest index 6275e3d92e..fd561474b9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Correct\sthe\shandling\sof\sthe\sworker1\sand\spromiser\sJS\sfiles\sin\sthe\sface\sof\sthe\sbundler-friendly\schanges.\sThose\sfiles\srequire\sseparate,\sbundler-friendly\scopies. -D 2023-01-29T05:09:39.456 +C Two\sJS\sfile\srenames\swhich\sgot\sinadvertently\sundone\swhile\ssetting\sup\s[9062b31174618c0e].\sCosmetic\scleanups\sin\sext/wasm/dist.make. +D 2023-01-29T06:01:32.206 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -488,8 +488,8 @@ F ext/wasm/api/sqlite3-v-helper.js 6f6c3e390a72e08b0a5b16a0d567d7af3c04d17283185 F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js a10bdc9695dcf453e120970a5de8a3e61db4e4047d0a7cc5a6d63dfe7ae87f4e F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9 F ext/wasm/api/sqlite3-wasm.c 76625a70937a8522d014ef686c32db5b53a3ee61850323f5c601d2ac39fe52fe -F ext/wasm/api/sqlite3-worker1-promiser.js f10c3ecd9df06f6320073c2ce230a7ed7c56034d8b88c1e57095f2a97faf423a -F ext/wasm/api/sqlite3-worker1.js 77b3835192469e9da23926ec8f78fb0b114a51d048dc54388709ac22b5c5f0a0 +F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js f10c3ecd9df06f6320073c2ce230a7ed7c56034d8b88c1e57095f2a97faf423a w ext/wasm/api/sqlite3-worker1-promiser.js +F ext/wasm/api/sqlite3-worker1.c-pp.js 77b3835192469e9da23926ec8f78fb0b114a51d048dc54388709ac22b5c5f0a0 w ext/wasm/api/sqlite3-worker1.js F ext/wasm/batch-runner.html 4deeed44fe41496dc6898d9fb17938ea3291f40f4bfb977e29d0cef96fbbe4c8 F ext/wasm/batch-runner.js 0dad6a02ad796f1003d3b7048947d275c4d6277f63767b8e685c27df8fdac93e F ext/wasm/c-pp.c 6d80d8569d85713effe8b0818a3cf51dc779e3f0bf8dc88771b8998552ee25b4 @@ -506,7 +506,7 @@ F ext/wasm/demo-worker1-promiser.html 1de7c248c7c2cfd4a5783d2aa154bce62d74c6de98 F ext/wasm/demo-worker1-promiser.js b99c550763fa792c204e9a7cceadd976004036d9fc3e22fab7051712e30d207d F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2eb1ab2c68ef5d F ext/wasm/demo-worker1.js a619adffc98b75b66c633b00f747b856449a134a9a0357909287d80a182d70fa -F ext/wasm/dist.make 836176877b8d4ae1d4217dcc1f3c057c7d7c5546df012532b9f5ff83061b24fd +F ext/wasm/dist.make f55f9c9e1980ea11a59964e59535c66175a17f004d1c2e274522c3366b3a084a F ext/wasm/fiddle.make d5308b5c35f691758ef20badd25f91f3780b20415760daf0d98afbe4f24921b9 F ext/wasm/fiddle/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d69513dd6ef1f289ada3f F ext/wasm/fiddle/fiddle-worker.js b4a0c8ab6c0983218543ca771c45f6075449f63a1dcf290ae5a681b2cba8800d @@ -2045,8 +2045,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P f27804484df57de76be9dbd1a9e5869916617684ee407101c978df7da30b34ac -R 667e12e7399fd0840589fd5b12faf9a7 +P 9062b31174618c0e67e86441e14eac420c734a0cc321f7eebc7d89ff8a449c10 +R 8f85e81de3851592997fc03573edca4f U stephan -Z 6f0092c7605698427bc685848784d5f5 +Z bfd47a7c26f55476ee645fdcf247a796 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 6a5ce342cf..33c1027661 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9062b31174618c0e67e86441e14eac420c734a0cc321f7eebc7d89ff8a449c10 \ No newline at end of file +0c2fde767f77d6204e95737edd573f42d72e956a3c20ea7e4daeff906657bbe5 \ No newline at end of file From f7af9ba13cb7ef413c5202d12678a475ed1234c9 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 30 Jan 2023 20:44:54 +0000 Subject: [PATCH 22/65] Additional tweaks to the enhancement at [609fbb94b8f01d67] to further reduce the cost estimate for constructing an automatic index on an ephemeral table, in order to resolve the performance problem described by [forum:/forumpost/1d571c0296|forum post 1d571c0296]. FossilOrigin-Name: bf1aae7a8c7f2c74681aa29baa35259d10ce6a1737d2607def6bf27fed592131 --- manifest | 20 +++++++------- manifest.uuid | 2 +- src/where.c | 3 ++- test/where.test | 69 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 82 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index fd561474b9..7b52f050f3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Two\sJS\sfile\srenames\swhich\sgot\sinadvertently\sundone\swhile\ssetting\sup\s[9062b31174618c0e].\sCosmetic\scleanups\sin\sext/wasm/dist.make. -D 2023-01-29T06:01:32.206 +C Additional\stweaks\sto\sthe\senhancement\sat\s[609fbb94b8f01d67]\sto\sfurther\sreduce\nthe\scost\sestimate\sfor\sconstructing\san\sautomatic\sindex\son\san\sephemeral\stable,\nin\sorder\sto\sresolve\sthe\sperformance\sproblem\sdescribed\sby\n[forum:/forumpost/1d571c0296|forum\spost\s1d571c0296]. +D 2023-01-30T20:44:54.399 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -488,8 +488,8 @@ F ext/wasm/api/sqlite3-v-helper.js 6f6c3e390a72e08b0a5b16a0d567d7af3c04d17283185 F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js a10bdc9695dcf453e120970a5de8a3e61db4e4047d0a7cc5a6d63dfe7ae87f4e F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9 F ext/wasm/api/sqlite3-wasm.c 76625a70937a8522d014ef686c32db5b53a3ee61850323f5c601d2ac39fe52fe -F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js f10c3ecd9df06f6320073c2ce230a7ed7c56034d8b88c1e57095f2a97faf423a w ext/wasm/api/sqlite3-worker1-promiser.js -F ext/wasm/api/sqlite3-worker1.c-pp.js 77b3835192469e9da23926ec8f78fb0b114a51d048dc54388709ac22b5c5f0a0 w ext/wasm/api/sqlite3-worker1.js +F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js f10c3ecd9df06f6320073c2ce230a7ed7c56034d8b88c1e57095f2a97faf423a +F ext/wasm/api/sqlite3-worker1.c-pp.js 77b3835192469e9da23926ec8f78fb0b114a51d048dc54388709ac22b5c5f0a0 F ext/wasm/batch-runner.html 4deeed44fe41496dc6898d9fb17938ea3291f40f4bfb977e29d0cef96fbbe4c8 F ext/wasm/batch-runner.js 0dad6a02ad796f1003d3b7048947d275c4d6277f63767b8e685c27df8fdac93e F ext/wasm/c-pp.c 6d80d8569d85713effe8b0818a3cf51dc779e3f0bf8dc88771b8998552ee25b4 @@ -707,7 +707,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/wal.c b9df133a705093da8977da5eb202eaadb844839f1c7297c08d33471f5491843d F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a F src/walker.c f890a3298418d7cba3b69b8803594fdc484ea241206a8dfa99db6dd36f8cbb3b -F src/where.c e75ca01cc4025c0023a4e32c137ad933ecaf1d5fbaf9f88ffae7db216ac2f762 +F src/where.c f180e2fdc93d286b48f23647cc26aab5a5b7437af2d3843f6228aff8d68eb9fe F src/whereInt.h e25203e5bfee149f5f1225ae0166cfb4f1e65490c998a024249e98bb0647377c F src/wherecode.c 76bca3379219880d2527493b71a3be49e696f75396d3481e4de5d4ceec7886b2 F src/whereexpr.c 7c5671a04b00c876bec5e99fd4e6f688065feb4773160fbf76fd7900d2901777 @@ -1864,7 +1864,7 @@ F test/walthread.test 14b20fcfa6ae152f5d8e12f5dc8a8a724b7ef189f5d8ef1e2ceab79f2a F test/walvfs.test e1a6ad0f3c78e98b55c3d5f0889cf366cc0d0a1cb2bccb44ac9ec67384adc4a1 F test/wapp.tcl b440cd8cf57953d3a49e7ee81e6a18f18efdaf113b69f7d8482b0710a64566ec F test/wapptest.tcl 1bea58a6a8e68a73f542ee4fca28b771b84ed803bd0c9e385087070b3d747b3c x -F test/where.test 3954cf22ba7b17f9606e177001d2963bcd1ecfbc6e1e7caadb14462f7eecd099 +F test/where.test 26c9e2f5db19c7f90e5b70127f664facd30c0e5c496956ea3a533bcda7fad74a F test/where2.test 03c21a11e7b90e2845fc3c8b4002fc44cc2797fa74c86ee47d70bd7ea4f29ed6 F test/where3.test 5b4ffc0ac2ea0fe92f02b1244b7531522fe4d7bccf6fa8741d54e82c10e67753 F test/where4.test 4a371bfcc607f41d233701bdec33ac2972908ba8 @@ -2045,8 +2045,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 9062b31174618c0e67e86441e14eac420c734a0cc321f7eebc7d89ff8a449c10 -R 8f85e81de3851592997fc03573edca4f -U stephan -Z bfd47a7c26f55476ee645fdcf247a796 +P 0c2fde767f77d6204e95737edd573f42d72e956a3c20ea7e4daeff906657bbe5 +R eff4b53eb789da902d77064ecbd62787 +U drh +Z 55e9959d5ae7e5a9913374f5d774ce27 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 33c1027661..bc5d3b3b4a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0c2fde767f77d6204e95737edd573f42d72e956a3c20ea7e4daeff906657bbe5 \ No newline at end of file +bf1aae7a8c7f2c74681aa29baa35259d10ce6a1737d2607def6bf27fed592131 \ No newline at end of file diff --git a/src/where.c b/src/where.c index 6a9edd028b..51e018c97f 100644 --- a/src/where.c +++ b/src/where.c @@ -3595,7 +3595,8 @@ static int whereLoopAddBtree( if( !IsView(pTab) && (pTab->tabFlags & TF_Ephemeral)==0 ){ pNew->rSetup += 28; }else{ - pNew->rSetup -= 10; + pNew->rSetup -= 25; /* Greatly reduced setup cost for auto indexes + ** on ephemeral materializations of views */ } ApplyCostMultiplier(pNew->rSetup, pTab->costMult); if( pNew->rSetup<0 ) pNew->rSetup = 0; diff --git a/test/where.test b/test/where.test index 4f7c2f84b2..acc3253819 100644 --- a/test/where.test +++ b/test/where.test @@ -1633,4 +1633,73 @@ do_execsql_test where-29.1 { 1, 1, 1, 1; } {xyz} +# 2023-01-30 +# Tests case for the query planner performance issue reported by +# https://sqlite.org/forum/forumpost/1d571c0296 +# +# The fix was to adjust the cost of computing an automatic index for +# ephemeral tables, to help ensure that they are generated if they are +# needed. The test case below only looks at the query plan. But 12x +# improved performance has been verified by populating the "raw" table +# with 100K rows of random data and running actual speed tests. +# +do_test where-30.1 { + unset -nocomplain res + set res {} + db eval {CREATE TABLE raw(country,date,total,delta, UNIQUE(country,date));} + db eval { + EXPLAIN QUERY PLAN + WITH + -- Find the country and min/max date + init(country, date, fin) AS (SELECT country, min(date), max(date) + FROM raw WHERE total > 0 GROUP BY country), + + -- Generate the date stream for each country + src(country, date) AS (SELECT raw.country, raw.date + FROM raw JOIN init i on raw.country = i.country AND raw.date > i.date + ORDER BY raw.country, raw.date), + + -- Generate the x & y for each entry in the country/date stream + vals(country, date, x, y) AS (SELECT src.country, src.date, + julianday(raw.date) - julianday(src.date), log(delta+1) + FROM src JOIN raw on raw.country = src.country + AND raw.date > date(src.date,'-7 days') + AND raw.date <= src.date AND delta >= 0), + + -- Accumulate the data we need + sums(country, date, x2, x, n, xy, y) AS (SELECT country, date, + sum(x*x*1.0), sum(x*1.0), sum(1.0), sum(x*y*1.0), sum(y*1.0) + FROM vals GROUP BY 1, 2), + + -- use these to calculate to divisor for the inverse matrix + mult(country, date, m) AS (SELECT country, date, 1.0/(x2 * n - x * x) + FROM sums), + + -- Build the inverse matrix + inv(country, date, a,b,c,d) AS (SELECT mult.country, mult.date, n * m, + -x * m, -x * m, x2 * m + FROM mult JOIN sums on sums.country=mult.country + AND mult.date=sums.date), + + -- Calculate the coefficients for the least squares fit + fit(country, date, a, b) AS (SELECT inv.country, inv.date, + a * xy + b * y, c * xy + d * y + FROM inv + JOIN mult on mult.country = inv.country AND mult.date = inv.date + JOIN sums on sums.country = mult.country AND sums.date = mult.date + ) + SELECT *, nFin/nPrev - 1 AS growth, log(2)/log(nFin/nPrev) AS doubling + FROM (SELECT f.*, exp(b) - 1 AS nFin, exp(a* (-1) + b) - 1 AS nPrev + FROM fit f JOIN init i on i.country = f.country + AND f.date <= date(i.fin,'-3 days')) + WHERE nPrev > 0 AND nFin > 0; + } { + if {$parent!=0} continue + if {![string match SCAN* $detail]} continue + lappend res SCAN + } + set res +} {SCAN} +# ^^^^^^-- there should only be one top-level table scan in the query plan. + finish_test From ca3aabdf5397b7e47b24b85dc321dc0e8e4ec749 Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 31 Jan 2023 20:21:06 +0000 Subject: [PATCH 23/65] Fix a race condition during hot-journal rollback that could theoretically cause spurious corruption errors. FossilOrigin-Name: 20ea53ddf590a9dd19501fabd2bfdb9c10b5eb265cd2995bdb335769c936c763 --- manifest | 20 ++++--- manifest.uuid | 2 +- src/os_unix.c | 11 ++-- src/test_vfs.c | 5 +- test/pendingrace.test | 123 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 145 insertions(+), 16 deletions(-) create mode 100644 test/pendingrace.test diff --git a/manifest b/manifest index 7b52f050f3..4b7e37fff5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Additional\stweaks\sto\sthe\senhancement\sat\s[609fbb94b8f01d67]\sto\sfurther\sreduce\nthe\scost\sestimate\sfor\sconstructing\san\sautomatic\sindex\son\san\sephemeral\stable,\nin\sorder\sto\sresolve\sthe\sperformance\sproblem\sdescribed\sby\n[forum:/forumpost/1d571c0296|forum\spost\s1d571c0296]. -D 2023-01-30T20:44:54.399 +C Fix\sa\srace\scondition\sduring\shot-journal\srollback\sthat\scould\stheoretically\scause\sspurious\scorruption\serrors. +D 2023-01-31T20:21:06.739 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -604,7 +604,7 @@ F src/os.h 1ff5ae51d339d0e30d8a9d814f4b8f8e448169304d83a7ed9db66a65732f3e63 F src/os_common.h 6c0eb8dd40ef3e12fe585a13e709710267a258e2c8dd1c40b1948a1d14582e06 F src/os_kv.c 4d39e1f1c180b11162c6dc4aa8ad34053873a639bac6baae23272fc03349986a F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d872107 -F src/os_unix.c 9107314500e44908e8d2cdf1ed3333ca5fa17dcfdf9c6a079002b4df90d5f806 +F src/os_unix.c 85096ad0bb4e6a6ac3764603cea0f5332816fa25f0e50c936453edc8ac9acee7 F src/os_win.c 295fe45f18bd86f2477f4cd79f3377c6f883ceb941b1f46808665c73747f2345 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a F src/pager.c fc6d3ec7017d7369ab5dc5421ad1763ff224551c9381866b6da69040db62e406 @@ -677,7 +677,7 @@ F src/test_tclsh.c 7dd98be675a1dc0d1fd302b8247bab992c909db384df054381a2279ad76f9 F src/test_tclvar.c 33ff42149494a39c5fbb0df3d25d6fafb2f668888e41c0688d07273dcb268dfc F src/test_thread.c 269ea9e1fa5828dba550eb26f619aa18aedbc29fd92f8a5f6b93521fbb74a61c F src/test_vdbecov.c f60c6f135ec42c0de013a1d5136777aa328a776d33277f92abac648930453d43 -F src/test_vfs.c 2cc38a79892017702d13da79ad5152c196eec19bbd67fbde4d88065aac894a84 +F src/test_vfs.c 193c18da3dbf62a0e33ae7a240bbef938a50846672ee947664512b77d853fe81 F src/test_vfstrace.c bab9594adc976cbe696ff3970728830b4c5ed698 F src/test_windirent.c a895e2c068a06644eef91a7f0a32182445a893b9a0f33d0cdb4283dca2486ac1 F src/test_windirent.h 90dfbe95442c9762357fe128dc7ae3dc199d006de93eb33ba3972e0a90484215 @@ -1371,6 +1371,7 @@ F test/pagesize.test 5769fc62d8c890a83a503f67d47508dfdc543305 F test/parser1.test 6ccdf5e459a5dc4673d3273dc311a7e9742ca952dd0551a6a6320d27035ce4b3 F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442 +F test/pendingrace.test fb997b46d6c144a508fb8025d988a1e511b53d42d24143c57b51de3a405c7490 F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff F test/permutations.test 4705a032bbfef531bb3fd98b8c6ba4a739998949eae9ac0ea97c8696b331211d F test/pg_common.tcl 3b27542224db1e713ae387459b5d117c836a5f6e328846922993b6d2b7640d9f @@ -2045,8 +2046,11 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 0c2fde767f77d6204e95737edd573f42d72e956a3c20ea7e4daeff906657bbe5 -R eff4b53eb789da902d77064ecbd62787 -U drh -Z 55e9959d5ae7e5a9913374f5d774ce27 +P bf1aae7a8c7f2c74681aa29baa35259d10ce6a1737d2607def6bf27fed592131 +R acc2b6cc65d6bb367d9e15964ca7789d +T *branch * pending-lock-race +T *sym-pending-lock-race * +T -sym-trunk * +U dan +Z 4879461e3eb613f63b1ce94cf45161f5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index bc5d3b3b4a..9dd108c7c6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -bf1aae7a8c7f2c74681aa29baa35259d10ce6a1737d2607def6bf27fed592131 \ No newline at end of file +20ea53ddf590a9dd19501fabd2bfdb9c10b5eb265cd2995bdb335769c936c763 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index c3359f1bc7..7c1acc8164 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -1652,7 +1652,7 @@ static int unixFileLock(unixFile *pFile, struct flock *pLock){ ** UNLOCKED -> SHARED ** SHARED -> RESERVED ** SHARED -> (PENDING) -> EXCLUSIVE -** RESERVED -> (PENDING) -> EXCLUSIVE +** RESERVED -> EXCLUSIVE ** PENDING -> EXCLUSIVE ** ** This routine will only increase a lock. Use the sqlite3OsUnlock() @@ -1767,7 +1767,7 @@ static int unixLock(sqlite3_file *id, int eFileLock){ lock.l_len = 1L; lock.l_whence = SEEK_SET; if( eFileLock==SHARED_LOCK - || (eFileLock==EXCLUSIVE_LOCK && pFile->eFileLockeFileLock==RESERVED_LOCK) ){ lock.l_type = (eFileLock==SHARED_LOCK?F_RDLCK:F_WRLCK); lock.l_start = PENDING_BYTE; @@ -1778,6 +1778,9 @@ static int unixLock(sqlite3_file *id, int eFileLock){ storeLastErrno(pFile, tErrno); } goto end_lock; + }else if( eFileLock==EXCLUSIVE_LOCK ){ + pFile->eFileLock = PENDING_LOCK; + pInode->eFileLock = PENDING_LOCK; } } @@ -1865,13 +1868,9 @@ static int unixLock(sqlite3_file *id, int eFileLock){ } #endif - if( rc==SQLITE_OK ){ pFile->eFileLock = eFileLock; pInode->eFileLock = eFileLock; - }else if( eFileLock==EXCLUSIVE_LOCK ){ - pFile->eFileLock = PENDING_LOCK; - pInode->eFileLock = PENDING_LOCK; } end_lock: diff --git a/src/test_vfs.c b/src/test_vfs.c index f3e8297ac7..312e1a1be6 100644 --- a/src/test_vfs.c +++ b/src/test_vfs.c @@ -485,6 +485,9 @@ static int tvfsLock(sqlite3_file *pFile, int eLock){ tvfsExecTcl(p, "xLock", Tcl_NewStringObj(pFd->zFilename, -1), Tcl_NewStringObj(zLock, -1), 0, 0); } + if( p->mask&TESTVFS_LOCK_MASK && tvfsInjectIoerr(p) ){ + return SQLITE_IOERR_LOCK; + } return sqlite3OsLock(pFd->pReal, eLock); } @@ -500,7 +503,7 @@ static int tvfsUnlock(sqlite3_file *pFile, int eLock){ tvfsExecTcl(p, "xUnlock", Tcl_NewStringObj(pFd->zFilename, -1), Tcl_NewStringObj(zLock, -1), 0, 0); } - if( p->mask&TESTVFS_WRITE_MASK && tvfsInjectIoerr(p) ){ + if( p->mask&TESTVFS_UNLOCK_MASK && tvfsInjectIoerr(p) ){ return SQLITE_IOERR_UNLOCK; } return sqlite3OsUnlock(pFd->pReal, eLock); diff --git a/test/pendingrace.test b/test/pendingrace.test new file mode 100644 index 0000000000..645ebbfc80 --- /dev/null +++ b/test/pendingrace.test @@ -0,0 +1,123 @@ +# 2023 January 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. +# +#*********************************************************************** +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl +set testprefix pendingrace + +# This test file tests that a race condition surrounding hot-journal +# rollback that once existed has been resolved. The problem was that +# if, when attempting to upgrade from a SHARED to EXCLUSIVE lock in +# order to roll back a hot journal, a connection failed to take the +# lock, the file-descriptor was left holding a PENDING lock for +# a very short amount of time. In a multi-threaded deployment, this +# could allow a second connection to read the database without rolling +# back the hot journal. +# + +testvfs tvfs +db close +sqlite3 db test.db -vfs tvfs + +# Create a 20 page database using connection [db]. Connection [db] uses +# Tcl VFS wrapper "tvfs", but it is configured to do straight pass-through +# for now. +# +do_execsql_test 1.0 { + PRAGMA cache_size = 5; + CREATE TABLE t1(a, b); + CREATE INDEX i1 ON t1(a, b); + WITH s(i) AS ( + SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<10 + ) + INSERT INTO t1 SELECT hex(randomblob(100)), hex(randomblob(100)) FROM s; + PRAGMA page_count; +} {20} + +# Simulate a crash in another process. This leaves the db with a hot-journal. +# Without the journal the db is corrupt. +# +sqlite3 db2 test.db +do_execsql_test -db db2 1.1 { + PRAGMA cache_size = 5; + BEGIN; + UPDATE t1 SET b=hex(randomblob(100)); +} +db_save +db2 close +proc my_db_restore {} { + forcecopy sv_test.db-journal test.db-journal + + set fd1 [open sv_test.db r] + fconfigure $fd1 -encoding binary -translation binary + set data [read $fd1] + close $fd1 + + set fd1 [open test.db w] + fconfigure $fd1 -encoding binary -translation binary + puts -nonewline $fd1 $data + close $fd1 +} +my_db_restore +do_test 1.2 { + file exists test.db-journal +} {1} + +# Set up connection [db2] to use Tcl VFS wrapper [tvfs2]. Which is configured +# so that the first call to xUnlock() fails. And then all VFS calls thereafter +# fail as well. +# +testvfs tvfs2 +tvfs2 filter xUnlock +tvfs2 script xUnlock +set ::seen_unlock 0 +proc xUnlock {args} { + if {$::seen_unlock==0} { + set ::seen_unlock 1 + tvfs2 ioerr 1 1 + tvfs2 filter {xLock xUnlock} + } + return "" +} +sqlite3 db2 test.db -vfs tvfs2 + +# Configure [tvfs] (used by [db]) so that within the first call to xAccess, +# [db2] attempts to read the db. This causes [db2] to fail to upgrade to +# EXCLUSIVE, leaving it with a PENDING lock. Which it holds on to, +# as the xUnlock() and all subsequent VFS calls fail. +# +tvfs filter xAccess +tvfs script xAccess +set ::seen_access 0 +proc xAccess {args} { + if {$::seen_access==0} { + set ::seen_access 1 + catch { db2 eval { SELECT count(*)+0 FROM t1 } } + breakpoint + } + return "" +} + +# Run an integrity check using [db]. +do_catchsql_test 1.3 { + PRAGMA integrity_check +} {1 {database is locked}} + +db close +db2 close +tvfs delete +tvfs2 delete + +finish_test + + + From 288409d7319625702da13ee0e8e955482d9b99e2 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 1 Feb 2023 14:17:25 +0000 Subject: [PATCH 24/65] Fix a comment related to PENDING locks in os_unix.c. No code changes. FossilOrigin-Name: 6b3546c871fe78a4e550e0144b48ac98325787cc8b192a9e7f5f2a2ffa57f76d --- manifest | 13 ++++++------- manifest.uuid | 2 +- src/os_unix.c | 29 +++++++++++++++-------------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/manifest b/manifest index 35154f60aa..8db5bd8d45 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\srace\scondition\sduring\shot-journal\srollback\son\sunix\sthat\scould\stheoretically\scause\sspurious\scorruption\serrors. -D 2023-01-31T20:43:21.518 +C Fix\sa\scomment\srelated\sto\sPENDING\slocks\sin\sos_unix.c.\sNo\scode\schanges. +D 2023-02-01T14:17:25.856 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -604,7 +604,7 @@ F src/os.h 1ff5ae51d339d0e30d8a9d814f4b8f8e448169304d83a7ed9db66a65732f3e63 F src/os_common.h 6c0eb8dd40ef3e12fe585a13e709710267a258e2c8dd1c40b1948a1d14582e06 F src/os_kv.c 4d39e1f1c180b11162c6dc4aa8ad34053873a639bac6baae23272fc03349986a F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d872107 -F src/os_unix.c 85096ad0bb4e6a6ac3764603cea0f5332816fa25f0e50c936453edc8ac9acee7 +F src/os_unix.c 49b0d3d0f86fc4736d1b9a71035bbd791b892ed6908803f270d4d71f149c60ac F src/os_win.c 295fe45f18bd86f2477f4cd79f3377c6f883ceb941b1f46808665c73747f2345 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a F src/pager.c fc6d3ec7017d7369ab5dc5421ad1763ff224551c9381866b6da69040db62e406 @@ -2046,9 +2046,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P bf1aae7a8c7f2c74681aa29baa35259d10ce6a1737d2607def6bf27fed592131 20ea53ddf590a9dd19501fabd2bfdb9c10b5eb265cd2995bdb335769c936c763 -R acc2b6cc65d6bb367d9e15964ca7789d -T +closed 20ea53ddf590a9dd19501fabd2bfdb9c10b5eb265cd2995bdb335769c936c763 +P e365dca4e5775b4897118c8937a1063282d7a1ecc2604529256b0a6b8a3510ba +R fb035ed50ecd9dcfe4baa0545c9c7232 U dan -Z ba4534b9ca16705b4343f518cb36fba2 +Z 000725ab58aa79e849a1ff78f61507a0 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 34ffae9075..66baad4780 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e365dca4e5775b4897118c8937a1063282d7a1ecc2604529256b0a6b8a3510ba \ No newline at end of file +6b3546c871fe78a4e550e0144b48ac98325787cc8b192a9e7f5f2a2ffa57f76d \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 7c1acc8164..0990968189 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -1651,8 +1651,8 @@ static int unixFileLock(unixFile *pFile, struct flock *pLock){ ** ** UNLOCKED -> SHARED ** SHARED -> RESERVED -** SHARED -> (PENDING) -> EXCLUSIVE -** RESERVED -> EXCLUSIVE +** SHARED -> EXCLUSIVE +** RESERVED -> (PENDING) -> EXCLUSIVE ** PENDING -> EXCLUSIVE ** ** This routine will only increase a lock. Use the sqlite3OsUnlock() @@ -1684,19 +1684,20 @@ static int unixLock(sqlite3_file *id, int eFileLock){ ** A RESERVED lock is implemented by grabbing a write-lock on the ** 'reserved byte'. ** - ** A process may only obtain a PENDING lock after it has obtained a - ** SHARED lock. A PENDING lock is implemented by obtaining a write-lock - ** on the 'pending byte'. This ensures that no new SHARED locks can be - ** obtained, but existing SHARED locks are allowed to persist. A process - ** does not have to obtain a RESERVED lock on the way to a PENDING lock. - ** This property is used by the algorithm for rolling back a journal file - ** after a crash. + ** An EXCLUSIVE lock may only be requested after either a SHARED or + ** RESERVED lock is held. An EXCLUSIVE lock is implemented by obtaining + ** a write-lock on the entire 'shared byte range'. Since all other locks + ** require a read-lock on one of the bytes within this range, this ensures + ** that no other locks are held on the database. ** - ** An EXCLUSIVE lock, obtained after a PENDING lock is held, is - ** implemented by obtaining a write-lock on the entire 'shared byte - ** range'. Since all other locks require a read-lock on one of the bytes - ** within this range, this ensures that no other locks are held on the - ** database. + ** If a process that holds a RESERVED lock requests an EXCLUSIVE, then + ** a PENDING lock is obtained first. A PENDING lock is implemented by + ** obtaining a write-lock on the 'pending byte'. This ensures that no new + ** SHARED locks can be obtained, but existing SHARED locks are allowed to + ** persist. If the call to this function fails to obtain the EXCLUSIVE + ** lock in this case, it holds the PENDING lock intead. The client may + ** then re-attempt the EXCLUSIVE lock later on, after existing SHARED + ** locks have cleared. */ int rc = SQLITE_OK; unixFile *pFile = (unixFile*)id; From 54725efd806a410624e6a193f841e7793c732f59 Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 1 Feb 2023 15:41:07 +0000 Subject: [PATCH 25/65] Just because a CTE is used more than once, does not mean it should be tagged with M10d_Yes and thereby prohibited from participating in the query flattening optimization. See [forum:/forumpost/1d571c02963355ed|forum thread 1d571c02963]. FossilOrigin-Name: 66f29c403d28630bfaea9124bd63ee4a047b1fe4a7e27dc5d10d67d1601b15e0 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/select.c | 19 ++++++++++-------- test/with6.test | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 17 deletions(-) diff --git a/manifest b/manifest index 8db5bd8d45..18a6046fe0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\scomment\srelated\sto\sPENDING\slocks\sin\sos_unix.c.\sNo\scode\schanges. -D 2023-02-01T14:17:25.856 +C Just\sbecause\sa\sCTE\sis\sused\smore\sthan\sonce,\sdoes\snot\smean\sit\sshould\sbe\ntagged\swith\sM10d_Yes\sand\sthereby\sprohibited\sfrom\sparticipating\sin\sthe\nquery\sflattening\soptimization.\s\sSee\n[forum:/forumpost/1d571c02963355ed|forum\sthread\s1d571c02963]. +D 2023-02-01T15:41:07.645 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -620,7 +620,7 @@ F src/printf.c ff4b05e38bf928ff1b80d3dda4f977b10fe39ecbfe69c018224c7e5594fb2455 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 5a98a7bf277aa60584b6bb4c5dd6a9ef2b19537910612c34f596e2901e88596d F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92 -F src/select.c d389ccdb96855dbfaadc22d936889e1f0652ffca17e31a6b6522b45d99daa8ce +F src/select.c c3ce1b49cca2c66c8c88fe7d9e1f3db23590deb4dd631619ad90e1e5d21bcf1f F src/shell.c.in f7fd28e68269a58690c665e8a5e96ba242201267925fbd335f08695c79fc6db7 F src/sqlite.h.in d2a5fc1f6740bd02b571d33d2eb308fa7d1b0fac5b86f6f1fe8310cd49bca97d F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 @@ -1924,7 +1924,7 @@ F test/with2.test a1df41b987198383b9b70bf5e5fda390582e46398653858dbc6ceb24253b28 F test/with3.test e7bf809bf75c1f44f98bca78bc331dbf542002c5227bf53c1261144db4e824c8 F test/with4.test 257be66c0c67fee1defbbac0f685c3465e2cad037f21ce65f23f86084f198205 F test/with5.test 6248213c41fab36290b5b73aa3f937309dfba337004d9d8434c3fabc8c7d4be8 -F test/with6.test ae570b31bf1f6fab6210fb1caf6dfa9a6d69c0e6633beb905583bb158a5e309e +F test/with6.test 7afab289442bd0a023c18deef854642932294fa63cdb885a4b4db69e28c5fbf9 F test/withM.test 693b61765f2b387b5e3e24a4536e2e82de15ff64 F test/without_rowid1.test a5210b8770dc4736bca4e74bc96588f43025ad03ad6a80f885afd36d9890e217 F test/without_rowid2.test af260339f79d13cb220288b67cd287fbcf81ad99 @@ -2046,8 +2046,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P e365dca4e5775b4897118c8937a1063282d7a1ecc2604529256b0a6b8a3510ba -R fb035ed50ecd9dcfe4baa0545c9c7232 -U dan -Z 000725ab58aa79e849a1ff78f61507a0 +P 6b3546c871fe78a4e550e0144b48ac98325787cc8b192a9e7f5f2a2ffa57f76d +R 70533f1fdb382e48eceffd4225281dd8 +U drh +Z 915bf0e8238a05acb8b086524ea9263b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 66baad4780..3fedf45517 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6b3546c871fe78a4e550e0144b48ac98325787cc8b192a9e7f5f2a2ffa57f76d \ No newline at end of file +66f29c403d28630bfaea9124bd63ee4a047b1fe4a7e27dc5d10d67d1601b15e0 \ No newline at end of file diff --git a/src/select.c b/src/select.c index d27bed026f..b0e303066a 100644 --- a/src/select.c +++ b/src/select.c @@ -5626,9 +5626,6 @@ static int resolveFromTermToCte( pFrom->fg.isCte = 1; pFrom->u2.pCteUse = pCteUse; pCteUse->nUse++; - if( pCteUse->nUse>=2 && pCteUse->eM10d==M10d_Any ){ - pCteUse->eM10d = M10d_Yes; - } /* Check if this is a recursive CTE. */ pRecTerm = pSel = pFrom->pSelect; @@ -6911,8 +6908,10 @@ static int sameSrcAlias(SrcItem *p0, SrcList *pSrc){ ** being used as the outer loop if the sqlite3WhereBegin() ** routine nominates it to that position. ** (iii) The query is not a UPDATE ... FROM -** (2) The subquery is not a CTE that should be materialized because of -** the AS MATERIALIZED keywords +** (2) The subquery is not a CTE that should be materialized because +** (a) the AS MATERIALIZED keyword is used, or +** (b) the CTE is used multiple times and does not have the +** NOT MATERIALIZED keyword ** (3) The subquery is not part of a left operand for a RIGHT JOIN ** (4) The SQLITE_Coroutine optimization disable flag is not set ** (5) The subquery is not self-joined @@ -6924,9 +6923,13 @@ static int fromClauseTermCanBeCoroutine( int selFlags /* Flags on the SELECT statement */ ){ SrcItem *pItem = &pTabList->a[i]; - if( pItem->fg.isCte && pItem->u2.pCteUse->eM10d==M10d_Yes ) return 0;/* (2) */ - if( pTabList->a[0].fg.jointype & JT_LTORJ ) return 0; /* (3) */ - if( OptimizationDisabled(pParse->db, SQLITE_Coroutines) ) return 0; /* (4) */ + if( pItem->fg.isCte ){ + const CteUse *pCteUse = pItem->u2.pCteUse; + if( pCteUse->eM10d==M10d_Yes ) return 0; /* (2a) */ + if( pCteUse->nUse>=2 && pCteUse->eM10d!=M10d_No ) return 0; /* (2b) */ + } + if( pTabList->a[0].fg.jointype & JT_LTORJ ) return 0; /* (3) */ + if( OptimizationDisabled(pParse->db, SQLITE_Coroutines) ) return 0; /* (4) */ if( isSelfJoinView(pTabList, pItem, i+1, pTabList->nSrc)!=0 ){ return 0; /* (5) */ } diff --git a/test/with6.test b/test/with6.test index 7fce34687e..91d64fa297 100644 --- a/test/with6.test +++ b/test/with6.test @@ -318,5 +318,56 @@ do_eqp_test 331 { `--SCAN t3 } +# 2023-02-01 +# https://sqlite.org/forum/forumpost/1d571c02963355ed +# +# Just because a CTE is used more than once, does not mean it should be +# marked with M10d_Yes and hence prohibited from participating in the +# query flattening optimization. +# +reset_db +db eval { + CREATE TABLE raw(country,date,total,delta, UNIQUE(country,date)); +} +do_eqp_test 400 { + with recursive + init(country, date, fin) AS (SELECT country, min(date), max(date) FROM raw WHERE total > 0 GROUP BY country), + src(country, date) AS (SELECT raw.country, raw.date + FROM raw JOIN init i on raw.country = i.country AND raw.date > i.date + ORDER BY raw.country, raw.date), + vals(country, date, x, y) AS (SELECT src.country, src.date, julianday(raw.date) - julianday(src.date), log(delta+1) + FROM src JOIN raw on raw.country = src.country AND raw.date > date(src.date,'-7 days') AND raw.date <= src.date AND delta >= 0), + sums(country, date, x2, x, n, xy, y) AS (SELECT country, date, sum(x*x*1.0), sum(x*1.0), sum(1.0), sum(x*y*1.0), sum(y*1.0) FROM vals GROUP BY 1, 2), + mult(country, date, m) AS (SELECT country, date, 1.0/(x2 * n - x * x) FROM sums), + inv(country, date, a,b,c,d) AS (SELECT mult.country, mult.date, n * m, -x * m, -x * m, x2 * m + FROM mult JOIN sums on sums.country=mult.country AND mult.date=sums.date), + fit(country, date, a, b) AS (SELECT inv.country, inv.date, a * xy + b * y, c * xy + d * y + FROM inv + JOIN mult on mult.country = inv.country AND mult.date = inv.date + JOIN sums on sums.country = mult.country AND sums.date = mult.date + ) + SELECT *, nFin/nPrev - 1 AS growth, log(2)/log(nFin/nPrev) AS doubling + FROM (SELECT f.*, exp(b) - 1 AS nFin, exp(a* (-1) + b) - 1 AS nPrev + FROM fit f JOIN init i on i.country = f.country AND f.date <= date(i.fin,'-3 days')) + WHERE nPrev > 0 AND nFin > 0; +} { + QUERY PLAN + |--MATERIALIZE sums + | |--MATERIALIZE src + | | |--MATERIALIZE init + | | | `--SCAN raw USING INDEX sqlite_autoindex_raw_1 + | | |--SCAN i + | | |--SEARCH raw USING COVERING INDEX sqlite_autoindex_raw_1 (country=? AND date>?) + | | `--USE TEMP B-TREE FOR ORDER BY + | |--SCAN src + | |--SEARCH raw USING INDEX sqlite_autoindex_raw_1 (country=? AND date>? AND date Date: Wed, 1 Feb 2023 20:14:59 +0000 Subject: [PATCH 26/65] Update testrunner.tcl to use a separate process for each test script. And to run some extra tests too. FossilOrigin-Name: d090948a69a9c4b86693bd3caedba3d7e5883e4b2ad1f2d4bf7ae14c105ddea7 --- ext/recover/recover1.test | 12 +- ext/rtree/rtreecheck.test | 15 +- manifest | 36 +- manifest.uuid | 2 +- test/distinctagg.test | 1 + test/pager2.test | 2 + test/permutations.test | 5 +- test/sort4.test | 2 + test/tester.tcl | 15 +- test/testrunner.tcl | 986 +++++++++++++++++++------------------- test/testrunner_data.tcl | 123 +++++ test/vt02.c | 6 + test/windowB.test | 3 +- 13 files changed, 674 insertions(+), 534 deletions(-) create mode 100644 test/testrunner_data.tcl diff --git a/ext/recover/recover1.test b/ext/recover/recover1.test index 3e8a691492..fef1bf90f4 100644 --- a/ext/recover/recover1.test +++ b/ext/recover/recover1.test @@ -275,11 +275,13 @@ do_recover_test 15 #------------------------------------------------------------------------- reset_db -do_execsql_test 16.1 { - PRAGMA journal_mode = wal; - CREATE TABLE t1(x); - INSERT INTO t1 VALUES(1), (2), (3); -} {wal} +do_test 16.1 { + execsql { PRAGMA journal_mode = wal } + execsql { + CREATE TABLE t1(x); + INSERT INTO t1 VALUES(1), (2), (3); + } +} {} do_test 16.2 { set R [sqlite3_recover_init db main test.db2] $R run diff --git a/ext/rtree/rtreecheck.test b/ext/rtree/rtreecheck.test index 1754ff5c3d..ff5397e1e1 100644 --- a/ext/rtree/rtreecheck.test +++ b/ext/rtree/rtreecheck.test @@ -167,9 +167,18 @@ do_execsql_test 6.0 { } db close sqlite3 db test.db -do_catchsql_test 6.1 { - SELECT ( 'elvis' IN(SELECT rtreecheck('t1')) ) FROM (SELECT 1) GROUP BY 1; -} {1 {database table is locked}} + +if {[permutation]=="inmemory_journal"} { + # This doesn't hit an SQLITE_LOCKED in this permutation as the schema + # has already been loaded. + do_catchsql_test 6.1.inmemory_journal { + SELECT ( 'elvis' IN(SELECT rtreecheck('t1')) ) FROM (SELECT 1) GROUP BY 1; + } {0 0} +} else { + do_catchsql_test 6.1 { + SELECT ( 'elvis' IN(SELECT rtreecheck('t1')) ) FROM (SELECT 1) GROUP BY 1; + } {1 {database table is locked}} +} finish_test diff --git a/manifest b/manifest index 18a6046fe0..2558c1e997 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Just\sbecause\sa\sCTE\sis\sused\smore\sthan\sonce,\sdoes\snot\smean\sit\sshould\sbe\ntagged\swith\sM10d_Yes\sand\sthereby\sprohibited\sfrom\sparticipating\sin\sthe\nquery\sflattening\soptimization.\s\sSee\n[forum:/forumpost/1d571c02963355ed|forum\sthread\s1d571c02963]. -D 2023-02-01T15:41:07.645 +C Update\stestrunner.tcl\sto\suse\sa\sseparate\sprocess\sfor\seach\stest\sscript.\sAnd\sto\srun\ssome\sextra\stests\stoo. +D 2023-02-01T20:14:59.965 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -365,7 +365,7 @@ F ext/rbu/sqlite3rbu.c 348bb6251e6ec459de102f8b2dd50789a98643ef7a28e56e4c787ac96 F ext/rbu/sqlite3rbu.h 9d923eb135c5d04aa6afd7c39ca47b0d1d0707c100e02f19fdde6a494e414304 F ext/rbu/test_rbu.c ee6ede75147bc081fe9bc3931e6b206277418d14d3fbceea6fdc6216d9b47055 F ext/recover/dbdata.c dc25628e405c86936c597e28f3e6f56a257029c3034c5ef7f6b10f7c02f41018 -F ext/recover/recover1.test 2a2df2943d6696f9487e75868feae4b1511c4a511b102854ba0d2af0326d9dfb +F ext/recover/recover1.test 2072993624d5e32fef20ae03b17fc06c02bcb344421fe17bb329b24d2a51e647 F ext/recover/recover_common.tcl a61306c1eb45c0c3fc45652c35b2d4ec19729e340bdf65a272ce4c229cefd85a F ext/recover/recoverclobber.test 3ba6c0c373c5c63d17e82eced64c05c57ccaf26c1abe1ca7141334022a79f32e F ext/recover/recovercorrupt.test 64c081ad1200ae77b447da99eb724785d6bf71715f394543dc7689642e92bf49 @@ -413,7 +413,7 @@ F ext/rtree/rtreeH.test 0885151ee8429242625600ae47142cca935332c70a06737f35af53a7 F ext/rtree/rtreeI.test 608e77f7fde9be5a12eae316baef640fffaafcfa90a3d67443e78123e19c4ca4 F ext/rtree/rtree_perf.tcl 6c18c1f23cd48e0f948930c98dfdd37dfccb5195 F ext/rtree/rtree_util.tcl db734b4c5e75fed6acc56d9701f2235345acfdec750b5fc7b587936f5f6bceed -F ext/rtree/rtreecheck.test e53fc47fb727d7ffa17ea79fecfe3e709815b65233c11464a0b8f1f4ac0cb50a +F ext/rtree/rtreecheck.test 4e859a9cd49d2353ff10c122f72183ec37b400e35d2b0349b2e9696649b6a00e F ext/rtree/rtreecirc.test aec664eb21ae943aeb344191407afff5d392d3ae9d12b9a112ced0d9c5de298e F ext/rtree/rtreeconnect.test 225ad3fcb483d36cbee423a25052a6bbae762c9576ae9268332360c68c170d3d F ext/rtree/rtreedoc.test 27a5703cb1200f6f69051de68da546cef3dfdcf59be73afadfc50b9f9c9960d9 @@ -936,7 +936,7 @@ F test/descidx3.test 953c831df7ea219c73826dfbf2f6ee02d95040725aa88ccb4fa43d1a199 F test/diskfull.test 106391384780753ea6896b7b4f005d10e9866b6e F test/distinct.test a7687c2fb50c93f6a486936c51439a93221c6e1188f9bc7b27b3ec26f9c58b1e F test/distinct2.test cd1d15a4a2abf579298f7161e821ed50c0119136fe0424db85c52cf0adc230d1 -F test/distinctagg.test d76ef2e91fe810630c176d6bd0a58c14d5851c3125f0a1d977db87ba76359639 +F test/distinctagg.test 14ec5026e684eddd414c61c08692b43773e224ac92efbed6ec08c6994bc39723 F test/e_blobbytes.test 4c01dfe4f12087b92b20705a3fdfded45dc4ed16d5a211fed4e1d2786ba68a52 F test/e_blobclose.test 692fc02a058476c2222a63d97e3f3b2b809c1842e5525ded7f854d540ac2e075 F test/e_blobopen.test 29f6055ee453b8e679fe9570c4d3acfedbef821622c5dad16875148c5952ef50 @@ -1360,7 +1360,7 @@ F test/ossfuzz.c 9636dad2092a05a32110df0ca06713038dd0c43dd89a77dabe4b8b0d7109671 F test/ossshell.c f125c5bd16e537a2549aa579b328dd1c59905e7ab1338dfc210e755bb7b69f17 F test/ovfl.test 199c482696defceacee8c8e0e0ef36da62726b2f F test/pager1.test ffd885cdc98b986c9f746496508c0c4810ed0eaade3575ddf53c222e85880552 -F test/pager2.test 67b8f40ae98112bcdba1f2b2d03ea83266418c71 +F test/pager2.test 57ce815e31a7509fcdf7c5474577fd2e9cfee1281d45601e0f7a3bd5534d70a4 F test/pager3.test 4e9a83d6ca0838d7c602c9eb93d1357562d9059c1e02ffb138a8271020838370 F test/pager4.test a122e9e6925d5b23b31e3dfef8c6a44bbf19590e F test/pagerfault.test 63c5da625562c66345ab4528790327ca63db2f6f9cbae2aba8cb7c51de3d1628 @@ -1373,7 +1373,7 @@ F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442 F test/pendingrace.test fb997b46d6c144a508fb8025d988a1e511b53d42d24143c57b51de3a405c7490 F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff -F test/permutations.test 4705a032bbfef531bb3fd98b8c6ba4a739998949eae9ac0ea97c8696b331211d +F test/permutations.test 3a202a870735688a85c03c880a0560ce5a39d7360d5e26469594f365bca9e2b9 F test/pg_common.tcl 3b27542224db1e713ae387459b5d117c836a5f6e328846922993b6d2b7640d9f F test/pragma.test a74a9c9642e5d7e32f5a2aa77a2ed64ec5b69fecff39d52c4daf5945a2a4de65 F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f @@ -1508,7 +1508,7 @@ F test/softheap1.test 843cd84db9891b2d01b9ab64cef3e9020f98d087 F test/sort.test f86751134159abb5e5fd4381a0d7038c91013638cd1e3fa1d7850901f6df6196 F test/sort2.test cc23b7c19d684657559e8a55b02f7fcee03851d0 F test/sort3.test 1480ed7c4c157682542224e05e3b75faf4a149e5 -F test/sort4.test 5c34d9623a4ae5921d956dfa2b70e77ed0fc6e5c +F test/sort4.test cca6f4b0b5255882645bbbe346a6a9f4a5c7b6a18513a6a7bf4ac1c4761ddc19 F test/sort5.test 6b43ae0e2169b5ceed441844492e55ba7f1ae0790528395ddf7888ab3094525d F test/sorterref.test 9a606c86a4c682db5eeaaefa0565b52102778db53e48ca7101cd4f9ebcc0ad94 F test/sortfault.test d4ccf606a0c77498e2beb542764fd9394acb4d66 @@ -1564,8 +1564,9 @@ F test/temptable.test d2c9b87a54147161bcd1822e30c1d1cd891e5b30 F test/temptable2.test 76821347810ecc88203e6ef0dd6897b6036ac788e9dd3e6b04fd4d1631311a16 F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637 F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc -F test/tester.tcl e72c337f01e47c2833c83288b60e0a1730165cc7de7b59724e925c4ce026c0a1 -F test/testrunner.tcl 407fc02be0c859ef7a85b9431de9c5aa79363cab822ecbee3500a0daeb6b82cd +F test/tester.tcl 8d54d40a55e12554b4509bc12078b201b233c8e842a7543629094a21b1ba956d +F test/testrunner.tcl de0f2922631fc1cd43903e6e28fb69d01f09685c4e52bceea9da4f051dc03dab +F test/testrunner_data.tcl 7c9e97b0caea7420e29bbc731eef7e44a27781c192c4c9e4c605c74ed81a9d2f F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899 F test/thread002.test c24c83408e35ba5a952a3638b7ac03ccdf1ce4409289c54a050ac4c5f1de7502 F test/thread003.test ee4c9efc3b86a6a2767516a37bd64251272560a7 @@ -1801,7 +1802,7 @@ F test/veryquick.test 57ab846bacf7b90cf4e9a672721ea5c5b669b661 F test/view.test d4c4281e1679245829db35597817282f60dc513fc39cc5439078f009bd118487 F test/view2.test db32c8138b5b556f610b35dfddd38c5a58a292f07fda5281eedb0851b2672679 F test/view3.test ad8a8290ee2b55ff6ce66c9ef1ce3f1e47926273a3814e1c425293e128a95456 -F test/vt02.c 33ecddc0832d4cd24e9e9fa83d868981b1e049462f4ec9080710353f6479a534 +F test/vt02.c 86253b57d6bc2170dfca33f45fd099b66d0bf874e95ecd7786dcbb134f179469 F test/vtab1.test 09a72330d0f31eda2ffaa828b06a6b917fb86250ee72de0301570af725774c07 F test/vtab2.test 14d4ab26cee13ba6cf5c5601b158e4f57552d3b055cdd9406cf7f711e9c84082 F test/vtab3.test b45f47d20f225ccc9c28dc915d92740c2dee311e @@ -1911,7 +1912,7 @@ F test/window8.tcl 5e02e41d9d9a80f597063aed1a381eb19d1d0ef677a4f0df352c5365cf23f F test/window8.test 4ab16817414af0c904abe2ebdf88eb6c2b00058b84f9748c6174ff11fc45f1ed F test/window9.test 349c71eab4288a1ffc19e2f65872ec2c37e6cf8a1dda2ad300364b7450ae4836 F test/windowA.test 6d63dc1260daa17141a55007600581778523a8b420629f1282d2acfc36af23be -F test/windowB.test 57f9fb931ed5e04f17db4fcb7059e76026079daf451aac27e54d41217078039b +F test/windowB.test cf1278912c7a059763c49cbd6e1b3213b5e9b9d87a5b22714c63808fc33bc8d5 F test/windowC.test 6fd75f5bb2f1343d34e470e36e68f0ff638d8a42f6aa7d99471261b31a0d42f2 F test/windowD.test 65cf5a765fb8072450e8a0de2979ce7f09a38d87724fe1280c6444073e3da49b F test/windowE.test 6ba0c8048e4cc02b942e56640f8fcd50fd7ca72c876656c40f6baf42e316684c @@ -2046,8 +2047,11 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 6b3546c871fe78a4e550e0144b48ac98325787cc8b192a9e7f5f2a2ffa57f76d -R 70533f1fdb382e48eceffd4225281dd8 -U drh -Z 915bf0e8238a05acb8b086524ea9263b +P 66f29c403d28630bfaea9124bd63ee4a047b1fe4a7e27dc5d10d67d1601b15e0 +R 06a2d845016cccabda66a252a397ec86 +T *branch * testrunner +T *sym-testrunner * +T -sym-trunk * +U dan +Z a224100f94ae40bc55815239c2a30b96 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 3fedf45517..feab0b951a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -66f29c403d28630bfaea9124bd63ee4a047b1fe4a7e27dc5d10d67d1601b15e0 \ No newline at end of file +d090948a69a9c4b86693bd3caedba3d7e5883e4b2ad1f2d4bf7ae14c105ddea7 \ No newline at end of file diff --git a/test/distinctagg.test b/test/distinctagg.test index a34312ef98..6e46c88616 100644 --- a/test/distinctagg.test +++ b/test/distinctagg.test @@ -184,6 +184,7 @@ foreach {tn use_t3 sql res} { 10 1 "SELECT count(DISTINCT x) FROM t1 LEFT JOIN t3 ON (t3.x=0)" 0 } { + unset -nocomplain a do_test 5.$tn.1 { set bUse 0 db eval "EXPLAIN $sql" a { diff --git a/test/pager2.test b/test/pager2.test index 0e2b33b833..1d78b30f5a 100644 --- a/test/pager2.test +++ b/test/pager2.test @@ -165,4 +165,6 @@ do_test pager2-3.1 { list [catch { db3 eval { INSERT INTO t1 VALUES(3, 4) } } msg] $msg } {1 {no such table: t1}} +db1 close + finish_test diff --git a/test/permutations.test b/test/permutations.test index 1b44ba52bf..79e549c138 100644 --- a/test/permutations.test +++ b/test/permutations.test @@ -99,6 +99,7 @@ foreach f [glob -nocomplain \ foreach f [glob -nocomplain $testdir/../ext/session/*.test] { lappend alltests $f } +unset f if {$::tcl_platform(platform)!="unix"} { set alltests [test_set $alltests -exclude crash.test crash2.test] @@ -115,7 +116,7 @@ set allquicktests [test_set $alltests -exclude { corruptC.test crash.test crash2.test crash3.test crash4.test crash5.test crash6.test crash7.test delete3.test e_fts3.test fts3rnd.test fkey_malloc.test fuzz.test fuzz3.test fuzz_malloc.test in2.test loadext.test - misc7.test mutex2.test notify2.test onefile.test pagerfault2.test + misc7.test mutex2.test onefile.test pagerfault2.test savepoint4.test savepoint6.test select9.test speed1.test speed1p.test speed2.test speed3.test speed4.test speed4p.test sqllimits1.test tkt2686.test thread001.test thread002.test @@ -915,6 +916,8 @@ ifcapable threadsafe { autoinstall_test_functions } -shutdown { catch {db close} + catch {db2 close} + catch {db3 close} sqlite3_shutdown install_mutex_counters 0 sqlite3_initialize diff --git a/test/sort4.test b/test/sort4.test index 13d9a5999a..84125885ab 100644 --- a/test/sort4.test +++ b/test/sort4.test @@ -8,6 +8,8 @@ # May you share freely, never taking more than you give. # #*********************************************************************** +# TESTRUNNER: superslow +# # This file implements regression tests for SQLite library. # # The tests in this file are brute force tests of the multi-threaded diff --git a/test/tester.tcl b/test/tester.tcl index 022dad900d..4658590cf4 100644 --- a/test/tester.tcl +++ b/test/tester.tcl @@ -552,6 +552,7 @@ if {[info exists cmdlinearg]==0} { } } } + unset -nocomplain a set testdir [file normalize $testdir] set cmdlinearg(TESTFIXTURE_HOME) [pwd] set cmdlinearg(INFO_SCRIPT) [file normalize [info script]] @@ -1318,9 +1319,11 @@ proc finalize_testing {} { if {$::cmdlinearg(binarylog)} { vfslog finalize binarylog } - if {$sqlite_open_file_count} { - output2 "$sqlite_open_file_count files were left open" - incr nErr + if {[info exists ::run_thread_tests_called]==0} { + if {$sqlite_open_file_count} { + output2 "$sqlite_open_file_count files were left open" + incr nErr + } } if {[lindex [sqlite3_status SQLITE_STATUS_MALLOC_COUNT 0] 1]>0 || [sqlite3_memory_used]>0} { @@ -2502,8 +2505,10 @@ proc test_restore_config_pagecache {} { catch {db3 close} sqlite3_shutdown - eval sqlite3_config_pagecache $::old_pagecache_config - unset ::old_pagecache_config + if {[info exists ::old_pagecache_config]} { + eval sqlite3_config_pagecache $::old_pagecache_config + unset ::old_pagecache_config + } sqlite3_initialize autoinstall_test_functions sqlite3 db test.db diff --git a/test/testrunner.tcl b/test/testrunner.tcl index 48afff47e6..2e3ad1193b 100644 --- a/test/testrunner.tcl +++ b/test/testrunner.tcl @@ -1,4 +1,6 @@ +source [file join [file dirname [info script]] testrunner_data.tcl] + #------------------------------------------------------------------------- # Usage: # @@ -47,38 +49,77 @@ proc usage {} { } #------------------------------------------------------------------------- + +# If this script is invoked using: +# +# testrunner.tcl helper