aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--auto.def2
-rw-r--r--autoconf/auto.def2
-rw-r--r--autosetup/sqlite-config.tcl36
-rw-r--r--doc/compile-for-windows.md9
-rw-r--r--ext/session/session1.test2
-rw-r--r--ext/session/session9.test4
-rw-r--r--ext/session/sessionnoact.test66
-rw-r--r--ext/session/sqlite3session.c5
-rw-r--r--ext/wasm/README-dist.txt12
-rw-r--r--ext/wasm/README.md9
-rw-r--r--ext/wasm/api/README.md24
-rw-r--r--main.mk2
-rw-r--r--manifest48
-rw-r--r--manifest.uuid2
-rw-r--r--src/expr.c5
-rw-r--r--src/tclsqlite.c8
-rw-r--r--src/vdbe.h1
-rw-r--r--test/capi3.test4
-rw-r--r--test/in7.test29
-rw-r--r--tool/buildtclext.tcl2
-rw-r--r--tool/emcc.sh.in2
21 files changed, 208 insertions, 66 deletions
diff --git a/auto.def b/auto.def
index dade81613..52c758850 100644
--- a/auto.def
+++ b/auto.def
@@ -275,8 +275,6 @@ sqlite-handle-load-extension
sqlite-handle-math
sqlite-handle-icu
sqlite-handle-emsdk
-sqlite-handle-common-feature-flags
-sqlite-show-feature-flags
sqlite-process-dot-in-files
sqlite-post-config-validation
sqlite-dump-defines
diff --git a/autoconf/auto.def b/autoconf/auto.def
index 0f36e733c..12eb3d75c 100644
--- a/autoconf/auto.def
+++ b/autoconf/auto.def
@@ -90,8 +90,6 @@ sqlite-handle-line-editing
sqlite-handle-load-extension
sqlite-handle-math
sqlite-handle-icu
-sqlite-handle-common-feature-flags
-sqlite-show-feature-flags
define ENABLE_LIB_SHARED [opt-bool shared]
define ENABLE_LIB_STATIC [opt-bool static]
diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl
index 40941687e..9f300e317 100644
--- a/autosetup/sqlite-config.tcl
+++ b/autosetup/sqlite-config.tcl
@@ -226,6 +226,24 @@ proc sqlite-setup-default-cflags {} {
define CFLAGS [proj-get-env CFLAGS $defaultCFlags]
# BUILD_CFLAGS is the CFLAGS for CC_FOR_BUILD.
define BUILD_CFLAGS [proj-get-env BUILD_CFLAGS {-g}]
+
+ # Copy all CFLAGS entries matching -DSQLITE_OMIT* and
+ # -DSQLITE_ENABLE* to OPT_FEATURE_FLAGS. This behavior is derived
+ # from the legacy build and was missing the 3.48.0 release (the
+ # initial Autosetup port).
+ # https://sqlite.org/forum/forumpost/9801e54665afd728
+ #
+ # If any configure flags for features are in conflict with
+ # CFLAGS-specified feature flags, all bets are off. There are no
+ # guarantees about which one will take precedence.
+ foreach cf [get-define CFLAGS ""] {
+ switch -glob -- $cf {
+ -DSQLITE_OMIT* -
+ -DSQLITE_ENABLE* {
+ sqlite-add-feature-flag $cf
+ }
+ }
+ }
}
########################################################################
@@ -293,8 +311,9 @@ proc sqlite-handle-common-feature-flags {} {
}
#########################################################################
-# Show the final feature flag sets.
-proc sqlite-show-feature-flags {} {
+# Remove duplicates from the final feature flag sets and show them to
+# the user.
+proc sqlite-finalize-feature-flags {} {
set oFF [get-define OPT_FEATURE_FLAGS]
if {"" ne $oFF} {
define OPT_FEATURE_FLAGS [lsort -unique $oFF]
@@ -305,7 +324,6 @@ proc sqlite-show-feature-flags {} {
define OPT_SHELL [lsort -unique $oFF]
msg-result "Shell options: [get-define OPT_SHELL]"
}
- #parray ::sqliteConfig
}
########################################################################
@@ -844,13 +862,21 @@ proc sqlite-handle-math {} {
}
########################################################################
-# Generate the configure-process output file(s).
+# Perform some late-stage work and generate the configure-process
+# output file(s).
proc sqlite-process-dot-in-files {} {
########################################################################
# When cross-compiling, we have to avoid using the -s flag to
- # /usr/bin/install: https://sqlite.org/forum/forumpost/9a67df63eda9925c
+ # /usr/bin/install:
+ # https://sqlite.org/forum/forumpost/9a67df63eda9925c
define IS_CROSS_COMPILING $::sqliteConfig(is-cross-compiling)
+ # Finish up handling of the various feature flags here because it's
+ # convenient for both the canonical build and autoconf bundles that
+ # it be done here.
+ sqlite-handle-common-feature-flags
+ sqlite-finalize-feature-flags
+
########################################################################
# "Re-export" the autoconf-conventional --XYZdir flags into something
# which is more easily overridable from a make invocation. See the docs
diff --git a/doc/compile-for-windows.md b/doc/compile-for-windows.md
index 717569dd7..2e6228633 100644
--- a/doc/compile-for-windows.md
+++ b/doc/compile-for-windows.md
@@ -43,8 +43,13 @@ systems, including MacOS.
or <https://sqlite.org/tmp/tcl9.0.0.tar.gz>.
<li>Untar or unzip the source archive. CD into the "win/" subfolder
of the source tree.
- <li>Run: `nmake /f makefile.vc release`
- <li>Run: `nmake /f makefile.vc INSTALLDIR=c:\Tcl install`
+ <li>Run: `nmake /f makefile.vc INSTALLDIR=c:\Tcl release`
+ <li>Run: `nmake /f makefile.vc INSTALLDIR=c:\Tcl install` <br>
+ Notes:
+ <ol type="i">
+ <li> The previous two `nmake` commands must be run separately.
+ <li> Also, the INSTALLDIR=... argument is required on both.
+ </ol>
<li><i>Optional:</i> CD to `c:\Tcl\bin` and make a copy of
`tclsh90.exe` over into just `tclsh.exe`.
<li><i>Optional:</i>
diff --git a/ext/session/session1.test b/ext/session/session1.test
index dfc1aa895..6da905179 100644
--- a/ext/session/session1.test
+++ b/ext/session/session1.test
@@ -285,7 +285,7 @@ do_conflict_test $tn.3.2.3 -tables t2 -sql {
{FOREIGN_KEY 1}
}
do_execsql_test $tn.3.2.4 "SELECT * FROM t2" {}
-do_db2_test $tn.3.2.5 "SELECT * FROM t2" {1 one 2 two 4 five}
+do_db2_test $tn.3.2.5 "SELECT * FROM t2" {4 five}
# Test UPDATE changesets.
#
diff --git a/ext/session/session9.test b/ext/session/session9.test
index 6b7d1648b..5c406c344 100644
--- a/ext/session/session9.test
+++ b/ext/session/session9.test
@@ -80,7 +80,7 @@ foreach {tn delrow trans conflictargs conflictret} {
8 3 1 {FOREIGN_KEY 1} ABORT
} {
- set A(OMIT,0) {1 SQLITE_CONSTRAINT}
+ set A(OMIT,0) {0 {}}
set A(OMIT,1) {0 {}}
set A(ABORT,0) {1 SQLITE_CONSTRAINT}
set A(ABORT,1) {1 SQLITE_CONSTRAINT}
@@ -95,7 +95,7 @@ foreach {tn delrow trans conflictargs conflictret} {
do_test 1.2.$tn.2 { set ::xConflict } $conflictargs
- set A(OMIT,0) {0 0}
+ set A(OMIT,0) {1 1}
set A(OMIT,1) {1 1}
set A(ABORT,0) {0 0}
set A(ABORT,1) {0 0}
diff --git a/ext/session/sessionnoact.test b/ext/session/sessionnoact.test
index e447bc8a1..54e9a6215 100644
--- a/ext/session/sessionnoact.test
+++ b/ext/session/sessionnoact.test
@@ -59,7 +59,7 @@ do_execsql_test 1.2 {
set ::nConflict 0
proc conflict {args} {
incr ::nConflict
- return "OMIT"
+ return "ABORT"
}
sqlite3changeset_apply_v2 db $C conflict
@@ -111,6 +111,9 @@ do_execsql_test 1.8 {
# Check that a changeset that causes an FK violation may not be applied,
# even if SQLITE_CHANGESETAPPLY_FKNOACTION is specified.
#
+# UPDATE: Unless the conflict-handler returns OMIT. In that case it can
+# be committed. See test cases 3.* in this file.
+#
reset_db
do_execsql_test 2.0 {
CREATE TABLE p1(a INTEGER PRIMARY KEY, b, c UNIQUE);
@@ -164,5 +167,66 @@ do_execsql_test 2.8 {
SELECT * FROM c1;
} {two}
+#-------------------------------------------------------------------------
+#
+reset_db
+do_execsql_test 3.0 {
+ CREATE TABLE p1(a INTEGER PRIMARY KEY, b, c UNIQUE);
+ INSERT INTO p1 VALUES(1, 1, 'one');
+ INSERT INTO p1 VALUES(2, 2, 'two');
+
+ CREATE TABLE c1(x REFERENCES p1(c) ON DELETE CASCADE);
+ INSERT INTO c1 VALUES('two');
+}
+
+set ::nConflict 0
+proc conflict {args} {
+ incr ::nConflict
+ return "OMIT"
+}
+
+db_save
+
+set C [changeset_from_sql {
+ DELETE FROM p1 WHERE a=2;
+}]
+
+db_restore_and_reopen
+
+do_test 3.1 {
+ sqlite3changeset_apply_v2 -noaction db $C conflict
+} {}
+do_execsql_test 3.2 {
+ SELECT * FROM p1
+} {1 1 one}
+
+db_restore_and_reopen
+db eval { PRAGMA foreign_keys = 1 }
+
+do_test 3.3 {
+ list [catch { sqlite3changeset_apply_v2 -noaction db $C conflict } msg] $msg
+} {0 {}}
+do_execsql_test 3.4 {
+ SELECT * FROM p1;
+} {1 1 one}
+do_execsql_test 3.5 {
+ SELECT * FROM c1;
+} {two}
+
+db_restore_and_reopen
+db eval { PRAGMA foreign_keys = 1 }
+
+do_test 3.6 {
+ list [catch {
+ sqlite3changeset_apply_v2 -ignorenoop -noaction db $C conflict
+ } msg] $msg
+} {0 {}}
+do_execsql_test 3.7 {
+ SELECT * FROM p1;
+} {1 1 one}
+do_execsql_test 3.8 {
+ SELECT * FROM c1;
+} {two}
+
finish_test
diff --git a/ext/session/sqlite3session.c b/ext/session/sqlite3session.c
index d78dd9b06..66b21d63a 100644
--- a/ext/session/sqlite3session.c
+++ b/ext/session/sqlite3session.c
@@ -5318,6 +5318,11 @@ static int sessionChangesetApply(
}
}
+ {
+ int rc2 = sqlite3_exec(db, "PRAGMA defer_foreign_keys = 0", 0, 0, 0);
+ if( rc==SQLITE_OK ) rc = rc2;
+ }
+
if( (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT)==0 ){
if( rc==SQLITE_OK ){
rc = sqlite3_exec(db, "RELEASE changeset_apply", 0, 0, 0);
diff --git a/ext/wasm/README-dist.txt b/ext/wasm/README-dist.txt
index 6656a2072..4a527fc5e 100644
--- a/ext/wasm/README-dist.txt
+++ b/ext/wasm/README-dist.txt
@@ -31,16 +31,20 @@ build:
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:
+demonstration apps require a web server and that server must, for the
+OPFS[^1]-related features, 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.
+Most functionality will work without those headers but the OPFS[^1]
+storage capability will not be available without them.
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:
althttpd --enable-sab --page index.html
+
+
+[^1]: https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Origin_private_file_system
diff --git a/ext/wasm/README.md b/ext/wasm/README.md
index 21330f0eb..c41e54bd2 100644
--- a/ext/wasm/README.md
+++ b/ext/wasm/README.md
@@ -35,7 +35,7 @@ after upgrading it! Our build process makes no guarantees about which
Emscripten version(s) will or won't work, but it's important that
production builds are built using a compatible version. During active
development, the EMSDK is frequently updated, the goal being to keep
-sqlite3.wasm working with "the latest" EMSDK.)
+`sqlite3.wasm` working with "the latest" EMSDK.)
The SQLite configure script will search for the EMSDK. One way
to ensure that it finds it is:
@@ -95,14 +95,14 @@ $ make httpd
That will open the system's browser and visit the index page, from
which (almost) all of the test and demo applications can be accessed.
(`ext/wasm/SQLTester` is not listed in that page because it's only of
-real utility when it's used in conjunction with the proprietary test
-suite, which most users don't have access to.)
+real utility when it's used in conjunction with the project's
+proprietary test suite, which most users don't have access to.)
Note that when serving this app via [althttpd][], it must be a version
from 2022-09-26 or newer so that it recognizes the `--enable-sab`
flag, which causes althttpd to emit two HTTP response headers which
are required to enable JavaScript's `SharedArrayBuffer` and `Atomics`
-APIs. Those APIs are required in order to enable the OPFS-related
+APIs. Those APIs are required in order to enable the [OPFS][]-related
features in the apps which use them.
# Testing on a remote machine that is accessed via SSH
@@ -129,3 +129,4 @@ be tunneled using SSH.
[emscripten]: https://emscripten.org
[althttpd]: https://sqlite.org/althttpd
[SharedArrayBuffer]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer
+[OPFS]: https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Origin_private_file_system
diff --git a/ext/wasm/api/README.md b/ext/wasm/api/README.md
index ebd4aaacb..ce7e58ebe 100644
--- a/ext/wasm/api/README.md
+++ b/ext/wasm/api/README.md
@@ -85,17 +85,18 @@ browser client:
Installs the `sqlite3.vtab` namespace, which contain helpers for use
by downstream code which creates `sqlite3_module` implementations.
- **`sqlite3-vfs-opfs.c-pp.js`**\
- is an sqlite3 VFS implementation which supports the Origin-Private
- FileSystem (OPFS) as a storage layer to provide persistent storage
- for database files in a browser. It requires...
+ is an sqlite3 VFS implementation which supports the [Origin-Private
+ FileSystem (OPFS)][OPFS] as a storage layer to provide persistent
+ storage for database files in a browser. It requires...
- **`sqlite3-opfs-async-proxy.js`**\
- is the asynchronous backend part of the OPFS proxy. It speaks
- directly to the (async) OPFS API and channels those results back
- to its synchronous counterpart. This file, because it must be
- started in its own Worker, is not part of the amalgamation.
+ is the asynchronous backend part of the [OPFS][] proxy. It
+ speaks directly to the (async) OPFS API and channels those
+ results back to its synchronous counterpart. This file, because
+ it must be started in its own Worker, is not part of the
+ amalgamation.
- **`sqlite3-vfs-opfs-sahpool.c-pp.js`**\
- is another sqlite3 VFS supporting the OPFS, but uses a completely
- different approach that the above-listed one.
+ is another sqlite3 VFS supporting the [OPFS][], but uses a
+ completely different approach that the above-listed one.
- **`sqlite3-api-cleanup.js`**\
The previous files do not immediately extend the library. Instead
they add callback functions to be called during its
@@ -152,7 +153,7 @@ into the build-generated `sqlite3.js` along with `sqlite3-api.js`.
flag. This file overwrites the Emscripten-installed
`sqlite3InitModule()` function with one which, after the module is
loaded, also initializes the asynchronous parts of the sqlite3
- module. For example, the OPFS VFS support.
+ module. For example, the [OPFS][] VFS support.
<a id='c-pp'></a>
Preprocessing of Source Files
@@ -164,3 +165,6 @@ builds. The preprocessor application itself is in
[`c-pp.c`](/file/ext/wasm/c-pp.c) and the complete technical details
of such preprocessing are maintained in
[`GNUMakefile`](/file/ext/wasm/GNUmakefile).
+
+
+[OPFS]: https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Origin_private_file_system
diff --git a/main.mk b/main.mk
index 1def7d1d0..f2212c4f1 100644
--- a/main.mk
+++ b/main.mk
@@ -1507,7 +1507,7 @@ install: install-headers
# libtclsqlite3...
#
pkgIndex.tcl:
- echo 'package ifneeded sqlite3 $(PACKAGE_VERSION) [list load [file join $$dir libtclsqlite3[info sharedlibextension]] sqlite3]' > $@
+ echo 'package ifneeded sqlite3 $(PACKAGE_VERSION) [list load [file join $$dir libtclsqlite3[info sharedlibextension]] Sqlite3]' > $@
pkgIndex.tcl-1: pkgIndex.tcl
pkgIndex.tcl-0 pkgIndex.tcl-:
tcl: pkgIndex.tcl-$(HAVE_TCL)
diff --git a/manifest b/manifest
index e02024cfb..78d794bcb 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Simplify\show\sOpfsSAHPoolUtil.unpauseVfs()'s\sreturned\spromise\sis\shandled.
-D 2025-01-29T11:28:18.640
+C Merge\strunk\sinto\sopfs-sahpool-pause\sbranch.
+D 2025-01-31T12:39:07.019
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d
@@ -14,13 +14,13 @@ F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90
F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2
F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531
-F auto.def caf7cca9c235fc6a3d7639e00eb75972d9bf8527717498b9fa1d7112d50b5720
+F auto.def e7e92090c98aeb0174d29988c259834eb1b71ae1ea927015c3ef300f6f9b68ae
F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac
F autoconf/Makefile.in 56697ad25ecf23afa317148b06bdc14f85960b42e5ec434ac1ba87f63a3cb789
F autoconf/Makefile.msc ffff61fe851443015ddb6600ab69a9df503cfec25459b336be7ba8c9a9e473f8
F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136
F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288
-F autoconf/auto.def 623e0d2339cbccc86b1c5e58d65702dc91a9fec4843a4c6198139e248579858e
+F autoconf/auto.def 23bc095a3890c0ca334abf7ef67d1c8af4c22c12832bcc738015e868d54fe9d7
F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e
F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3
F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43
@@ -50,13 +50,13 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e
F autosetup/jimsh0.c d40e381ea4526a067590e7b91bd4b2efa6d4980d286f908054c647b3df4aee14
F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba
F autosetup/proj.tcl 9adf1539673cef15bff862d9360b479e6920cc2c0d85de707b0ba31c04ce4531
-F autosetup/sqlite-config.tcl f37f6961c8fb2454960f97a28011a29994f6c591b1da392a9ae28af96e0c15a2
+F autosetup/sqlite-config.tcl 00af5b9d94d580367bf01984b86397e8d35b74090427def9591a54ded0e1a287
F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9
F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x
F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd
F doc/compile-for-unix.md c9dce1ddd4bf0d25efccc5c63eb047e78c01ce06a6ff29c73e0a8af4a0f4adbc
-F doc/compile-for-windows.md 31cddda1d5f34027f1f2b7484d580e7558f22a9875884805b6fdc84d56cab848
+F doc/compile-for-windows.md 5141661e783c9ca9e3fd30e813345898712f5c311d71316f183db87038fa28a6
F doc/json-enhancements.md e356fc834781f1f1aa22ee300027a270b2c960122468499bf347bb123ce1ea4f
F doc/jsonb.md 5fab4b8613aa9153fbeb6259297bd4697988af8b3d23900deba588fa7841456b
F doc/lemon.html 8b266ff711d2ec7f867c3dca37634963f48a630329908cc282beebfa8c708706
@@ -576,14 +576,14 @@ F ext/rtree/visual01.txt e9c2564083bcd30ec51b07f881bffbf0e12b50a3f6fced0c222c5c1
F ext/session/changeset.c 7a1e6a14c7e92d36ca177e92e88b5281acd709f3b726298dc34ec0fb58869cb5
F ext/session/changesetfuzz.c 227076ab0ae4447d742c01ee88a564da6478bbf26b65108bf8fac9cd8b0b24aa
F ext/session/changesetfuzz1.test 15b629004e58d5ffcc852e6842a603775bb64b1ce51254831f3d12b113b616cd
-F ext/session/session1.test 8d0509cd3fcfdee6a33422d5fe5c95a9770d62a0b8588adb0177ecdf79b2c345
+F ext/session/session1.test cc7e58976c2cc6263fb7ef0c5125a98eafc2f213c75929f986768d2dbc224725
F ext/session/session2.test ee83bb973b9ce17ccce4db931cdcdae65eb40bbb22089b2fe6aa4f6be3b9303f
F ext/session/session3.test 2cc1629cfb880243aec1a7251145e07b78411d851b39b2aa1390704550db8e6a
F ext/session/session4.test 823f6f018fcbb8dacf61e2960f8b3b848d492b094f8b495eae1d9407d9ab7219
F ext/session/session5.test 716bc6fafd625ce60dfa62ae128971628c1a1169
F ext/session/session6.test 35279f2ec45448cd2e24a61688219dc6cf7871757716063acf4a8b5455e1e926
F ext/session/session8.test 326f3273abf9d5d2d7d559eee8f5994c4ea74a5d935562454605e6607ee29904
-F ext/session/session9.test be090b1420f3824a573da9e56ff542b1e1c2a4f772118e9ab2f75774e66d25d0
+F ext/session/session9.test 4e3aff62d6b4294498ddbe309076de06f4fddffad4fe5f5a6c033358b01df083
F ext/session/sessionA.test 1feeab0b8e03527f08f2f1defb442da25480138f
F ext/session/sessionB.test c4fb7f8a688787111606e123a555f18ee04f65bb9f2a4bb2aa71d55ce4e6d02c
F ext/session/sessionC.test f8a5508bc059ae646e5ec9bdbca66ad24bc92fe99fda5790ac57e1f59fce2fdf
@@ -607,7 +607,7 @@ F ext/session/sessionfault2.test b0d6a7c1d7398a7e800d84657404909c7d385965ea8576d
F ext/session/sessionfault3.test ce0b5d182133935c224d72507dbf1c5be1a1febf7e85d0b0fbd6d2f724b32b96
F ext/session/sessioninvert.test 04075517a9497a80d39c495ba6b44f3982c7371129b89e2c52219819bc105a25
F ext/session/sessionmem.test f2a735db84a3e9e19f571033b725b0b2daf847f3f28b1da55a0c1a4e74f1de09
-F ext/session/sessionnoact.test 0f552bd318b764bbc5b2cd6f3518435254a1c830fdaa5aab9c688f507ebc301e
+F ext/session/sessionnoact.test 4c7ae5c7d351cb5323bca62b6b095592ad24bd90a6713c178b62ab0063d23e19
F ext/session/sessionnoop.test a9366a36a95ef85f8a3687856ebef46983df399541174cb1ede2ee53b8011bc7
F ext/session/sessionnoop2.test de4672dce88464396ec9f30ed08c6c01643a69c53ae540fadbbf6d30642d64e8
F ext/session/sessionrebase.test 702378bdcb5062f1106e74457beca8797d09c113a81768734a58b197b5b334e2
@@ -615,13 +615,13 @@ F ext/session/sessionrowid.test 85187c2f1b38861a5844868126f69f9ec62223a03449a98a
F ext/session/sessionsize.test 8fcf4685993c3dbaa46a24183940ab9f5aa9ed0d23e5fb63bfffbdb56134b795
F ext/session/sessionstat1.test 5e718d5888c0c49bbb33a7a4f816366db85f59f6a4f97544a806421b85dc2dec
F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009ecef8511f4cf3fc
-F ext/session/sqlite3session.c b2047d4b6c343f92d1c5cead3a7f529d074db01ceb4724f5ec4cd361379afb38
+F ext/session/sqlite3session.c 01e321269fe21982b79336c8b7a4b83ef0779f5c1644a04c8bb7c1174c8c71ae
F ext/session/sqlite3session.h 683ccbf16e2c2521661fc4c1cf918ce57002039efbcabcd8097fa4bca569104b
F ext/session/test_session.c 12e0a2c15fd60f92da4bb29c697c9177ff0c0dbcdc5129a54c47e999f147937a
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
F ext/wasm/GNUmakefile 47f121d057c08ba49443c06c1c51ba2572e3d5d28a06c968cf0b2ccd5878c3d3
-F ext/wasm/README-dist.txt 6382cb9548076fca472fb3330bbdba3a55c1ea0b180ff9253f084f07ff383576
-F ext/wasm/README.md 6c1dd9e4448c672f4a072c56d3ce9164b3c7dc818ea8f18b49c6834bfd5efe24
+F ext/wasm/README-dist.txt f01081a850ce38a56706af6b481e3a7878e24e42b314cfcd4b129f0f8427066a
+F ext/wasm/README.md b89605f65661cf35bf034ff6d43e448cc169b8017fc105d498e33b81218b482c
F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff
F ext/wasm/SQLTester/SQLTester.mjs 66e1adc3d79467b68e3e40614fd42c1a577c7e219ec0985db966eded52a941e5
F ext/wasm/SQLTester/SQLTester.run.mjs 57f2adb33f43f2784abbf8026c1bfd049d8013af1998e7dcb8b50c89ffc332e0
@@ -631,7 +631,7 @@ F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-core 2bcbbfe3b95c043ed6037e2708a2ee078
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-extras fe40d6d758646e38f8b15f709044951e10884214f5453d35502100179c388c13
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-see fb29e62082a658f0d81102488414d422c393c4b20cc2f685b216bc566237957b
F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287
-F ext/wasm/api/README.md 34fe11466f9c1d81b10a0469e1114e5f1c5a6365c73d80a1a6ca639a1a358b73
+F ext/wasm/api/README.md c64ec8e84449c069e0217706d9d7d31b3bd53627228b2ba0c3cddbdc2350ca66
F ext/wasm/api/extern-post-js.c-pp.js 3fcd904f1204685dea84e5ae90d8b7e65a1dcebab1e838386d8328b74cce46c9
F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41
F ext/wasm/api/post-js-footer.js 365405929f41ca0e6d389ed8a8da3f3c93e11d3ef43a90ae151e37fa9f75bf41
@@ -702,7 +702,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a
F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702
F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0
-F main.mk 18b859068a43818d29172b36d624a9bc8ce8204350ebd18a9f96994970081ab9
+F main.mk 043987843e8365dbaf74dce60c11683b62e2bcfcb3122574c14a0324d37a72f3
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421
@@ -730,7 +730,7 @@ F src/date.c 842c08ac143a56a627b05ac51d68624f2b7b03e3b4cba596205e735eed64ee57
F src/dbpage.c e90410e5d4c0217dfddc4184a81e38ec4903c25d4ec0f201060a0e54e7c2099f
F src/dbstat.c 73362c0df0f40ad5523a6f5501224959d0976757b511299bf892313e79d14f5c
F src/delete.c 03a77ba20e54f0f42ebd8eddf15411ed6bdb06a2c472ac4b6b336521bf7cea42
-F src/expr.c ce83e7361454a195f8393fa0baad694e2fee6c49a44c0d6db44d8a2b92534aeb
+F src/expr.c 8705be31ee713aaa43c97d91399db09f16ee41b88250406eb99de6b47f550a98
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c 928ed2517e8732113d2b9821aa37af639688d752f4ea9ac6e0e393d713eeb76f
F src/func.c f5b31c805679930cc5afcdfb1e657f9dd273053f52ff51133df5a448c519e5d9
@@ -789,7 +789,7 @@ F src/sqliteInt.h 6f23e483be7810ea1854c8fbfbbbfae2a702529d1feb9a210a290abb445541
F src/sqliteLimit.h 1bbdbf72bd0411d003267ffebc59a262f061df5653027a75627d03f48ca30523
F src/status.c cb11f8589a6912af2da3bb1ec509a94dd8ef27df4d4c1a97e0bcf2309ece972b
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
-F src/tclsqlite.c 6a7538560adc856faea295c0f09c33a57a1cfa5c59f85ab4e12aa50dba7ff2de
+F src/tclsqlite.c 5c1e367e26711044730c93d4b81312170918a8d1fe811f45be740ab48f7de8c1
F src/tclsqlite.h 65e2c761446e1c9fa0342b7d2612a703483643c8b6a316d12a65b745a4727395
F src/test1.c 9d2da51b4c33633e7370e4068af6d16d2c52b22a5810ec012ac32e77f8397b64
F src/test2.c 7ebc518e6735939d8979273a6f7b1d9b5702babf059f6ad62499f7f60a9eb9a3
@@ -850,7 +850,7 @@ F src/utf.c 8b29d9a5956569ea2700f869669b8ef67a9662ee5e724ff77ab3c387e27094ba
F src/util.c e5f6a5eeaa26b69054a43bbd0048cfe3d2851f6961052b35aed8f695df922850
F src/vacuum.c b763b6457bd058d2072ef9364832351fd8d11e8abf70cbb349657360f7d55c40
F src/vdbe.c b428a751953c0c2ff85e3e152ec16e29d488895cd541c8c20876ff9f3bf6978a
-F src/vdbe.h 9676348d342bd04e21e384c63b57224171ce84fac77853357334ef94c4d33cf4
+F src/vdbe.h 3d26d5c7660c5c7bd33ffb0d8784615072d8b23c81f8110870efe2631136bc89
F src/vdbeInt.h 895b1ab7536f018d3d70d690f6c0adbd1062b6dddce1c2cad912927856d4033c
F src/vdbeapi.c 08d0445b6066b04e5014d5d322b75736a61fe847ed88eb6e1a186c79dd9ed117
F src/vdbeaux.c 885e16100597507fbbe09d82cbb963bff3fd8a9c1e358dc4f463fc95feb18e8b
@@ -990,7 +990,7 @@ F test/cache.test 13bc046b26210471ca6f2889aceb1ea52dc717de
F test/cacheflush.test af25bb1509df04c1da10e38d8f322d66eceedf61
F test/cachespill.test 895997f84a25b323b166aecb69baab2d6380ea98f9e0bcc688c4493c535cfab9
F test/capi2.test 4ee545824adc3eb33bf57ef89f77440b28188ec3da72e5425ff0fcdba32e8d5a
-F test/capi3.test 4892b5e53d2a6941edc9d204a0ab174dd66e8689282d9a15e4384561c3965945
+F test/capi3.test ab90c548969613315605c555a8623f6b56e00e28d451c46a17ef73683c422c70
F test/capi3b.test efb2b9cfd127efa84433cd7a2d72ce0454ae0dc4
F test/capi3c.test 31d3a6778f2d06f2d9222bd7660c41a516d1518a059b069e96ebbeadb5a490f7
F test/capi3d.test 8b778794af891b0dca3d900bd345fbc8ebd2aa2aae425a9dccdd10d5233dfbde
@@ -1307,7 +1307,7 @@ F test/in3.test 3cbf58c87f4052cee3a58b37b6389777505aa0c0
F test/in4.test bb767ec1cfd1730256f0a83219f0acda36bc251b63f8b8bb7d8c7cff17875a4f
F test/in5.test 4fd79c70dfa0681313e8cdca07f5ff0400bdc0e20f808a5c59eaef1e4b48082a
F test/in6.test f5f40d6816a8bb7c784424b58a10ac38efb76ab29127a2c17399e0cbeeda0e4b
-F test/in7.test 5050b648510d88bd27ff6b40991a45e1cc277c20e258162e81650e01069a56bb
+F test/in7.test d9efdee00b074a60c6343993b2eda78bc369ab080dad864513c73f8aca89d566
F test/incrblob.test c9b96afc292aeff43d6687bcb09b0280aa599822
F test/incrblob2.test a494c9e848560039a23974b9119cfc2cf3ad3bd15cc2694ee6367ae537ef8f1f
F test/incrblob3.test 67621a04b3084113bf38ce03797d70eca012d9d8f948193b8f655df577b0da6f
@@ -2114,7 +2114,7 @@ F tool/GetTclKit.bat d84033c6a93dfe735d247f48ba00292a1cc284dcf69963e5e672444e045
F tool/Replace.cs 02c67258801c2fb5f63231e0ac0f220b4b36ba91
F tool/build-all-msvc.bat c817b716e0edeecaf265a6775b63e5f45c34a6544f1d4114a222701ed5ac79ab x
F tool/build-shell.sh 369c4b171cc877ad974fef691e4da782b4c1e99fe8f4361316c735f64d49280f
-F tool/buildtclext.tcl e82120d672b34b507e1d9cb220ce18c5c36c3ee0ff0328e35f1806ce74ed2266
+F tool/buildtclext.tcl 20726b6b73c7911baa8519a9467b4062104339a5ce57947819884525c56d79e3
F tool/cg_anno.tcl c1f875f5a4c9caca3d59937b16aff716f8b1883935f1b4c9ae23124705bc8099 x
F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2
F tool/cktclsh.sh 6075eef9c6b9ba4b38fef2ca2a66d25f2311bd3c610498d18a9b01f861629cca
@@ -2123,7 +2123,7 @@ F tool/custom.txt 24ed55e71c5edae0067ba159bbf09240d58b160331f7716e95816cd3aa0ba5
F tool/dbhash.c 5da0c61032d23d74f2ab84ffc5740f0e8abec94f2c45c0b4306be7eb3ae96df0
F tool/dbtotxt.c ca48d34eaca6d6b6e4bd6a7be2b72caf34475869054240244c60fa7e69a518d6
F tool/dbtotxt.md c9a57af8739957ef36d2cfad5c4b1443ff3688ed33e4901ee200c8b651f43f3c
-F tool/emcc.sh.in 1f3226166bad1765c0bf42fac3d29037704c2078eb22562f9ddfbe73bff023b0
+F tool/emcc.sh.in 41a049468c8155433e37e656ba5bae063a000768b1d627025f277732c4e7c4a4
F tool/enlargedb.c 3e8b2612b985cfa7e3e8800031ee191b43ae80de96abb5abbd5eada62651ee21
F tool/extract-sqlite3h.tcl 069ceab0cee26cba99952bfa08c0b23e35941c837acabe143f0c355d96c9e2eb x
F tool/extract.c 054069d81b095fbdc189a6f5d4466e40380505e2
@@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 1d2683fe9e4be01c3137e750900f54d287e7d96185e66924d24b50f4647e7ef1
-R 66a514dac494b6089e61caf69206dcd1
+P d651b8da5a84cd54d71f15bd34e4db685674ef73f26f5cc26b7af5321a2ec05e 56b618da9073db8b8d5dafa177a3c9e4c4d927bf512e14b0e6d23937f91ce4cf
+R 0de3f6553f08e8afe4528e7b192214df
U stephan
-Z 0fe942552ec304dc399f25e3701534d9
+Z 411d369a110121e7891ed7e96e9dfba9
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index 056d267bf..49b636768 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-d651b8da5a84cd54d71f15bd34e4db685674ef73f26f5cc26b7af5321a2ec05e
+775a547eca2b0b3dbb6c03990236128a095cc34d28caec44b9a5072510c75b63
diff --git a/src/expr.c b/src/expr.c
index fcd3da213..8f898a1e3 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -3462,6 +3462,7 @@ static int findCompatibleInRhsSubrtn(
assert( pOp->opcode==OP_BeginSubrtn );
pSig = pOp->p4.pSubrtnSig;
assert( pSig!=0 );
+ if( !pSig->bComplete ) continue;
if( pNewSig->selId!=pSig->selId ) continue;
if( strcmp(pNewSig->zAff,pSig->zAff)!=0 ) continue;
pExpr->y.sub.iAddr = pSig->iAddr;
@@ -3508,6 +3509,7 @@ void sqlite3CodeRhsOfIN(
KeyInfo *pKeyInfo = 0; /* Key information */
int nVal; /* Size of vector pLeft */
Vdbe *v; /* The prepared statement under construction */
+ SubrtnSig *pSig = 0; /* Signature for this subroutine */
v = pParse->pVdbe;
assert( v!=0 );
@@ -3528,7 +3530,6 @@ void sqlite3CodeRhsOfIN(
** Compute a signature for the RHS of the IN operator to facility
** finding and reusing prior instances of the same IN operator.
*/
- SubrtnSig *pSig = 0;
assert( !ExprUseXSelect(pExpr) || pExpr->x.pSelect!=0 );
if( ExprUseXSelect(pExpr) && (pExpr->x.pSelect->selFlags & SF_All)==0 ){
pSig = sqlite3DbMallocRawNN(pParse->db, sizeof(pSig[0]));
@@ -3571,6 +3572,7 @@ void sqlite3CodeRhsOfIN(
pExpr->y.sub.iAddr =
sqlite3VdbeAddOp2(v, OP_BeginSubrtn, 0, pExpr->y.sub.regReturn) + 1;
if( pSig ){
+ pSig->bComplete = 0;
pSig->iAddr = pExpr->y.sub.iAddr;
pSig->regReturn = pExpr->y.sub.regReturn;
pSig->iTable = iTab;
@@ -3706,6 +3708,7 @@ void sqlite3CodeRhsOfIN(
sqlite3ReleaseTempReg(pParse, r1);
sqlite3ReleaseTempReg(pParse, r2);
}
+ if( pSig ) pSig->bComplete = 1;
if( pKeyInfo ){
sqlite3VdbeChangeP4(v, addr, (void *)pKeyInfo, P4_KEYINFO);
}
diff --git a/src/tclsqlite.c b/src/tclsqlite.c
index 76c9ef75c..824e8c4d3 100644
--- a/src/tclsqlite.c
+++ b/src/tclsqlite.c
@@ -510,7 +510,7 @@ static int createIncrblobChannel(
** or {...} or ; to be seen anywhere. Most callback scripts consist
** of just a single procedure name and they meet this requirement.
*/
-static int safeToUseEvalObjv(Tcl_Interp *interp, Tcl_Obj *pCmd){
+static int safeToUseEvalObjv(Tcl_Obj *pCmd){
/* We could try to do something with Tcl_Parse(). But we will instead
** just do a search for forbidden characters. If any of the forbidden
** characters appear in pCmd, we will report the string as unsafe.
@@ -2993,7 +2993,7 @@ deserialize_error:
}
pFunc->pScript = pScript;
Tcl_IncrRefCount(pScript);
- pFunc->useEvalObjv = safeToUseEvalObjv(interp, pScript);
+ pFunc->useEvalObjv = safeToUseEvalObjv(pScript);
pFunc->eType = eType;
rc = sqlite3_create_function(pDb->db, zName, nArg, flags,
pFunc, tclSqlFunc, 0, 0);
@@ -4021,7 +4021,9 @@ EXTERN int Tclsqlite_Unload(Tcl_Interp *interp, int flags){ return TCL_OK; }
EXTERN int Sqlite_SafeInit(Tcl_Interp *interp){ return TCL_ERROR; }
EXTERN int Sqlite_SafeUnload(Tcl_Interp *interp, int flags){return TCL_ERROR;}
-/* Also variants with a lowercase "s" */
+/* Also variants with a lowercase "s". I'm told that these are
+** deprecated in Tcl9, but they continue to be included for backwards
+** compatibility. */
EXTERN int sqlite3_Init(Tcl_Interp *interp){ return Sqlite3_Init(interp);}
EXTERN int sqlite_Init(Tcl_Interp *interp){ return Sqlite3_Init(interp);}
diff --git a/src/vdbe.h b/src/vdbe.h
index 71aae29a0..476f1b4ea 100644
--- a/src/vdbe.h
+++ b/src/vdbe.h
@@ -40,6 +40,7 @@ typedef struct SubrtnSig SubrtnSig;
*/
struct SubrtnSig {
int selId; /* SELECT-id for the SELECT statement on the RHS */
+ u8 bComplete; /* True if fully coded and available for reusable */
char *zAff; /* Affinity of the overall IN expression */
int iTable; /* Ephemeral table generated by the subroutine */
int iAddr; /* Subroutine entry address */
diff --git a/test/capi3.test b/test/capi3.test
index e65f90e3a..6319d8284 100644
--- a/test/capi3.test
+++ b/test/capi3.test
@@ -689,7 +689,9 @@ do_test capi3-6.3 {
sqlite3_finalize $STMT
} {SQLITE_OK}
-if {[clang_sanitize_address]==0} {
+if {0 && [clang_sanitize_address]==0} {
+ # This use-after-free occasionally causes segfaults during ordinary
+ # builds. Let's just disable it completely.
do_test capi3-6.4-misuse {
db cache flush
sqlite3_close $DB
diff --git a/test/in7.test b/test/in7.test
index 4dc0821d1..763396140 100644
--- a/test/in7.test
+++ b/test/in7.test
@@ -219,4 +219,33 @@ do_execsql_test 3.8 {
SELECT t1.a, t2.b FROM t1, t2 WHERE (t1.a, t2.b) IN ((1, 2));
} {1 2}
+# 2025-01-30 Inifinite loop in byte-code discovered by dbsqlfuzz
+# having to do with SubrtnSig logic. The code was using a Subroutine
+# from within itself resulting in infinite recursion.
+#
+# This test will spin forever if the bug has not been fixed, or if
+# it reappears.
+#
+reset_db
+do_execsql_test 4.0 {
+ CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
+ INSERT INTO t1 VALUES(1,x'1111');
+ CREATE TABLE t2(c);
+ CREATE TABLE t3(d);
+ CREATE TRIGGER t1tr UPDATE ON t1 BEGIN
+ UPDATE t1 SET b=x'2222' FROM t2;
+ UPDATE t1
+ SET b = (SELECT a IN (SELECT a
+ FROM t1
+ WHERE (b,a) IN (SELECT rowid, d
+ FROM t3
+ )
+ )
+ FROM t1 NATURAL RIGHT JOIN t1
+ );
+ END;
+ UPDATE t1 SET b=x'3333';
+ SELECT quote(b) FROM t1;
+} {X'3333'}
+
finish_test
diff --git a/tool/buildtclext.tcl b/tool/buildtclext.tcl
index 26f9b6dcc..905087d1d 100644
--- a/tool/buildtclext.tcl
+++ b/tool/buildtclext.tcl
@@ -289,7 +289,7 @@ if {$build} {
# Tcl package index file, version ???
#
package ifneeded sqlite3 $VERSION \\
- [list load [file join \$dir $OUT] sqlite3]
+ [list load [file join \$dir $OUT] Sqlite3]
}]
close $fd
diff --git a/tool/emcc.sh.in b/tool/emcc.sh.in
index 1263e1b0e..1264df537 100644
--- a/tool/emcc.sh.in
+++ b/tool/emcc.sh.in
@@ -63,4 +63,4 @@ if [ x = "x${emcc}" ]; then
fi
fi
-exec emcc "$@"
+exec $emcc "$@"