diff --git a/.fossil-settings/binary-glob b/.fossil-settings/binary-glob
new file mode 100755
index 0000000000..3997beadf8
--- /dev/null
+++ b/.fossil-settings/binary-glob
@@ -0,0 +1 @@
+*.db
\ No newline at end of file
diff --git a/Makefile.in b/Makefile.in
index 6a2ba323a0..3bb66f13ff 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -340,5 +340,4 @@ distclean: distclean-autosetup
version-info$(T.exe): $(TOP)/tool/version-info.c Makefile sqlite3.h
$(T.link) $(ST_OPT) -o $@ $(TOP)/tool/version-info.c
-IS_CROSS_COMPILING = @IS_CROSS_COMPILING@
include $(TOP)/main.mk
diff --git a/auto.def b/auto.def
index ee852dddf5..a1191cdd1e 100644
--- a/auto.def
+++ b/auto.def
@@ -12,7 +12,6 @@
#
# JimTCL: https://jim.tcl.tk
#
-
use sqlite-config
sqlite-configure canonical {
proj-if-opt-truthy dev {
diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in
index 0fa9065be8..009398617c 100644
--- a/autoconf/Makefile.in
+++ b/autoconf/Makefile.in
@@ -72,11 +72,8 @@ LDFLAGS.rt = @LDFLAGS_RT@
LDFLAGS.icu = @LDFLAGS_ICU@
CFLAGS.icu = @CFLAGS_ICU@
-# When cross-compiling, we need to avoid the -s flag because it only
-# works on the build host's platform.
-INSTALL.strip.1 = $(INSTALL)
-INSTALL.strip.0 = $(INSTALL) -s
-INSTALL.strip = $(INSTALL.strip.@IS_CROSS_COMPILING@)
+# INSTALL reminder: we specifically do not strip binaries,
+# as discussed in https://sqlite.org/forum/forumpost/9a67df63eda9925c.
INSTALL.noexec = $(INSTALL) -m 0644
install-dir.bin = $(DESTDIR)$(bindir)
@@ -242,7 +239,7 @@ sqlite3$(T.exe)-0: sqlite3$(T.exe)
all: sqlite3$(T.exe)-$(HAVE_WASI_SDK)
install-shell-0: sqlite3$(T.exe) $(install-dir.bin)
- $(INSTALL.strip) sqlite3$(T.exe) "$(install-dir.bin)"
+ $(INSTALL) sqlite3$(T.exe) "$(install-dir.bin)"
install-shell-1:
install: install-shell-$(HAVE_WASI_SDK)
diff --git a/autoconf/auto.def b/autoconf/auto.def
index 5d7ff83913..85fa7d93ed 100644
--- a/autoconf/auto.def
+++ b/autoconf/auto.def
@@ -8,4 +8,13 @@ sqlite-configure autoconf {
sqlite-check-common-bins ;# must come before [sqlite-handle-wasi-sdk]
sqlite-handle-wasi-sdk ;# must run relatively early, as it changes the environment
sqlite-check-common-system-deps
+ proj-define-for-opt static-shell ENABLE_STATIC_SHELL \
+ "Link library statically into the CLI shell?"
+ if {![opt-bool shared] && ![opt-bool static-shell]} {
+ proj-opt-set shared 1
+ proj-indented-notice {
+ NOTICE: ignoring --disable-shared because --disable-static-shell
+ was specified.
+ }
+ }
}
diff --git a/autosetup/README.md b/autosetup/README.md
index a61f94fbda..3301f57395 100644
--- a/autosetup/README.md
+++ b/autosetup/README.md
@@ -15,6 +15,8 @@ build infrastructure. It is not an [Autosetup][] reference.
- Do Not Update Global Shared State
- [Updating Autosetup](#updating)
- ***[Patching Autosetup for Project-local changes](#patching)***
+- [Branch-specific Customization](#branch-customization)
+
------------------------------------------------------------------------
@@ -385,6 +387,60 @@ If autosetup is upgraded and this patch is _not_ applied the invoking
`./configure` will fail loudly because of the declaration of the
`debug` flag in `auto.def` - duplicated flags are not permitted.
+
+Branch-specific Customization
+========================================================================
+
+Certain vendor-specific branches require slight configure script
+customization. Rather than editing `sqlite-config.tcl` for this,
+which frequently leads to merge conflicts, the following approach
+is recommended:
+
+In the vendor-specific branch, create a file named
+`autosetup/sqlite-custom.tcl`.
+
+That file should contain the following content...
+
+If flag customization is required, add:
+
+>
+```
+proc sqlite-custom-flags {} {
+ # If any existing --flags require different default values
+ # then call:
+ options-defaults {
+ flag-name new-default-value
+ ...
+ }
+ # ^^^ That will replace the default value but will not update
+ # the --help text, which may lead to some confusion:
+ # https://github.com/msteveb/autosetup/issues/77
+
+ return {
+ {*} {
+ new-flag-name => {Help text}
+ ...
+ }
+ }; #see below
+}
+```
+
+That function must return either an empty string or a list in the form
+used internally by `sqlite-config.tcl:sqlite-configure`.
+
+Next, define:
+
+>
+```
+proc sqlite-custom-handle-flags {} {
+ ... do any custom flag handling here ...
+}
+```
+
+That function, if defined, will be called relatively late in the
+configure process, before any filtered files are generated but after
+all other significant processing.
+
[Autosetup]: https://msteveb.github.io/autosetup/
[auto.def]: /file/auto.def
diff --git a/tool/find_tclconfig.tcl b/autosetup/find_tclconfig.tcl
similarity index 100%
rename from tool/find_tclconfig.tcl
rename to autosetup/find_tclconfig.tcl
diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl
index ba5427b6a5..fdd5d5e346 100644
--- a/autosetup/proj.tcl
+++ b/autosetup/proj.tcl
@@ -64,6 +64,7 @@ proc proj-warn {msg} {
show-notices
puts stderr "WARNING: $msg"
}
+
########################################################################
# @proj-error msg
#
@@ -75,22 +76,22 @@ proc proj-fatal {msg} {
}
########################################################################
-# @proj-assert script
+# @proj-assert script ?message?
#
# Kind of like a C assert: if uplevel (eval) of [expr {$script}] is
# false, a fatal error is triggered. The error message, by default,
-# includes the body of the failed assertion, but if $descr is set then
+# includes the body of the failed assertion, but if $msg is set then
# that is used instead.
-proc proj-assert {script {descr ""}} {
+proc proj-assert {script {msg ""}} {
if {1 == [get-env proj-assert 0]} {
msg-result [proj-bold "asserting: $script"]
}
set x "expr \{ $script \}"
if {![uplevel 1 $x]} {
- if {"" eq $descr} {
- set descr $script
+ if {"" eq $msg} {
+ set msg $script
}
- proj-fatal "Assertion failed: $descr"
+ proj-fatal "Assertion failed: $msg"
}
}
@@ -111,6 +112,7 @@ proc proj-bold {str} {
# @proj-indented-notice ?-error? ?-notice? msg
#
# Takes a multi-line message and emits it with consistent indentation.
+# It does not perform any line-wrapping of its own.
#
# If the -notice flag it used then it emits using [user-notice], which
# means its rendering will (A) go to stderr and (B) be delayed until
@@ -162,33 +164,14 @@ proc proj-is-cross-compiling {} {
return [expr {[get-define host] ne [get-define build]}]
}
-########################################################################
-# proj-lshift_ shifts $count elements from the list named $listVar
-# and returns them as a new list. On empty input, returns "".
-#
-# Modified slightly from: https://wiki.tcl-lang.org/page/lshift
-proc proj-lshift_ {listVar {count 1}} {
- upvar 1 $listVar l
- if {![info exists l]} {
- # make the error message show the real variable name
- error "can't read \"$listVar\": no such variable"
- }
- if {![llength $l]} {
- # error Empty
- return ""
- }
- set r [lrange $l 0 [incr count -1]]
- set l [lreplace $l [set l 0] $count]
- return $r
-}
-
########################################################################
# @proj-strip-hash-comments value
#
# Expects to receive string input, which it splits on newlines, strips
# out any lines which begin with any number of whitespace followed by
# a '#', and returns a value containing the [append]ed results of each
-# remaining line with a \n between each.
+# remaining line with a \n between each. It does not strip out
+# comments which appear after the first non-whitespace character.
proc proj-strip-hash-comments {val} {
set x {}
foreach line [split $val \n] {
@@ -223,8 +206,8 @@ proc proj-cflags-without-werror {{var CFLAGS}} {
#
# - Does not make any global changes to the LIBS define.
#
-# - Strips out -W... warning flags from CFLAGS before running the
-# test, as these feature tests will often fail if -Werror is used.
+# - Strips out the -Werror flag from CFLAGS before running the test,
+# as these feature tests will often fail if -Werror is used.
#
# Returns the result of cc-check-function-in-lib (i.e. true or false).
# The resulting linker flags are stored in the [define] named
@@ -478,16 +461,16 @@ proc proj-opt-define-bool {args} {
set invert 0
if {[lindex $args 0] eq "-v"} {
set invert 1
- set args [lrange $args 1 end]
+ lassign $args - optName defName descr
+ } else {
+ lassign $args optName defName descr
}
- set optName [proj-lshift_ args]
- set defName [proj-lshift_ args]
- set descr [proj-lshift_ args]
if {"" eq $descr} {
set descr $defName
}
+ puts "optName=$optName defName=$defName descr=$descr"
set rc 0
- msg-checking "$descr ... "
+ msg-checking "[join $descr] ... "
if {[proj-opt-truthy $optName]} {
if {0 eq $invert} {
set rc 1
@@ -593,7 +576,7 @@ proc proj-file-content {args} {
set trim 1
lassign $args - fname
}
- set fp [open $fname r]
+ set fp [open $fname rb]
set rc [read $fp]
close $fp
if {$trim} { return [string trim $rc] }
@@ -606,7 +589,7 @@ proc proj-file-content {args} {
# Returns the contents of the given file as an array of lines, with
# the EOL stripped from each input line.
proc proj-file-content-list {fname} {
- set fp [open $fname r]
+ set fp [open $fname rb]
set rc {}
while { [gets $fp line] >= 0 } {
lappend rc $line
@@ -615,6 +598,31 @@ proc proj-file-content-list {fname} {
return $rc
}
+########################################################################
+# @proj-file-write ?-ro? fname content
+#
+# Works like autosetup's [writefile] but explicitly uses binary mode
+# to avoid EOL translation on Windows. If $fname already exists, it is
+# overwritten, even if it's flagged as read-only.
+proc proj-file-write {args} {
+ if {"-ro" eq [lindex $args 0]} {
+ lassign $args ro fname content
+ } else {
+ set ro ""
+ lassign $args fname content
+ }
+ file delete -force -- $fname; # in case it's read-only
+ set f [open $fname wb]
+ puts -nonewline $f $content
+ close $f
+ if {"" ne $ro} {
+ catch {
+ exec chmod -w $fname
+ #file attributes -w $fname; #jimtcl has no 'attributes'
+ }
+ }
+}
+
########################################################################
# @proj-check-compile-commands ?configFlag?
#
@@ -681,12 +689,17 @@ proc proj-make-from-dot-in {args} {
}
foreach f $filename {
set f [string trim $f]
- catch { exec chmod u+w $f }
+ if {[file exists $f]} {
+ catch { exec chmod u+w $f }
+ }
make-template $f.in $f
if {$touch} {
proj-touch $f
}
- catch { exec chmod -w $f }
+ catch {
+ exec chmod -w $f
+ #file attributes -w $f; #jimtcl has no 'attributes'
+ }
}
}
@@ -1365,3 +1378,63 @@ proc proj-env-file {flag {dflt ""}} {
proc proj-get-env {var {dflt ""}} {
return [get-env $var [proj-env-file $var $dflt]]
}
+
+########################################################################
+# @proj-current-proc-name
+#
+# Returns the name of the _calling_ proc from ($lvl + 1) levels up the
+# call stack (where the caller's level will be 1 up from _this_
+# call). It is not legal to call this from the top scope.
+proc proj-current-proc-name {{lvl 0}} {
+ #uplevel [expr {$lvl + 1}] {lindex [info level 0] 0}
+ lindex [info level [expr {-$lvl - 1}]] 0
+}
+
+
+########################################################################
+# Converts parts of tclConfig.sh to autosetup [define]s.
+#
+# Expects to be passed the name of a value tclConfig.sh or an empty
+# string. It converts certain parts of that file's contents to
+# [define]s (see the code for the whole list). If $tclConfigSh is an
+# empty string then it [define]s the various vars as empty strings.
+proc proj-tclConfig-sh-to-autosetup {tclConfigSh} {
+ set shBody {}
+ set tclVars {
+ TCL_INCLUDE_SPEC
+ TCL_LIB_SPEC
+ TCL_STUB_LIB_SPEC
+ TCL_EXEC_PREFIX
+ TCL_PREFIX
+ TCL_VERSION
+ }
+ # Build a small shell script which proxies the $tclVars from
+ # $tclConfigSh into autosetup code...
+ lappend shBody "if test x = \"x${tclConfigSh}\"; then"
+ foreach v $tclVars {
+ lappend shBody "$v= ;"
+ }
+ lappend shBody "else . \"${tclConfigSh}\"; fi"
+ foreach v $tclVars {
+ lappend shBody "echo define $v {\$$v} ;"
+ }
+ lappend shBody "exit"
+ set shBody [join $shBody "\n"]
+ #puts "shBody=$shBody\n"; exit
+ if {0} {
+ # This doesn't work but would be preferable to using a temp file...
+ set fd [open "| sh" "rw"]
+ #puts "fd = $fd"; exit
+ puts $fd $shBody
+ flush $fd
+ set rd [read $fd]
+ close $fd
+ puts "rd=$rd"; exit 1
+ eval $rd
+ } else {
+ set shName ".tclConfigSh.tcl"
+ proj-file-write $shName $shBody
+ eval [exec sh $shName $tclConfigSh]
+ file delete -force $shName
+ }
+}
diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl
index 42b4382cfa..67895a2434 100644
--- a/autosetup/sqlite-config.tcl
+++ b/autosetup/sqlite-config.tcl
@@ -11,11 +11,13 @@ if {[string first " " $autosetup(builddir)] != -1} {
user-error "The pathname of the build directory\
may not contain space characters"
}
-
+#parray ::autosetup; exit 0
use proj
-# We want this version info to be emitted up front, but we have to
-# 'use system' for --prefix=... to work. Ergo, this bit is up here
-# instead of in [sqlite-configure].
+#
+# We want the package version info to be emitted early on, but doing
+# so requires a bit of juggling. We have to [use system] for
+# --prefix=... to work and to emit the Host/Build system info, but we
+# don't want those to interfere with --help output.
define PACKAGE_VERSION [proj-file-content -trim $::autosetup(srcdir)/VERSION]
if {"--help" ni $::argv} {
msg-result "Configuring SQLite version [get-define PACKAGE_VERSION]"
@@ -28,15 +30,23 @@ if {"--help" ni $::argv} {
}
#
-# Object for communicating config-time state across various
+# Object for communicating certain config-time state across various
# auto.def-related pieces.
-#
-array set sqliteConfig [proj-strip-hash-comments {
+array set sqliteConfig [subst [proj-strip-hash-comments {
+ #
+ # Gets set by [sqlite-configure] (the main configure script driver).
+ build-mode unknown
#
# Gets set to 1 when using jimsh for code generation. May affect
# later decisions.
use-jim-for-codegen 0
#
+ # Set to 1 when cross-compiling This value may be changed by certain
+ # build options, so it's important that config code which checks for
+ # cross-compilation uses this var instead of
+ # [proj-is-cross-compiling].
+ is-cross-compiling [proj-is-cross-compiling]
+ #
# Pass msg-debug=1 to configure to enable obnoxiously loud output
# from [msg-debug].
msg-debug-enabled 0
@@ -49,34 +59,31 @@ array set sqliteConfig [proj-strip-hash-comments {
# (dump-defines-txt) but also a JSON file named after this option's
# value.
dump-defines-json ""
-}]
-
-#
-# Set to 1 when cross-compiling This value may be changed by certain
-# build options, so it's important that config code which checks for
-# cross-compilation uses this var instead of
-# [proj-is-cross-compiling].
-#
-set sqliteConfig(is-cross-compiling) [proj-is-cross-compiling]
+}]]
########################################################################
# Processes all configure --flags for this build, run build-specific
# config checks, then finalize the configure process. $buildMode must
-# be either "canonical" or "autoconf", and others may be added in the
+# be one of (canonical, autoconf), and others may be added in the
# future. After bootstrapping, $configScript is eval'd in the caller's
# scope, then post-configuration finalization is run. $configScript is
# intended to hold configure code which is specific to the given
# $buildMode, with the caveat that _some_ build-specific code is
# encapsulated in the configuration finalization step.
#
-# The intent is that all build-mode-specific configuration goes inside
-# the $configScript argument to this function, and that an auto.def file
-# contains only two commands:
+# The intent is that all (or almost all) build-mode-specific
+# configuration goes inside the $configScript argument to this
+# function, and that an auto.def file contains only two commands:
#
# use sqlite-config
# sqlite-configure BUILD_NAME { build-specific configure script }
+#
+# There are snippets of build-mode-specific decision-making in
+# [sqlite-configure-finalize]
proc sqlite-configure {buildMode configScript} {
- set allBuildModes {canonical autoconf}
+ proj-assert {$::sqliteConfig(build-mode) eq "unknown"} \
+ "sqlite-configure must not be called more than once"
+ set allBuildModes {canonical autoconf tcl-extension}
if {$buildMode ni $allBuildModes} {
user-error "Invalid build mode: $buildMode. Expecting one of: $allBuildModes"
}
@@ -158,7 +165,7 @@ proc sqlite-configure {buildMode configScript} {
# Options for how to build the library
build-modes {
- {*} {
+ {canonical autoconf} {
shared=1 => {Disable build of shared library}
static=1 => {Disable build of static library}
}
@@ -172,12 +179,9 @@ proc sqlite-configure {buildMode configScript} {
{*} {
threadsafe=1 => {Disable mutexing}
with-tempstore:=no => {Use an in-RAM database for temporary tables: never,no,yes,always}
- largefile=1
- => {This legacy flag has no effect on the library but may influence
- the contents of the generated sqlite_cfg.h}
- # ^^^ It's not clear that LFS support actually does anything,
- # as HAVE_LFS is not checked anywhere in the .c/.h/.in files.
load-extension=1 => {Disable loading of external extensions}
+ # ^^^ one of the downstream custom builds overrides the load-extension default to 0, which
+ # confuses the --help text generator. https://github.com/msteveb/autosetup/issues/77
math=1 => {Disable math functions}
json=1 => {Disable JSON functions}
memsys5 => {Enable MEMSYS5}
@@ -190,12 +194,22 @@ proc sqlite-configure {buildMode configScript} {
rtree => {Enable the RTREE extension}
session => {Enable the SESSION extension}
all => {Enable FTS4, FTS5, Geopoly, RTree, Sessions}
+ largefile=1
+ => {This legacy flag has no effect on the library but may influence
+ the generated sqlite_cfg.h by adding #define HAVE_LFS}
}
}
# Options for TCL support
tcl {
{canonical} {
+ tcl=1
+ => {Disable components which require TCL, including all tests.
+ This tree requires TCL for code generation but can use the in-tree
+ copy of autosetup/jimsh0.c for that. The SQLite TCL extension and the
+ test code require a canonical tclsh.}
+ }
+ {canonical tcl-extension} {
with-tcl:DIR
=> {Directory containing tclConfig.sh or a directory one level up from
that, from which we can derive a directory containing tclConfig.sh.
@@ -206,17 +220,12 @@ proc sqlite-configure {buildMode configScript} {
tclConfig.sh and (B) all TCL-based code generation. Warning: if
its containing dir has multiple tclsh versions, it may select the
wrong tclConfig.sh!}
- tcl=1
- => {Disable components which require TCL, including all tests.
- This tree requires TCL for code generation but can use the in-tree
- copy of autosetup/jimsh0.c for that. The SQLite TCL extension and the
- test code require a canonical tclsh.}
}
}
# Options for line-editing modes for the CLI shell
line-editing {
- {*} {
+ {canonical autoconf} {
readline=1
=> {Disable readline support}
# --with-readline-lib is a backwards-compatible alias for
@@ -258,12 +267,12 @@ proc sqlite-configure {buildMode configScript} {
# Options for exotic/alternative build modes
alternative-builds {
- {*} {
+ {canonical autoconf} {
with-wasi-sdk:=/opt/wasi-sdk
=> {Top-most dir of the wasi-sdk for a WASI build}
}
- {canonical} {
+ {canonical} {
with-emsdk:=auto
=> {Top-most dir of the Emscripten SDK installation.
Needed only by ext/wasm. Default=EMSDK env var.}
@@ -281,7 +290,7 @@ proc sqlite-configure {buildMode configScript} {
static-shell=1
=> {Link the sqlite3 shell app against the DLL instead of embedding sqlite3.c}
}
- {*} {
+ {canonical autoconf} {
# A potential TODO without a current use case:
#rpath=1 => {Disable use of the rpath linker flag}
# soname: https://sqlite.org/src/forumpost/5a3b44f510df8ded
@@ -302,9 +311,9 @@ proc sqlite-configure {buildMode configScript} {
# out-implib: https://sqlite.org/forum/forumpost/0c7fc097b2
out-implib:=auto
=> {Enable use of --out-implib linker flag to generate an
- "import library" for the DLL. The output's base name name is
- specified by the value, with "auto" meaning to figure out a
- name automatically. On some platforms this flag gets
+ "import library" for the DLL. The output's base name is
+ specified by this flag's value, with "auto" meaning to figure
+ out a name automatically. On some platforms this flag gets
automatically enabled if it is not provided. Use "none" to
explicitly disable this feature on such platforms.}
}
@@ -348,9 +357,31 @@ proc sqlite-configure {buildMode configScript} {
(for build debugging)}
}
}
- }; # $allOpts
+ }; # $allFlags
- # Filter allOpts to create the set of [options] legal for this build
+ set allFlags [proj-strip-hash-comments $allFlags]
+ # ^^^ lappend of [sqlite-custom-flags] introduces weirdness if
+ # we delay [proj-strip-hash-comments] until after that.
+
+
+ ########################################################################
+ # sqlite-custom.tcl is intended only for vendor-branch-specific
+ # customization. See autosetup/README.md#branch-customization for
+ # details.
+ if {[file exists $::autosetup(libdir)/sqlite-custom.tcl]} {
+ uplevel 1 {source $::autosetup(libdir)/sqlite-custom.tcl}
+ }
+
+ if {[llength [info proc sqlite-custom-flags]] > 0} {
+ # sqlite-custom-flags is assumed to be imported via
+ # autosetup/sqlite-custom.tcl.
+ set scf [sqlite-custom-flags]
+ if {"" ne $scf} {
+ lappend allFlags sqlite-custom-flags $scf
+ }
+ }
+
+ # Filter allFlags to create the set of [options] legal for this build
set opts {}
foreach {group XY} [subst -nobackslashes -nocommands \
[proj-strip-hash-comments $allFlags]] {
@@ -370,84 +401,16 @@ proc sqlite-configure {buildMode configScript} {
dict incr xopts -level
return {*}$xopts $msg
}
- sqlite-post-options-init
+ sqlite-configure-phase1 $buildMode
uplevel 1 $configScript
sqlite-configure-finalize
}; # sqlite-configure
########################################################################
-# Performs late-stage config steps common to all supported
-# $::sqliteConfig(build-mode) values.
-proc sqlite-configure-finalize {} {
- set buildMode $::sqliteConfig(build-mode)
- set isCanonical [expr {$buildMode eq "canonical"}]
- set isAutoconf [expr {$buildMode eq "autoconf"}]
- proj-assert {$isCanonical || $isAutoconf} "Unknown build mode: $buildMode"
-
- define HAVE_LFS 0
- if {[opt-bool largefile]} {
- #
- # Insofar as we can determine HAVE_LFS has no effect on the
- # library. Perhaps it did back in the early 2000's. The
- # --enable/disable-largefile flag is retained because it's
- # harmless, but it doesn't do anything useful. It does have
- # visible side-effects, though: the generated sqlite_cfg.h may (or
- # may not) define HAVE_LFS.
- #
- cc-check-lfs
- }
-
- if {$isCanonical} {
- if {![opt-bool static]} {
- proj-indented-notice {
- NOTICE: static lib build may be implicitly re-activated by
- other components, e.g. some test apps.
- }
- }
- } else {
- proj-assert { $isAutoconf } "Invalid build mode"
- proj-define-for-opt static-shell ENABLE_STATIC_SHELL \
- "Link library statically into the CLI shell?"
- if {![opt-bool shared] && ![opt-bool static-shell]} {
- proj-opt-set shared 1
- proj-indented-notice {
- NOTICE: ignoring --disable-shared because --disable-static-shell
- was specified.
- }
- }
- }
- proj-define-for-opt shared ENABLE_LIB_SHARED "Build shared library?"
- proj-define-for-opt static ENABLE_LIB_STATIC "Build static library?"
-
- sqlite-handle-debug
- sqlite-handle-rpath
- sqlite-handle-soname
- sqlite-handle-threadsafe
- sqlite-handle-tempstore
- sqlite-handle-line-editing
- sqlite-handle-load-extension
- sqlite-handle-math
- sqlite-handle-icu
- sqlite-handle-env-quirks
- sqlite-handle-common-feature-flags
- sqlite-finalize-feature-flags
- ########################################################################
- # When cross-compiling, we have to avoid using the -s flag to
- # /usr/bin/install:
- # https://sqlite.org/forum/forumpost/9a67df63eda9925c
- define IS_CROSS_COMPILING $::sqliteConfig(is-cross-compiling)
- sqlite-process-dot-in-files
- sqlite-post-config-validation
- sqlite-dump-defines
-}; # sqlite-configure-finalize
-
-########################################################################
-# Runs some common initialization which must happen immediately after
-# autosetup's [options] function is called. This is also a convenient
-# place to put some generic pieces common to both the canonical
-# top-level build and the "autoconf" build, but it's not intended to
-# be a catch-all dumping ground for such.
-proc sqlite-post-options-init {} {
+# Runs "phase 1" of the configure process: after initial --flags
+# handling but before the build-specific parts are run. $buildMode
+# must be the mode which was passed to [sqlite-configure].
+proc sqlite-configure-phase1 {buildMode} {
define PACKAGE_NAME sqlite
define PACKAGE_URL {https://sqlite.org}
define PACKAGE_BUGREPORT [get-define PACKAGE_URL]/forum
@@ -460,6 +423,8 @@ proc sqlite-post-options-init {} {
with-readline-lib => with-readline-ldflags
with-debug => debug
}
+ set ::sqliteConfig(msg-debug-enabled) [proj-val-truthy [get-env msg-debug 0]]
+ proc-debug "msg-debug is enabled"
sqlite-autoreconfig
proj-file-extensions
if {".exe" eq [get-define TARGET_EXEEXT]} {
@@ -469,8 +434,53 @@ proc sqlite-post-options-init {} {
define SQLITE_OS_UNIX 1
define SQLITE_OS_WIN 0
}
- set ::sqliteConfig(msg-debug-enabled) [proj-val-truthy [get-env msg-debug 0]]
sqlite-setup-default-cflags
+ sqlite-handle-debug
+ define HAVE_LFS 0
+ if {[opt-bool largefile]} {
+ #
+ # Insofar as we can determine HAVE_LFS has no effect on the
+ # library. Perhaps it did back in the early 2000's. The
+ # --enable/disable-largefile flag is retained because it's
+ # harmless, but it doesn't do anything useful. It does have
+ # visible side-effects, though: the generated sqlite_cfg.h may (or
+ # may not) define HAVE_LFS.
+ cc-check-lfs
+ }
+}; # sqlite-configure-phase1
+
+########################################################################
+# Performs late-stage config steps common to all supported
+# $::sqliteConfig(build-mode) values.
+proc sqlite-configure-finalize {} {
+ sqlite-handle-rpath
+ sqlite-handle-soname
+ sqlite-handle-threadsafe
+ sqlite-handle-tempstore
+ sqlite-handle-load-extension
+ sqlite-handle-math
+ sqlite-handle-icu
+ if {[proj-opt-exists readline]} {
+ sqlite-handle-line-editing
+ }
+ if {[proj-opt-exists shared]} {
+ proj-define-for-opt shared ENABLE_LIB_SHARED "Build shared library?"
+ }
+ if {[proj-opt-exists static]} {
+ if {![proj-define-for-opt static ENABLE_LIB_STATIC "Build static library?"]} {
+ # This notice really only applies to the canonical build...
+ proj-indented-notice {
+ NOTICE: static lib build may be implicitly re-activated by
+ other components, e.g. some test apps.
+ }
+ }
+ }
+ sqlite-handle-env-quirks
+ sqlite-handle-common-feature-flags
+ sqlite-finalize-feature-flags
+ sqlite-process-dot-in-files; # do not [define] anything after this
+ sqlite-post-config-validation
+ sqlite-dump-defines
}
########################################################################
@@ -481,6 +491,13 @@ proc msg-debug {msg} {
puts stderr [proj-bold "** DEBUG: $msg"]
}
}
+########################################################################
+# A [msg-debug] proxy which prepends the name of the current proc to
+# the debug message. It is not legal to call this from the global
+# scope.
+proc proc-debug {msg} {
+ msg-debug "\[[proj-current-proc-name 1]\]: $msg"
+}
########################################################################
# Sets up the SQLITE_AUTORECONFIG define.
@@ -561,6 +578,10 @@ proc sqlite-check-common-bins {} {
########################################################################
# Run checks for system-level includes and libs which are common to
# both the canonical build and the "autoconf" bundle.
+#
+# For the canonical build this must come after
+# [sqlite-handle-wasi-sdk], as that function may change the
+# environment in ways which affect this.
proc sqlite-check-common-system-deps {} {
# Check for needed/wanted data types
cc-with {-includes stdint.h} \
@@ -671,7 +692,7 @@ proc sqlite-setup-default-cflags {} {
}
########################################################################
-# Handle various SQLITE_ENABLE_... feature flags.
+# Handle various SQLITE_ENABLE/OMIT_... feature flags.
proc sqlite-handle-common-feature-flags {} {
msg-result "Feature flags..."
foreach {boolFlag featureFlag ifSetEvalThis} {
@@ -731,7 +752,6 @@ proc sqlite-handle-common-feature-flags {} {
msg-result " - $boolFlag"
}
}
-
}
#########################################################################
@@ -755,13 +775,12 @@ proc sqlite-finalize-feature-flags {} {
}
########################################################################
-# Checks for the --debug flag, defining SQLITE_DEBUG to 1 if it is
-# true. TARGET_DEBUG gets defined either way, with content depending
-# on whether --debug is true or false.
+# Checks for the --debug flag and [define]s TARGET_DEBUG based on
+# that. TARGET_DEBUG is unused in the autoconf build but that is
+# arguably a bug.
proc sqlite-handle-debug {} {
msg-checking "SQLITE_DEBUG build? "
proj-if-opt-truthy debug {
- define SQLITE_DEBUG 1
define TARGET_DEBUG {-g -DSQLITE_DEBUG=1 -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE -O0 -Wall}
proj-opt-set memsys5
msg-result yes
@@ -797,7 +816,7 @@ proc sqlite-handle-soname {} {
}
}
}
- msg-debug "soname=$soname"
+ proc-debug "soname=$soname"
if {[proj-check-soname $soname]} {
define LDFLAGS_LIBSQLITE3_SONAME [get-define LDFLAGS_SONAME_PREFIX]$soname
msg-result "Setting SONAME using: [get-define LDFLAGS_LIBSQLITE3_SONAME]"
@@ -928,6 +947,11 @@ proc sqlite-handle-emsdk {} {
########################################################################
# Internal helper for [sqlite-check-line-editing]. Returns a list of
# potential locations under which readline.h might be found.
+#
+# On some environments this function may perform extra work to help
+# sqlite-check-line-editing figure out how to find libreadline and
+# friends. It will communicate those results via means other than the
+# result value, e.g. by modifying configure --flags.
proc sqlite-get-readline-dir-list {} {
# Historical note: the dirs list, except for the inclusion of
# $prefix and some platform-specific dirs, originates from the
@@ -944,13 +968,24 @@ proc sqlite-get-readline-dir-list {} {
*-mingw64 {
lappend dirs /mingw64 /mingw
}
+ *-haiku {
+ lappend dirs /boot/system/develop/headers
+ if {[opt-val with-readline-ldflags] in {auto ""}} {
+ # If the user did not supply their own --with-readline-ldflags
+ # value, hijack that flag to inject options which are known to
+ # work on a default Haiku installation.
+ if {"" ne [glob -nocomplain /boot/system/lib/libreadline*]} {
+ proj-opt-set with-readline-ldflags {-L/boot/system/lib -lreadline}
+ }
+ }
+ }
}
lappend dirs /usr /usr/local /usr/local/readline /usr/contrib
set rv {}
foreach d $dirs {
if {[file isdir $d]} {lappend rv $d}
}
- #msg-debug "sqlite-get-readline-dir-list dirs=$rv"
+ #proc-debug "dirs=$rv"
return $rv
}
@@ -1091,7 +1126,9 @@ proc sqlite-check-line-editing {} {
proj-warn "Skipping check for readline.h because we're cross-compiling."
} else {
set dirs [sqlite-get-readline-dir-list]
- set subdirs "include/$editLibName"
+ set subdirs [list \
+ include/$editLibName \
+ readline]
if {"editline" eq $editLibName} {
lappend subdirs include/readline
# ^^^ editline, on some systems, does not have its own header,
@@ -1099,7 +1136,8 @@ proc sqlite-check-line-editing {} {
}
lappend subdirs include
set rlInc [proj-search-for-header-dir readline.h \
- -dirs $dirs -subdirs $subdirs]
+ -dirs $dirs -subdirs $subdirs]
+ #proc-debug "rlInc=$rlInc"
if {"" ne $rlInc} {
if {[string match */readline $rlInc]} {
set rlInc [file dirname $rlInc]; # CLI shell: #include
@@ -1124,7 +1162,8 @@ proc sqlite-check-line-editing {} {
set rlLib ""
if {"" ne $rlInc} {
set rlLib [opt-val with-readline-ldflags]
- if {$rlLib eq "auto" || $rlLib eq ""} {
+ #proc-debug "rlLib=$rlLib"
+ if {$rlLib in {auto ""}} {
set rlLib ""
set libTerm ""
if {[proj-check-function-in-lib tgetent "$editLibName ncurses curses termcap"]} {
@@ -1192,9 +1231,10 @@ proc sqlite-check-line-editing {} {
}; # sqlite-check-line-editing
########################################################################
-# Runs sqlite-check-line-editing and adds a message around it In the
+# Runs sqlite-check-line-editing and adds a message around it. In the
# canonical build this must not be called before
-# sqlite-determine-codegen-tcl.
+# sqlite-determine-codegen-tcl for reasons now lost to history (and
+# might not still be applicable).
proc sqlite-handle-line-editing {} {
msg-result "Line-editing support for the sqlite3 shell: [sqlite-check-line-editing]"
}
@@ -1234,7 +1274,7 @@ proc sqlite-handle-icu {} {
msg-result "Checking for ICU support..."
set icuConfigBin [opt-val with-icu-config]
set tryIcuConfigBin 1; # set to 0 if we end up using pkg-config
- if {"auto" eq $icuConfigBin || "pkg-config" eq $icuConfigBin} {
+ if {$icuConfigBin in {auto pkg-config}} {
if {[pkg-config-init 0] && [pkg-config icu-io]} {
# Maintenance reminder: historical docs say to use both of
# (icu-io, icu-uc). icu-uc lacks a required lib and icu-io has
@@ -1344,7 +1384,7 @@ proc sqlite-handle-load-extension {} {
if {$found} {
msg-result "Loadable extension support enabled."
} else {
- msg-result "Disabling loadable extension support. Use --enable-load-extensions to enable them."
+ msg-result "Disabling loadable extension support. Use --enable-load-extension to enable them."
sqlite-add-feature-flag {-DSQLITE_OMIT_LOAD_EXTENSION=1}
}
return $found
@@ -1360,7 +1400,7 @@ proc sqlite-handle-math {} {
define LDFLAGS_MATH [get-define lib_ceil]
undefine lib_ceil
sqlite-add-feature-flag {-DSQLITE_ENABLE_MATH_FUNCTIONS}
- msg-result "Enabling math SQL functions [get-define LDFLAGS_MATH]"
+ msg-result "Enabling math SQL functions"
} {
define LDFLAGS_MATH ""
msg-result "Disabling math SQL functions"
@@ -1570,6 +1610,11 @@ proc sqlite-handle-env-quirks {} {
sqlite-handle-dll-basename
sqlite-handle-out-implib
sqlite-handle-mac-cversion
+ if {[llength [info proc sqlite-custom-handle-flags]] > 0} {
+ # sqlite-custom-handle-flags is assumed to be imported via a
+ # client-specific import: autosetup/sqlite-custom.tcl.
+ sqlite-custom-handle-flags
+ }
}
########################################################################
@@ -1587,7 +1632,15 @@ proc sqlite-process-dot-in-files {} {
# (e.g. [proj-check-rpath]) may do so before we "mangle" them here.
proj-remap-autoconf-dir-vars
- proj-make-from-dot-in -touch Makefile sqlite3.pc
+ set srcdir $::autosetup(srcdir)/
+ foreach f {Makefile sqlite3.pc} {
+ if {[file exists $srcdir/$f.in]} {
+ # ^^^ we do this only so that this block can be made to work for
+ # multiple builds. e.g. the tea build (under construction) does
+ # not hae sqlite3.pc.in.
+ proj-make-from-dot-in -touch $f
+ }
+ }
make-config-header sqlite_cfg.h \
-bare {SIZEOF_* HAVE_DECL_*} \
-none {HAVE_CFLAG_* LDFLAGS_* SH_* SQLITE_AUTORECONFIG
@@ -1657,7 +1710,7 @@ proc sqlite-handle-wasi-sdk {} {
threadsafe
} {
if {[proj-opt-exists $opt] && [opt-bool $opt]} {
- # -^^^^ distinguish between canonical and autoconf builds
+ # -^^^^ not all builds define all of these flags
msg-result " --disable-$opt"
proj-opt-set $opt 0
}
@@ -1734,12 +1787,10 @@ proc sqlite-check-tcl {} {
define TCLLIBDIR "" ; # Installation dir for TCL extension lib
define TCL_CONFIG_SH ""; # full path to tclConfig.sh
- # Clear out all vars which would be set by tclConfigToAutoDef.sh, so
- # that the late-config validation of @VARS@ works even if
- # --disable-tcl is used.
- foreach k {TCL_INCLUDE_SPEC TCL_LIB_SPEC TCL_STUB_LIB_SPEC TCL_EXEC_PREFIX TCL_VERSION} {
- define $k ""
- }
+ # Clear out all vars which would harvest from tclConfig.sh so that
+ # the late-config validation of @VARS@ works even if --disable-tcl
+ # is used.
+ proj-tclConfig-sh-to-autosetup ""
file delete -force ".tclenv.sh"; # ensure no stale state from previous configures.
if {![opt-bool tcl]} {
@@ -1760,14 +1811,14 @@ proc sqlite-check-tcl {} {
if {"prefix" eq $with_tcl} {
set with_tcl [get-define prefix]
}
- msg-debug "sqlite-check-tcl: use_tcl ${use_tcl}"
- msg-debug "sqlite-check-tcl: with_tclsh=${with_tclsh}"
- msg-debug "sqlite-check-tcl: with_tcl=$with_tcl"
+ proc-debug "use_tcl ${use_tcl}"
+ proc-debug "with_tclsh=${with_tclsh}"
+ proc-debug "with_tcl=$with_tcl"
if {"" eq $with_tclsh && "" eq $with_tcl} {
# If neither --with-tclsh nor --with-tcl are provided, try to find
# a workable tclsh.
- set with_tclsh [proj-first-bin-of tclsh9.0 tclsh8.6 tclsh]
- msg-debug "sqlite-check-tcl: with_tclsh=${with_tclsh}"
+ set with_tclsh [proj-first-bin-of tclsh9.1 tclsh9.0 tclsh8.6 tclsh]
+ proc-debug "with_tclsh=${with_tclsh}"
}
set doConfigLookup 1 ; # set to 0 to test the tclConfig.sh-not-found cases
@@ -1781,7 +1832,7 @@ proc sqlite-check-tcl {} {
#msg-result "Using tclsh: $with_tclsh"
}
if {$doConfigLookup &&
- [catch {exec $with_tclsh $srcdir/tool/find_tclconfig.tcl} result] == 0} {
+ [catch {exec $with_tclsh $::autosetup(libdir)/find_tclconfig.tcl} result] == 0} {
set with_tcl $result
}
if {"" ne $with_tcl && [file isdir $with_tcl]} {
@@ -1792,7 +1843,7 @@ proc sqlite-check-tcl {} {
}
}
set cfg ""
- set tclSubdirs {tcl9.0 tcl8.6 lib}
+ set tclSubdirs {tcl9.1 tcl9.0 tcl8.6 lib}
while {$use_tcl} {
if {"" ne $with_tcl} {
# Ensure that we can find tclConfig.sh under ${with_tcl}/...
@@ -1838,9 +1889,7 @@ proc sqlite-check-tcl {} {
# Export a subset of tclConfig.sh to the current TCL-space. If $cfg
# is an empty string, this emits empty-string entries for the
# various options we're interested in.
- eval [exec sh "$srcdir/tool/tclConfigShToAutoDef.sh" "$cfg"]
- # ---------^^ a Windows/msys workaround, without which it cannot
- # exec a .sh file: https://sqlite.org/forum/forumpost/befb352a42a7cd6d
+ proj-tclConfig-sh-to-autosetup $cfg
if {"" eq $with_tclsh && $cfg ne ""} {
# We have tclConfig.sh but no tclsh. Attempt to locate a tclsh
@@ -2009,10 +2058,14 @@ proc sqlite-determine-codegen-tcl {} {
}; # sqlite-determine-codegen-tcl
########################################################################
-# Runs sqlite-check-tcl and sqlite-determine-codegen-tcl.
-proc sqlite-handle-tcl {} {
+# Runs sqlite-check-tcl and, if $alsoCheckCodeGen is true,
+# sqlite-determine-codegen-tcl (intended only for the canonical
+# build).
+proc sqlite-handle-tcl {{alsoCheckCodeGen 1}} {
sqlite-check-tcl
- msg-result "TCL for code generation: [sqlite-determine-codegen-tcl]"
+ if {$alsoCheckCodeGen} {
+ msg-result "TCL for code generation: [sqlite-determine-codegen-tcl]"
+ }
}
########################################################################
diff --git a/ext/misc/series.c b/ext/misc/series.c
index e8188f1c97..4e328d298c 100644
--- a/ext/misc/series.c
+++ b/ext/misc/series.c
@@ -115,6 +115,7 @@ SQLITE_EXTENSION_INIT1
#include
#include
#include
+#include
#ifndef SQLITE_OMIT_VIRTUALTABLE
/*
@@ -480,25 +481,52 @@ static int seriesFilter(
** constraints on the "value" column.
*/
if( idxNum & 0x0080 ){
- iMin = iMax = sqlite3_value_int64(argv[i++]);
+ if( sqlite3_value_numeric_type(argv[i])==SQLITE_FLOAT ){
+ double r = sqlite3_value_double(argv[i++]);
+ if( r==ceil(r) ){
+ iMin = iMax = (sqlite3_int64)r;
+ }else{
+ returnNoRows = 1;
+ }
+ }else{
+ iMin = iMax = sqlite3_value_int64(argv[i++]);
+ }
}else{
if( idxNum & 0x0300 ){
- iMin = sqlite3_value_int64(argv[i++]);
- if( idxNum & 0x0200 ){
- if( iMin==LARGEST_INT64 ){
- returnNoRows = 1;
+ if( sqlite3_value_numeric_type(argv[i])==SQLITE_FLOAT ){
+ double r = sqlite3_value_double(argv[i++]);
+ if( idxNum & 0x0200 && r==ceil(r) ){
+ iMin = (sqlite3_int64)ceil(r+1.0);
}else{
- iMin++;
+ iMin = (sqlite3_int64)ceil(r);
+ }
+ }else{
+ iMin = sqlite3_value_int64(argv[i++]);
+ if( idxNum & 0x0200 ){
+ if( iMin==LARGEST_INT64 ){
+ returnNoRows = 1;
+ }else{
+ iMin++;
+ }
}
}
}
if( idxNum & 0x3000 ){
- iMax = sqlite3_value_int64(argv[i++]);
- if( idxNum & 0x2000 ){
- if( iMax==SMALLEST_INT64 ){
- returnNoRows = 1;
+ if( sqlite3_value_numeric_type(argv[i])==SQLITE_FLOAT ){
+ double r = sqlite3_value_double(argv[i++]);
+ if( (idxNum & 0x2000)!=0 && r==floor(r) ){
+ iMax = (sqlite3_int64)(r-1.0);
}else{
- iMax--;
+ iMax = (sqlite3_int64)floor(r);
+ }
+ }else{
+ iMax = sqlite3_value_int64(argv[i++]);
+ if( idxNum & 0x2000 ){
+ if( iMax==SMALLEST_INT64 ){
+ returnNoRows = 1;
+ }else{
+ iMax--;
+ }
}
}
}
diff --git a/ext/session/session1.test b/ext/session/session1.test
index 6da9051791..27ac0a194b 100644
--- a/ext/session/session1.test
+++ b/ext/session/session1.test
@@ -684,6 +684,122 @@ do_test $tn.14.4 {
list [catch {sqlite3session_config invalid 123} msg] $msg
} {1 SQLITE_MISUSE}
+#-------------------------------------------------------------------------
+reset_db
+
+do_execsql_test $tn.15.0 {
+ CREATE TABLE records(
+ idx INTEGER PRIMARY KEY AUTOINCREMENT,
+ tbl TEXT NOT NULL,
+ pk TEXT NOT NULL,
+ value TEXT,
+ UNIQUE(tbl, pk)
+ );
+
+ CREATE TABLE changes(
+ idx INTEGER PRIMARY KEY AUTOINCREMENT,
+ tbl TEXT NOT NULL,
+ pk TEXT NOT NULL,
+ op TEXT DEFAULT ('='),
+ path TEXT DEFAULT ('$'),
+ value TEXT,
+ UNIQUE(tbl, pk)
+ );
+
+ CREATE TRIGGER changes_after_insert
+ AFTER INSERT ON changes
+ FOR EACH ROW
+ BEGIN
+ INSERT INTO records(tbl, pk, value)
+ VALUES (NEW.tbl, NEW.pk, NEW.value)
+ ON CONFLICT(tbl, pk) DO UPDATE SET value = NEW.value;
+ END;
+
+ CREATE VIEW data_view AS
+ SELECT *, '=' AS op, '$' AS path FROM records
+ WHERE tbl = 'data';
+
+ CREATE TRIGGER data_insert
+ INSTEAD OF INSERT ON data_view
+ BEGIN
+ INSERT INTO changes(tbl, pk, op, path, value)
+ VALUES (NEW.tbl, NEW.pk, NEW.op, NEW.path, NEW.value);
+ END;
+
+ CREATE TRIGGER data_update
+ INSTEAD OF UPDATE ON data_view
+ BEGIN
+ INSERT INTO changes(tbl, pk, op, path, value)
+ VALUES (NEW.tbl, NEW.pk, NEW.op, NEW.path, NEW.value);
+ END;
+
+ CREATE TRIGGER data_delete
+ INSTEAD OF DELETE ON data_view
+ BEGIN
+ INSERT INTO changes(tbl, pk, op, path, value)
+ VALUES (NEW.tbl, NEW.pk, NEW.op, NEW.path, NEW.value);
+ END;
+}
+
+do_test $tn.15.1 {
+ set C [changeset_from_sql {
+ INSERT INTO data_view (tbl, pk, value) VALUES
+ ('data', '1', 'First'),
+ ('data', '2', 'Second');
+ }]
+ changeset_to_list $C
+} [list \
+ {INSERT changes 1 X..... {} {i 1 t data t 1 n {} n {} t First}} \
+ {INSERT changes 1 X..... {} {i 2 t data t 2 n {} n {} t Second}} \
+ {INSERT records 1 X... {} {i 1 t data t 1 t First}} \
+ {INSERT records 1 X... {} {i 2 t data t 2 t Second}} \
+]
+
+forcedelete test.db2
+sqlite3 db2 test.db2
+
+do_test $tn.15.2 {
+ db2 eval {
+ CREATE TABLE records(
+ idx INTEGER PRIMARY KEY AUTOINCREMENT,
+ tbl TEXT NOT NULL,
+ pk TEXT NOT NULL,
+ value TEXT,
+ UNIQUE(tbl, pk)
+ );
+ CREATE TABLE changes(
+ idx INTEGER PRIMARY KEY AUTOINCREMENT,
+ tbl TEXT NOT NULL,
+ pk TEXT NOT NULL,
+ op TEXT DEFAULT ('='),
+ path TEXT DEFAULT ('$'),
+ value TEXT,
+ UNIQUE(tbl, pk)
+ );
+
+ CREATE TRIGGER changes_after_insert
+ AFTER INSERT ON changes
+ FOR EACH ROW
+ BEGIN
+ INSERT INTO records(tbl, pk, value)
+ VALUES (NEW.tbl, NEW.pk, NEW.value)
+ ON CONFLICT(tbl, pk) DO UPDATE SET value = NEW.value;
+ END;
+ }
+
+ sqlite3changeset_apply db2 $C ""
+
+ db2 eval {
+ SELECT * FROM records;
+ }
+} [list 1 data 1 First 2 data 2 Second]
+
+do_test $tn.15.3 {
+ db2 eval {
+ SELECT * FROM changes;
+ }
+} {1 data 1 {} {} First 2 data 2 {} {} Second}
+
}]
}
diff --git a/main.mk b/main.mk
index 93cfe4b7c1..bcdfbd8638 100644
--- a/main.mk
+++ b/main.mk
@@ -187,6 +187,9 @@ CFLAGS.readline ?= -I$(prefix)/include
# during installation, which may break the build of targets which are
# built after others are installed.
#
+# Maintenance reminder: we specifically do not strip binaries, as
+# discussed in https://sqlite.org/forum/forumpost/9a67df63eda9925c.
+#
INSTALL ?= install
#
# $(ENABLE_LIB_SHARED) =
diff --git a/manifest b/manifest
index 58d6822f2f..53f357a5f3 100644
--- a/manifest
+++ b/manifest
@@ -1,9 +1,10 @@
-C Correct\spart\sof\s[505d9e49f7]\sand\s[7126a51ed8]\sto\sget\ssessioninvert\stests\sworking\son\scygwin.
-D 2025-03-19T15:21:21.407
+C Merge\strunk\sinto\scygwin-fixes\sbranch.\sAdd\s.fossil-settings/binary-glob\sto\ssquelch\swarnings\sabout\s*.db\sfiles\son\sCygwin.
+D 2025-03-26T00:02:15.069
+F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d
-F Makefile.in 2c4d3c20e42ddd7596432c8d45feeaf709f93b37279e274ea413034912a4f840
+F Makefile.in 86cc5297495fd5ce632cd7ec298c562900f874eef42c44d5890bd22397bb3820
F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0
F Makefile.msc bb2cc6f75bbcb2d690fbdd1489914a2febd5e99bad9c77538cb3330d304694c6
F README.md a953c0cffd6e4f2501a306c00ee2b6e1e6630c25031e094629307fe99dd003d1
@@ -14,13 +15,13 @@ F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90
F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2
F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531
-F auto.def 23f0e7eb5eff4cf922963e667ed630793ed60300df59ef9d93c87a23e31c7232
+F auto.def f769bf3111089ee9471a2a872c47651c4e29e81d104a52867ab544fde5ef6bad
F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac
-F autoconf/Makefile.in b499f790938d5334a5e22fa9a91af603661e714dea40cd5fb60d03f500b3ae4f
+F autoconf/Makefile.in 1fe497c0df20102f7824ec8a3423cc13c26505655456ecd06a7a8ab02f606586
F autoconf/Makefile.msc 5bc67d3912444c40c6f96d003e5c90663e51abb83d204a520110b1b2038dcd8b
F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136
F autoconf/README.txt 1a32296d8bbdd67110c79d224c92c05545a0b5bd0c272950025fe3c7c7b49580
-F autoconf/auto.def 42d239bda4feffe1cf8a431dae35f83d100f2c17ed4b189edeb12f067bd4fa90
+F autoconf/auto.def 4cb3c39042039bb852034dc1a9d42717d42eef759a687a664ad283db8e6b816e
F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e
F autoconf/tea/README.txt 6c396709b45eb2b3be0ae6dc7e40a140d231962e3a2354da6c4dd48b1d9999bc
F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43
@@ -37,7 +38,7 @@ F autoconf/tea/win/rules.vc 94a18c3e453535459b4a643983acca52fb8756e79055bd2ad4b0
F autoconf/tea/win/targets.vc 96a25a1fa6e9e9cfb348fd3760a5395b4ce8acafc8ed10f0412937ec200d5dbd
F autosetup/LICENSE 41a26aebdd2cd185d1e2b210f71b7ce234496979f6b35aef2cbf6b80cbed4ce4
F autosetup/README.autosetup a78ff8c4a3d2636a4268736672a74bf14a82f42687fcf0631a70c516075c031e
-F autosetup/README.md f98cc827a162a1da4877e9656d749d414ba3f408d457d30e029afc66590c00c3
+F autosetup/README.md f324bb9f9bf1cc787122034df53fbfdfed28ee2657e6652b763d992ab0d04829
F autosetup/autosetup 74a9782b68d07934510190fbd03fc6ad92e63f0ea3b5cbffa5f0bd271ad60f01 x
F autosetup/autosetup-config.guess dfa101c5e8220e864d5e9c72a85e87110df60260d36cb951ad0a85d6d9eaa463 x
F autosetup/autosetup-config.sub a38fb074d0dece01cf919e9fb534a26011608aa8fa606490864295328526cd73 x
@@ -47,10 +48,11 @@ F autosetup/cc-db.tcl 6e0ed90146197a5a05b245e649975c07c548e30926b218ca3e1d4dc034
F autosetup/cc-lib.tcl 493c5935b5dd3bf9bd4eca89b07c8b1b1a9356d61783035144e21795facf7360
F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1de1e5460d78
F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f
+F autosetup/find_tclconfig.tcl e64886ffe3b982d4df42cd28ed91fe0b5940c2c5785e126c1821baf61bc86a7e w tool/find_tclconfig.tcl
F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049
F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba
-F autosetup/proj.tcl bdf0489d4ce8110fc1d4a09b1e2e274e50dd51711637b55c7c63a6a7ecec2aa5
-F autosetup/sqlite-config.tcl a2eb8234de355233787ad7bc926d8a622ef9f97594749374c4360b63c37fc223
+F autosetup/proj.tcl 8bf99398c20a440d197182f85aaa60a41f07248af779fea68c41df30e6da8546
+F autosetup/sqlite-config.tcl 85490e59fb374cf091765308eae96bb96cc85169af46d78e034f3766bdbd0523
F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9
F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x
F contrib/sqlitecon.tcl eb4c6578e08dd353263958da0dc620f8400b869a50d06e271ab0be85a51a08d3
@@ -436,7 +438,7 @@ F ext/misc/regexp.c 388e7f237307c7dfbfb8dde44e097946f6c437801d63f0d7ad63f3320d4e
F ext/misc/remember.c add730f0f7e7436cd15ea3fd6a90fd83c3f706ab44169f7f048438b7d6baa69c
F ext/misc/rot13.c 51ac5f51e9d5fd811db58a9c23c628ad5f333c173f1fc53c8491a3603d38556c
F ext/misc/scrub.c 2a44b0d44c69584c0580ad2553f6290a307a49df4668941d2812135bfb96a946
-F ext/misc/series.c 076a4c85dde2ae543d040f1080cdab74ebf3da7f3febfe38e0cd45a2217498bf
+F ext/misc/series.c 0c285a21821e71b473e701cb52f6cbd708f76aa1adeb30644909a718ba4f0ba5
F ext/misc/sha1.c cb5002148c2661b5946f34561701e9105e9d339b713ec8ac057fd888b196dcb9
F ext/misc/shathree.c fd22d70620f86a0467acfdd3acd8435d5cb54eb1e2d9ff36ae44e389826993df
F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52
@@ -576,7 +578,7 @@ 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 cc7e58976c2cc6263fb7ef0c5125a98eafc2f213c75929f986768d2dbc224725
+F ext/session/session1.test 57cb77a816af7760bf4e321d315603ab517e46abd853e75620cfb07eb409c6f8
F ext/session/session2.test ee83bb973b9ce17ccce4db931cdcdae65eb40bbb22089b2fe6aa4f6be3b9303f
F ext/session/session3.test 2cc1629cfb880243aec1a7251145e07b78411d851b39b2aa1390704550db8e6a
F ext/session/session4.test 823f6f018fcbb8dacf61e2960f8b3b848d492b094f8b495eae1d9407d9ab7219
@@ -707,7 +709,7 @@ F ext/wasm/tests/opfs/sahpool/sahpool-pausing.js f264925cfc82155de38cecb3d204c36
F ext/wasm/tests/opfs/sahpool/sahpool-worker.js bd25a43fc2ab2d1bafd8f2854ad3943ef673f7c3be03e95ecf1612ff6e8e2a61
F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702
F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0
-F main.mk 7006135b902177f7c8bca2733a6820b72a0c6f5a47412b2a7c86668f0398f1fd
+F main.mk a8930b3338afa3065f89735c6e5f9a9d64d90bd3154fe4580696502a7c2a99ad
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421
@@ -731,7 +733,7 @@ F src/build.c 3fe9b9d0f411cc2139a2d5ffa1c9b555417f89332f4dbf7f8e311c2e69e40c81
F src/callback.c acae8c8dddda41ee85cfdf19b926eefe830f371069f8aadca3aa39adf5b1c859
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/date.c 9db4d604e699a73e10b8e85a44db074a1f04c0591a77e2abfd77703f50dce1e9
-F src/dbpage.c 2e677acb658a29965e55398bbc61161cb7819da538057c8032adac7ab8e4a8c0
+F src/dbpage.c fcb1aafe00872a8aff9a7aa0ef7ff1b01e5817ec7bbd521f8f3e1e674ac8d609
F src/dbstat.c 73362c0df0f40ad5523a6f5501224959d0976757b511299bf892313e79d14f5c
F src/delete.c 03a77ba20e54f0f42ebd8eddf15411ed6bdb06a2c472ac4b6b336521bf7cea42
F src/expr.c 61c3baab38f1b50eb4696e1f37c8f7ae1d1ecbfc1a35d446cfd1886624784131
@@ -784,7 +786,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
F src/resolve.c 20e1fbe8f840ffc0cd835e33f68a802a22e34faa918d7a269f3de242fda02f99
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
F src/select.c bfe14cdfceba54744b1c6c29099313f5173a0793dfaff0cd484774e9d05dbeab
-F src/shell.c.in 248050551cad788f8bb4b4728e00d8e36a10130d2d101e55cd51cfee03df91ff
+F src/shell.c.in 9d1b46e09c1b933b0c7afaf4ae27030dc356ee19ae4f95ce8bf3647035b9635b
F src/sqlite.h.in fd70afd92948cf7cc93f687ac960bad1b0b6fbc436752419eff2fd65a1809380
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54
@@ -864,7 +866,7 @@ F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf8
F src/vdbevtab.c fc46b9cbd759dc013f0b3724549cc0d71379183c667df3a5988f7e2f1bd485f3
F src/vtab.c 828221bdbeaaa6d62126ee6d07fd4ec0d09dcaea846f87ad01944d8b7e548859
F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
-F src/wal.c 554a6b1afaaecb98cb47bb598bccf1374c9d3b624e5c4c3c4eb2ad364cc579f8
+F src/wal.c bcf40795a09b699ad7e42624dd6282b13335164fbabcd5a98a717758cebef451
F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452
F src/walker.c d5006d6b005e4ea7302ad390957a8d41ed83faa177e412f89bc5600a7462a014
F src/where.c e80177e452b4e436abc6ece0cb0249631000434f2a7425cc1df709015fce74ad
@@ -1288,7 +1290,7 @@ F test/fuzzdata4.db b502c7d5498261715812dd8b3c2005bad08b3a26e6489414bd13926cd3e4
F test/fuzzdata5.db e35f64af17ec48926481cfaf3b3855e436bd40d1cfe2d59a9474cb4b748a52a5
F test/fuzzdata6.db b8725a5f5cf7a3b7241a9038e57ca7e7cc8c3f4d86b44bd770617bda245ab2b0
F test/fuzzdata7.db 0166b56fd7a6b9636a1d60ef0a060f86ddaecf99400a666bb6e5bbd7199ad1f2
-F test/fuzzdata8.db c6f9cb7d2b808fb10894afe53ef00f51e73e43baa7aabdba7e9af4713fc5b186
+F test/fuzzdata8.db 8f34ae00d8d5d4747dd80983cf46161065e4f78324dcff3c893506ff8db3a4a6
F test/fuzzer1.test 3d4c4b7e547aba5e5511a2991e3e3d07166cfbb8
F test/fuzzer2.test a85ef814ce071293bce1ad8dffa217cbbaad4c14
F test/fuzzerfault.test f64c4aef4c9e9edf1d6dc0d3f1e65dcc81e67c996403c88d14f09b74807a42bc
@@ -1719,7 +1721,7 @@ F test/sync.test a619e407ede58a7b6e3e44375328628559fc9695a9c24c47cb5690a866b0031
F test/sync2.test 06152269ed73128782c450c355988fe8dd794d305833af75e1a5e79edd4dae47
F test/syscall.test a067468b43b8cb2305e9f9fe414e5f40c875bb5d2cba5f00b8154396e95fcf37
F test/sysfault.test c9f2b0d8d677558f74de750c75e12a5454719d04
-F test/tabfunc01.test 76da0509b01b9d12f4e71f8af28ee702d38166a5306bd77a955fb1a370dcd8b5
+F test/tabfunc01.test e85679a3800aa632dee787966b8482fce0bd47629dad82f102fd52f319d2c281
F test/table.test 7862a00b58b5541511a26757ea9c5c7c3f8298766e98aa099deec703d9c0a8e0
F test/tableapi.test e37c33e6be2276e3a96bb54b00eea7f321277115d10e5b30fdb52a112b432750
F test/tableopts.test dba698ba97251017b7c80d738c198d39ab747930
@@ -1972,6 +1974,7 @@ F test/view.test 3c23d7a068e9e4a0c4e6907498042772adea725f0630c3d9638ffd4e5a08b92
F test/view2.test db32c8138b5b556f610b35dfddd38c5a58a292f07fda5281eedb0851b2672679
F test/view3.test ad8a8290ee2b55ff6ce66c9ef1ce3f1e47926273a3814e1c425293e128a95456
F test/vt02.c 5b44ac67b1a283fedecf2d6e2ceda61e7a157f01d44dcb4490dcb1e87d057060
+F test/vt100-a.sql 631eeab18c5adb531bab79aecf64eee3934b42c75a309ee395c814717a6a7651
F test/vtab1.test 09a72330d0f31eda2ffaa828b06a6b917fb86250ee72de0301570af725774c07
F test/vtab2.test 14d4ab26cee13ba6cf5c5601b158e4f57552d3b055cdd9406cf7f711e9c84082
F test/vtab3.test b45f47d20f225ccc9c28dc915d92740c2dee311e
@@ -2134,7 +2137,6 @@ F tool/enlargedb.c 3e8b2612b985cfa7e3e8800031ee191b43ae80de96abb5abbd5eada62651e
F tool/extract-sqlite3h.tcl 069ceab0cee26cba99952bfa08c0b23e35941c837acabe143f0c355d96c9e2eb x
F tool/extract.c 054069d81b095fbdc189a6f5d4466e40380505e2
F tool/fast_vacuum.c c129ae2924a48310c7b766810391da9e8fda532b9f6bd3f9a9e3a799a1b42af9
-F tool/find_tclconfig.tcl e64886ffe3b982d4df42cd28ed91fe0b5940c2c5785e126c1821baf61bc86a7e
F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439
F tool/fuzzershell.c 41480c8a1e4749351f381431ecfdfceba645396c5d836f8d26b51a33c4a21b33
F tool/genfkey.README e550911fa984c8255ebed2ef97824125d83806eb5232582700de949edf836eb1
@@ -2150,7 +2152,7 @@ F tool/logest.c c34e5944318415de513d29a6098df247a9618c96d83c38d4abd88641fe46e669
F tool/max-limits.c cbb635fbb37ae4d05f240bfb5b5270bb63c54439
F tool/merge-test.tcl de76b62f2de2a92d4c1ca4f976bce0aea6899e0229e250479b229b2a1914b176
F tool/mkamalzip.tcl 8aa5ebe7973c8b8774062d34e15fea9815c4cc2ceea3a9b184695f005910876a
-F tool/mkautoconfamal.sh c5e65fa1c922f2e3b3e4f6cd0331ec7d84bdef085f32cb1c46673cdf95ec8090
+F tool/mkautoconfamal.sh 401f6378a99bb045b63abe8c2dad6bd6fd5a1c2b9c8cded9d7ac5848ea578994
F tool/mkccode.tcl c42a8f8cf78f92e83795d5447460dbce7aaf78a3bbf9082f1507dc71a3665f3c x
F tool/mkctimec.tcl f76dbfc74cefad8d126384ba3263677939f077bd184fcdf8c592a1daf64f50c3 x
F tool/mkkeywordhash.c 6b0be901c47f9ad42215fc995eb2f4384ac49213b1fba395102ec3e999acf559
@@ -2206,7 +2208,6 @@ F tool/stack_usage.tcl f8e71b92cdb099a147dad572375595eae55eca43
F tool/stripccomments.c 68d2aa8cb504439f541ce66b8f128067612bdd16f5fb7bfe540f3fcb67c9c197
F tool/symbols-mingw.sh 4dbcea7e74768305384c9fd2ed2b41bbf9f0414d
F tool/symbols.sh 1612bd947750e21e7b47befad5f6b3825b06cce0705441f903bf35ced65ae9b9
-F tool/tclConfigShToAutoDef.sh 44ec55046d86a3febb2cb3e099399b41794e80e9cd138eee7b9b016f819e882b x
F tool/tclConfigShToMake.sh 7c065d81c2d178e15e45a77372c6e5a38b5a1b08755301cd6f20a3a862db7312 x
F tool/varint.c 5d94cb5003db9dbbcbcc5df08d66f16071aee003
F tool/vdbe-compress.tcl fa2f37ab39b2a0087fafb6a7f3ce19503e25e624ffa8ed9951717ab72920c088
@@ -2215,8 +2216,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 505d9e49f7af619eda9e46e7ed19c4446c64628233528e1ab3f70264e1640ace
-R 08c1a7493121908afbb1dcd042c1e7a8
+P 83c34decbe336c76062e6b1bfe4c2e8f786841a4b6efa001747e786e872c8c71 1f98fc07fdf06d699ffbf1521b0b5e937a582017e4325bd994b488e06becbecc
+R de2202eb83cd3308bb9095ebe2525c12
U stephan
-Z 7f697af593c155277b9e5f1e31c153ef
+Z 7d9ccaf76dafc30f1ae03a1dfceab1ce
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index bc4be40e96..16e22e682d 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-83c34decbe336c76062e6b1bfe4c2e8f786841a4b6efa001747e786e872c8c71
+a8328b921c5504eceacade417e16e713999eff63978caf3418fd79501590b1cb
diff --git a/src/dbpage.c b/src/dbpage.c
index eb5ab33fe1..f9fdcc5a37 100644
--- a/src/dbpage.c
+++ b/src/dbpage.c
@@ -395,8 +395,8 @@ static int dbpageUpdate(
/* "INSERT INTO dbpage($PGNO,NULL)" causes page number $PGNO and
** all subsequent pages to be deleted. */
pTab->iDbTrunc = iDb;
- pgno--;
- pTab->pgnoTrunc = pgno;
+ pTab->pgnoTrunc = pgno-1;
+ pgno = 1;
}else{
zErr = "bad page value";
goto update_fail;
diff --git a/src/shell.c.in b/src/shell.c.in
index 93d73e6ac7..8272956ebd 100644
--- a/src/shell.c.in
+++ b/src/shell.c.in
@@ -784,6 +784,23 @@ int cli_wcswidth(const char *z){
}
#endif
+/*
+** Check to see if z[] is a valid VT100 escape. If it is, then
+** return the number of bytes in the escape sequence. Return 0 if
+** z[] is not a VT100 escape.
+**
+** This routine assumes that z[0] is \033 (ESC).
+*/
+static int isVt100(const unsigned char *z){
+ int i;
+ if( z[1]!='[' ) return 0;
+ i = 2;
+ while( z[i]>=0x30 && z[i]<=0x3f ){ i++; }
+ while( z[i]>=0x20 && z[i]<=0x2f ){ i++; }
+ if( z[i]<0x40 || z[i]>0x7e ) return 0;
+ return i+1;
+}
+
/*
** Output string zUtf to stdout as w characters. If w is negative,
** then right-justify the text. W is the width in UTF-8 characters, not
@@ -799,6 +816,7 @@ static void utf8_width_print(FILE *out, int w, const char *zUtf){
unsigned char c;
int i = 0;
int n = 0;
+ int k;
int aw = w<0 ? -w : w;
if( zUtf==0 ) zUtf = "";
while( (c = a[i])!=0 ){
@@ -811,6 +829,8 @@ static void utf8_width_print(FILE *out, int w, const char *zUtf){
}
i += len;
n += x;
+ }else if( c==0x1b && (k = isVt100(&a[i]))>0 ){
+ i += k;
}else if( n>=aw ){
break;
}else{
@@ -3998,9 +4018,14 @@ static char *translateForDisplayAndDup(
i++;
continue;
}
- n++;
- j += 3;
- i++;
+ if( c==0x1b && p->eEscMode==SHELL_ESC_OFF && (k = isVt100(&z[i]))>0 ){
+ i += k;
+ j += k;
+ }else{
+ n++;
+ j += 3;
+ i++;
+ }
}
if( n>=mxWidth && bWordWrap ){
/* Perhaps try to back up to a better place to break the line */
@@ -4066,9 +4091,17 @@ static char *translateForDisplayAndDup(
zOut[j++] = '^';
zOut[j++] = 0x40 + c;
break;
- case SHELL_ESC_OFF:
- zOut[j++] = c;
+ case SHELL_ESC_OFF: {
+ int nn;
+ if( c==0x1b && (nn = isVt100(&z[i]))>0 ){
+ memcpy(&zOut[j], &z[i], nn);
+ j += nn;
+ i += nn - 1;
+ }else{
+ zOut[j++] = c;
+ }
break;
+ }
}
i++;
}
diff --git a/src/wal.c b/src/wal.c
index 7f091a48cf..5fe2296d6c 100644
--- a/src/wal.c
+++ b/src/wal.c
@@ -871,10 +871,8 @@ static void walChecksumBytes(
s1 = s2 = 0;
}
- assert( nByte>=8 );
- assert( (nByte&0x00000007)==0 );
- assert( nByte<=65536 );
- assert( nByte%4==0 );
+ /* nByte is a multiple of 8 between 8 and 65536 */
+ assert( nByte>=8 && (nByte&7)==0 && nByte<=65536 );
if( !nativeCksum ){
do {
diff --git a/test/fuzzdata8.db b/test/fuzzdata8.db
index 469df2c681..bfa3e3ecd0 100644
Binary files a/test/fuzzdata8.db and b/test/fuzzdata8.db differ
diff --git a/test/tabfunc01.test b/test/tabfunc01.test
index c16fb9bec2..5938ec6cb6 100644
--- a/test/tabfunc01.test
+++ b/test/tabfunc01.test
@@ -194,6 +194,63 @@ do_execsql_test tabfunc01-5.2 {
WHERE value=67;
} 67
+# 2025-03-22 forum post 0d5d63257e3ff4f6
+#
+do_execsql_test tabfunc01-6.1 {
+ SELECT value FROM generate_series(1,10) WHERE value<5.5;
+} {1 2 3 4 5}
+do_execsql_test tabfunc01-6.2 {
+ SELECT value FROM generate_series(1,10) WHERE value<5.0;
+} {1 2 3 4}
+do_execsql_test tabfunc01-6.3 {
+ SELECT value FROM generate_series(1,10) WHERE value<=5.5;
+} {1 2 3 4 5}
+do_execsql_test tabfunc01-6.4 {
+ SELECT value FROM generate_series(1,10) WHERE value<=5.0;
+} {1 2 3 4 5}
+do_execsql_test tabfunc01-6.5 {
+ SELECT value FROM generate_series(1,10) WHERE value>5.5;
+} {6 7 8 9 10}
+do_execsql_test tabfunc01-6.6 {
+ SELECT value FROM generate_series(1,10) WHERE value>5.0;
+} {6 7 8 9 10}
+do_execsql_test tabfunc01-6.7 {
+ SELECT value FROM generate_series(1,10) WHERE value>=5.5;
+} {6 7 8 9 10}
+do_execsql_test tabfunc01-6.8 {
+ SELECT value FROM generate_series(1,10) WHERE value>=5.0;
+} {5 6 7 8 9 10}
+do_execsql_test tabfunc01-6.9 {
+ SELECT value FROM generate_series(10,1,-1) WHERE value<5.5;
+} {5 4 3 2 1}
+do_execsql_test tabfunc01-6.10 {
+ SELECT value FROM generate_series(10,1,-1) WHERE value<5.0;
+} {4 3 2 1}
+do_execsql_test tabfunc01-6.11 {
+ SELECT value FROM generate_series(10,1,-1) WHERE value<=5.5;
+} {5 4 3 2 1}
+do_execsql_test tabfunc01-6.12 {
+ SELECT value FROM generate_series(10,1,-1) WHERE value<=5.0;
+} {5 4 3 2 1}
+do_execsql_test tabfunc01-6.13 {
+ SELECT value FROM generate_series(10,1,-1) WHERE value>5.5;
+} {10 9 8 7 6}
+do_execsql_test tabfunc01-6.14 {
+ SELECT value FROM generate_series(10,1,-1) WHERE value>5.0;
+} {10 9 8 7 6}
+do_execsql_test tabfunc01-6.15 {
+ SELECT value FROM generate_series(10,1,-1) WHERE value>=5.5;
+} {10 9 8 7 6}
+do_execsql_test tabfunc01-6.16 {
+ SELECT value FROM generate_series(10,1,-1) WHERE value>=5.0;
+} {10 9 8 7 6 5}
+do_execsql_test tabfunc01-6.17 {
+ SELECT value FROM generate_series(1,10) WHERE value==5.5;
+} {}
+do_execsql_test tabfunc01-6.18 {
+ SELECT value FROM generate_series(1,10) WHERE value==5.0;
+} {5}
+
# The next series of tests is verifying that virtual table are able
# to optimize the IN operator, even on terms that are not marked "omit".
# When the generate_series virtual table is compiled for the testfixture,
diff --git a/test/vt100-a.sql b/test/vt100-a.sql
new file mode 100644
index 0000000000..a0d3f46be7
--- /dev/null
+++ b/test/vt100-a.sql
@@ -0,0 +1,19 @@
+/*
+** Run this script using the "sqlite3" command-line shell
+** test test formatting of output text that contains
+** vt100 escape sequences.
+*/
+.mode box -escape off
+CREATE TEMP TABLE t1(a,b,c);
+INSERT INTO t1 VALUES
+ ('one','twotwotwo','thirty-three'),
+ (unistr('\u001b[91mRED\u001b[0m'),'fourfour','fifty-five'),
+ ('six','seven','eighty-eight');
+.print With -escape off
+SELECT * FROM t1;
+.mode box -escape ascii
+.print With -escape ascii
+SELECT * FROM t1;
+.mode box -escape symbol
+.print With -escape symbol
+SELECT * FROM t1;
diff --git a/tool/mkautoconfamal.sh b/tool/mkautoconfamal.sh
index c26ac8c73c..9ccf8b6558 100644
--- a/tool/mkautoconfamal.sh
+++ b/tool/mkautoconfamal.sh
@@ -37,6 +37,8 @@ then echo "TEA version number ok"
else echo "TEA version number mismatch. Should be $VERSION"; exit 1
fi
+
+
# If this script is given an argument of --snapshot, then generate a
# snapshot tarball named for the current checkout SHA hash, rather than
# the version number.
diff --git a/tool/tclConfigShToAutoDef.sh b/tool/tclConfigShToAutoDef.sh
deleted file mode 100755
index d12657063e..0000000000
--- a/tool/tclConfigShToAutoDef.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-#
-# A level of indirection for use soley by the configure script
-# (auto.def).
-#
-# Expects to be passed a full path to a tclConfig.sh. It sources it
-# and emits TCL code which sets some vars which are exported by
-# tclConfig.sh.
-#
-# This script expects that the caller has already validated that the
-# file exists, is not a directory, and is readable.
-#
-# If passed no filename, or an empty one, then it emits config code
-# suitable for the "config not found" case.
-if test x = "x$1"; then
- TCL_INCLUDE_SPEC=
- TCL_LIB_SPEC=
- TCL_STUB_LIB_SPEC=
- TCL_EXEC_PREFIX=
- TCL_VERSION=
-else
- . "$1"
-fi
-
-echo "define TCL_INCLUDE_SPEC {$TCL_INCLUDE_SPEC} ;"
-echo "define TCL_LIB_SPEC {$TCL_LIB_SPEC} ;"
-echo "define TCL_STUB_LIB_SPEC {$TCL_STUB_LIB_SPEC} ;"
-echo "define TCL_EXEC_PREFIX {$TCL_EXEC_PREFIX} ;"
-echo "define TCL_VERSION {$TCL_VERSION} ;"