From 5cc7f4b5802d4a5ce0fa16f827382dd8dfdb512e Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 1 Aug 2024 14:16:36 +0000 Subject: [PATCH 01/45] Add the "errors" command to testrunner.tcl. FossilOrigin-Name: 03b7f99229cfcffde024915e6812d75ae11318db9dc93a00838e4588a79b1243 --- manifest | 12 ++++---- manifest.uuid | 2 +- test/testrunner.tcl | 67 +++++++++++++++++++++++++++++++++++++++------ 3 files changed, 66 insertions(+), 15 deletions(-) diff --git a/manifest b/manifest index ce082dd8f3..5a1c13a60f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\stclsqlite.c\sTCL\sinterface\smodule\sso\sthat\sit\sworks\swith\sboth\sTcl8\sand\nTcl9.\s\sMake\schanges\sacross\sthe\sTCL-based\stest\sharness\sto\senable\sSQLite\sto\nbe\stested\swith\seither\sTcl8\sor\sTcl9.\s\sGet\sthe\s--with-tcl=\sargument\son\sthe\nconfigure\sscript\sworking.\sTesting\schanges\sonly\s-\sno\schanges\sto\sthe\sSQLite\score.\nI\sbelieve\sthe\sprevious\smerge\sattempt\sdidn't\swork\sbecause\sof\serrors\sin\sthe\nmerge\sitself,\snot\sbecause\sof\sfaults\sin\sthe\scode.\s\sTrying\sagain... -D 2024-07-31T22:36:14.186 +C Add\sthe\s"errors"\scommand\sto\stestrunner.tcl. +D 2024-08-01T14:16:36.126 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -1705,7 +1705,7 @@ F test/temptable2.test 76821347810ecc88203e6ef0dd6897b6036ac788e9dd3e6b04fd4d163 F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637 F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc F test/tester.tcl 640106bf8f7785d0ac67cda2837577eb9f2d936033bacedf9e705ca5451958ef -F test/testrunner.tcl 2d100e73245e5f423942b6c198176c699137ee65192ed872bd8c9d4ac2c779b3 +F test/testrunner.tcl 609d9e8f073ad7a4f839e3394ffb5019d4ea895c08e6701115bb0e94afa45c65 F test/testrunner_data.tcl c5ae2b1f9a99210b0600d002fb3af1fee350997cee9416551e83b93501360ebf F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899 F test/thread002.test c24c83408e35ba5a952a3638b7ac03ccdf1ce4409289c54a050ac4c5f1de7502 @@ -2200,8 +2200,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 86de4e755e37dc1cbcbd59018927aa87ff49fc15f706a36187631d8f14075c12 f23ad0979865f3c11a3dbd0598ee7c4e2eabeaf1863d000fc0242e18890a4a11 -R 5fce834a5a2db65fecaa00b46e4798f7 +P ea9d88f9ca3399bca83bf03893689a927b73e481604b94527e42de43f103eb46 +R bfca8ad2d62c4f03659e091bb06ca2cc U drh -Z 9ec5dbf6df6049abe121ce7ac9b8445b +Z 49d94432a94da4d21f2422461c255ece # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 05b9c5c202..6742779a8c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ea9d88f9ca3399bca83bf03893689a927b73e481604b94527e42de43f103eb46 +03b7f99229cfcffde024915e6812d75ae11318db9dc93a00838e4588a79b1243 diff --git a/test/testrunner.tcl b/test/testrunner.tcl index b320528735..3b9da35b00 100644 --- a/test/testrunner.tcl +++ b/test/testrunner.tcl @@ -54,6 +54,7 @@ proc usage {} { Usage: $a0 ?SWITCHES? ?PERMUTATION? ?PATTERNS? $a0 PERMUTATION FILE + $a0 errors ?-v|--verbose? $a0 help $a0 njob ?NJOB? $a0 script ?-msvc? CONFIG @@ -107,6 +108,11 @@ The "script" command outputs the script used to build a configuration. Add the "-msvc" option for a Windows-compatible script. For a list of available configurations enter "$a0 script help". +The "errors" commands shows the output of all tests that failed in the +most recent run. Complete output is shown if the -v or --verbose options +are used. Otherwise, an attempt is made to minimize the output to show +only the parts that contain the error messages. + Full documentation here: https://sqlite.org/src/doc/trunk/doc/testrunner.md }]] @@ -398,12 +404,22 @@ if {[llength $argv]==1 puts " $dfname $dtm" } + if {![file readable $TRG(dbname)]} { + puts "Database missing: $TRG(dbname)" + exit + } sqlite3 mydb $TRG(dbname) mydb timeout 2000 mydb eval BEGIN - set cmdline [mydb one { SELECT value FROM config WHERE name='cmdline' }] - set nJob [mydb one { SELECT value FROM config WHERE name='njob' }] + if {[catch { + set cmdline [mydb one { SELECT value FROM config WHERE name='cmdline' }] + set nJob [mydb one { SELECT value FROM config WHERE name='njob' }] + } msg]} { + puts "Cannot read database: $TRG(dbname)" + mydb close + exit + } set now [clock_milliseconds] set tm [mydb one { @@ -457,6 +473,47 @@ if {[llength $argv]==1 exit } +#-------------------------------------------------------------------------- +# Check if this is the "errors" command: +# +if {[llength $argv]>=1 && [llength $argv]<=2 + && ([string compare -nocase errors [lindex $argv 0]]==0 || + [string match err* [lindex $argv 0]]==1) +} { + set verbose 0 + for {set ii 1} {$ii<[llength $argv]} {incr ii} { + set a0 [lindex $argv $ii] + if {$a0=="-v" || $a0=="--verbose" || $a0=="-verbose"} { + set verbose 1 + } else { + puts "unknown option: \"$a0\"". Use --help for more info." + exit 1 + } + } + set cnt 0 + sqlite3 mydb $TRG(dbname) + mydb timeout 2000 + mydb eval {SELECT displaytype, displayname, output + FROM jobs WHERE state='failed'} { + puts "**** $displayname ****" + if {$verbose || $displaytype!="tcl"} { + puts $output + } else { + foreach line [split $output \n] { + if {[string match {!*} $line] || [string match *failed* $line]} { + puts $line + } + } + } + incr cnt + } + mydb close + if {$cnt==0} { + puts "No errors" + } + exit +} + #------------------------------------------------------------------------- # Parse the command line. # @@ -603,12 +660,6 @@ proc r_get_next_job {iJob} { return $ret } -#rename r_get_next_job r_get_next_job_r -#proc r_get_next_job {iJob} { - #puts [time { set res [r_get_next_job_r $iJob] }] - #set res -#} - # Usage: # # add_job OPTION ARG OPTION ARG... From a51de65758d5bfd9507dfbee897d66dd3215503c Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 1 Aug 2024 14:43:27 +0000 Subject: [PATCH 02/45] Include a test case summary in the output of "errors" in testrunner.tcl. FossilOrigin-Name: 173df1478e89996126e172656e35da8026d4ef145b2341ef56213f00ade14f48 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/testrunner.tcl | 31 ++++++++++++++++++++++++++++--- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 5a1c13a60f..488738897e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\s"errors"\scommand\sto\stestrunner.tcl. -D 2024-08-01T14:16:36.126 +C Include\sa\stest\scase\ssummary\sin\sthe\soutput\sof\s"errors"\sin\stestrunner.tcl. +D 2024-08-01T14:43:27.026 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -1705,7 +1705,7 @@ F test/temptable2.test 76821347810ecc88203e6ef0dd6897b6036ac788e9dd3e6b04fd4d163 F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637 F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc F test/tester.tcl 640106bf8f7785d0ac67cda2837577eb9f2d936033bacedf9e705ca5451958ef -F test/testrunner.tcl 609d9e8f073ad7a4f839e3394ffb5019d4ea895c08e6701115bb0e94afa45c65 +F test/testrunner.tcl f6ac1a55ce4c9278cf8c4dbaed1facd347c9b80acae5d32511c3bf3e529a4817 F test/testrunner_data.tcl c5ae2b1f9a99210b0600d002fb3af1fee350997cee9416551e83b93501360ebf F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899 F test/thread002.test c24c83408e35ba5a952a3638b7ac03ccdf1ce4409289c54a050ac4c5f1de7502 @@ -2200,8 +2200,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P ea9d88f9ca3399bca83bf03893689a927b73e481604b94527e42de43f103eb46 -R bfca8ad2d62c4f03659e091bb06ca2cc +P 03b7f99229cfcffde024915e6812d75ae11318db9dc93a00838e4588a79b1243 +R 08e6905a776f74e196253ed63d164e48 U drh -Z 49d94432a94da4d21f2422461c255ece +Z 096dcbc7b2b21544af81d2d7e8439d72 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 6742779a8c..7d0cd49d41 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -03b7f99229cfcffde024915e6812d75ae11318db9dc93a00838e4588a79b1243 +173df1478e89996126e172656e35da8026d4ef145b2341ef56213f00ade14f48 diff --git a/test/testrunner.tcl b/test/testrunner.tcl index 3b9da35b00..aeb015865d 100644 --- a/test/testrunner.tcl +++ b/test/testrunner.tcl @@ -473,6 +473,32 @@ if {[llength $argv]==1 exit } +# Scan the output of all jobs looking for the summary lines that +# report the number of test cases and the number of errors. +# Aggregate these numbers and return them. +# +proc aggregate_test_counts {db} { + set ncase 0 + set nerr 0 + $db eval {SELECT output FROM jobs WHERE displaytype IN ('tcl','fuzz')} { + set n 0 + set m 0 + if {[regexp {(\d+) errors out of (\d+) tests} $output all n m] + && [string is integer -strict $n] + && [string is integer -strict $m]} { + incr ncase $m + incr nerr $n + } elseif {[regexp {sessionfuzz.*: *(\d+) cases, (\d+) crash} $output \ + all m n] + && [string is integer -strict $m] + && [string is integer -strict $n]} { + incr ncase $m + incr nerr $n + } + } + return [list $nerr $ncase] +} + #-------------------------------------------------------------------------- # Check if this is the "errors" command: # @@ -507,10 +533,9 @@ if {[llength $argv]>=1 && [llength $argv]<=2 } incr cnt } + set summary [aggregate_test_counts mydb] mydb close - if {$cnt==0} { - puts "No errors" - } + puts "Total [lindex $summary 0] errors out of [lindex $summary 1] tests" exit } From 91db27aff576f818bd8be078494fed3feb341f0d Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 1 Aug 2024 18:10:00 +0000 Subject: [PATCH 03/45] Clean up and restructure the TCL configuration sections in autoconf. The new --with-tclsh=FILE option lets you select the specific tclsh that you want to run. FossilOrigin-Name: 8fafc679d91e857602fbbe203144ca98242246660ede5a49c5fec8aaff571151 --- configure | 361 +++++++++++----------------------------- configure.ac | 252 ++++++---------------------- manifest | 18 +- manifest.uuid | 2 +- tool/find_tclconfig.tcl | 24 +++ 5 files changed, 187 insertions(+), 470 deletions(-) create mode 100644 tool/find_tclconfig.tcl diff --git a/configure b/configure index efd0422ac1..744410589b 100755 --- a/configure +++ b/configure @@ -781,18 +781,6 @@ TARGET_HAVE_EDITLINE TARGET_HAVE_READLINE TARGET_READLINE_INC TARGET_READLINE_LIBS -HAVE_TCL -TCL_SHLIB_SUFFIX -TCL_STUB_LIB_SPEC -TCL_STUB_LIB_FLAG -TCL_STUB_LIB_FILE -TCL_LIB_SPEC -TCL_LIB_FLAG -TCL_LIB_FILE -TCL_INCLUDE_SPEC -TCL_SRC_DIR -TCL_BIN_DIR -TCL_VERSION TARGET_EXEEXT SQLITE_OS_WIN SQLITE_OS_UNIX @@ -806,6 +794,18 @@ RELEASE VERSION program_prefix TCLLIBDIR +HAVE_TCL +TCL_SHLIB_SUFFIX +TCL_STUB_LIB_SPEC +TCL_STUB_LIB_FLAG +TCL_STUB_LIB_FILE +TCL_LIB_SPEC +TCL_LIB_FLAG +TCL_LIB_FILE +TCL_INCLUDE_SPEC +TCL_SRC_DIR +TCL_BIN_DIR +TCL_VERSION TCLSH_CMD INSTALL_DATA INSTALL_SCRIPT @@ -894,12 +894,12 @@ enable_fast_install with_gnu_ld enable_libtool_lock enable_largefile +with_tclsh +with_tcl with_wasi_sdk enable_threadsafe enable_releasemode enable_tempstore -enable_tcl -with_tcl enable_editline enable_readline with_readline_lib @@ -1555,7 +1555,6 @@ Optional Features: --enable-releasemode Support libtool link to release mode --enable-tempstore Use an in-ram database for temporary tables (never,no,yes,always) - --disable-tcl do not build TCL extension --enable-editline enable BSD editline support --disable-readline disable readline support --enable-debug enable debugging & verbose explain @@ -1583,10 +1582,10 @@ Optional Packages: --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-tclsh=PATHNAME full pathname of a tclsh to use + --with-tcl=DIR directory containing (tclConfig.sh) --with-wasi-sdk=DIR directory containing the WASI SDK. Triggers cross-compile to WASM. - --with-tcl=DIR directory containing tcl configuration - (tclConfig.sh) --with-readline-lib specify readline library --with-readline-inc specify readline include paths --with-linenoise=DIR source directory for linenoise library @@ -3945,13 +3944,13 @@ if ${lt_cv_nm_interface+:} false; then : else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:3948: $ac_compile\"" >&5) + (eval echo "\"\$as_me:3947: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:3951: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:3950: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:3954: output\"" >&5) + (eval echo "\"\$as_me:3953: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -5157,7 +5156,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5160 "configure"' > conftest.$ac_ext + echo '#line 5159 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -6682,11 +6681,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6685: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6684: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6689: \$? = $ac_status" >&5 + echo "$as_me:6688: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7021,11 +7020,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7024: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7023: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7028: \$? = $ac_status" >&5 + echo "$as_me:7027: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7126,11 +7125,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7129: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7128: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7133: \$? = $ac_status" >&5 + echo "$as_me:7132: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -7181,11 +7180,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7184: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7183: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7188: \$? = $ac_status" >&5 + echo "$as_me:7187: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9561,7 +9560,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 9564 "configure" +#line 9563 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -9657,7 +9656,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 9660 "configure" +#line 9659 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10314,24 +10313,23 @@ done USE_AMALGAMATION=1 ######### -# See whether we can run specific tclsh versions known to work well; -# if not, then we fall back to plain tclsh. -# TODO: try other versions before falling back? +# Figure out all the name of a working tclsh and parameters needed to compile against Tcl. +# The --with-tcl= configuration parameter might be useful for this. # -if test x"${with_tcl}" != x; then - if test ! -r ${with_tcl}/tclConfig.sh; then - as_fn_error $? "no tclConfig.sh file found in --with-tcl: ${with_tcl}" "$LINENO" 5 - else - . ${with_tcl}/tclConfig.sh - TCLSH_CMD=${TCL_EXEC_PREFIX}/bin/tclsh${TCL_VERSION} - if test ! -x ${TCLSH_CMD}; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot use tclsh at: ${TCLSH_CMD}" >&5 -$as_echo "$as_me: WARNING: cannot use tclsh at: ${TCLSH_CMD}" >&2;} - TCLSH_CMD=none - fi - fi -else - for ac_prog in tclsh8.6 tclsh8.5 tclsh + +# Check whether --with-tclsh was given. +if test "${with_tclsh+set}" = set; then : + withval=$with_tclsh; +fi + + +# Check whether --with-tcl was given. +if test "${with_tcl+set}" = set; then : + withval=$with_tcl; +fi + +if test x"${with_tclsh}" == x -a x"${with_tcl}" == x; then + for ac_prog in tclsh8.6 tclsh tclsh9.0 do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 @@ -10374,23 +10372,71 @@ fi done test -n "$TCLSH_CMD" || TCLSH_CMD="none" + with_tclsh=${TCLSH_CMD} +fi +if test x"${with_tclsh}" != x -a x"${with_tclsh}" != xnone; then + TCLSH_CMD=${with_tclsh} + { $as_echo "$as_me:${as_lineno-$LINENO}: result: using tclsh at \"$TCLSH_CMD\"" >&5 +$as_echo "using tclsh at \"$TCLSH_CMD\"" >&6; } + with_tcl=`${with_tclsh} <${srcdir}/tool/find_tclconfig.tcl` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TCLSH_CMD recommends the tclConfig.sh at ${with_tcl}" >&5 +$as_echo "$TCLSH_CMD recommends the tclConfig.sh at ${with_tcl}" >&6; } +fi +if test x"${with_tcl}" != x; then + if test -r ${with_tcl}/tclConfig.sh; then + tclconfig="${with_tcl}/tclConfig.sh" + else + if test -r ${with_tcl}/tcl8.6/tclConfig.sh; then + tclconfig="${with_tcl}/tcl8.6/tclConfig.sh" + else + as_fn_error $? "no tclConfig.sh file found in ${with_tcl} or ${with_tcl}/tcl8.6" "$LINENO" 5 + fi + fi + if test x"${tclconfig}" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: loading TCL configuration from ${tclconfig}" >&5 +$as_echo "loading TCL configuration from ${tclconfig}" >&6; } + . ${tclconfig} + + + + + + + + + + + + fi + if test x"$TCLSH_CMD" == x; then + TCLSH_CMD=${TCL_EXEC_PREFIX}/bin/tclsh${TCL_VERSION} + if test ! -x ${TCLSH_CMD}; then + TCLSH_CMD_2=${TCL_EXEC_PREFIX}/bin/tclsh + if test ! -x ${TCLSH_CMD_2}; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot find a usable tclsh at either ${TCLSH_CMD} or ${TCLSH_CMD_2}" >&5 +$as_echo "$as_me: WARNING: cannot find a usable tclsh at either ${TCLSH_CMD} or ${TCLSH_CMD_2}" >&2;} + TCLSH_CMD=none + else + TCLSH_CMD=${TCLSH_CMD_2} + fi + fi + fi fi if test "$TCLSH_CMD" = "none"; then # If we can't find a local tclsh, then building the amalgamation will fail. # We act as though --disable-amalgamation has been used. - echo "Warning: can't find tclsh - defaulting to non-amalgamation build." + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Warning: can't find tclsh - defaulting to non-amalgamation build." >&5 +$as_echo "$as_me: WARNING: Warning: can't find tclsh - defaulting to non-amalgamation build." >&2;} USE_AMALGAMATION=0 TCLSH_CMD="tclsh" -fi -if test x"$TCLSH_CMD" = x; then - as_fn_error $? "cannot find a usable tclsh" "$LINENO" 5 + HAVE_TCL=0 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: using $TCLSH_CMD" >&5 -$as_echo "using $TCLSH_CMD" >&6; } + HAVE_TCL=1 fi + if test "x${TCLLIBDIR+set}" != "xset" ; then TCLLIBDIR='$(libdir)' for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}` ; do @@ -10789,213 +10835,6 @@ fi -########## -# Figure out all the parameters needed to compile against Tcl. -# -# This code is derived from the SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG -# macros in the in the tcl.m4 file of the standard TCL distribution. -# Those macros could not be used directly since we have to make some -# minor changes to accomodate systems that do not have TCL installed. -# -# Check whether --enable-tcl was given. -if test "${enable_tcl+set}" = set; then : - enableval=$enable_tcl; use_tcl=$enableval -else - use_tcl=yes -fi - -if test "${use_tcl}" = "yes" ; then - -# Check whether --with-tcl was given. -if test "${with_tcl+set}" = set; then : - withval=$with_tcl; with_tclconfig=${withval} -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl configuration" >&5 -$as_echo_n "checking for Tcl configuration... " >&6; } - if ${ac_cv_c_tclconfig+:} false; then : - $as_echo_n "(cached) " >&6 -else - - # First check to see if --with-tcl was specified. - if test x"${with_tclconfig}" != x ; then - if test -f "${with_tclconfig}/tclConfig.sh" ; then - ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` - else - as_fn_error $? "${with_tclconfig} directory doesn't contain tclConfig.sh" "$LINENO" 5 - fi - fi - - # Start autosearch by asking tclsh - if test x"${ac_cv_c_tclconfig}" = x ; then - if test x"$cross_compiling" = xno; then - for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}` - do - if test -f "$i/tclConfig.sh" ; then - ac_cv_c_tclconfig="$i" - break - fi - done - fi - fi - - # On ubuntu 14.10, $auto_path on tclsh is not quite correct. - # So try again after applying corrections. - if test x"${ac_cv_c_tclconfig}" = x ; then - if test x"$cross_compiling" = xno; then - for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD} | sed 's,/tcltk/tcl,/tcl,g'` - do - if test -f "$i/tclConfig.sh" ; then - ac_cv_c_tclconfig="$i" - break - fi - done - fi - fi - - # Recent versions of Xcode on Macs hid the tclConfig.sh file - # in a strange place. - if test x"${ac_cv_c_tclconfig}" = x ; then - if test x"$cross_compiling" = xno; then - for i in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX*.sdk/usr/lib - do - if test -f "$i/tclConfig.sh" ; then - ac_cv_c_tclconfig="$i" - break - fi - done - fi - fi - - # then check for a private Tcl installation - if test x"${ac_cv_c_tclconfig}" = x ; then - for i in \ - ../tcl \ - `ls -dr ../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ - `ls -dr ../tcl[8-9].[0-9] 2>/dev/null` \ - `ls -dr ../tcl[8-9].[0-9]* 2>/dev/null` \ - ../../tcl \ - `ls -dr ../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ - `ls -dr ../../tcl[8-9].[0-9] 2>/dev/null` \ - `ls -dr ../../tcl[8-9].[0-9]* 2>/dev/null` \ - ../../../tcl \ - `ls -dr ../../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ - `ls -dr ../../../tcl[8-9].[0-9] 2>/dev/null` \ - `ls -dr ../../../tcl[8-9].[0-9]* 2>/dev/null` - do - if test -f "$i/unix/tclConfig.sh" ; then - ac_cv_c_tclconfig=`(cd $i/unix; pwd)` - break - fi - done - fi - - # check in a few common install locations - if test x"${ac_cv_c_tclconfig}" = x ; then - for i in \ - `ls -d ${libdir} 2>/dev/null` \ - `ls -d /usr/local/lib 2>/dev/null` \ - `ls -d /usr/contrib/lib 2>/dev/null` \ - `ls -d /usr/lib 2>/dev/null` - do - if test -f "$i/tclConfig.sh" ; then - ac_cv_c_tclconfig=`(cd $i; pwd)` - break - fi - done - fi - - # check in a few other private locations - if test x"${ac_cv_c_tclconfig}" = x ; then - for i in \ - ${srcdir}/../tcl \ - `ls -dr ${srcdir}/../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ - `ls -dr ${srcdir}/../tcl[8-9].[0-9] 2>/dev/null` \ - `ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` - do - if test -f "$i/unix/tclConfig.sh" ; then - ac_cv_c_tclconfig=`(cd $i/unix; pwd)` - break - fi - done - fi - -fi - - - if test x"${ac_cv_c_tclconfig}" = x ; then - use_tcl=no - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't find Tcl configuration definitions" >&5 -$as_echo "$as_me: WARNING: Can't find Tcl configuration definitions" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Without Tcl the regression tests cannot be executed ***" >&5 -$as_echo "$as_me: WARNING: *** Without Tcl the regression tests cannot be executed ***" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Consider using --with-tcl=... to define location of Tcl ***" >&5 -$as_echo "$as_me: WARNING: *** Consider using --with-tcl=... to define location of Tcl ***" >&2;} - else - TCL_BIN_DIR=${ac_cv_c_tclconfig} - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found $TCL_BIN_DIR/tclConfig.sh" >&5 -$as_echo "found $TCL_BIN_DIR/tclConfig.sh" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5 -$as_echo_n "checking for existence of $TCL_BIN_DIR/tclConfig.sh... " >&6; } - if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: loading" >&5 -$as_echo "loading" >&6; } - . $TCL_BIN_DIR/tclConfig.sh - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: file not found" >&5 -$as_echo "file not found" >&6; } - fi - - # - # If the TCL_BIN_DIR is the build directory (not the install directory), - # then set the common variable name to the value of the build variables. - # For example, the variable TCL_LIB_SPEC will be set to the value - # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC - # instead of TCL_BUILD_LIB_SPEC since it will work with both an - # installed and uninstalled version of Tcl. - # - - if test -f $TCL_BIN_DIR/Makefile ; then - TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} - TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} - TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} - fi - - # - # eval is required to do the TCL_DBGX substitution - # - - eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" - eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" - eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" - - eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" - eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" - eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" - - - - - - - - - - - - - - - fi -fi -if test "${use_tcl}" = "no" ; then - HAVE_TCL="" -else - HAVE_TCL=1 -fi - - ########## # Figure out what C libraries are required to compile programs # that use "readline()" library. diff --git a/configure.ac b/configure.ac index 9d8c594bae..404a80bffd 100644 --- a/configure.ac +++ b/configure.ac @@ -116,37 +116,71 @@ AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_s USE_AMALGAMATION=1 ######### -# See whether we can run specific tclsh versions known to work well; -# if not, then we fall back to plain tclsh. -# TODO: try other versions before falling back? +# Figure out all the name of a working tclsh and parameters needed to compile against Tcl. +# The --with-tcl= configuration parameter might be useful for this. # +AC_ARG_WITH(tclsh, AS_HELP_STRING([--with-tclsh=PATHNAME],[full pathname of a tclsh to use])) +AC_ARG_WITH(tcl, AS_HELP_STRING([--with-tcl=DIR],[directory containing (tclConfig.sh)])) +if test x"${with_tclsh}" == x -a x"${with_tcl}" == x; then + AC_CHECK_PROGS(TCLSH_CMD, [tclsh8.6 tclsh tclsh9.0],none) + with_tclsh=${TCLSH_CMD} +fi +if test x"${with_tclsh}" != x -a x"${with_tclsh}" != xnone; then + TCLSH_CMD=${with_tclsh} + AC_MSG_RESULT([using tclsh at "$TCLSH_CMD"]) + with_tcl=`${with_tclsh} <${srcdir}/tool/find_tclconfig.tcl` + AC_MSG_RESULT([$TCLSH_CMD recommends the tclConfig.sh at ${with_tcl}]) +fi if test x"${with_tcl}" != x; then - if test ! -r ${with_tcl}/tclConfig.sh; then - AC_MSG_ERROR([no tclConfig.sh file found in --with-tcl: ${with_tcl}]) + if test -r ${with_tcl}/tclConfig.sh; then + tclconfig="${with_tcl}/tclConfig.sh" else - . ${with_tcl}/tclConfig.sh - TCLSH_CMD=${TCL_EXEC_PREFIX}/bin/tclsh${TCL_VERSION} - if test ! -x ${TCLSH_CMD}; then - AC_MSG_WARN([cannot use tclsh at: ${TCLSH_CMD}]) - TCLSH_CMD=none + if test -r ${with_tcl}/tcl8.6/tclConfig.sh; then + tclconfig="${with_tcl}/tcl8.6/tclConfig.sh" + else + AC_MSG_ERROR([no tclConfig.sh file found in ${with_tcl} or ${with_tcl}/tcl8.6]) + fi + fi + if test x"${tclconfig}" != x; then + AC_MSG_RESULT([loading TCL configuration from ${tclconfig}]) + . ${tclconfig} + AC_SUBST(TCL_VERSION) + AC_SUBST(TCL_BIN_DIR) + AC_SUBST(TCL_SRC_DIR) + AC_SUBST(TCL_INCLUDE_SPEC) + AC_SUBST(TCL_LIB_FILE) + AC_SUBST(TCL_LIB_FLAG) + AC_SUBST(TCL_LIB_SPEC) + AC_SUBST(TCL_STUB_LIB_FILE) + AC_SUBST(TCL_STUB_LIB_FLAG) + AC_SUBST(TCL_STUB_LIB_SPEC) + AC_SUBST(TCL_SHLIB_SUFFIX) + fi + if test x"$TCLSH_CMD" == x; then + TCLSH_CMD=${TCL_EXEC_PREFIX}/bin/tclsh${TCL_VERSION} + if test ! -x ${TCLSH_CMD}; then + TCLSH_CMD_2=${TCL_EXEC_PREFIX}/bin/tclsh + if test ! -x ${TCLSH_CMD_2}; then + AC_MSG_WARN([cannot find a usable tclsh at either ${TCLSH_CMD} or ${TCLSH_CMD_2}]) + TCLSH_CMD=none + else + TCLSH_CMD=${TCLSH_CMD_2} + fi fi fi -else - AC_CHECK_PROGS(TCLSH_CMD, [tclsh8.6 tclsh8.5 tclsh], none) fi if test "$TCLSH_CMD" = "none"; then # If we can't find a local tclsh, then building the amalgamation will fail. # We act as though --disable-amalgamation has been used. - echo "Warning: can't find tclsh - defaulting to non-amalgamation build." + AC_MSG_WARN([Warning: can't find tclsh - defaulting to non-amalgamation build.]) USE_AMALGAMATION=0 TCLSH_CMD="tclsh" -fi -if test x"$TCLSH_CMD" = x; then - AC_MSG_ERROR([cannot find a usable tclsh]) + HAVE_TCL=0 else - AC_MSG_RESULT([using $TCLSH_CMD]) + HAVE_TCL=1 fi AC_SUBST(TCLSH_CMD) +AC_SUBST(HAVE_TCL) AC_ARG_VAR([TCLLIBDIR], [Where to install tcl plugin]) if test "x${TCLLIBDIR+set}" != "xset" ; then @@ -357,190 +391,6 @@ AC_SUBST(SQLITE_OS_UNIX) AC_SUBST(SQLITE_OS_WIN) AC_SUBST(TARGET_EXEEXT) -########## -# Figure out all the parameters needed to compile against Tcl. -# -# This code is derived from the SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG -# macros in the in the tcl.m4 file of the standard TCL distribution. -# Those macros could not be used directly since we have to make some -# minor changes to accomodate systems that do not have TCL installed. -# -AC_ARG_ENABLE(tcl, AS_HELP_STRING([--disable-tcl],[do not build TCL extension]), - [use_tcl=$enableval],[use_tcl=yes]) -if test "${use_tcl}" = "yes" ; then - AC_ARG_WITH(tcl, AS_HELP_STRING([--with-tcl=DIR],[directory containing tcl configuration (tclConfig.sh)]), with_tclconfig=${withval}) - AC_MSG_CHECKING([for Tcl configuration]) - AC_CACHE_VAL(ac_cv_c_tclconfig,[ - # First check to see if --with-tcl was specified. - if test x"${with_tclconfig}" != x ; then - if test -f "${with_tclconfig}/tclConfig.sh" ; then - ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` - else - AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh]) - fi - fi - - # Start autosearch by asking tclsh - if test x"${ac_cv_c_tclconfig}" = x ; then - if test x"$cross_compiling" = xno; then - for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}` - do - if test -f "$i/tclConfig.sh" ; then - ac_cv_c_tclconfig="$i" - break - fi - done - fi - fi - - # On ubuntu 14.10, $auto_path on tclsh is not quite correct. - # So try again after applying corrections. - if test x"${ac_cv_c_tclconfig}" = x ; then - if test x"$cross_compiling" = xno; then - for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD} | sed 's,/tcltk/tcl,/tcl,g'` - do - if test -f "$i/tclConfig.sh" ; then - ac_cv_c_tclconfig="$i" - break - fi - done - fi - fi - - # Recent versions of Xcode on Macs hid the tclConfig.sh file - # in a strange place. - if test x"${ac_cv_c_tclconfig}" = x ; then - if test x"$cross_compiling" = xno; then - for i in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX*.sdk/usr/lib - do - if test -f "$i/tclConfig.sh" ; then - ac_cv_c_tclconfig="$i" - break - fi - done - fi - fi - - # then check for a private Tcl installation - if test x"${ac_cv_c_tclconfig}" = x ; then - for i in \ - ../tcl \ - `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ - `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \ - `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ - ../../tcl \ - `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ - `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ - `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ - ../../../tcl \ - `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ - `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ - `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` - do - if test -f "$i/unix/tclConfig.sh" ; then - ac_cv_c_tclconfig=`(cd $i/unix; pwd)` - break - fi - done - fi - - # check in a few common install locations - if test x"${ac_cv_c_tclconfig}" = x ; then - for i in \ - `ls -d ${libdir} 2>/dev/null` \ - `ls -d /usr/local/lib 2>/dev/null` \ - `ls -d /usr/contrib/lib 2>/dev/null` \ - `ls -d /usr/lib 2>/dev/null` - do - if test -f "$i/tclConfig.sh" ; then - ac_cv_c_tclconfig=`(cd $i; pwd)` - break - fi - done - fi - - # check in a few other private locations - if test x"${ac_cv_c_tclconfig}" = x ; then - for i in \ - ${srcdir}/../tcl \ - `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ - `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \ - `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` - do - if test -f "$i/unix/tclConfig.sh" ; then - ac_cv_c_tclconfig=`(cd $i/unix; pwd)` - break - fi - done - fi - ]) - - if test x"${ac_cv_c_tclconfig}" = x ; then - use_tcl=no - AC_MSG_WARN(Can't find Tcl configuration definitions) - AC_MSG_WARN(*** Without Tcl the regression tests cannot be executed ***) - AC_MSG_WARN(*** Consider using --with-tcl=... to define location of Tcl ***) - else - TCL_BIN_DIR=${ac_cv_c_tclconfig} - AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh) - - AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh]) - if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then - AC_MSG_RESULT([loading]) - . $TCL_BIN_DIR/tclConfig.sh - else - AC_MSG_RESULT([file not found]) - fi - - # - # If the TCL_BIN_DIR is the build directory (not the install directory), - # then set the common variable name to the value of the build variables. - # For example, the variable TCL_LIB_SPEC will be set to the value - # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC - # instead of TCL_BUILD_LIB_SPEC since it will work with both an - # installed and uninstalled version of Tcl. - # - - if test -f $TCL_BIN_DIR/Makefile ; then - TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} - TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} - TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} - fi - - # - # eval is required to do the TCL_DBGX substitution - # - - eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" - eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" - eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" - - eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" - eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" - eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" - - AC_SUBST(TCL_VERSION) - AC_SUBST(TCL_BIN_DIR) - AC_SUBST(TCL_SRC_DIR) - AC_SUBST(TCL_INCLUDE_SPEC) - - AC_SUBST(TCL_LIB_FILE) - AC_SUBST(TCL_LIB_FLAG) - AC_SUBST(TCL_LIB_SPEC) - - AC_SUBST(TCL_STUB_LIB_FILE) - AC_SUBST(TCL_STUB_LIB_FLAG) - AC_SUBST(TCL_STUB_LIB_SPEC) - AC_SUBST(TCL_SHLIB_SUFFIX) - fi -fi -if test "${use_tcl}" = "no" ; then - HAVE_TCL="" -else - HAVE_TCL=1 -fi -AC_SUBST(HAVE_TCL) - ########## # Figure out what C libraries are required to compile programs # that use "readline()" library. diff --git a/manifest b/manifest index 488738897e..19bf09ec46 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Include\sa\stest\scase\ssummary\sin\sthe\soutput\sof\s"errors"\sin\stestrunner.tcl. -D 2024-08-01T14:43:27.026 +C Clean\sup\sand\srestructure\sthe\sTCL\sconfiguration\ssections\sin\sautoconf.\nThe\snew\s--with-tclsh=FILE\soption\slets\syou\sselect\sthe\sspecific\stclsh\nthat\syou\swant\sto\srun. +D 2024-08-01T18:10:00.524 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -35,8 +35,8 @@ F autoconf/tea/win/nmakehlp.c b01f822eabbe1ed2b64e70882d97d48402b42d2689a1ea0034 F autoconf/tea/win/rules.vc 7b3bb2ef32ade0f3f14d951231811678722725e3bca240dd9727ae0dfe10f6a5 F config.guess 883205ddf25b46f10c181818bf42c09da9888884af96f79e1719264345053bd6 F config.sub c2d0260f17f3e4bc0b6808fccf1b291cb5e9126c14fc5890efc77b9fd0175559 -F configure e0efd210b151971f4158e3fdf93b34322882a668a96f88b6167a6f7a51edebec x -F configure.ac 7361a1dd862c0ba0d2daa3d978bc3b93fcccc1ef3efe204d0238722c19bbdcf5 +F configure 7657b4eaced7589ee0259f7c99ca0b71fe3d47b7fdcc13844b64f77d3084c082 x +F configure.ac 6c41bb7a160c3c057af689f5fbf44bd290ccf2fb68be63b3f8d6a9062b224832 F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd F doc/compile-for-windows.md e8635eea9153dcd6a51fd2740666ebc4492b3813cb1ac31cd8e99150df91762d @@ -2104,6 +2104,7 @@ 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 cf68fddd4643bbe3ff8e31b8b6d8b0a1b85e20f4 @@ -2200,8 +2201,11 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 03b7f99229cfcffde024915e6812d75ae11318db9dc93a00838e4588a79b1243 -R 08e6905a776f74e196253ed63d164e48 +P 173df1478e89996126e172656e35da8026d4ef145b2341ef56213f00ade14f48 +R 9276dc9ad744c7eb260be766cc2b74e8 +T *branch * autoconf-revamp +T *sym-autoconf-revamp * +T -sym-trunk * U drh -Z 096dcbc7b2b21544af81d2d7e8439d72 +Z c7858b737379341436d4877837104339 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 7d0cd49d41..0be9acc96b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -173df1478e89996126e172656e35da8026d4ef145b2341ef56213f00ade14f48 +8fafc679d91e857602fbbe203144ca98242246660ede5a49c5fec8aaff571151 diff --git a/tool/find_tclconfig.tcl b/tool/find_tclconfig.tcl new file mode 100644 index 0000000000..c3d3df8ec3 --- /dev/null +++ b/tool/find_tclconfig.tcl @@ -0,0 +1,24 @@ +# +# Run this TCL script to find and print the pathname for the tclConfig.sh +# file. Used by ../configure +# +if {[catch { + set libdir [tcl::pkgconfig get libdir,install] +}]} { + puts stderr "tclsh too old: does not support tcl::pkgconfig" + exit 1 +} +if {![file exists $libdir]} { + puts stderr "tclsh reported library directory \"$libdir\" does not exist" + exit 1 +} +if {![file exists $libdir/tclConfig.sh]} { + set n1 $libdir/tcl$::tcl_version + if {[file exists $n1/tclConfig.sh]} { + set libdir $n1 + } else { + puts stderr "cannot find tclConfig.sh in either $libdir or $n1" + exit 1 + } +} +puts $libdir From 24b1d7a0c8d0ad66864d7600ea60888649e54b5b Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 1 Aug 2024 20:18:10 +0000 Subject: [PATCH 04/45] Work on a TCL script that will compile and install the TCL extension. Works on Linux only, so far. This is an incremental check-in. FossilOrigin-Name: 58babd2aa4b5c9c70e1169cdf09f05eb95d7b13f50bb2ec0e487182288172678 --- manifest | 14 ++-- manifest.uuid | 2 +- tool/buildtclext.tcl | 167 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 174 insertions(+), 9 deletions(-) create mode 100644 tool/buildtclext.tcl diff --git a/manifest b/manifest index 19bf09ec46..a7deb9327a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Clean\sup\sand\srestructure\sthe\sTCL\sconfiguration\ssections\sin\sautoconf.\nThe\snew\s--with-tclsh=FILE\soption\slets\syou\sselect\sthe\sspecific\stclsh\nthat\syou\swant\sto\srun. -D 2024-08-01T18:10:00.524 +C Work\son\sa\sTCL\sscript\sthat\swill\scompile\sand\sinstall\sthe\sTCL\sextension.\nWorks\son\sLinux\sonly,\sso\sfar.\s\sThis\sis\san\sincremental\scheck-in. +D 2024-08-01T20:18:10.470 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -2093,6 +2093,7 @@ F tool/GetTclKit.bat d84033c6a93dfe735d247f48ba00292a1cc284dcf69963e5e672444e045 F tool/Replace.cs 02c67258801c2fb5f63231e0ac0f220b4b36ba91 F tool/build-all-msvc.bat c817b716e0edeecaf265a6775b63e5f45c34a6544f1d4114a222701ed5ac79ab x F tool/build-shell.sh f193b5e3eb4afcb4abbf96bf1475be6cfb74763ee2e50c82bc7ca105e8a136c5 +F tool/buildtclext.tcl 0ef183d0786744d13b06fec85e2cd4ee7369dd58c3ef2f684c5a616d952777d4 F tool/cg_anno.tcl c1f875f5a4c9caca3d59937b16aff716f8b1883935f1b4c9ae23124705bc8099 x F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2 F tool/cktclsh.sh 6075eef9c6b9ba4b38fef2ca2a66d25f2311bd3c610498d18a9b01f861629cca @@ -2201,11 +2202,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 173df1478e89996126e172656e35da8026d4ef145b2341ef56213f00ade14f48 -R 9276dc9ad744c7eb260be766cc2b74e8 -T *branch * autoconf-revamp -T *sym-autoconf-revamp * -T -sym-trunk * +P 8fafc679d91e857602fbbe203144ca98242246660ede5a49c5fec8aaff571151 +R e8c67e263d146ad1487048a2a5cec02e U drh -Z c7858b737379341436d4877837104339 +Z b7f53b5d5d52347992c8bf634ae8776a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0be9acc96b..0a50f25895 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8fafc679d91e857602fbbe203144ca98242246660ede5a49c5fec8aaff571151 +58babd2aa4b5c9c70e1169cdf09f05eb95d7b13f50bb2ec0e487182288172678 diff --git a/tool/buildtclext.tcl b/tool/buildtclext.tcl new file mode 100644 index 0000000000..947bcf5e4c --- /dev/null +++ b/tool/buildtclext.tcl @@ -0,0 +1,167 @@ +# +# Run this TCL script to build and optionally install the TCL interface +# library for SQLite. Run the script with the specific "tclsh" for which +# the installation should occur. +# +# Options: +# +# --build-only Only build the extension, don't install it +# --install-only Install an extension previously build +# --uninstall Uninstall the extension +# +set installonly 0 +set buildonly 0 +set uninstall 0 +for {set ii 0} {$ii<[llength $argv]} {incr ii} { + set a0 [lindex $argv $ii] + if {$a0=="--install-only"} { + set installonly 1 + } elseif {$a0=="--build-only"} { + set buildonly 1 + } elseif {$a0=="--uninstall"} { + set uninstall 1 + } else { + puts stderr "Unknown option: \"$a0\"" + exit 1 + } +} + +# Find the root of the SQLite source tree +# +set srcdir [file normalize [file dir $argv0]/..] + +# Get the SQLite version number into $VERSION +# +set fd [open $srcdir/VERSION] +set VERSION [string trim [read $fd]] +close $fd + +# Figure out the location of the tclConfig.sh file used by the +# tclsh that is executing this script. +# +if {[catch { + set LIBDIR [tcl::pkgconfig get libdir,install] +}]} { + puts stderr "$argv0: tclsh does not support tcl::pkgconfig." + exit 1 +} +if {![file exists $LIBDIR]} { + puts stderr "$argv0: cannot find the tclConfig.sh file." + puts stderr "$argv0: tclsh reported library directory \"$LIBDIR\"\ + does not exist." + exit 1 +} +if {![file exists $LIBDIR/tclConfig.sh]} { + set n1 $LIBDIR/tcl$::tcl_version + if {[file exists $n1/tclConfig.sh]} { + set LIBDIR $n1 + } else { + puts stderr "$argv0: cannot find tclConfig.sh in either $LIBDIR or $n1" + exit 1 + } +} + +# Read the tclConfig.sh file into the $tclConfig variable +# +set fd [open $LIBDIR/tclConfig.sh rb] +set tclConfig [read $fd] +close $fd + +# Extract parameter we will need from the tclConfig.sh file +# +set TCLMAJOR 8 +regexp {TCL_MAJOR_VERSION='(\d)'} $tclConfig all TCLMAJOR +set SUFFIX so +regexp {TCL_SHLIB_SUFFIX='\.([^']+)'} $tclConfig all SUFFIX +set CC gcc +regexp {TCL_CC='([^']+)'} $tclConfig all CC +set CFLAGS -fPIC +regexp {TCL_SHLIB_CFLAGS='([^']+)'} $tclConfig all CFLAGS +set opt {} +regexp {TCL_CFLAGS_OPTIMIZE='([^']+)'} $tclConfig all opt +if {$opt!=""} { + append CFLAGS " $opt" +} +set LIBS {} +regexp {TCL_STUB_LIB_SPEC='([^']+)'} $tclConfig all LIBS +set INC "-I$srcdir/src" +set inc {} +regexp {TCL_INCLUDE_SPEC='([^']+)'} $tclConfig all inc +if {$inc!=""} { + append INC " $inc" +} +set cmd {} +regexp {TCL_SHLIB_LD='([^']+)'} $tclConfig all cmd +set LDFLAGS $INC +set CMD [subst $cmd] +if {$TCLMAJOR>8} { + set OUT libtcl9sqlite$VERSION.$SUFFIX +} else { + set OUT libsqlite$VERSION.$SUFFIX +} + +# Uninstall the extension +# +if {$uninstall} { + set cnt 0 + foreach dir $auto_path { + if {[file isdirectory $dir/sqlite$VERSION]} { + incr cnt + if {![file writable $dir] || ![file writable $dir/sqlite$VERSION]} { + puts "cannot uninstall $dir/sqlite$VERSION - permission denied" + } else { + puts "uninstalling $dir/sqlite$VERSION..." + file delete -force $dir/sqlite$VERSION + } + } + } + if {$cnt==0} { + puts "nothing to uninstall" + } + exit +} + +# Figure out where the extension will be installed. +# +set DEST {} +foreach dir $auto_path { + if {[file writable $dir]} { + set DEST $dir + break + } +} +if {$DEST==""} { + puts "None of the directories on $auto_path are writable by this process," + puts "so the installation cannot take place. Consider running using sudo" + puts "to work around this." +} + +if {!$installonly} { + # Generate the pkgIndex.tcl file + # + set fd [open pkgIndex.tcl w] + puts $fd [subst -nocommands {# -*- tcl -*- +# Tcl package index file, version ??? +# +package ifneeded sqlite3 $VERSION \\ + [list load [file join \$dir $OUT] sqlite3] +}] + close $fd + + # Generate and execute the command with which to do the compilation. + # + set cmd "$CMD tclsqlite3.c -o $OUT $LIBS" + puts $cmd + exec {*}$cmd +} + +# Install the extension +# +if {$DEST!="" && !$buildonly} { + set DEST2 $DEST/sqlite$VERSION + file mkdir $DEST2 + puts "installing $DEST2/pkgIndex.tcl" + file copy -force pkgIndex.tcl $DEST2 + puts "installing $DEST2/$OUT" + file copy -force $OUT $DEST2 +} From 1bed50d42470ead54ce5236e5978cc398f756c0a Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 1 Aug 2024 20:26:22 +0000 Subject: [PATCH 05/45] New makefile targets: tclextension-install and tclextension-uninstall. Seem to work on Linux. FossilOrigin-Name: 534f8344abbda78e841edafe84c27ea8b1dfdecb9ab51271772a7f7264ef5b8c --- Makefile.in | 15 ++++++++------- manifest | 14 +++++++------- manifest.uuid | 2 +- tool/buildtclext.tcl | 2 ++ 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/Makefile.in b/Makefile.in index 4ce4b7392f..bae560b4dc 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1556,13 +1556,14 @@ install: sqlite3$(TEXE) lib_install sqlite3.h sqlite3.pc ${HAVE_TCL:1=tcl_instal $(INSTALL) -d $(DESTDIR)$(pkgconfigdir) $(INSTALL) -m 0644 sqlite3.pc $(DESTDIR)$(pkgconfigdir) -pkgIndex.tcl: - echo 'package ifneeded sqlite3 $(RELEASE) [list load [file join $$dir libtclsqlite3[info sharedlibextension]] sqlite3]' > $@ -tcl_install: lib_install libtclsqlite3.la pkgIndex.tcl - $(INSTALL) -d $(DESTDIR)$(TCLLIBDIR) - $(LTINSTALL) libtclsqlite3.la $(DESTDIR)$(TCLLIBDIR) - rm -f $(DESTDIR)$(TCLLIBDIR)/libtclsqlite3.la $(DESTDIR)$(TCLLIBDIR)/libtclsqlite3.a - $(INSTALL) -m 0644 pkgIndex.tcl $(DESTDIR)$(TCLLIBDIR) +pkgIndex.tcl: tclsqlite3.c + $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --build-only + +tclextension-install: pkgIndex.tcl + $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --install-only + +tclextension-uninstall: + $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --uninstall clean: rm -f *.lo *.la *.o sqlite3$(TEXE) libsqlite3.la diff --git a/manifest b/manifest index a7deb9327a..e6c0cd9da5 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Work\son\sa\sTCL\sscript\sthat\swill\scompile\sand\sinstall\sthe\sTCL\sextension.\nWorks\son\sLinux\sonly,\sso\sfar.\s\sThis\sis\san\sincremental\scheck-in. -D 2024-08-01T20:18:10.470 +C New\smakefile\stargets:\stclextension-install\sand\stclextension-uninstall.\s\sSeem\nto\swork\son\sLinux. +D 2024-08-01T20:26:22.352 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 -F Makefile.in 58c2cc5010aa5fd5e8eef6fe24d4ebcec7dc2e8c56f135d4f49e90a099bbc531 +F Makefile.in 1e1686272e573f924567483d123abc2a1397cf59c0ec823916a1368b46e13382 F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6 F Makefile.msc 993f8addade63bcac7192416e7161ceee60edcee2376299ea48b2a74c66ac2d5 F README.md 6358805260a03ebead84e168bbf3740ddf3f683b477e478567186aa7afb490d3 @@ -2093,7 +2093,7 @@ F tool/GetTclKit.bat d84033c6a93dfe735d247f48ba00292a1cc284dcf69963e5e672444e045 F tool/Replace.cs 02c67258801c2fb5f63231e0ac0f220b4b36ba91 F tool/build-all-msvc.bat c817b716e0edeecaf265a6775b63e5f45c34a6544f1d4114a222701ed5ac79ab x F tool/build-shell.sh f193b5e3eb4afcb4abbf96bf1475be6cfb74763ee2e50c82bc7ca105e8a136c5 -F tool/buildtclext.tcl 0ef183d0786744d13b06fec85e2cd4ee7369dd58c3ef2f684c5a616d952777d4 +F tool/buildtclext.tcl b360c5133169d555b2b2d6aeac8aece43a34babc672dd6c05fd41ebc850cc14f F tool/cg_anno.tcl c1f875f5a4c9caca3d59937b16aff716f8b1883935f1b4c9ae23124705bc8099 x F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2 F tool/cktclsh.sh 6075eef9c6b9ba4b38fef2ca2a66d25f2311bd3c610498d18a9b01f861629cca @@ -2202,8 +2202,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 8fafc679d91e857602fbbe203144ca98242246660ede5a49c5fec8aaff571151 -R e8c67e263d146ad1487048a2a5cec02e +P 58babd2aa4b5c9c70e1169cdf09f05eb95d7b13f50bb2ec0e487182288172678 +R 38f4741323b0ec90afecf9f175b90c98 U drh -Z b7f53b5d5d52347992c8bf634ae8776a +Z a4ed4e2858217ff286bef81105749295 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0a50f25895..49f1f98f35 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -58babd2aa4b5c9c70e1169cdf09f05eb95d7b13f50bb2ec0e487182288172678 +534f8344abbda78e841edafe84c27ea8b1dfdecb9ab51271772a7f7264ef5b8c diff --git a/tool/buildtclext.tcl b/tool/buildtclext.tcl index 947bcf5e4c..f2510da98e 100644 --- a/tool/buildtclext.tcl +++ b/tool/buildtclext.tcl @@ -3,6 +3,8 @@ # library for SQLite. Run the script with the specific "tclsh" for which # the installation should occur. # +# Must do "make tclsqlite3.c" first. +# # Options: # # --build-only Only build the extension, don't install it From 58c5a95c07f12a17a554da852cdbbfc0297bded8 Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 1 Aug 2024 23:00:37 +0000 Subject: [PATCH 06/45] Add the tclextension-list makefile target. The the makefile running on Mac. FossilOrigin-Name: 2f667cc8e54167342e17e63e1a017388365ebf4cd379f9c16c12e4603b34a326 --- Makefile.in | 19 +++++++- manifest | 16 +++---- manifest.uuid | 2 +- src/tclsqlite.c | 11 ++++- tool/buildtclext.tcl | 111 ++++++++++++++++++++++++++++++------------- 5 files changed, 112 insertions(+), 47 deletions(-) diff --git a/Makefile.in b/Makefile.in index bae560b4dc..61fcf6e7d6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1556,15 +1556,30 @@ install: sqlite3$(TEXE) lib_install sqlite3.h sqlite3.pc ${HAVE_TCL:1=tcl_instal $(INSTALL) -d $(DESTDIR)$(pkgconfigdir) $(INSTALL) -m 0644 sqlite3.pc $(DESTDIR)$(pkgconfigdir) -pkgIndex.tcl: tclsqlite3.c +# Build the SQLite TCL extension in a way that make it compatible +# with whatever version of TCL is running as $TCLSH_CMD, possibly defined +# by --with-tclsh= +# +tclextension: tclsqlite3.c $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --build-only -tclextension-install: pkgIndex.tcl +# Install the SQLite TCL extension in a way that is appropriate for $TCLSH_CMD +# to find it. +# +tclextension-install: tclextension $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --install-only +# Install the SQLite TCL extension that is used by $TCLSH_CMD +# tclextension-uninstall: $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --uninstall +# List all installed the SQLite TCL extension that is are accessible +# by $TCLSH_CMD, included prior versions. +# +tclextension-list: + $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --info + clean: rm -f *.lo *.la *.o sqlite3$(TEXE) libsqlite3.la rm -f sqlite3.h opcodes.* diff --git a/manifest b/manifest index e6c0cd9da5..15bb5252ff 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C New\smakefile\stargets:\stclextension-install\sand\stclextension-uninstall.\s\sSeem\nto\swork\son\sLinux. -D 2024-08-01T20:26:22.352 +C Add\sthe\stclextension-list\smakefile\starget.\s\sThe\sthe\smakefile\srunning\son\sMac. +D 2024-08-01T23:00:37.841 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 -F Makefile.in 1e1686272e573f924567483d123abc2a1397cf59c0ec823916a1368b46e13382 +F Makefile.in 4fc6dc2def18b4a2e8fb4c4cad04699e829b3fcefa85974ec71a4a9110a0ea88 F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6 F Makefile.msc 993f8addade63bcac7192416e7161ceee60edcee2376299ea48b2a74c66ac2d5 F README.md 6358805260a03ebead84e168bbf3740ddf3f683b477e478567186aa7afb490d3 @@ -768,7 +768,7 @@ F src/sqliteInt.h b77218c425891c7c90506c77fd2eb13bae03628d065b44fffeb37401cd955a F src/sqliteLimit.h 6878ab64bdeb8c24a1d762d45635e34b96da21132179023338c93f820eee6728 F src/status.c cb11f8589a6912af2da3bb1ec509a94dd8ef27df4d4c1a97e0bcf2309ece972b F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 -F src/tclsqlite.c 8e86ab2595c2ff7bb155331fb173e560180235bceaacce7931a718b1c2e6dfb4 +F src/tclsqlite.c 9bd7443f5db3250dbb073aa6f046a52f939832ac0193c710d6fffb6ca68674be F src/tclsqlite.h c6af51f31a2b2172d674608763a4b98fdf5cd587e4025053e546fb8077757262 F src/test1.c 51159784f29d3dfd4b50fd6ed9c43c8f7f36925c501a3ad3083528e5e5544bd7 F src/test2.c 7ebc518e6735939d8979273a6f7b1d9b5702babf059f6ad62499f7f60a9eb9a3 @@ -2093,7 +2093,7 @@ F tool/GetTclKit.bat d84033c6a93dfe735d247f48ba00292a1cc284dcf69963e5e672444e045 F tool/Replace.cs 02c67258801c2fb5f63231e0ac0f220b4b36ba91 F tool/build-all-msvc.bat c817b716e0edeecaf265a6775b63e5f45c34a6544f1d4114a222701ed5ac79ab x F tool/build-shell.sh f193b5e3eb4afcb4abbf96bf1475be6cfb74763ee2e50c82bc7ca105e8a136c5 -F tool/buildtclext.tcl b360c5133169d555b2b2d6aeac8aece43a34babc672dd6c05fd41ebc850cc14f +F tool/buildtclext.tcl 23a986cfcb0338e02ad277cebd94d92b37a9cd848fe168f088fa80ca973b4d79 F tool/cg_anno.tcl c1f875f5a4c9caca3d59937b16aff716f8b1883935f1b4c9ae23124705bc8099 x F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2 F tool/cktclsh.sh 6075eef9c6b9ba4b38fef2ca2a66d25f2311bd3c610498d18a9b01f861629cca @@ -2202,8 +2202,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 58babd2aa4b5c9c70e1169cdf09f05eb95d7b13f50bb2ec0e487182288172678 -R 38f4741323b0ec90afecf9f175b90c98 +P 534f8344abbda78e841edafe84c27ea8b1dfdecb9ab51271772a7f7264ef5b8c +R 2909fb7ee21646cc58011e08d136b308 U drh -Z a4ed4e2858217ff286bef81105749295 +Z d8a3255efb288995807535829d58616f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 49f1f98f35..01a9c859f1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -534f8344abbda78e841edafe84c27ea8b1dfdecb9ab51271772a7f7264ef5b8c +2f667cc8e54167342e17e63e1a017388365ebf4cd379f9c16c12e4603b34a326 diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 906f429ab9..51049b4d21 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -369,12 +369,19 @@ static int SQLITE_TCLAPI incrblobOutput( return nWrite; } +/* The datatype of Tcl_DriverWideSeekProc changes between tcl8.6 and tcl9.0 */ +#if TCL_MAJOR_VERSION==9 +# define WideSeekProcType long lone +#else +# define WideSeekProcType Tcl_WideInt +#endif + /* ** Seek an incremental blob channel. */ -static long long SQLITE_TCLAPI incrblobWideSeek( +static WideSeekProcType SQLITE_TCLAPI incrblobWideSeek( ClientData instanceData, - long long offset, + WideSeekProcType offset, int seekMode, int *errorCodePtr ){ diff --git a/tool/buildtclext.tcl b/tool/buildtclext.tcl index f2510da98e..26067ecd87 100644 --- a/tool/buildtclext.tcl +++ b/tool/buildtclext.tcl @@ -1,29 +1,38 @@ +#!/usr/bin/tclsh # -# Run this TCL script to build and optionally install the TCL interface -# library for SQLite. Run the script with the specific "tclsh" for which -# the installation should occur. -# -# Must do "make tclsqlite3.c" first. -# -# Options: -# -# --build-only Only build the extension, don't install it -# --install-only Install an extension previously build -# --uninstall Uninstall the extension -# -set installonly 0 -set buildonly 0 +set help \ +{Run this TCL script to build and install the TCL interface library for +SQLite. Run the script with the specific "tclsh" for which the installation +should occur. + +There must be a valid "tclsqlite3.c" file in the working directory prior +to running this script. Use "make tclsqlite3.c" to generate that file. + +Options: + + --build-only Only build the extension, don't install it + --info Show info on existing SQLite TCL extension installs + --install-only Install an extension previously build + --uninstall Uninstall the extension} + + +set build 1 +set install 1 set uninstall 0 +set infoonly 0 for {set ii 0} {$ii<[llength $argv]} {incr ii} { set a0 [lindex $argv $ii] if {$a0=="--install-only"} { - set installonly 1 + set build 0 } elseif {$a0=="--build-only"} { - set buildonly 1 + set install 0 } elseif {$a0=="--uninstall"} { set uninstall 1 + } elseif {$a0=="--info"} { + set infoonly 1 } else { - puts stderr "Unknown option: \"$a0\"" + puts stderr "Unknown option: \"$a0\"\n" + puts stderr $help exit 1 } } @@ -94,7 +103,7 @@ if {$inc!=""} { } set cmd {} regexp {TCL_SHLIB_LD='([^']+)'} $tclConfig all cmd -set LDFLAGS $INC +set LDFLAGS "$INC -DUSE_TCL_STUBS" set CMD [subst $cmd] if {$TCLMAJOR>8} { set OUT libtcl9sqlite$VERSION.$SUFFIX @@ -102,6 +111,24 @@ if {$TCLMAJOR>8} { set OUT libsqlite$VERSION.$SUFFIX } +# Show information about prior installs +# +if {$infoonly} { + set cnt 0 + foreach dir $auto_path { + foreach subdir [glob -nocomplain -types d $dir/sqlite3*] { + if {[file exists $subdir/pkgIndex.tcl]} { + puts $subdir + incr cnt + } + } + } + if {$cnt==0} { + puts "no current installations of the SQLite TCL extension" + } + exit +} + # Uninstall the extension # if {$uninstall} { @@ -123,24 +150,40 @@ if {$uninstall} { exit } -# Figure out where the extension will be installed. -# -set DEST {} -foreach dir $auto_path { - if {[file writable $dir]} { - set DEST $dir - break +if {$install} { + # Figure out where the extension will be installed. Put the extension + # in the first writable directory on $auto_path. + # + set DEST {} + foreach dir $auto_path { + if {[file writable $dir]} { + set DEST $dir + break + } elseif {[glob -nocomplain $dir/sqlite3*/pkgIndex.tcl]!=""} { + set conflict [lindex [glob $dir/sqlite3*/pkgIndex.tcl] 0] + puts "Unable to install. There is already a conflicting version" + puts "of the SQLite TCL Extension that cannot be overwritten at\n" + puts " [file dirname $conflict]\n" + puts "Consider running using sudo to work around this problem." + exit 1 + } + } + if {$DEST==""} { + puts "None of the directories on \$auto_path are writable by this process," + puts "so the installation cannot take place. Consider running using sudo" + puts "to work around this problem.\n" + puts "These are the (unwritable) \$auto_path directories:\n" + foreach dir $auto_path { + puts " * $dir" + } + exit 1 } } -if {$DEST==""} { - puts "None of the directories on $auto_path are writable by this process," - puts "so the installation cannot take place. Consider running using sudo" - puts "to work around this." -} -if {!$installonly} { +if {$build} { # Generate the pkgIndex.tcl file # + puts "generating pkgConfig.tcl..." set fd [open pkgIndex.tcl w] puts $fd [subst -nocommands {# -*- tcl -*- # Tcl package index file, version ??? @@ -157,9 +200,9 @@ package ifneeded sqlite3 $VERSION \\ exec {*}$cmd } -# Install the extension -# -if {$DEST!="" && !$buildonly} { + +if {$install} { + # Install the extension set DEST2 $DEST/sqlite$VERSION file mkdir $DEST2 puts "installing $DEST2/pkgIndex.tcl" From bb99e73ef55cd18764754509affaf333ae345d96 Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 1 Aug 2024 23:30:29 +0000 Subject: [PATCH 07/45] Simplification the ./configure script. Carry Makefile CFLAGS and OPTS through into builttclext.tcl. Fix a bug in tclsqlite.c introduced by the previous check-in. FossilOrigin-Name: 72a80aa0abb121a23f8cc1eb1af04ba06c733a7a40c06f1fe9e62f2a0a26ca6e --- Makefile.in | 2 +- configure | 51 +++++++++++++++----------------------------- configure.ac | 13 +++-------- manifest | 20 ++++++++--------- manifest.uuid | 2 +- src/tclsqlite.c | 2 +- tool/buildtclext.tcl | 33 ++++++++++++++++++++-------- 7 files changed, 57 insertions(+), 66 deletions(-) diff --git a/Makefile.in b/Makefile.in index 61fcf6e7d6..4e804f889a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1561,7 +1561,7 @@ install: sqlite3$(TEXE) lib_install sqlite3.h sqlite3.pc ${HAVE_TCL:1=tcl_instal # by --with-tclsh= # tclextension: tclsqlite3.c - $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --build-only + $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --build-only --cc $(CC) $(CFLAGS) $(OPT_FEATURE_FLAGS) $(OPTS) # Install the SQLite TCL extension in a way that is appropriate for $TCLSH_CMD # to find it. diff --git a/configure b/configure index 744410589b..3486ebc034 100755 --- a/configure +++ b/configure @@ -795,17 +795,7 @@ VERSION program_prefix TCLLIBDIR HAVE_TCL -TCL_SHLIB_SUFFIX -TCL_STUB_LIB_SPEC -TCL_STUB_LIB_FLAG -TCL_STUB_LIB_FILE TCL_LIB_SPEC -TCL_LIB_FLAG -TCL_LIB_FILE -TCL_INCLUDE_SPEC -TCL_SRC_DIR -TCL_BIN_DIR -TCL_VERSION TCLSH_CMD INSTALL_DATA INSTALL_SCRIPT @@ -3944,13 +3934,13 @@ if ${lt_cv_nm_interface+:} false; then : else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:3947: $ac_compile\"" >&5) + (eval echo "\"\$as_me:3937: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:3950: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:3940: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:3953: output\"" >&5) + (eval echo "\"\$as_me:3943: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -5156,7 +5146,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5159 "configure"' > conftest.$ac_ext + echo '#line 5149 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -6681,11 +6671,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6684: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6674: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6688: \$? = $ac_status" >&5 + echo "$as_me:6678: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7020,11 +7010,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7023: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7013: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7027: \$? = $ac_status" >&5 + echo "$as_me:7017: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7125,11 +7115,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7128: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7118: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7132: \$? = $ac_status" >&5 + echo "$as_me:7122: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -7180,11 +7170,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7183: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7173: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7187: \$? = $ac_status" >&5 + echo "$as_me:7177: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9560,7 +9550,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 9563 "configure" +#line 9553 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -9656,7 +9646,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 9659 "configure" +#line 9649 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10397,16 +10387,9 @@ if test x"${with_tcl}" != x; then $as_echo "loading TCL configuration from ${tclconfig}" >&6; } . ${tclconfig} - - - - - - - - - - + # There are lots of other configuration variables that are provided by the + # tclConfig.sh file and that could be included here. But as of right now, + # TCL_LIB_SPEC is the only what that the Makefile uses. fi if test x"$TCLSH_CMD" == x; then TCLSH_CMD=${TCL_EXEC_PREFIX}/bin/tclsh${TCL_VERSION} diff --git a/configure.ac b/configure.ac index 404a80bffd..fba0755e62 100644 --- a/configure.ac +++ b/configure.ac @@ -144,17 +144,10 @@ if test x"${with_tcl}" != x; then if test x"${tclconfig}" != x; then AC_MSG_RESULT([loading TCL configuration from ${tclconfig}]) . ${tclconfig} - AC_SUBST(TCL_VERSION) - AC_SUBST(TCL_BIN_DIR) - AC_SUBST(TCL_SRC_DIR) - AC_SUBST(TCL_INCLUDE_SPEC) - AC_SUBST(TCL_LIB_FILE) - AC_SUBST(TCL_LIB_FLAG) AC_SUBST(TCL_LIB_SPEC) - AC_SUBST(TCL_STUB_LIB_FILE) - AC_SUBST(TCL_STUB_LIB_FLAG) - AC_SUBST(TCL_STUB_LIB_SPEC) - AC_SUBST(TCL_SHLIB_SUFFIX) + # There are lots of other configuration variables that are provided by the + # tclConfig.sh file and that could be included here. But as of right now, + # TCL_LIB_SPEC is the only what that the Makefile uses. fi if test x"$TCLSH_CMD" == x; then TCLSH_CMD=${TCL_EXEC_PREFIX}/bin/tclsh${TCL_VERSION} diff --git a/manifest b/manifest index 15bb5252ff..26917c15b6 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Add\sthe\stclextension-list\smakefile\starget.\s\sThe\sthe\smakefile\srunning\son\sMac. -D 2024-08-01T23:00:37.841 +C Simplification\sthe\s./configure\sscript.\s\sCarry\sMakefile\sCFLAGS\sand\sOPTS\sthrough\ninto\sbuilttclext.tcl.\s\sFix\sa\sbug\sin\stclsqlite.c\sintroduced\sby\sthe\sprevious\ncheck-in. +D 2024-08-01T23:30:29.441 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 -F Makefile.in 4fc6dc2def18b4a2e8fb4c4cad04699e829b3fcefa85974ec71a4a9110a0ea88 +F Makefile.in 3de6a3420170d4f6fac8fd0f338db422ce100be1e64c1e8cb62b85876ebc5fca F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6 F Makefile.msc 993f8addade63bcac7192416e7161ceee60edcee2376299ea48b2a74c66ac2d5 F README.md 6358805260a03ebead84e168bbf3740ddf3f683b477e478567186aa7afb490d3 @@ -35,8 +35,8 @@ F autoconf/tea/win/nmakehlp.c b01f822eabbe1ed2b64e70882d97d48402b42d2689a1ea0034 F autoconf/tea/win/rules.vc 7b3bb2ef32ade0f3f14d951231811678722725e3bca240dd9727ae0dfe10f6a5 F config.guess 883205ddf25b46f10c181818bf42c09da9888884af96f79e1719264345053bd6 F config.sub c2d0260f17f3e4bc0b6808fccf1b291cb5e9126c14fc5890efc77b9fd0175559 -F configure 7657b4eaced7589ee0259f7c99ca0b71fe3d47b7fdcc13844b64f77d3084c082 x -F configure.ac 6c41bb7a160c3c057af689f5fbf44bd290ccf2fb68be63b3f8d6a9062b224832 +F configure 33192bee7d11f68a2be3a1ddf1dc4aa02060675f0bfb48eaf61b63fcd45abedf x +F configure.ac 1665604ede8e83da1454f26eb19dcc7cff70f1b21d305616b6c7cea2d107c005 F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd F doc/compile-for-windows.md e8635eea9153dcd6a51fd2740666ebc4492b3813cb1ac31cd8e99150df91762d @@ -768,7 +768,7 @@ F src/sqliteInt.h b77218c425891c7c90506c77fd2eb13bae03628d065b44fffeb37401cd955a F src/sqliteLimit.h 6878ab64bdeb8c24a1d762d45635e34b96da21132179023338c93f820eee6728 F src/status.c cb11f8589a6912af2da3bb1ec509a94dd8ef27df4d4c1a97e0bcf2309ece972b F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 -F src/tclsqlite.c 9bd7443f5db3250dbb073aa6f046a52f939832ac0193c710d6fffb6ca68674be +F src/tclsqlite.c c6888598f08dee3d9112a38ef42c8f5c89ca7f3190f4694744d0b84250f4bf8c F src/tclsqlite.h c6af51f31a2b2172d674608763a4b98fdf5cd587e4025053e546fb8077757262 F src/test1.c 51159784f29d3dfd4b50fd6ed9c43c8f7f36925c501a3ad3083528e5e5544bd7 F src/test2.c 7ebc518e6735939d8979273a6f7b1d9b5702babf059f6ad62499f7f60a9eb9a3 @@ -2093,7 +2093,7 @@ F tool/GetTclKit.bat d84033c6a93dfe735d247f48ba00292a1cc284dcf69963e5e672444e045 F tool/Replace.cs 02c67258801c2fb5f63231e0ac0f220b4b36ba91 F tool/build-all-msvc.bat c817b716e0edeecaf265a6775b63e5f45c34a6544f1d4114a222701ed5ac79ab x F tool/build-shell.sh f193b5e3eb4afcb4abbf96bf1475be6cfb74763ee2e50c82bc7ca105e8a136c5 -F tool/buildtclext.tcl 23a986cfcb0338e02ad277cebd94d92b37a9cd848fe168f088fa80ca973b4d79 +F tool/buildtclext.tcl d6e880173bec323f30c0505c5f82eb29c5661bd501d33b5b7a3b5507269dc4f9 F tool/cg_anno.tcl c1f875f5a4c9caca3d59937b16aff716f8b1883935f1b4c9ae23124705bc8099 x F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2 F tool/cktclsh.sh 6075eef9c6b9ba4b38fef2ca2a66d25f2311bd3c610498d18a9b01f861629cca @@ -2202,8 +2202,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 534f8344abbda78e841edafe84c27ea8b1dfdecb9ab51271772a7f7264ef5b8c -R 2909fb7ee21646cc58011e08d136b308 +P 2f667cc8e54167342e17e63e1a017388365ebf4cd379f9c16c12e4603b34a326 +R 79bc0ffb836cbf05c7dcfd1908280244 U drh -Z d8a3255efb288995807535829d58616f +Z c826d5650b7fb369e6f2edfd17fa30c3 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 01a9c859f1..a4767bc367 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2f667cc8e54167342e17e63e1a017388365ebf4cd379f9c16c12e4603b34a326 +72a80aa0abb121a23f8cc1eb1af04ba06c733a7a40c06f1fe9e62f2a0a26ca6e diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 51049b4d21..0c8888fd48 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -371,7 +371,7 @@ static int SQLITE_TCLAPI incrblobOutput( /* The datatype of Tcl_DriverWideSeekProc changes between tcl8.6 and tcl9.0 */ #if TCL_MAJOR_VERSION==9 -# define WideSeekProcType long lone +# define WideSeekProcType long long #else # define WideSeekProcType Tcl_WideInt #endif diff --git a/tool/buildtclext.tcl b/tool/buildtclext.tcl index 26067ecd87..8d6d0c25b0 100644 --- a/tool/buildtclext.tcl +++ b/tool/buildtclext.tcl @@ -11,15 +11,20 @@ to running this script. Use "make tclsqlite3.c" to generate that file. Options: --build-only Only build the extension, don't install it + --cc COMPILER Build using this compiler --info Show info on existing SQLite TCL extension installs --install-only Install an extension previously build - --uninstall Uninstall the extension} + --uninstall Uninstall the extension + +Other options are retained and passed through into the compiler.} set build 1 set install 1 set uninstall 0 set infoonly 0 +set CC {} +set OPTS {} for {set ii 0} {$ii<[llength $argv]} {incr ii} { set a0 [lindex $argv $ii] if {$a0=="--install-only"} { @@ -30,6 +35,11 @@ for {set ii 0} {$ii<[llength $argv]} {incr ii} { set uninstall 1 } elseif {$a0=="--info"} { set infoonly 1 + } elseif {$a0=="--cc" && $ii+1<[llength $argv]} { + incr ii + set CC [lindex $argv $ii] + } elseif {[string match -* $a0]} { + append OPTS " $a0" } else { puts stderr "Unknown option: \"$a0\"\n" puts stderr $help @@ -84,15 +94,12 @@ set TCLMAJOR 8 regexp {TCL_MAJOR_VERSION='(\d)'} $tclConfig all TCLMAJOR set SUFFIX so regexp {TCL_SHLIB_SUFFIX='\.([^']+)'} $tclConfig all SUFFIX -set CC gcc -regexp {TCL_CC='([^']+)'} $tclConfig all CC +if {$CC==""} { + set CC gcc + regexp {TCL_CC='([^']+)'} $tclConfig all CC +} set CFLAGS -fPIC regexp {TCL_SHLIB_CFLAGS='([^']+)'} $tclConfig all CFLAGS -set opt {} -regexp {TCL_CFLAGS_OPTIMIZE='([^']+)'} $tclConfig all opt -if {$opt!=""} { - append CFLAGS " $opt" -} set LIBS {} regexp {TCL_STUB_LIB_SPEC='([^']+)'} $tclConfig all LIBS set INC "-I$srcdir/src" @@ -104,6 +111,9 @@ if {$inc!=""} { set cmd {} regexp {TCL_SHLIB_LD='([^']+)'} $tclConfig all cmd set LDFLAGS "$INC -DUSE_TCL_STUBS" +if {[string length $OPTS]>1} { + append LDFLAGS $OPTS +} set CMD [subst $cmd] if {$TCLMAJOR>8} { set OUT libtcl9sqlite$VERSION.$SUFFIX @@ -197,7 +207,12 @@ package ifneeded sqlite3 $VERSION \\ # set cmd "$CMD tclsqlite3.c -o $OUT $LIBS" puts $cmd - exec {*}$cmd + if {[catch { + exec {*}$cmd + } errmsg]} { + puts $errmsg + exit 1 + } } From 490661fd967d301985a558d1cce3b1630140fb00 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 2 Aug 2024 00:19:59 +0000 Subject: [PATCH 08/45] Extra robustness for the SQLite Tcl Extension builder, so that it works on Debian Linux. FossilOrigin-Name: 2f0738daaff48c51a60f063af6e453443bd7eedf6936daab325b2a36927c7a2b --- manifest | 12 ++++++------ manifest.uuid | 2 +- tool/buildtclext.tcl | 17 +++++++++++++---- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 26917c15b6..55d18cc6fd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Simplification\sthe\s./configure\sscript.\s\sCarry\sMakefile\sCFLAGS\sand\sOPTS\sthrough\ninto\sbuilttclext.tcl.\s\sFix\sa\sbug\sin\stclsqlite.c\sintroduced\sby\sthe\sprevious\ncheck-in. -D 2024-08-01T23:30:29.441 +C Extra\srobustness\sfor\sthe\sSQLite\sTcl\sExtension\sbuilder,\sso\sthat\sit\sworks\non\sDebian\sLinux. +D 2024-08-02T00:19:59.895 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -2093,7 +2093,7 @@ F tool/GetTclKit.bat d84033c6a93dfe735d247f48ba00292a1cc284dcf69963e5e672444e045 F tool/Replace.cs 02c67258801c2fb5f63231e0ac0f220b4b36ba91 F tool/build-all-msvc.bat c817b716e0edeecaf265a6775b63e5f45c34a6544f1d4114a222701ed5ac79ab x F tool/build-shell.sh f193b5e3eb4afcb4abbf96bf1475be6cfb74763ee2e50c82bc7ca105e8a136c5 -F tool/buildtclext.tcl d6e880173bec323f30c0505c5f82eb29c5661bd501d33b5b7a3b5507269dc4f9 +F tool/buildtclext.tcl 865343ca043c4119e19de9651d01185d0017e588d70f533612c345553cc8160b F tool/cg_anno.tcl c1f875f5a4c9caca3d59937b16aff716f8b1883935f1b4c9ae23124705bc8099 x F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2 F tool/cktclsh.sh 6075eef9c6b9ba4b38fef2ca2a66d25f2311bd3c610498d18a9b01f861629cca @@ -2202,8 +2202,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 2f667cc8e54167342e17e63e1a017388365ebf4cd379f9c16c12e4603b34a326 -R 79bc0ffb836cbf05c7dcfd1908280244 +P 72a80aa0abb121a23f8cc1eb1af04ba06c733a7a40c06f1fe9e62f2a0a26ca6e +R 30cc174315110745d69ebebfb5ba6cf9 U drh -Z c826d5650b7fb369e6f2edfd17fa30c3 +Z 07ee2d4f800935e6e99694df22387f92 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index a4767bc367..d4b99149ef 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -72a80aa0abb121a23f8cc1eb1af04ba06c733a7a40c06f1fe9e62f2a0a26ca6e +2f0738daaff48c51a60f063af6e453443bd7eedf6936daab325b2a36927c7a2b diff --git a/tool/buildtclext.tcl b/tool/buildtclext.tcl index 8d6d0c25b0..5b50c627f9 100644 --- a/tool/buildtclext.tcl +++ b/tool/buildtclext.tcl @@ -72,9 +72,11 @@ if {![file exists $LIBDIR]} { does not exist." exit 1 } -if {![file exists $LIBDIR/tclConfig.sh]} { +if {![file exists $LIBDIR/tclConfig.sh] + || [file size $LIBDIR/tclConfig.sh]<5000} { set n1 $LIBDIR/tcl$::tcl_version - if {[file exists $n1/tclConfig.sh]} { + if {[file exists $n1/tclConfig.sh] + && [file size $n1/tclConfig.sh]>5000} { set LIBDIR $n1 } else { puts stderr "$argv0: cannot find tclConfig.sh in either $LIBDIR or $n1" @@ -84,6 +86,7 @@ if {![file exists $LIBDIR/tclConfig.sh]} { # Read the tclConfig.sh file into the $tclConfig variable # +#puts "using $LIBDIR/tclConfig.sh" set fd [open $LIBDIR/tclConfig.sh rb] set tclConfig [read $fd] close $fd @@ -94,9 +97,15 @@ set TCLMAJOR 8 regexp {TCL_MAJOR_VERSION='(\d)'} $tclConfig all TCLMAJOR set SUFFIX so regexp {TCL_SHLIB_SUFFIX='\.([^']+)'} $tclConfig all SUFFIX +if {$CC==""} { + set cc {} + regexp {TCL_CC='([^']+)'} $tclConfig all cc + if {$cc!=""} { + set CC $cc + } +} if {$CC==""} { set CC gcc - regexp {TCL_CC='([^']+)'} $tclConfig all CC } set CFLAGS -fPIC regexp {TCL_SHLIB_CFLAGS='([^']+)'} $tclConfig all CFLAGS @@ -108,7 +117,7 @@ regexp {TCL_INCLUDE_SPEC='([^']+)'} $tclConfig all inc if {$inc!=""} { append INC " $inc" } -set cmd {} +set cmd {${CC} ${CFLAGS} ${LDFLAGS} -shared} regexp {TCL_SHLIB_LD='([^']+)'} $tclConfig all cmd set LDFLAGS "$INC -DUSE_TCL_STUBS" if {[string length $OPTS]>1} { From 0c059b598d6ec7528cb455fe79b58ab67f869bd4 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 2 Aug 2024 00:51:52 +0000 Subject: [PATCH 09/45] Continuing refinements of the tclextension-install makefile target. FossilOrigin-Name: 871c20a848e0e9b7f3d5661bd076fde16e9ec1e445a7ee657ef267978988ad56 --- Makefile.in | 4 ++-- manifest | 14 +++++++------- manifest.uuid | 2 +- tool/buildtclext.tcl | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Makefile.in b/Makefile.in index 4e804f889a..626a6bb909 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1566,8 +1566,8 @@ tclextension: tclsqlite3.c # Install the SQLite TCL extension in a way that is appropriate for $TCLSH_CMD # to find it. # -tclextension-install: tclextension - $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --install-only +tclextension-install: tclsqlite3.c + $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl # Install the SQLite TCL extension that is used by $TCLSH_CMD # diff --git a/manifest b/manifest index 55d18cc6fd..b182fa3dff 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Extra\srobustness\sfor\sthe\sSQLite\sTcl\sExtension\sbuilder,\sso\sthat\sit\sworks\non\sDebian\sLinux. -D 2024-08-02T00:19:59.895 +C Continuing\srefinements\sof\sthe\stclextension-install\smakefile\starget. +D 2024-08-02T00:51:52.845 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 -F Makefile.in 3de6a3420170d4f6fac8fd0f338db422ce100be1e64c1e8cb62b85876ebc5fca +F Makefile.in 3cbcc2626f946d826350d68e16ecc987cb653117dde77ebfb33179f5ec86b5a9 F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6 F Makefile.msc 993f8addade63bcac7192416e7161ceee60edcee2376299ea48b2a74c66ac2d5 F README.md 6358805260a03ebead84e168bbf3740ddf3f683b477e478567186aa7afb490d3 @@ -2093,7 +2093,7 @@ F tool/GetTclKit.bat d84033c6a93dfe735d247f48ba00292a1cc284dcf69963e5e672444e045 F tool/Replace.cs 02c67258801c2fb5f63231e0ac0f220b4b36ba91 F tool/build-all-msvc.bat c817b716e0edeecaf265a6775b63e5f45c34a6544f1d4114a222701ed5ac79ab x F tool/build-shell.sh f193b5e3eb4afcb4abbf96bf1475be6cfb74763ee2e50c82bc7ca105e8a136c5 -F tool/buildtclext.tcl 865343ca043c4119e19de9651d01185d0017e588d70f533612c345553cc8160b +F tool/buildtclext.tcl 0368eda9802262105d4b1896439889b042a40acfe73e55869ea24edb4fcba94b F tool/cg_anno.tcl c1f875f5a4c9caca3d59937b16aff716f8b1883935f1b4c9ae23124705bc8099 x F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2 F tool/cktclsh.sh 6075eef9c6b9ba4b38fef2ca2a66d25f2311bd3c610498d18a9b01f861629cca @@ -2202,8 +2202,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 72a80aa0abb121a23f8cc1eb1af04ba06c733a7a40c06f1fe9e62f2a0a26ca6e -R 30cc174315110745d69ebebfb5ba6cf9 +P 2f0738daaff48c51a60f063af6e453443bd7eedf6936daab325b2a36927c7a2b +R 154770fef55d2b7a022438541d20df55 U drh -Z 07ee2d4f800935e6e99694df22387f92 +Z fb4c8793f898a65a5ea5be50709db328 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d4b99149ef..fb3c0b0c69 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2f0738daaff48c51a60f063af6e453443bd7eedf6936daab325b2a36927c7a2b +871c20a848e0e9b7f3d5661bd076fde16e9ec1e445a7ee657ef267978988ad56 diff --git a/tool/buildtclext.tcl b/tool/buildtclext.tcl index 5b50c627f9..011f01cb5b 100644 --- a/tool/buildtclext.tcl +++ b/tool/buildtclext.tcl @@ -216,9 +216,9 @@ package ifneeded sqlite3 $VERSION \\ # set cmd "$CMD tclsqlite3.c -o $OUT $LIBS" puts $cmd - if {[catch { - exec {*}$cmd - } errmsg]} { + file delete -force $OUT + catch {exec {*}$cmd} errmsg + if {$errmsg!="" && ![file exists $OUT]} { puts $errmsg exit 1 } From ea9a25e5005a8e405738b1bcebf1f96eae0ba23c Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 2 Aug 2024 00:56:31 +0000 Subject: [PATCH 10/45] Previous Makefile.in change broke the tclextension-install target. FossilOrigin-Name: 7748367c78a1f480ec9e892ba77652e3c31a4b387b89221ae584891818804851 --- Makefile.in | 2 +- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile.in b/Makefile.in index 626a6bb909..778dc08493 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1567,7 +1567,7 @@ tclextension: tclsqlite3.c # to find it. # tclextension-install: tclsqlite3.c - $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl + $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --cc $(CC) $(CFLAGS) $(OPT_FEATURE_FLAGS) $(OPTS) # Install the SQLite TCL extension that is used by $TCLSH_CMD # diff --git a/manifest b/manifest index b182fa3dff..c5f9ba6e5a 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Continuing\srefinements\sof\sthe\stclextension-install\smakefile\starget. -D 2024-08-02T00:51:52.845 +C Previous\sMakefile.in\schange\sbroke\sthe\stclextension-install\starget. +D 2024-08-02T00:56:31.886 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 -F Makefile.in 3cbcc2626f946d826350d68e16ecc987cb653117dde77ebfb33179f5ec86b5a9 +F Makefile.in fbfe18ff577bcb35b1236015e442667bcdf94230cef07a0897e26f3cab5bf488 F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6 F Makefile.msc 993f8addade63bcac7192416e7161ceee60edcee2376299ea48b2a74c66ac2d5 F README.md 6358805260a03ebead84e168bbf3740ddf3f683b477e478567186aa7afb490d3 @@ -2202,8 +2202,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 2f0738daaff48c51a60f063af6e453443bd7eedf6936daab325b2a36927c7a2b -R 154770fef55d2b7a022438541d20df55 +P 871c20a848e0e9b7f3d5661bd076fde16e9ec1e445a7ee657ef267978988ad56 +R ba9c12b4ec23352b095b4f17c1f3bef8 U drh -Z fb4c8793f898a65a5ea5be50709db328 +Z bc0e02f193279e0ca2d17c115ebd2a46 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index fb3c0b0c69..797363580e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -871c20a848e0e9b7f3d5661bd076fde16e9ec1e445a7ee657ef267978988ad56 +7748367c78a1f480ec9e892ba77652e3c31a4b387b89221ae584891818804851 From eb48fddac73b11aea3a83d0f86141fcb9f85ec11 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 2 Aug 2024 11:32:28 +0000 Subject: [PATCH 11/45] Fix problems in the configure/Makefile system caused by recent enhancements and report by [forum:/forumpost/242ebd0c81|forum post 242ebd0c81]. FossilOrigin-Name: a59319fe4adc094381c46e490289b3e0cda8f804edaea6984571c47a68a23eef --- Makefile.in | 4 ---- configure | 32 ++++++++++++++++++-------------- configure.ac | 2 ++ manifest | 17 ++++++++--------- manifest.uuid | 2 +- 5 files changed, 29 insertions(+), 28 deletions(-) diff --git a/Makefile.in b/Makefile.in index 778dc08493..c83e76a3db 100644 --- a/Makefile.in +++ b/Makefile.in @@ -121,10 +121,6 @@ TCLSH_CMD = @TCLSH_CMD@ # TCLLIBDIR = @TCLLIBDIR@ -# The suffix used on shared libraries. Ex: ".dll", ".so", ".dylib" -# -SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ - # If gcov support was enabled by the configure script, add the appropriate # flags here. It's not always as easy as just having the user add the right # CFLAGS / LDFLAGS, because libtool wants to use CFLAGS when linking, which diff --git a/configure b/configure index 3486ebc034..616fb26276 100755 --- a/configure +++ b/configure @@ -795,7 +795,9 @@ VERSION program_prefix TCLLIBDIR HAVE_TCL +TCL_STUB_LIB_SPEC TCL_LIB_SPEC +TCL_INCLUDE_SPEC TCLSH_CMD INSTALL_DATA INSTALL_SCRIPT @@ -3934,13 +3936,13 @@ if ${lt_cv_nm_interface+:} false; then : else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:3937: $ac_compile\"" >&5) + (eval echo "\"\$as_me:3939: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:3940: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:3942: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:3943: output\"" >&5) + (eval echo "\"\$as_me:3945: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -5146,7 +5148,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5149 "configure"' > conftest.$ac_ext + echo '#line 5151 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -6671,11 +6673,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6674: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6676: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6678: \$? = $ac_status" >&5 + echo "$as_me:6680: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7010,11 +7012,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7013: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7015: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7017: \$? = $ac_status" >&5 + echo "$as_me:7019: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7115,11 +7117,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7118: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7120: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7122: \$? = $ac_status" >&5 + echo "$as_me:7124: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -7170,11 +7172,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7173: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7175: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7177: \$? = $ac_status" >&5 + echo "$as_me:7179: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9550,7 +9552,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 9553 "configure" +#line 9555 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -9646,7 +9648,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 9649 "configure" +#line 9651 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10387,6 +10389,8 @@ if test x"${with_tcl}" != x; then $as_echo "loading TCL configuration from ${tclconfig}" >&6; } . ${tclconfig} + + # There are lots of other configuration variables that are provided by the # tclConfig.sh file and that could be included here. But as of right now, # TCL_LIB_SPEC is the only what that the Makefile uses. diff --git a/configure.ac b/configure.ac index fba0755e62..7526c211dc 100644 --- a/configure.ac +++ b/configure.ac @@ -144,7 +144,9 @@ if test x"${with_tcl}" != x; then if test x"${tclconfig}" != x; then AC_MSG_RESULT([loading TCL configuration from ${tclconfig}]) . ${tclconfig} + AC_SUBST(TCL_INCLUDE_SPEC) AC_SUBST(TCL_LIB_SPEC) + AC_SUBST(TCL_STUB_LIB_SPEC) # There are lots of other configuration variables that are provided by the # tclConfig.sh file and that could be included here. But as of right now, # TCL_LIB_SPEC is the only what that the Makefile uses. diff --git a/manifest b/manifest index b778d5d880..023e985314 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C New\sconfiguration\soption:\s\s--with-tclsh=FILE.\s\sNew\smakefile\stargets:\ntclextension,\stclextension-install,\stclextension-uninstall,\ntclextension-list. -D 2024-08-02T00:59:32.758 +C Fix\sproblems\sin\sthe\sconfigure/Makefile\ssystem\scaused\sby\srecent\senhancements\nand\sreport\sby\s[forum:/forumpost/242ebd0c81|forum\spost\s242ebd0c81]. +D 2024-08-02T11:32:28.781 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 -F Makefile.in fbfe18ff577bcb35b1236015e442667bcdf94230cef07a0897e26f3cab5bf488 +F Makefile.in d9d8d60efaad73dde2ed2380ab3ae3b9b15cb98089d0a7d0573f39de7f093ea2 F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6 F Makefile.msc 993f8addade63bcac7192416e7161ceee60edcee2376299ea48b2a74c66ac2d5 F README.md 6358805260a03ebead84e168bbf3740ddf3f683b477e478567186aa7afb490d3 @@ -35,8 +35,8 @@ F autoconf/tea/win/nmakehlp.c b01f822eabbe1ed2b64e70882d97d48402b42d2689a1ea0034 F autoconf/tea/win/rules.vc 7b3bb2ef32ade0f3f14d951231811678722725e3bca240dd9727ae0dfe10f6a5 F config.guess 883205ddf25b46f10c181818bf42c09da9888884af96f79e1719264345053bd6 F config.sub c2d0260f17f3e4bc0b6808fccf1b291cb5e9126c14fc5890efc77b9fd0175559 -F configure 33192bee7d11f68a2be3a1ddf1dc4aa02060675f0bfb48eaf61b63fcd45abedf x -F configure.ac 1665604ede8e83da1454f26eb19dcc7cff70f1b21d305616b6c7cea2d107c005 +F configure 187978aa8b6e5bfe261bce02a883f82f7a1d239f95e53cbb5eb6be0aaab2a5b6 x +F configure.ac 50ac86967b264eab4f2925ae8c981601f154aa090ef2fd0c413974fca63251d0 F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd F doc/compile-for-windows.md e8635eea9153dcd6a51fd2740666ebc4492b3813cb1ac31cd8e99150df91762d @@ -2202,9 +2202,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 173df1478e89996126e172656e35da8026d4ef145b2341ef56213f00ade14f48 7748367c78a1f480ec9e892ba77652e3c31a4b387b89221ae584891818804851 -R ba9c12b4ec23352b095b4f17c1f3bef8 -T +closed 7748367c78a1f480ec9e892ba77652e3c31a4b387b89221ae584891818804851 +P 888284d1d47269e66e23627e2519cd2cf83ef65a777a679af20c288453f092e2 +R 93c99f8e3949df92d18547af26ca7640 U drh -Z d1d647e1ea5237f2d093d8aa4cd2371f +Z ef0c9981348aa214ce55c288609b3967 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 942974cd56..5f086dac62 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -888284d1d47269e66e23627e2519cd2cf83ef65a777a679af20c288453f092e2 +a59319fe4adc094381c46e490289b3e0cda8f804edaea6984571c47a68a23eef From 9e88d4bb8a3143e7cc03d569e0c496bbd59049d8 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 2 Aug 2024 13:56:55 +0000 Subject: [PATCH 12/45] Fix typo in a progress message in the builttclext.tcl script. FossilOrigin-Name: 5e7c94645632b736e805428ff4c135666ab525fac99c29c12d5127b06f39fc6e --- manifest | 12 ++++++------ manifest.uuid | 2 +- tool/buildtclext.tcl | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 023e985314..a208551566 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sproblems\sin\sthe\sconfigure/Makefile\ssystem\scaused\sby\srecent\senhancements\nand\sreport\sby\s[forum:/forumpost/242ebd0c81|forum\spost\s242ebd0c81]. -D 2024-08-02T11:32:28.781 +C Fix\stypo\sin\sa\sprogress\smessage\sin\sthe\sbuilttclext.tcl\sscript. +D 2024-08-02T13:56:55.670 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -2093,7 +2093,7 @@ F tool/GetTclKit.bat d84033c6a93dfe735d247f48ba00292a1cc284dcf69963e5e672444e045 F tool/Replace.cs 02c67258801c2fb5f63231e0ac0f220b4b36ba91 F tool/build-all-msvc.bat c817b716e0edeecaf265a6775b63e5f45c34a6544f1d4114a222701ed5ac79ab x F tool/build-shell.sh f193b5e3eb4afcb4abbf96bf1475be6cfb74763ee2e50c82bc7ca105e8a136c5 -F tool/buildtclext.tcl 0368eda9802262105d4b1896439889b042a40acfe73e55869ea24edb4fcba94b +F tool/buildtclext.tcl 6b8907c6a7b6734940513886d06ea9c00d2f3ba62ce39208db4e2ea5d115198b F tool/cg_anno.tcl c1f875f5a4c9caca3d59937b16aff716f8b1883935f1b4c9ae23124705bc8099 x F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2 F tool/cktclsh.sh 6075eef9c6b9ba4b38fef2ca2a66d25f2311bd3c610498d18a9b01f861629cca @@ -2202,8 +2202,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 888284d1d47269e66e23627e2519cd2cf83ef65a777a679af20c288453f092e2 -R 93c99f8e3949df92d18547af26ca7640 +P a59319fe4adc094381c46e490289b3e0cda8f804edaea6984571c47a68a23eef +R 50f27b8d2c62eae13aeca51f3735d0b2 U drh -Z ef0c9981348aa214ce55c288609b3967 +Z d21a99cc930b4bc362ff91cb037b47fd # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5f086dac62..bd9c9a3c54 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a59319fe4adc094381c46e490289b3e0cda8f804edaea6984571c47a68a23eef +5e7c94645632b736e805428ff4c135666ab525fac99c29c12d5127b06f39fc6e diff --git a/tool/buildtclext.tcl b/tool/buildtclext.tcl index 011f01cb5b..016f5751d2 100644 --- a/tool/buildtclext.tcl +++ b/tool/buildtclext.tcl @@ -202,7 +202,7 @@ if {$install} { if {$build} { # Generate the pkgIndex.tcl file # - puts "generating pkgConfig.tcl..." + puts "generating pkgIndex.tcl..." set fd [open pkgIndex.tcl w] puts $fd [subst -nocommands {# -*- tcl -*- # Tcl package index file, version ??? From dcea6335c7e8c50194a341da328f52822a5fa54c Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 2 Aug 2024 15:28:40 +0000 Subject: [PATCH 13/45] New MSVC makefile targets: tclextension, tclextension-install, tclextension-uninstall, and tclextension-list. FossilOrigin-Name: c38734f57509c50dd28029738dd602600950703b773d9b7b60fdb1dcb06e8fd8 --- Makefile.msc | 13 ++++ manifest | 14 ++-- manifest.uuid | 2 +- tool/buildtclext.tcl | 154 ++++++++++++++++++++++++------------------- 4 files changed, 107 insertions(+), 76 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index a5191739ff..e31aee0899 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1820,6 +1820,19 @@ pkgIndex.tcl: $(TOP)\VERSION $(SQLITE3TCLDLL): libtclsqlite3.lib $(LIBRESOBJS) tclsqlite3.def pkgIndex.tcl $(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /DEF:tclsqlite3.def /OUT:$@ libtclsqlite3.lib $(LIBRESOBJS) $(LTLIBS) $(TLIBS) + +tclextension: $(SQLITE3TCLDLL) + +tclextension-install: $(SQLITE3TCLDLL) + $(TCLSH_CMD) $(TOP)\tool\buildtclext.tcl --install-only + +tclextension-uninstall: + $(TCLSH_CMD) $(TOP)\tool\buildtclext.tcl --uninstall + +tclextension-list: + $(TCLSH_CMD) $(TOP)\tool\buildtclext.tcl --info + + # <> $(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP) diff --git a/manifest b/manifest index a208551566..0e8de61d1a 100644 --- a/manifest +++ b/manifest @@ -1,11 +1,11 @@ -C Fix\stypo\sin\sa\sprogress\smessage\sin\sthe\sbuilttclext.tcl\sscript. -D 2024-08-02T13:56:55.670 +C New\sMSVC\smakefile\stargets:\s\stclextension,\stclextension-install,\ntclextension-uninstall,\sand\stclextension-list. +D 2024-08-02T15:28:40.391 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 F Makefile.in d9d8d60efaad73dde2ed2380ab3ae3b9b15cb98089d0a7d0573f39de7f093ea2 F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6 -F Makefile.msc 993f8addade63bcac7192416e7161ceee60edcee2376299ea48b2a74c66ac2d5 +F Makefile.msc 6c3fe8b6ce60e73f34a148c957d78b4648745c8d30e792423aa1a8d8bf12d065 F README.md 6358805260a03ebead84e168bbf3740ddf3f683b477e478567186aa7afb490d3 F VERSION 0db40f92c04378404eb45bff93e9e42c148c7e54fd3da99469ed21e22411f5a6 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -2093,7 +2093,7 @@ F tool/GetTclKit.bat d84033c6a93dfe735d247f48ba00292a1cc284dcf69963e5e672444e045 F tool/Replace.cs 02c67258801c2fb5f63231e0ac0f220b4b36ba91 F tool/build-all-msvc.bat c817b716e0edeecaf265a6775b63e5f45c34a6544f1d4114a222701ed5ac79ab x F tool/build-shell.sh f193b5e3eb4afcb4abbf96bf1475be6cfb74763ee2e50c82bc7ca105e8a136c5 -F tool/buildtclext.tcl 6b8907c6a7b6734940513886d06ea9c00d2f3ba62ce39208db4e2ea5d115198b +F tool/buildtclext.tcl b64d250517b148e644d26fcbc097851867a0df52cd4bafe9bcd94b8421e1428a F tool/cg_anno.tcl c1f875f5a4c9caca3d59937b16aff716f8b1883935f1b4c9ae23124705bc8099 x F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2 F tool/cktclsh.sh 6075eef9c6b9ba4b38fef2ca2a66d25f2311bd3c610498d18a9b01f861629cca @@ -2202,8 +2202,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P a59319fe4adc094381c46e490289b3e0cda8f804edaea6984571c47a68a23eef -R 50f27b8d2c62eae13aeca51f3735d0b2 +P 5e7c94645632b736e805428ff4c135666ab525fac99c29c12d5127b06f39fc6e +R 34f8aa4c5bd786ba6f617a118e3aad0d U drh -Z d21a99cc930b4bc362ff91cb037b47fd +Z 99d8311f9a3fa0ec204446f79bbc573f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index bd9c9a3c54..e3145013e7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5e7c94645632b736e805428ff4c135666ab525fac99c29c12d5127b06f39fc6e +c38734f57509c50dd28029738dd602600950703b773d9b7b60fdb1dcb06e8fd8 diff --git a/tool/buildtclext.tcl b/tool/buildtclext.tcl index 016f5751d2..6d9e4c3063 100644 --- a/tool/buildtclext.tcl +++ b/tool/buildtclext.tcl @@ -32,8 +32,12 @@ for {set ii 0} {$ii<[llength $argv]} {incr ii} { } elseif {$a0=="--build-only"} { set install 0 } elseif {$a0=="--uninstall"} { + set build 0 + set install 0 set uninstall 1 } elseif {$a0=="--info"} { + set build 0 + set install 0 set infoonly 1 } elseif {$a0=="--cc" && $ii+1<[llength $argv]} { incr ii @@ -57,79 +61,93 @@ set fd [open $srcdir/VERSION] set VERSION [string trim [read $fd]] close $fd -# Figure out the location of the tclConfig.sh file used by the -# tclsh that is executing this script. -# -if {[catch { - set LIBDIR [tcl::pkgconfig get libdir,install] -}]} { - puts stderr "$argv0: tclsh does not support tcl::pkgconfig." - exit 1 -} -if {![file exists $LIBDIR]} { - puts stderr "$argv0: cannot find the tclConfig.sh file." - puts stderr "$argv0: tclsh reported library directory \"$LIBDIR\"\ - does not exist." - exit 1 -} -if {![file exists $LIBDIR/tclConfig.sh] - || [file size $LIBDIR/tclConfig.sh]<5000} { - set n1 $LIBDIR/tcl$::tcl_version - if {[file exists $n1/tclConfig.sh] - && [file size $n1/tclConfig.sh]>5000} { - set LIBDIR $n1 - } else { - puts stderr "$argv0: cannot find tclConfig.sh in either $LIBDIR or $n1" +if {$tcl_platform(platform)=="windows"} { + # We are only able to install, uninstall, and list on Windows. + # The build process is handled by the Makefile.msc, specifically + # using "nmake /f Makefile.msc pkgIndex.tcl tclsqlite3.dll" + # + if {$build} { + puts "Unable to build on Windows using the builttclext.tcl script." + puts "To build, run\n" + puts " \"nmake /f Makefile.msc pkgIndex.tcl tclsqlite3.dll" exit 1 } -} + set OUT tclsqlite3.dll +} else { + # Figure out the location of the tclConfig.sh file used by the + # tclsh that is executing this script. + # + if {[catch { + set LIBDIR [tcl::pkgconfig get libdir,install] + }]} { + puts stderr "$argv0: tclsh does not support tcl::pkgconfig." + exit 1 + } + if {![file exists $LIBDIR]} { + puts stderr "$argv0: cannot find the tclConfig.sh file." + puts stderr "$argv0: tclsh reported library directory \"$LIBDIR\"\ + does not exist." + exit 1 + } + if {![file exists $LIBDIR/tclConfig.sh] + || [file size $LIBDIR/tclConfig.sh]<5000} { + set n1 $LIBDIR/tcl$::tcl_version + if {[file exists $n1/tclConfig.sh] + && [file size $n1/tclConfig.sh]>5000} { + set LIBDIR $n1 + } else { + puts stderr "$argv0: cannot find tclConfig.sh in either $LIBDIR or $n1" + exit 1 + } + } -# Read the tclConfig.sh file into the $tclConfig variable -# -#puts "using $LIBDIR/tclConfig.sh" -set fd [open $LIBDIR/tclConfig.sh rb] -set tclConfig [read $fd] -close $fd - -# Extract parameter we will need from the tclConfig.sh file -# -set TCLMAJOR 8 -regexp {TCL_MAJOR_VERSION='(\d)'} $tclConfig all TCLMAJOR -set SUFFIX so -regexp {TCL_SHLIB_SUFFIX='\.([^']+)'} $tclConfig all SUFFIX -if {$CC==""} { - set cc {} - regexp {TCL_CC='([^']+)'} $tclConfig all cc - if {$cc!=""} { - set CC $cc + # Read the tclConfig.sh file into the $tclConfig variable + # + #puts "using $LIBDIR/tclConfig.sh" + set fd [open $LIBDIR/tclConfig.sh rb] + set tclConfig [read $fd] + close $fd + + # Extract parameter we will need from the tclConfig.sh file + # + set TCLMAJOR 8 + regexp {TCL_MAJOR_VERSION='(\d)'} $tclConfig all TCLMAJOR + set SUFFIX so + regexp {TCL_SHLIB_SUFFIX='\.([^']+)'} $tclConfig all SUFFIX + if {$CC==""} { + set cc {} + regexp {TCL_CC='([^']+)'} $tclConfig all cc + if {$cc!=""} { + set CC $cc + } + } + if {$CC==""} { + set CC gcc + } + set CFLAGS -fPIC + regexp {TCL_SHLIB_CFLAGS='([^']+)'} $tclConfig all CFLAGS + set LIBS {} + regexp {TCL_STUB_LIB_SPEC='([^']+)'} $tclConfig all LIBS + set INC "-I$srcdir/src" + set inc {} + regexp {TCL_INCLUDE_SPEC='([^']+)'} $tclConfig all inc + if {$inc!=""} { + append INC " $inc" + } + set cmd {${CC} ${CFLAGS} ${LDFLAGS} -shared} + regexp {TCL_SHLIB_LD='([^']+)'} $tclConfig all cmd + set LDFLAGS "$INC -DUSE_TCL_STUBS" + if {[string length $OPTS]>1} { + append LDFLAGS $OPTS + } + set CMD [subst $cmd] + if {$TCLMAJOR>8} { + set OUT libtcl9sqlite$VERSION.$SUFFIX + } else { + set OUT libsqlite$VERSION.$SUFFIX } } -if {$CC==""} { - set CC gcc -} -set CFLAGS -fPIC -regexp {TCL_SHLIB_CFLAGS='([^']+)'} $tclConfig all CFLAGS -set LIBS {} -regexp {TCL_STUB_LIB_SPEC='([^']+)'} $tclConfig all LIBS -set INC "-I$srcdir/src" -set inc {} -regexp {TCL_INCLUDE_SPEC='([^']+)'} $tclConfig all inc -if {$inc!=""} { - append INC " $inc" -} -set cmd {${CC} ${CFLAGS} ${LDFLAGS} -shared} -regexp {TCL_SHLIB_LD='([^']+)'} $tclConfig all cmd -set LDFLAGS "$INC -DUSE_TCL_STUBS" -if {[string length $OPTS]>1} { - append LDFLAGS $OPTS -} -set CMD [subst $cmd] -if {$TCLMAJOR>8} { - set OUT libtcl9sqlite$VERSION.$SUFFIX -} else { - set OUT libsqlite$VERSION.$SUFFIX -} - + # Show information about prior installs # if {$infoonly} { From b2d590c5f918be381b9aeb3a4a3dd0b60908b808 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 2 Aug 2024 17:36:34 +0000 Subject: [PATCH 14/45] Add the "-d SECS" option to the "status" command of testrunner.tcl FossilOrigin-Name: 2151ea31632f7aa363c7d4b7205e1174a45d710783a8efad8176049d356cfc70 --- manifest | 12 ++-- manifest.uuid | 2 +- test/testrunner.tcl | 162 ++++++++++++++++++++++++++++---------------- 3 files changed, 110 insertions(+), 66 deletions(-) diff --git a/manifest b/manifest index 0e8de61d1a..d42c57accb 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C New\sMSVC\smakefile\stargets:\s\stclextension,\stclextension-install,\ntclextension-uninstall,\sand\stclextension-list. -D 2024-08-02T15:28:40.391 +C Add\sthe\s"-d\sSECS"\soption\sto\sthe\s"status"\scommand\sof\stestrunner.tcl +D 2024-08-02T17:36:34.415 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -1705,7 +1705,7 @@ F test/temptable2.test 76821347810ecc88203e6ef0dd6897b6036ac788e9dd3e6b04fd4d163 F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637 F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc F test/tester.tcl 640106bf8f7785d0ac67cda2837577eb9f2d936033bacedf9e705ca5451958ef -F test/testrunner.tcl f6ac1a55ce4c9278cf8c4dbaed1facd347c9b80acae5d32511c3bf3e529a4817 +F test/testrunner.tcl 8a32439556e7ebba144e30c46cca95a3780647bd4f0101f3d43fbf92ef86414d F test/testrunner_data.tcl c5ae2b1f9a99210b0600d002fb3af1fee350997cee9416551e83b93501360ebf F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899 F test/thread002.test c24c83408e35ba5a952a3638b7ac03ccdf1ce4409289c54a050ac4c5f1de7502 @@ -2202,8 +2202,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 5e7c94645632b736e805428ff4c135666ab525fac99c29c12d5127b06f39fc6e -R 34f8aa4c5bd786ba6f617a118e3aad0d +P c38734f57509c50dd28029738dd602600950703b773d9b7b60fdb1dcb06e8fd8 +R 83c1979a453bc44130a53ce766cc177f U drh -Z 99d8311f9a3fa0ec204446f79bbc573f +Z 6d452c8f357818d9c3aa4547edb14d11 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index e3145013e7..304debfec0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c38734f57509c50dd28029738dd602600950703b773d9b7b60fdb1dcb06e8fd8 +2151ea31632f7aa363c7d4b7205e1174a45d710783a8efad8176049d356cfc70 diff --git a/test/testrunner.tcl b/test/testrunner.tcl index aeb015865d..80cf3ff9b9 100644 --- a/test/testrunner.tcl +++ b/test/testrunner.tcl @@ -58,7 +58,7 @@ Usage: $a0 help $a0 njob ?NJOB? $a0 script ?-msvc? CONFIG - $a0 status + $a0 status ?-d SECS? where SWITCHES are: --buildonly Build test exes but do not run tests @@ -101,8 +101,9 @@ with the specified permutation. The "status" and "njob" commands are designed to be run from the same directory as a running testrunner.tcl script that is running tests. The "status" command prints a report describing the current state and progress -of the tests. The "njob" command may be used to query or modify the number -of sub-processes the test script uses to run tests. +of the tests. Use the "-d N" option to have the status display clear the +screen and repeat every N seconds. The "njob" command may be used to query +or modify the number of sub-processes the test script uses to run tests. The "script" command outputs the script used to build a configuration. Add the "-msvc" option for a Windows-compatible script. For a list of @@ -390,10 +391,24 @@ if {[string compare -nocase script [lindex $argv 0]]==0} { #-------------------------------------------------------------------------- # Check if this is the "status" command: # -if {[llength $argv]==1 +if {[llength $argv]>=1 && [string compare -nocase status [lindex $argv 0]]==0 } { - + set delay 0 + for {set ii 1} {$ii<[llength $argv]} {incr ii} { + set a0 [lindex $argv $ii] + if {$a0=="-d" && $ii+1<[llength $argv]} { + incr ii + set delay [lindex $argv $ii] + if {![string is integer -strict $delay]} { + puts "Argument to -d should be an integer" + exit 1 + } + } else { + puts "unknown option: \"$a0\"" + exit 1 + } + } proc display_job {jobdict {tm ""}} { array set job $jobdict @@ -404,71 +419,100 @@ if {[llength $argv]==1 puts " $dfname $dtm" } + # The clreol proc returns the VT100 escape code for clear-to-end-of-line, + # if delay>0. If we are only painting the status once, it returns an + # empty string. + # + if {$delay>0} { + proc clreol {} {return ""} + } else { + proc clreol {} {return \033K} + } + if {![file readable $TRG(dbname)]} { puts "Database missing: $TRG(dbname)" exit } sqlite3 mydb $TRG(dbname) mydb timeout 2000 - mydb eval BEGIN - if {[catch { - set cmdline [mydb one { SELECT value FROM config WHERE name='cmdline' }] - set nJob [mydb one { SELECT value FROM config WHERE name='njob' }] - } msg]} { - puts "Cannot read database: $TRG(dbname)" - mydb close - exit - } + # Clear the whole screen initially. + # + if {$delay>0} {puts -nonewline "\033\[2J"} - set now [clock_milliseconds] - set tm [mydb one { - SELECT - COALESCE((SELECT value FROM config WHERE name='end'), $now) - - (SELECT value FROM config WHERE name='start') - }] - - set total 0 - foreach s {"" ready running done failed} { set S($s) 0 } - mydb eval { - SELECT state, count(*) AS cnt FROM jobs GROUP BY 1 - } { - incr S($state) $cnt - incr total $cnt - } - set fin [expr $S(done)+$S(failed)] - if {$cmdline!=""} {set cmdline " $cmdline"} - - set f "" - if {$S(failed)>0} { - set f "$S(failed) FAILED, " - } - puts "Command line: \[testrunner.tcl$cmdline\]" - puts "Jobs: $nJob" - puts "Summary: ${tm}ms, ($fin/$total) finished, ${f}$S(running) running" - - set srcdir [file dirname [file dirname $TRG(info_script)]] - if {$S(running)>0} { - puts "Running: " + while {1} { + mydb eval BEGIN + if {[catch { + set cmdline [mydb one { SELECT value FROM config WHERE name='cmdline' }] + set nJob [mydb one { SELECT value FROM config WHERE name='njob' }] + } msg]} { + puts "Cannot read database: $TRG(dbname)" + mydb close + exit + } + + set now [clock_milliseconds] + set tm [mydb one { + SELECT + COALESCE((SELECT value FROM config WHERE name='end'), $now) - + (SELECT value FROM config WHERE name='start') + }] + + set total 0 + foreach s {"" ready running done failed} { set S($s) 0 } mydb eval { - SELECT * FROM jobs WHERE state='running' ORDER BY starttime - } job { - display_job [array get job] $now + SELECT state, count(*) AS cnt FROM jobs GROUP BY 1 + } { + incr S($state) $cnt + incr total $cnt } + set fin [expr $S(done)+$S(failed)] + if {$cmdline!=""} {set cmdline " $cmdline"} + + if {$delay>0} { + # Move the cursor to the top-left corner. Each iteration will simply + # overwrite. + puts -nonewline "\033\[H" + } + set f "" + if {$S(failed)>0} { + set f "$S(failed) FAILED, " + } + puts "Command line: \[testrunner.tcl$cmdline\]" + puts "Jobs: $nJob" + puts "Summary: ${tm}ms, ($fin/$total) finished,\ + ${f}$S(running) running " + + set srcdir [file dirname [file dirname $TRG(info_script)]] + if {$S(running)>0} { + puts "Running: " + mydb eval { + SELECT * FROM jobs WHERE state='running' ORDER BY starttime + } job { + display_job [array get job] $now + } + } + if {$S(failed)>0} { + puts "Failures: " + mydb eval { + SELECT * FROM jobs WHERE state='failed' ORDER BY starttime + } job { + display_job [array get job] + } + set nOmit [mydb one {SELECT count(*) FROM jobs WHERE state='omit'}] + if {$nOmit} { + puts "$nOmit jobs omitted due to failures[clreol]" + } + } + if {$delay>0} { + # Clear everything else to the bottom of the screen + puts -nonewline "\033\[J" + flush stdout + } + mydb eval COMMIT + if {$delay<=0} break + after [expr {$delay*1000}] } - if {$S(failed)>0} { - puts "Failures: " - mydb eval { - SELECT * FROM jobs WHERE state='failed' ORDER BY starttime - } job { - display_job [array get job] - } - set nOmit [mydb one {SELECT count(*) FROM jobs WHERE state='omit'}] - if {$nOmit} { - puts "$nOmit jobs omitted due to failures" - } - } - mydb close exit } From 8517b7d2b6a47591edb8808be7d38adb967d6625 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 2 Aug 2024 18:20:10 +0000 Subject: [PATCH 15/45] Make sure the input buffer is big enough for an memcpy() when doing the restore autodetection in the shell. FossilOrigin-Name: 1637d29d518b3b4534a1b4c0dc0eddcb770f6f71763e4177812a3e79b97d2365 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/shell.c.in | 5 ++++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index d42c57accb..9200a9a3a8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\s"-d\sSECS"\soption\sto\sthe\s"status"\scommand\sof\stestrunner.tcl -D 2024-08-02T17:36:34.415 +C Make\ssure\sthe\sinput\sbuffer\sis\sbig\senough\sfor\san\smemcpy()\swhen\sdoing\sthe\nrestore\sautodetection\sin\sthe\sshell. +D 2024-08-02T18:20:10.582 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -760,7 +760,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 7e8d23ce7cdbfedf351a47e759f2722e8182ca10fd7580be43f4ce1f1a228145 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 6a95a2bffa6c09584dea99db5a7ae10c813305c09c92920ffc54f6eae2ba399e -F src/shell.c.in 44c02fd1581d95e066b479241e081f37dc95c98452badd03627ef2a1c21bdc80 +F src/shell.c.in 271bc66d805cedc9064d6218434bdaadb207d917dcecb4f46c17e5ff66085590 F src/sqlite.h.in 1ad9110150773c38ebababbad11b5cb361bcd3997676dec1c91ac5e0416a7b86 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 @@ -2202,8 +2202,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c38734f57509c50dd28029738dd602600950703b773d9b7b60fdb1dcb06e8fd8 -R 83c1979a453bc44130a53ce766cc177f +P 2151ea31632f7aa363c7d4b7205e1174a45d710783a8efad8176049d356cfc70 +R 4661deca42f48a6dcbd9a9e1fd37e56e U drh -Z 6d452c8f357818d9c3aa4547edb14d11 +Z dd91b61800449a04528ebdc3156c12eb # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 304debfec0..40805aee4e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2151ea31632f7aa363c7d4b7205e1174a45d710783a8efad8176049d356cfc70 +1637d29d518b3b4534a1b4c0dc0eddcb770f6f71763e4177812a3e79b97d2365 diff --git a/src/shell.c.in b/src/shell.c.in index f389c1f475..eea87b2dc7 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -11640,7 +11640,10 @@ static int doAutoDetectRestore(ShellState *p, const char *zSql){ case 0: { const char *zExpect = "PRAGMA foreign_keys=OFF;"; assert( strlen(zExpect)==24 ); - if( p->bSafeMode==0 && memcmp(zSql, zExpect, 25)==0 ){ + if( p->bSafeMode==0 + && strlen(zSql)>=25 + && memcmp(zSql, zExpect, 25)==0 + ){ p->eRestoreState = 1; }else{ p->eRestoreState = 7; From 4a36d304930cf3df27e43f8821fe149cce08cf88 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 3 Aug 2024 15:55:25 +0000 Subject: [PATCH 16/45] Add the --status option to the test runs using testrunner.tcl. Only works on Unix platforms. The "exec" command appears to interfere with VT100 escape codes on windows. FossilOrigin-Name: 94015cda4ceb4292ceceadb951fe5d9cb3e4e20403719b7254ad094a5b749ab3 --- manifest | 12 +- manifest.uuid | 2 +- test/testrunner.tcl | 291 ++++++++++++++++++++++++-------------------- 3 files changed, 168 insertions(+), 137 deletions(-) diff --git a/manifest b/manifest index 9200a9a3a8..cd4233fd08 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\ssure\sthe\sinput\sbuffer\sis\sbig\senough\sfor\san\smemcpy()\swhen\sdoing\sthe\nrestore\sautodetection\sin\sthe\sshell. -D 2024-08-02T18:20:10.582 +C Add\sthe\s--status\soption\sto\sthe\stest\sruns\susing\stestrunner.tcl.\s\sOnly\sworks\non\sUnix\splatforms.\s\sThe\s"exec"\scommand\sappears\sto\sinterfere\swith\sVT100\nescape\scodes\son\swindows. +D 2024-08-03T15:55:25.995 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -1705,7 +1705,7 @@ F test/temptable2.test 76821347810ecc88203e6ef0dd6897b6036ac788e9dd3e6b04fd4d163 F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637 F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc F test/tester.tcl 640106bf8f7785d0ac67cda2837577eb9f2d936033bacedf9e705ca5451958ef -F test/testrunner.tcl 8a32439556e7ebba144e30c46cca95a3780647bd4f0101f3d43fbf92ef86414d +F test/testrunner.tcl 5d02deeba7a53baeadae6aa7641d90aac58fdfa3a7bcac85cfcfd752b1aab87c F test/testrunner_data.tcl c5ae2b1f9a99210b0600d002fb3af1fee350997cee9416551e83b93501360ebf F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899 F test/thread002.test c24c83408e35ba5a952a3638b7ac03ccdf1ce4409289c54a050ac4c5f1de7502 @@ -2202,8 +2202,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 2151ea31632f7aa363c7d4b7205e1174a45d710783a8efad8176049d356cfc70 -R 4661deca42f48a6dcbd9a9e1fd37e56e +P 1637d29d518b3b4534a1b4c0dc0eddcb770f6f71763e4177812a3e79b97d2365 +R 2baa0a7875a2461a2d1db67ee8455074 U drh -Z dd91b61800449a04528ebdc3156c12eb +Z cdd1e09ba643f6fa1e24fe72f8439dd6 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 40805aee4e..551ed083cd 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1637d29d518b3b4534a1b4c0dc0eddcb770f6f71763e4177812a3e79b97d2365 +94015cda4ceb4292ceceadb951fe5d9cb3e4e20403719b7254ad094a5b749ab3 diff --git a/test/testrunner.tcl b/test/testrunner.tcl index 80cf3ff9b9..d3a2c1f4c9 100644 --- a/test/testrunner.tcl +++ b/test/testrunner.tcl @@ -58,7 +58,7 @@ Usage: $a0 help $a0 njob ?NJOB? $a0 script ?-msvc? CONFIG - $a0 status ?-d SECS? + $a0 status ?-d SECS? ?--cls? where SWITCHES are: --buildonly Build test exes but do not run tests @@ -67,6 +67,7 @@ Usage: --explain Write summary to stdout --jobs NUM Run tests using NUM separate processes --omit CONFIGS Omit configs on comma-separated list CONFIGS + --status Show the full "status" report while running --stop-on-coredump Stop running if any test segfaults --stop-on-error Stop running after any reported error --zipvfs ZIPVFSDIR ZIPVFS source directory @@ -187,6 +188,7 @@ set TRG(dryrun) 0 ;# True if --dryrun option set TRG(explain) 0 ;# True for the --explain option set TRG(stopOnError) 0 ;# Stop running at first failure set TRG(stopOnCore) 0 ;# Stop on a core-dump +set TRG(fullstatus) 0 ;# Full "status" report while running switch -nocase -glob -- $tcl_platform(os) { *darwin* { @@ -386,6 +388,99 @@ if {[string compare -nocase script [lindex $argv 0]]==0} { puts [trd_buildscript $config [file dirname $testdir] $bMsvc] exit } + +# Helper routine for show_status +# +proc display_job {jobdict {tm ""}} { + array set job $jobdict + set dfname [format %-60s $job(displayname)] + set dtm "" + if {$tm!=""} { + set dtm [format %-10s "\[[expr {$tm-$job(starttime)}]ms\]"] + } + puts " $dfname $dtm" +} + +# This procedure shows the "status" page. It uses the database +# connect passed in as the "db" parameter. If the "cls" parameter +# is true, then VT100 escape codes are used to format the display. +# +proc show_status {db cls} { + global TRG + $db eval BEGIN + if {[catch { + set cmdline [$db one { SELECT value FROM config WHERE name='cmdline' }] + set nJob [$db one { SELECT value FROM config WHERE name='njob' }] + } msg]} { + if {$cls} {puts "\033\[H\033\[2J"} + puts "Cannot read database: $TRG(dbname)" + return + } + set now [clock_milliseconds] + set tm [$db one { + SELECT + COALESCE((SELECT value FROM config WHERE name='end'), $now) - + (SELECT value FROM config WHERE name='start') + }] + + set total 0 + foreach s {"" ready running done failed} { set S($s) 0 } + $db eval { + SELECT state, count(*) AS cnt FROM jobs GROUP BY 1 + } { + incr S($state) $cnt + incr total $cnt + } + set fin [expr $S(done)+$S(failed)] + if {$cmdline!=""} {set cmdline " $cmdline"} + + if {$cls} { + # Move the cursor to the top-left corner. Each iteration will simply + # overwrite. + puts -nonewline "\033\[H" + flush stdout + set clreol "\033\[K" + } else { + set clreol "" + } + set f "" + if {$S(failed)>0} { + set f "$S(failed) FAILED, " + } + puts "Command line: \[testrunner.tcl$cmdline\]$clreol" + puts "Jobs: $nJob " + puts "Summary: ${tm}ms, ($fin/$total) finished,\ + ${f}$S(running) running " + + set srcdir [file dirname [file dirname $TRG(info_script)]] + if {$S(running)>0} { + puts "Running: " + $db eval { + SELECT * FROM jobs WHERE state='running' ORDER BY starttime + } job { + display_job [array get job] $now + } + } + if {$S(failed)>0} { + puts "Failures: " + $db eval { + SELECT * FROM jobs WHERE state='failed' ORDER BY starttime + } job { + display_job [array get job] + } + set nOmit [$db one {SELECT count(*) FROM jobs WHERE state='omit'}] + if {$nOmit} { + puts "$nOmit jobs omitted due to failures$clreol" + } + } + if {$cls} { + # Clear everything else to the bottom of the screen + puts -nonewline "\033\[0J" + flush stdout + } + $db eval COMMIT +} + #-------------------------------------------------------------------------- @@ -395,6 +490,7 @@ if {[llength $argv]>=1 && [string compare -nocase status [lindex $argv 0]]==0 } { set delay 0 + set cls 0 for {set ii 1} {$ii<[llength $argv]} {incr ii} { set a0 [lindex $argv $ii] if {$a0=="-d" && $ii+1<[llength $argv]} { @@ -404,30 +500,13 @@ if {[llength $argv]>=1 puts "Argument to -d should be an integer" exit 1 } + } elseif {$a0=="-cls" || $a0=="--cls"} { + set cls 1 } else { puts "unknown option: \"$a0\"" exit 1 } } - proc display_job {jobdict {tm ""}} { - array set job $jobdict - - set dfname [format %-60s $job(displayname)] - - set dtm "" - if {$tm!=""} { set dtm "\[[expr {$tm-$job(starttime)}]ms\]" } - puts " $dfname $dtm" - } - - # The clreol proc returns the VT100 escape code for clear-to-end-of-line, - # if delay>0. If we are only painting the status once, it returns an - # empty string. - # - if {$delay>0} { - proc clreol {} {return ""} - } else { - proc clreol {} {return \033K} - } if {![file readable $TRG(dbname)]} { puts "Database missing: $TRG(dbname)" @@ -438,78 +517,10 @@ if {[llength $argv]>=1 # Clear the whole screen initially. # - if {$delay>0} {puts -nonewline "\033\[2J"} + if {$delay>0 || $cls} {puts -nonewline "\033\[2J"} while {1} { - mydb eval BEGIN - if {[catch { - set cmdline [mydb one { SELECT value FROM config WHERE name='cmdline' }] - set nJob [mydb one { SELECT value FROM config WHERE name='njob' }] - } msg]} { - puts "Cannot read database: $TRG(dbname)" - mydb close - exit - } - - set now [clock_milliseconds] - set tm [mydb one { - SELECT - COALESCE((SELECT value FROM config WHERE name='end'), $now) - - (SELECT value FROM config WHERE name='start') - }] - - set total 0 - foreach s {"" ready running done failed} { set S($s) 0 } - mydb eval { - SELECT state, count(*) AS cnt FROM jobs GROUP BY 1 - } { - incr S($state) $cnt - incr total $cnt - } - set fin [expr $S(done)+$S(failed)] - if {$cmdline!=""} {set cmdline " $cmdline"} - - if {$delay>0} { - # Move the cursor to the top-left corner. Each iteration will simply - # overwrite. - puts -nonewline "\033\[H" - } - set f "" - if {$S(failed)>0} { - set f "$S(failed) FAILED, " - } - puts "Command line: \[testrunner.tcl$cmdline\]" - puts "Jobs: $nJob" - puts "Summary: ${tm}ms, ($fin/$total) finished,\ - ${f}$S(running) running " - - set srcdir [file dirname [file dirname $TRG(info_script)]] - if {$S(running)>0} { - puts "Running: " - mydb eval { - SELECT * FROM jobs WHERE state='running' ORDER BY starttime - } job { - display_job [array get job] $now - } - } - if {$S(failed)>0} { - puts "Failures: " - mydb eval { - SELECT * FROM jobs WHERE state='failed' ORDER BY starttime - } job { - display_job [array get job] - } - set nOmit [mydb one {SELECT count(*) FROM jobs WHERE state='omit'}] - if {$nOmit} { - puts "$nOmit jobs omitted due to failures[clreol]" - } - } - if {$delay>0} { - # Clear everything else to the bottom of the screen - puts -nonewline "\033\[J" - flush stdout - } - mydb eval COMMIT + show_status mydb [expr {$delay>0 || $cls}] if {$delay<=0} break after [expr {$delay*1000}] } @@ -616,6 +627,16 @@ for {set ii 0} {$ii < [llength $argv]} {incr ii} { set TRG(stopOnError) 1 } elseif {[string match "$a*" --stop-on-coredump]} { set TRG(stopOnCore) 1 + } elseif {[string match "$a*" --status]} { + if {$tcl_platform(platform)=="windows"} { + puts stdout \ +"The --status option is not available on Windows. A suggested work-around" + puts stdout \ +"is to run the following command in a separate window:\n" + puts stdout " [info nameofexe] $argv0 status -d 2\n" + } else { + set TRG(fullstatus) 1 + } } else { usage } @@ -1245,49 +1266,58 @@ proc launch_another_job {iJob} { return 1 } -proc one_line_report {} { +# Show the testing progress report +# +proc progress_report {} { global TRG - set tm [expr [clock_milliseconds] - $TRG(starttime)] - set tm [format "%d" [expr int($tm/1000.0 + 0.5)]] - - r_write_db { - trdb eval { - SELECT displaytype, state, count(*) AS cnt - FROM jobs - GROUP BY 1, 2 - } { - set v($state,$displaytype) $cnt - incr t($displaytype) $cnt + if {$TRG(fullstatus)} { + if {$::tcl_platform(platform)=="windows"} { + exec [info nameofexe] $::argv0 status --cls + } else { + show_status trdb 1 } - } - - set text "" - foreach j [lsort [array names t]] { - foreach k {done failed running} { incr v($k,$j) 0 } - set fin [expr $v(done,$j) + $v(failed,$j)] - lappend text "${j}($fin/$t($j))" - if {$v(failed,$j)>0} { - lappend text "f$v(failed,$j)" - } - if {$v(running,$j)>0} { - lappend text "r$v(running,$j)" - } - } - - if {[info exists TRG(reportlength)]} { - puts -nonewline "[string repeat " " $TRG(reportlength)]\r" - } - set report "${tm} [join $text { }]" - set TRG(reportlength) [string length $report] - if {[string length $report]<100} { - puts -nonewline "$report\r" - flush stdout } else { - puts $report + set tm [expr [clock_milliseconds] - $TRG(starttime)] + set tm [format "%d" [expr int($tm/1000.0 + 0.5)]] + + r_write_db { + trdb eval { + SELECT displaytype, state, count(*) AS cnt + FROM jobs + GROUP BY 1, 2 + } { + set v($state,$displaytype) $cnt + incr t($displaytype) $cnt + } + } + + set text "" + foreach j [lsort [array names t]] { + foreach k {done failed running} { incr v($k,$j) 0 } + set fin [expr $v(done,$j) + $v(failed,$j)] + lappend text "${j}($fin/$t($j))" + if {$v(failed,$j)>0} { + lappend text "f$v(failed,$j)" + } + if {$v(running,$j)>0} { + lappend text "r$v(running,$j)" + } + } + + if {[info exists TRG(reportlength)]} { + puts -nonewline "[string repeat " " $TRG(reportlength)]\r" + } + set report "${tm} [join $text { }]" + set TRG(reportlength) [string length $report] + if {[string length $report]<100} { + puts -nonewline "$report\r" + flush stdout + } else { + puts $report + } } - - after $TRG(reporttime) one_line_report + after $TRG(reporttime) progress_report } proc launch_some_jobs {} { @@ -1312,13 +1342,14 @@ proc run_testset {} { launch_some_jobs - one_line_report + if {$TRG(fullstatus)} {puts "\033\[2J"} + progress_report while {[dirs_nHelper]>0} { after 500 {incr ::wakeup} vwait ::wakeup } close $TRG(log) - one_line_report + progress_report r_write_db { set tm [clock_milliseconds] From 0a83dac31c9d4c2d65d4127f9cef07405757cf4d Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 3 Aug 2024 18:45:48 +0000 Subject: [PATCH 17/45] Ensure the sqlite3_index_info.colUsed mask always includes the PK fields of WITHOUT ROWID vtabs in cases where they may be used. FossilOrigin-Name: c327c0c02cfefdba373cfb15933a9cdfddb578b6582f2ce7c08929203743ffe9 --- manifest | 15 +++---- manifest.uuid | 2 +- src/where.c | 11 +++++- test/bestindexD.test | 93 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 112 insertions(+), 9 deletions(-) create mode 100644 test/bestindexD.test diff --git a/manifest b/manifest index cd4233fd08..c6e1fa4c8e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\s--status\soption\sto\sthe\stest\sruns\susing\stestrunner.tcl.\s\sOnly\sworks\non\sUnix\splatforms.\s\sThe\s"exec"\scommand\sappears\sto\sinterfere\swith\sVT100\nescape\scodes\son\swindows. -D 2024-08-03T15:55:25.995 +C Ensure\sthe\ssqlite3_index_info.colUsed\smask\salways\sincludes\sthe\sPK\sfields\sof\sWITHOUT\sROWID\svtabs\sin\scases\swhere\sthey\smay\sbe\sused. +D 2024-08-03T18:45:48.287 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -845,7 +845,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/wal.c 887fc4ca3f020ebb2e376f222069570834ac63bf50111ef0cbf3ae417048ed89 F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452 F src/walker.c 7c7ea0115345851c3da4e04e2e239a29983b61fb5b038b94eede6aba462640e2 -F src/where.c d87a4160e26a7a96a2f7ca283b147b1b283b54ba545c46acb14cfcc6ec37ae9e +F src/where.c 31d100c11a21e479e0dda679585f0ab2675e746a169349519a9a38d3ef10dec7 F src/whereInt.h 002adc3aa2cc10733b9b27958fdbe893987cd989fab25a9853941c1f9b9b0a65 F src/wherecode.c c9cac0b0b8e809c5e7e79d7796918907fb685ad99be2aaa9737f9787aa47349c F src/whereexpr.c 7d0d34b42b9edfd8e8ca66beb3a6ef63fe211c001af54caf2ccbcd989b783290 @@ -946,6 +946,7 @@ F test/bestindex9.test 1a4b93db117fd8abe74ae9be982f86aa72f01e60cd4ac541e6ede3967 F test/bestindexA.test e1b5def6b190797cacf008e6815ffb78fb30261999030d60a728d572eef44c7f F test/bestindexB.test 328b97b69cd1a20928d5997f9ecb04d2e00f1d18e19ab27f9e9adb44d7bc51ce F test/bestindexC.test 2df6ada16d8f00d9bb6a9664d9c323560aeed0e0ebc7a32b99d85d70037fd250 +F test/bestindexD.test 6a8f6f84990bcf17dfa59652a1f935beddb7afd96f8302830fbc86b0a13df3c3 F test/between.test b9a65fb065391980119e8a781a7409d3fcf059d89968279c750e190a9a1d5263 F test/bigfile.test aa74f4e5db51c8e54a1d9de9fa65d01d1eb20b59 F test/bigfile2.test 1b489a3a39ae90c7f027b79110d6b4e1dbc71bfc @@ -2202,8 +2203,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 1637d29d518b3b4534a1b4c0dc0eddcb770f6f71763e4177812a3e79b97d2365 -R 2baa0a7875a2461a2d1db67ee8455074 -U drh -Z cdd1e09ba643f6fa1e24fe72f8439dd6 +P 94015cda4ceb4292ceceadb951fe5d9cb3e4e20403719b7254ad094a5b749ab3 +R 0e3129b74e025069f852e333318489ef +U dan +Z 98131b222c55011293de598d5d0fb4ed # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 551ed083cd..abf3e708eb 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -94015cda4ceb4292ceceadb951fe5d9cb3e4e20403719b7254ad094a5b749ab3 +c327c0c02cfefdba373cfb15933a9cdfddb578b6582f2ce7c08929203743ffe9 diff --git a/src/where.c b/src/where.c index a9a2589956..35c6f204a9 100644 --- a/src/where.c +++ b/src/where.c @@ -1501,6 +1501,16 @@ static sqlite3_index_info *allocateIndexInfo( pIdxInfo->aConstraint = pIdxCons; pIdxInfo->aOrderBy = pIdxOrderBy; pIdxInfo->aConstraintUsage = pUsage; + pIdxInfo->colUsed = (sqlite3_int64)pSrc->colUsed; + if( HasRowid(pTab)==0 ){ + /* Ensure that all bits associated with PK columns are set. This is to + ** ensure they are available for cases like RIGHT joins or OR loops. */ + Index *pPk = sqlite3PrimaryKeyIndex((Table*)pTab); + for(i=0; inKeyCol; i++){ + int iCol = pPk->aiColumn[i]; + pIdxInfo->colUsed |= (iCol>=BMS ? ALLBITS : MASKBIT(iCol)); + } + } pHidden->pWC = pWC; pHidden->pParse = pParse; pHidden->eDistinct = eDistinct; @@ -4216,7 +4226,6 @@ static int whereLoopAddVirtualOne( pIdxInfo->estimatedCost = SQLITE_BIG_DBL / (double)2; pIdxInfo->estimatedRows = 25; pIdxInfo->idxFlags = 0; - pIdxInfo->colUsed = (sqlite3_int64)pSrc->colUsed; pHidden->mHandleIn = 0; /* Invoke the virtual table xBestIndex() method */ diff --git a/test/bestindexD.test b/test/bestindexD.test new file mode 100644 index 0000000000..b06d6b4270 --- /dev/null +++ b/test/bestindexD.test @@ -0,0 +1,93 @@ +# 2024-08-03 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl +set testprefix bestindexD + +ifcapable !vtab { + finish_test + return +} + +register_tcl_module db + +proc vtab_command {method args} { + switch -- $method { + xConnect { + return "CREATE TABLE t1(a PRIMARY KEY, b, c) WITHOUT ROWID" + } + + xBestIndex { + set hdl [lindex $args 0] + set ::colUsed [$hdl mask] + + set cost 1000000 + set used "" + + set cons 0 + foreach c [$hdl constraints] { + set cost [expr $cost/10] + append used " use $cons" + incr cons + } + + return "cost $cost rows $cost $used" + } + } + + return {} +} + +do_execsql_test 1.0 { + CREATE VIRTUAL TABLE x1 USING tcl(vtab_command); + + CREATE TABLE t2(a, b); +} {} + +# This proc assumes that there is only one use of a virtual table - x1 - +# in SQL statement $sql. It tests that the colUsed value passed to the +# xBestIndex method matches the actual columns used, which is ascertained +# by searching the compiled VM code for VColumn instructions. +# +proc do_colsused_test {tn sql} { + set ::colUsed "" + execsql $sql + set got $::colUsed + + set expect 0 + db eval "EXPLAIN $sql" x { + if {$x(opcode)=="VColumn"} { + set expect [expr $expect | (1<<$x(p2))] + } + } + + uplevel [list do_test $tn.($expect/$got) [list expr ($expect & $got)] $expect] +} + +do_colsused_test 1.1 { SELECT a FROM x1 } +do_colsused_test 1.2 { SELECT a,c FROM x1 } +do_colsused_test 1.3 { SELECT b FROM x1 } +do_colsused_test 1.4 { SELECT b FROM x1 WHERE c=? } + +do_colsused_test 1.5 { + select 1 from t2 full join x1; +} + +do_colsused_test 1.6 { + select 1 from x1 WHERE (b=? AND c=?) OR (b=? AND c=?) +} + +finish_test + + From 5c85ddc3d7c6688d8a29a224adfbe341c860000f Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 3 Aug 2024 18:58:25 +0000 Subject: [PATCH 18/45] Fix a typo in [c327c0c0] preventing the shell tool from running ".dump" scripts that feature virtual tables. FossilOrigin-Name: 10e97abb878debb67410902ea1af4df75a9ced1e38fec710b1796c5143aff48e --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/shell.c.in | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index cd4233fd08..fabb35471f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\s--status\soption\sto\sthe\stest\sruns\susing\stestrunner.tcl.\s\sOnly\sworks\non\sUnix\splatforms.\s\sThe\s"exec"\scommand\sappears\sto\sinterfere\swith\sVT100\nescape\scodes\son\swindows. -D 2024-08-03T15:55:25.995 +C Fix\sa\stypo\sin\s[c327c0c0]\spreventing\sthe\sshell\stool\sfrom\srunning\s".dump"\sscripts\sthat\sfeature\svirtual\stables. +D 2024-08-03T18:58:25.762 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -760,7 +760,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 7e8d23ce7cdbfedf351a47e759f2722e8182ca10fd7580be43f4ce1f1a228145 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 6a95a2bffa6c09584dea99db5a7ae10c813305c09c92920ffc54f6eae2ba399e -F src/shell.c.in 271bc66d805cedc9064d6218434bdaadb207d917dcecb4f46c17e5ff66085590 +F src/shell.c.in 664d443867c2a6d3f17da7dd864af5660012750847a985d0b22ee0c8cd6fc18a F src/sqlite.h.in 1ad9110150773c38ebababbad11b5cb361bcd3997676dec1c91ac5e0416a7b86 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 @@ -2202,8 +2202,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 1637d29d518b3b4534a1b4c0dc0eddcb770f6f71763e4177812a3e79b97d2365 -R 2baa0a7875a2461a2d1db67ee8455074 -U drh -Z cdd1e09ba643f6fa1e24fe72f8439dd6 +P 94015cda4ceb4292ceceadb951fe5d9cb3e4e20403719b7254ad094a5b749ab3 +R 29b4b37a6a2fc091f26014a6acc94dba +U dan +Z ee0e09932c59f9ad04251e6acfe5d403 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 551ed083cd..f469e40925 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -94015cda4ceb4292ceceadb951fe5d9cb3e4e20403719b7254ad094a5b749ab3 +10e97abb878debb67410902ea1af4df75a9ced1e38fec710b1796c5143aff48e diff --git a/src/shell.c.in b/src/shell.c.in index eea87b2dc7..4434a97aba 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -11641,7 +11641,7 @@ static int doAutoDetectRestore(ShellState *p, const char *zSql){ const char *zExpect = "PRAGMA foreign_keys=OFF;"; assert( strlen(zExpect)==24 ); if( p->bSafeMode==0 - && strlen(zSql)>=25 + && strlen(zSql)>=24 && memcmp(zSql, zExpect, 25)==0 ){ p->eRestoreState = 1; From 3a799b3e4e9f485e6efeb08fc508ee6570b6fa3b Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 3 Aug 2024 23:00:17 +0000 Subject: [PATCH 19/45] Fix to the previous checkin: The colUsed parameter should have high-order bit set if any of the 64-th or greater columns of the virtual table is used. The lower 63 bits of colUsed always show the usage of the first 63 columns of the virtual table. FossilOrigin-Name: 90ac8457750ace1d76d7bc957af7877e86e6301bb07361e19beaf5c7b3b6085a --- manifest | 13 ++++++------- manifest.uuid | 2 +- src/where.c | 5 ++++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index da99073cfd..952974c320 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Ensure\sthat\sthe\ssqlite3_index_info.colUsed\smask\salways\sincludes\sthe\sPK\sfields\sof\sWITHOUT\sROWID\svirtual\stables. -D 2024-08-03T21:45:46.594 +C Fix\sto\sthe\sprevious\scheckin:\s\sThe\scolUsed\sparameter\sshould\shave\shigh-order\sbit\nset\sif\sany\sof\sthe\s64-th\sor\sgreater\scolumns\sof\sthe\svirtual\stable\sis\sused.\s\sThe\nlower\s63\sbits\sof\scolUsed\salways\sshow\sthe\susage\sof\sthe\sfirst\s63\scolumns\sof\sthe\nvirtual\stable. +D 2024-08-03T23:00:17.844 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -845,7 +845,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/wal.c 887fc4ca3f020ebb2e376f222069570834ac63bf50111ef0cbf3ae417048ed89 F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452 F src/walker.c 7c7ea0115345851c3da4e04e2e239a29983b61fb5b038b94eede6aba462640e2 -F src/where.c 31d100c11a21e479e0dda679585f0ab2675e746a169349519a9a38d3ef10dec7 +F src/where.c 5bbe53db73ae6c8ee34a5eab693a5586ad8ff4f094ff0e524df965b683bec884 F src/whereInt.h 002adc3aa2cc10733b9b27958fdbe893987cd989fab25a9853941c1f9b9b0a65 F src/wherecode.c c9cac0b0b8e809c5e7e79d7796918907fb685ad99be2aaa9737f9787aa47349c F src/whereexpr.c 7d0d34b42b9edfd8e8ca66beb3a6ef63fe211c001af54caf2ccbcd989b783290 @@ -2203,9 +2203,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 10e97abb878debb67410902ea1af4df75a9ced1e38fec710b1796c5143aff48e c327c0c02cfefdba373cfb15933a9cdfddb578b6582f2ce7c08929203743ffe9 -R 1d93f534d15ca5d5211a14297b5dec08 -T +closed c327c0c02cfefdba373cfb15933a9cdfddb578b6582f2ce7c08929203743ffe9 +P ff4ac279b02190cc2107b0b110806dd7abcea47a6589d827b5ee39d4b80fb719 +R a2921e0516f49bd12a52be68e2b8cf58 U drh -Z cedb7caeaa81af02824696e786ffbd42 +Z fc6c19311d5767734dbc13dfa2309323 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 22570d3b73..cb9b47f097 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ff4ac279b02190cc2107b0b110806dd7abcea47a6589d827b5ee39d4b80fb719 +90ac8457750ace1d76d7bc957af7877e86e6301bb07361e19beaf5c7b3b6085a diff --git a/src/where.c b/src/where.c index 35c6f204a9..c850121c34 100644 --- a/src/where.c +++ b/src/where.c @@ -1506,9 +1506,12 @@ static sqlite3_index_info *allocateIndexInfo( /* Ensure that all bits associated with PK columns are set. This is to ** ensure they are available for cases like RIGHT joins or OR loops. */ Index *pPk = sqlite3PrimaryKeyIndex((Table*)pTab); + assert( pPk!=0 ); for(i=0; inKeyCol; i++){ int iCol = pPk->aiColumn[i]; - pIdxInfo->colUsed |= (iCol>=BMS ? ALLBITS : MASKBIT(iCol)); + assert( iCol>=0 ); + if( iCol>=BMS-1 ) iCol = BMS-1; + pIdxInfo->colUsed |= MASKBIT(iCol); } } pHidden->pWC = pWC; From f2b21a5f57e1a1db1a286c42af40563077635c3d Mon Sep 17 00:00:00 2001 From: drh <> Date: Sun, 4 Aug 2024 10:13:01 +0000 Subject: [PATCH 20/45] Restore legacy "tcl_install" makefile target, as an interim measure until I can figure out what is going on. FossilOrigin-Name: 931ad7d9e3aedb6d466fffc0af1f8d6b20d57a35dec644f28585f3e84f22d1ce --- Makefile.in | 9 +++++++++ manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Makefile.in b/Makefile.in index c83e76a3db..7ff6e901e4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1552,6 +1552,15 @@ install: sqlite3$(TEXE) lib_install sqlite3.h sqlite3.pc ${HAVE_TCL:1=tcl_instal $(INSTALL) -d $(DESTDIR)$(pkgconfigdir) $(INSTALL) -m 0644 sqlite3.pc $(DESTDIR)$(pkgconfigdir) +pkgIndex.tcl: + echo 'package ifneeded sqlite3 $(RELEASE) [list load [file join $$dir libtclsqlite3[info sharedlibextension]] sqlite3]' > $@ + +tcl_install: lib_install libtclsqlite3.la pkgIndex.tcl + $(INSTALL) -d $(DESTDIR)$(TCLLIBDIR) + $(LTINSTALL) libtclsqlite3.la $(DESTDIR)$(TCLLIBDIR) + rm -f $(DESTDIR)$(TCLLIBDIR)/libtclsqlite3.la $(DESTDIR)$(TCLLIBDIR)/libtclsqlite3.a + $(INSTALL) -m 0644 pkgIndex.tcl $(DESTDIR)$(TCLLIBDIR) + # Build the SQLite TCL extension in a way that make it compatible # with whatever version of TCL is running as $TCLSH_CMD, possibly defined # by --with-tclsh= diff --git a/manifest b/manifest index 952974c320..ee70922c67 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Fix\sto\sthe\sprevious\scheckin:\s\sThe\scolUsed\sparameter\sshould\shave\shigh-order\sbit\nset\sif\sany\sof\sthe\s64-th\sor\sgreater\scolumns\sof\sthe\svirtual\stable\sis\sused.\s\sThe\nlower\s63\sbits\sof\scolUsed\salways\sshow\sthe\susage\sof\sthe\sfirst\s63\scolumns\sof\sthe\nvirtual\stable. -D 2024-08-03T23:00:17.844 +C Restore\slegacy\s"tcl_install"\smakefile\starget,\sas\san\sinterim\smeasure\suntil\nI\scan\sfigure\sout\swhat\sis\sgoing\son. +D 2024-08-04T10:13:01.193 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 -F Makefile.in d9d8d60efaad73dde2ed2380ab3ae3b9b15cb98089d0a7d0573f39de7f093ea2 +F Makefile.in cf96aa7d2682650dec56dc2f03cfe463feb101a1be594e4929bcd38662bc2ea8 F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6 F Makefile.msc 6c3fe8b6ce60e73f34a148c957d78b4648745c8d30e792423aa1a8d8bf12d065 F README.md 6358805260a03ebead84e168bbf3740ddf3f683b477e478567186aa7afb490d3 @@ -2203,8 +2203,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P ff4ac279b02190cc2107b0b110806dd7abcea47a6589d827b5ee39d4b80fb719 -R a2921e0516f49bd12a52be68e2b8cf58 +P 90ac8457750ace1d76d7bc957af7877e86e6301bb07361e19beaf5c7b3b6085a +R 9b2d1c4cfc1de11b88618206fa47dc44 U drh -Z fc6c19311d5767734dbc13dfa2309323 +Z 58431a0b0955994c226a6fb05d3d3ed5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index cb9b47f097..cc1a387f2b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -90ac8457750ace1d76d7bc957af7877e86e6301bb07361e19beaf5c7b3b6085a +931ad7d9e3aedb6d466fffc0af1f8d6b20d57a35dec644f28585f3e84f22d1ce From 575a7b85f5f999bd8c04e59374e1e6d25b7af815 Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 6 Aug 2024 10:29:41 +0000 Subject: [PATCH 21/45] Change the AggInfoColumnReg() and AggInfoFuncReg() macros for compilers that cannot parse empty elements of a comma expression. [forum:/forumpost/8fd21998dc|Forum post 8fd21998dc]. FossilOrigin-Name: 533a6251f188805363f0e39613ea03b1bfd758eaea00e0855803238585bdfec7 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/sqliteInt.h | 6 ++++++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index ee70922c67..a186bcee82 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Restore\slegacy\s"tcl_install"\smakefile\starget,\sas\san\sinterim\smeasure\suntil\nI\scan\sfigure\sout\swhat\sis\sgoing\son. -D 2024-08-04T10:13:01.193 +C Change\sthe\sAggInfoColumnReg()\sand\sAggInfoFuncReg()\smacros\sfor\ncompilers\sthat\scannot\sparse\sempty\selements\sof\sa\scomma\sexpression.\n[forum:/forumpost/8fd21998dc|Forum\spost\s8fd21998dc]. +D 2024-08-06T10:29:41.290 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -764,7 +764,7 @@ F src/shell.c.in 664d443867c2a6d3f17da7dd864af5660012750847a985d0b22ee0c8cd6fc18 F src/sqlite.h.in 1ad9110150773c38ebababbad11b5cb361bcd3997676dec1c91ac5e0416a7b86 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 -F src/sqliteInt.h b77218c425891c7c90506c77fd2eb13bae03628d065b44fffeb37401cd955ac1 +F src/sqliteInt.h e3f3b3d80a666a7c5c85b4db102d41ca831c5624f0b3001814479d376f00c19d F src/sqliteLimit.h 6878ab64bdeb8c24a1d762d45635e34b96da21132179023338c93f820eee6728 F src/status.c cb11f8589a6912af2da3bb1ec509a94dd8ef27df4d4c1a97e0bcf2309ece972b F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 @@ -2203,8 +2203,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 90ac8457750ace1d76d7bc957af7877e86e6301bb07361e19beaf5c7b3b6085a -R 9b2d1c4cfc1de11b88618206fa47dc44 +P 931ad7d9e3aedb6d466fffc0af1f8d6b20d57a35dec644f28585f3e84f22d1ce +R d8ba70166a18ab57aa5e818fead8a2e7 U drh -Z 58431a0b0955994c226a6fb05d3d3ed5 +Z 3f8f0dbf60885f64555a59fa3dde5754 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index cc1a387f2b..5b481e56df 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -931ad7d9e3aedb6d466fffc0af1f8d6b20d57a35dec644f28585f3e84f22d1ce +533a6251f188805363f0e39613ea03b1bfd758eaea00e0855803238585bdfec7 diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 6a92befe0f..dca5bb150d 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -2914,9 +2914,15 @@ struct AggInfo { ** assignAggregateRegisters() that computes the value of pAggInfo->iFirstReg. ** The assert()s that are part of this macro verify that constraint. */ +#ifndef NDEBUG #define AggInfoColumnReg(A,I) (assert((A)->iFirstReg),(A)->iFirstReg+(I)) #define AggInfoFuncReg(A,I) \ (assert((A)->iFirstReg),(A)->iFirstReg+(A)->nColumn+(I)) +#else +#define AggInfoColumnReg(A,I) ((A)->iFirstReg+(I)) +#define AggInfoFuncReg(A,I) \ + ((A)->iFirstReg+(A)->nColumn+(I)) +#endif /* ** The datatype ynVar is a signed integer, either 16-bit or 32-bit. From 210f6f89befbe4e4c561fc34aabc175f552450f4 Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 6 Aug 2024 20:00:10 +0000 Subject: [PATCH 22/45] Improvements to ./configure that will hopefully break fewer builds. FossilOrigin-Name: 769e32a69b7b7c04225afa0371f139b2ed29aaee5a7a4159a30d600ed9f25c57 --- configure | 88 +++++++++++++++++++++++++++++++++------------------ configure.ac | 83 ++++++++++++++++++++++++++++++++---------------- manifest | 14 ++++---- manifest.uuid | 2 +- 4 files changed, 121 insertions(+), 66 deletions(-) diff --git a/configure b/configure index 616fb26276..2c57d6ac3a 100755 --- a/configure +++ b/configure @@ -10306,7 +10306,7 @@ USE_AMALGAMATION=1 ######### # Figure out all the name of a working tclsh and parameters needed to compile against Tcl. -# The --with-tcl= configuration parameter might be useful for this. +# The --with-tcl= and/or --with-tclsh= configuration arguments might be useful for this. # # Check whether --with-tclsh was given. @@ -10371,41 +10371,70 @@ if test x"${with_tclsh}" != x -a x"${with_tclsh}" != xnone; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: using tclsh at \"$TCLSH_CMD\"" >&5 $as_echo "using tclsh at \"$TCLSH_CMD\"" >&6; } with_tcl=`${with_tclsh} <${srcdir}/tool/find_tclconfig.tcl` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TCLSH_CMD recommends the tclConfig.sh at ${with_tcl}" >&5 + if test x"${with_tcl}" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TCLSH_CMD recommends the tclConfig.sh at ${with_tcl}" >&5 $as_echo "$TCLSH_CMD recommends the tclConfig.sh at ${with_tcl}" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $TCLSH_CMD is unable to recommend a tclConfig.sh" >&5 +$as_echo "$as_me: WARNING: $TCLSH_CMD is unable to recommend a tclConfig.sh" >&2;} + fi fi if test x"${with_tcl}" != x; then if test -r ${with_tcl}/tclConfig.sh; then tclconfig="${with_tcl}/tclConfig.sh" else - if test -r ${with_tcl}/tcl8.6/tclConfig.sh; then - tclconfig="${with_tcl}/tcl8.6/tclConfig.sh" - else - as_fn_error $? "no tclConfig.sh file found in ${with_tcl} or ${with_tcl}/tcl8.6" "$LINENO" 5 - fi - fi - if test x"${tclconfig}" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: loading TCL configuration from ${tclconfig}" >&5 -$as_echo "loading TCL configuration from ${tclconfig}" >&6; } - . ${tclconfig} - - - - # There are lots of other configuration variables that are provided by the - # tclConfig.sh file and that could be included here. But as of right now, - # TCL_LIB_SPEC is the only what that the Makefile uses. - fi - if test x"$TCLSH_CMD" == x; then - TCLSH_CMD=${TCL_EXEC_PREFIX}/bin/tclsh${TCL_VERSION} - if test ! -x ${TCLSH_CMD}; then - TCLSH_CMD_2=${TCL_EXEC_PREFIX}/bin/tclsh - if test ! -x ${TCLSH_CMD_2}; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot find a usable tclsh at either ${TCLSH_CMD} or ${TCLSH_CMD_2}" >&5 -$as_echo "$as_me: WARNING: cannot find a usable tclsh at either ${TCLSH_CMD} or ${TCLSH_CMD_2}" >&2;} - TCLSH_CMD=none - else - TCLSH_CMD=${TCLSH_CMD_2} + for i in tcl8.6 tcl9.0 lib; do + if test -r ${with_tcl}/$i/tclConfig.sh; then + tclconfig=${with_tcl}/$i/tclConfig.sh + break fi + done + fi + if test ! -r "${tclconfig}"; then + as_fn_error $? "no tclConfig.sh file found under ${with_tcl}" "$LINENO" 5 + fi +else + # If we have not yet found a tclConfig.sh file, look in $libdir whic is + # set automatically by autoconf or by the --prefix command-line option. + # See https://sqlite.org/forum/forumpost/e04e693439a22457 + libdir=${prefix}/lib + if test -r ${libdir}/tclConfig.sh; then + tclconfig=${libdir}/tclConfig.sh + else + for i in tcl8.6 tcl9.0 lib; do + if test -r ${libdir}/$i/tclConfig.sh; then + tclconfig=${libdir}/$i/tclConfig.sh + break + fi + done + fi + if test ! -r "${tclconfig}"; then + as_fn_error $? "cannot find a usable tclConfig.sh file. + Use --with-tcl=DIR to specify a directory where tclConfig.sh can be found. + SQLite does not use TCL internally, but TCL is required to build SQLite + from canonical sources and TCL is required for testing." "$LINENO" 5 + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: loading TCL configuration from ${tclconfig}" >&5 +$as_echo "loading TCL configuration from ${tclconfig}" >&6; } +. ${tclconfig} + + + +# There are lots of other configuration variables that are provided by the +# tclConfig.sh file and that could be included here. But as of right now, +# TCL_LIB_SPEC is the only what that the Makefile uses. + +if test x"$TCLSH_CMD" == x; then + TCLSH_CMD=${TCL_EXEC_PREFIX}/bin/tclsh${TCL_VERSION} + if test ! -x ${TCLSH_CMD}; then + TCLSH_CMD_2=${TCL_EXEC_PREFIX}/bin/tclsh + if test ! -x ${TCLSH_CMD_2}; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot find a usable tclsh at either ${TCLSH_CMD} or ${TCLSH_CMD_2}" >&5 +$as_echo "$as_me: WARNING: cannot find a usable tclsh at either ${TCLSH_CMD} or ${TCLSH_CMD_2}" >&2;} + TCLSH_CMD=none + else + TCLSH_CMD=${TCLSH_CMD_2} fi fi fi @@ -10425,7 +10454,6 @@ fi if test "x${TCLLIBDIR+set}" != "xset" ; then - TCLLIBDIR='$(libdir)' for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}` ; do if test -d $i ; then TCLLIBDIR=$i diff --git a/configure.ac b/configure.ac index 7526c211dc..095df5e4f6 100644 --- a/configure.ac +++ b/configure.ac @@ -117,7 +117,7 @@ USE_AMALGAMATION=1 ######### # Figure out all the name of a working tclsh and parameters needed to compile against Tcl. -# The --with-tcl= configuration parameter might be useful for this. +# The --with-tcl= and/or --with-tclsh= configuration arguments might be useful for this. # AC_ARG_WITH(tclsh, AS_HELP_STRING([--with-tclsh=PATHNAME],[full pathname of a tclsh to use])) AC_ARG_WITH(tcl, AS_HELP_STRING([--with-tcl=DIR],[directory containing (tclConfig.sh)])) @@ -129,38 +129,66 @@ if test x"${with_tclsh}" != x -a x"${with_tclsh}" != xnone; then TCLSH_CMD=${with_tclsh} AC_MSG_RESULT([using tclsh at "$TCLSH_CMD"]) with_tcl=`${with_tclsh} <${srcdir}/tool/find_tclconfig.tcl` - AC_MSG_RESULT([$TCLSH_CMD recommends the tclConfig.sh at ${with_tcl}]) + if test x"${with_tcl}" != x; then + AC_MSG_RESULT([$TCLSH_CMD recommends the tclConfig.sh at ${with_tcl}]) + else + AC_MSG_WARN([$TCLSH_CMD is unable to recommend a tclConfig.sh]) + fi fi if test x"${with_tcl}" != x; then if test -r ${with_tcl}/tclConfig.sh; then tclconfig="${with_tcl}/tclConfig.sh" else - if test -r ${with_tcl}/tcl8.6/tclConfig.sh; then - tclconfig="${with_tcl}/tcl8.6/tclConfig.sh" - else - AC_MSG_ERROR([no tclConfig.sh file found in ${with_tcl} or ${with_tcl}/tcl8.6]) - fi - fi - if test x"${tclconfig}" != x; then - AC_MSG_RESULT([loading TCL configuration from ${tclconfig}]) - . ${tclconfig} - AC_SUBST(TCL_INCLUDE_SPEC) - AC_SUBST(TCL_LIB_SPEC) - AC_SUBST(TCL_STUB_LIB_SPEC) - # There are lots of other configuration variables that are provided by the - # tclConfig.sh file and that could be included here. But as of right now, - # TCL_LIB_SPEC is the only what that the Makefile uses. - fi - if test x"$TCLSH_CMD" == x; then - TCLSH_CMD=${TCL_EXEC_PREFIX}/bin/tclsh${TCL_VERSION} - if test ! -x ${TCLSH_CMD}; then - TCLSH_CMD_2=${TCL_EXEC_PREFIX}/bin/tclsh - if test ! -x ${TCLSH_CMD_2}; then - AC_MSG_WARN([cannot find a usable tclsh at either ${TCLSH_CMD} or ${TCLSH_CMD_2}]) - TCLSH_CMD=none - else - TCLSH_CMD=${TCLSH_CMD_2} + for i in tcl8.6 tcl9.0 lib; do + if test -r ${with_tcl}/$i/tclConfig.sh; then + tclconfig=${with_tcl}/$i/tclConfig.sh + break fi + done + fi + if test ! -r "${tclconfig}"; then + AC_MSG_ERROR([no tclConfig.sh file found under ${with_tcl}]) + fi +else + # If we have not yet found a tclConfig.sh file, look in $libdir whic is + # set automatically by autoconf or by the --prefix command-line option. + # See https://sqlite.org/forum/forumpost/e04e693439a22457 + libdir=${prefix}/lib + if test -r ${libdir}/tclConfig.sh; then + tclconfig=${libdir}/tclConfig.sh + else + for i in tcl8.6 tcl9.0 lib; do + if test -r ${libdir}/$i/tclConfig.sh; then + tclconfig=${libdir}/$i/tclConfig.sh + break + fi + done + fi + if test ! -r "${tclconfig}"; then + AC_MSG_ERROR([cannot find a usable tclConfig.sh file. + Use --with-tcl=DIR to specify a directory where tclConfig.sh can be found. + SQLite does not use TCL internally, but TCL is required to build SQLite + from canonical sources and TCL is required for testing.]) + fi +fi +AC_MSG_RESULT([loading TCL configuration from ${tclconfig}]) +. ${tclconfig} +AC_SUBST(TCL_INCLUDE_SPEC) +AC_SUBST(TCL_LIB_SPEC) +AC_SUBST(TCL_STUB_LIB_SPEC) +# There are lots of other configuration variables that are provided by the +# tclConfig.sh file and that could be included here. But as of right now, +# TCL_LIB_SPEC is the only what that the Makefile uses. + +if test x"$TCLSH_CMD" == x; then + TCLSH_CMD=${TCL_EXEC_PREFIX}/bin/tclsh${TCL_VERSION} + if test ! -x ${TCLSH_CMD}; then + TCLSH_CMD_2=${TCL_EXEC_PREFIX}/bin/tclsh + if test ! -x ${TCLSH_CMD_2}; then + AC_MSG_WARN([cannot find a usable tclsh at either ${TCLSH_CMD} or ${TCLSH_CMD_2}]) + TCLSH_CMD=none + else + TCLSH_CMD=${TCLSH_CMD_2} fi fi fi @@ -179,7 +207,6 @@ AC_SUBST(HAVE_TCL) AC_ARG_VAR([TCLLIBDIR], [Where to install tcl plugin]) if test "x${TCLLIBDIR+set}" != "xset" ; then - TCLLIBDIR='$(libdir)' for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}` ; do if test -d $i ; then TCLLIBDIR=$i diff --git a/manifest b/manifest index a186bcee82..215ae7ad21 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\sthe\sAggInfoColumnReg()\sand\sAggInfoFuncReg()\smacros\sfor\ncompilers\sthat\scannot\sparse\sempty\selements\sof\sa\scomma\sexpression.\n[forum:/forumpost/8fd21998dc|Forum\spost\s8fd21998dc]. -D 2024-08-06T10:29:41.290 +C Improvements\sto\s./configure\sthat\swill\shopefully\sbreak\sfewer\sbuilds. +D 2024-08-06T20:00:10.407 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -35,8 +35,8 @@ F autoconf/tea/win/nmakehlp.c b01f822eabbe1ed2b64e70882d97d48402b42d2689a1ea0034 F autoconf/tea/win/rules.vc 7b3bb2ef32ade0f3f14d951231811678722725e3bca240dd9727ae0dfe10f6a5 F config.guess 883205ddf25b46f10c181818bf42c09da9888884af96f79e1719264345053bd6 F config.sub c2d0260f17f3e4bc0b6808fccf1b291cb5e9126c14fc5890efc77b9fd0175559 -F configure 187978aa8b6e5bfe261bce02a883f82f7a1d239f95e53cbb5eb6be0aaab2a5b6 x -F configure.ac 50ac86967b264eab4f2925ae8c981601f154aa090ef2fd0c413974fca63251d0 +F configure 8c74221e3e3af939270c27f0600281a5485ac2e5014dd7581b056e24a528d625 x +F configure.ac 9a3d92b38ad56456d09c1272f83131794f73110437f0f53fb94c90ce0d7a351a F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd F doc/compile-for-windows.md e8635eea9153dcd6a51fd2740666ebc4492b3813cb1ac31cd8e99150df91762d @@ -2203,8 +2203,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 931ad7d9e3aedb6d466fffc0af1f8d6b20d57a35dec644f28585f3e84f22d1ce -R d8ba70166a18ab57aa5e818fead8a2e7 +P 533a6251f188805363f0e39613ea03b1bfd758eaea00e0855803238585bdfec7 +R a7a477ca379232403aa066474b0e57d0 U drh -Z 3f8f0dbf60885f64555a59fa3dde5754 +Z 01918af4ac385e19f077c5342eefac64 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5b481e56df..c7ef415a77 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -533a6251f188805363f0e39613ea03b1bfd758eaea00e0855803238585bdfec7 +769e32a69b7b7c04225afa0371f139b2ed29aaee5a7a4159a30d600ed9f25c57 From e9b919d550262076d1b8453c3d6852b88822b922 Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 6 Aug 2024 22:49:01 +0000 Subject: [PATCH 23/45] Improved robustness of parsing of tokenize= arguments in FTS5. [forum:/forumpost/171bcc2bcd|Forum post 171bcc2bcd]. FossilOrigin-Name: d9f726ade6b258f8723f90d0b04a4682e885e30939eb29773913e4dfc8e85503 --- ext/fts5/fts5_tokenize.c | 12 +++++++----- ext/fts5/test/fts5tokenizer2.test | 20 ++++++++++++++++++++ ext/fts5/test/fts5trigram.test | 5 ++++- ext/fts5/test/fts5trigram2.test | 3 +++ manifest | 18 +++++++++--------- manifest.uuid | 2 +- 6 files changed, 44 insertions(+), 16 deletions(-) diff --git a/ext/fts5/fts5_tokenize.c b/ext/fts5/fts5_tokenize.c index 3e9fdff3eb..08de0d60d7 100644 --- a/ext/fts5/fts5_tokenize.c +++ b/ext/fts5/fts5_tokenize.c @@ -79,7 +79,7 @@ static int fts5AsciiCreate( int i; memset(p, 0, sizeof(AsciiTokenizer)); memcpy(p->aTokenChar, aAsciiTokenChar, sizeof(aAsciiTokenChar)); - for(i=0; rc==SQLITE_OK && ibFold = 1; pNew->iFoldParam = 0; - for(i=0; rc==SQLITE_OK && iiFoldParam!=0 && pNew->bFold==0 ){ rc = SQLITE_ERROR; diff --git a/ext/fts5/test/fts5tokenizer2.test b/ext/fts5/test/fts5tokenizer2.test index 0017046baf..4fe31d22c4 100644 --- a/ext/fts5/test/fts5tokenizer2.test +++ b/ext/fts5/test/fts5tokenizer2.test @@ -85,5 +85,25 @@ do_execsql_test 1.7 { SELECT highlight(t1, 0, '>', '<') FROM t1('BB mess'); } {AAdont>BBmess<} +# 2024-08-06 https://sqlite.org/forum/forumpost/171bcc2bcd +# Error handling of tokenize= arguments. +# +foreach {n tkz} { + 1 {ascii none} + 2 {unicode61 none} + 3 {porter none} + 4 {trigram none} + 5 {ascii none 0} + 6 {unicode61 none 0} + 7 {porter none 0} + 8 {trigram none 0} +} { + db eval {DROP TABLE IF EXISTS t2;} + do_catchsql_test 2.$n " + DROP TABLE IF EXISTS t2; + CREATE VIRTUAL TABLE t2 USING fts5(a,b,c,tokenize='$tkz'); + " {1 {error in tokenizer constructor}} +} + finish_test diff --git a/ext/fts5/test/fts5trigram.test b/ext/fts5/test/fts5trigram.test index 351c059bf5..752686620c 100644 --- a/ext/fts5/test/fts5trigram.test +++ b/ext/fts5/test/fts5trigram.test @@ -69,6 +69,9 @@ do_execsql_test 2.0 { INSERT INTO t1 VALUES('abcdefghijklm'); INSERT INTO t1 VALUES('กรุงเทพมหานคร'); } +do_catchsql_test 2.0.1 { + CREATE VIRTUAL TABLE t2 USING fts5(z, tokenize='trigram case_sensitive'); +} {1 {error in tokenizer constructor}} foreach {tn s res} { 1 abc "(abc)defghijklm" @@ -206,7 +209,7 @@ do_execsql_test 7.0 { (20, "жираф.png"), (30, "cat.png"), (40, "кот.png"), - (50, "misic-🎵-.mp3"); + (50, "misic-🎵-.mp3"); } do_execsql_test 7.1 { SELECT rowid FROM f WHERE +filename GLOB '*ир*'; diff --git a/ext/fts5/test/fts5trigram2.test b/ext/fts5/test/fts5trigram2.test index 00f6d43952..33c07d3f8b 100644 --- a/ext/fts5/test/fts5trigram2.test +++ b/ext/fts5/test/fts5trigram2.test @@ -21,6 +21,9 @@ do_execsql_test 1.0 " INSERT INTO t1 VALUES('abc\u0303defghijklm'); INSERT INTO t1 VALUES('a\u0303b\u0303c\u0303defghijklm'); " +do_catchsql_test 1.0.1 { + CREATE VIRTUAL TABLE t2 USING fts5(z, tokenize='trigram remove_diacritics'); +} {1 {error in tokenizer constructor}} do_execsql_test 1.1 { SELECT highlight(t1, 0, '(', ')') FROM t1('abc'); diff --git a/manifest b/manifest index 215ae7ad21..dcbcb3f3ae 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improvements\sto\s./configure\sthat\swill\shopefully\sbreak\sfewer\sbuilds. -D 2024-08-06T20:00:10.407 +C Improved\srobustness\sof\sparsing\sof\stokenize=\sarguments\sin\sFTS5.\n[forum:/forumpost/171bcc2bcd|Forum\spost\s171bcc2bcd]. +D 2024-08-06T22:49:01.135 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -105,7 +105,7 @@ F ext/fts5/fts5_storage.c 1d7e08d4331da2f3f7e78e70eef2ed6a013d91ba16175c651adbc5 F ext/fts5/fts5_tcl.c 5ca3e3e35010d326f5b821a563e4fcde3913e052935f5c2c72c264122a26b48f F ext/fts5/fts5_test_mi.c 08c11ec968148d4cb4119d96d819f8c1f329812c568bac3684f5464be177d3ee F ext/fts5/fts5_test_tok.c 3cb0a9b508b30d17ef025ccddd26ae3dc8ddffbe76c057616e59a9aa85d36f3b -F ext/fts5/fts5_tokenize.c fa5493075101540270f572038fc1723d44fcc97bfbf237c8530013b8a27860be +F ext/fts5/fts5_tokenize.c b1c3dc4de28f2532d9ee7be7182a96f943fa09fcc31c6f271d69dce72874ff8c F ext/fts5/fts5_unicode2.c eca63dbc797f8ff0572e97caf4631389c0ab900d6364861b915bdd4735973f00 F ext/fts5/fts5_varint.c e64d2113f6e1bfee0032972cffc1207b77af63319746951bf1d09885d1dadf80 F ext/fts5/fts5_vocab.c e4830b00809e5da53bc10f93adc59e321407b0f801c7f4167c0e47f5552267e0 @@ -229,9 +229,9 @@ F ext/fts5/test/fts5synonym2.test 58f357b997cf2fedeeb9d0de4db9f880fa96fa2fe27a74 F ext/fts5/test/fts5tok1.test 1f7817499f5971450d8c4a652114b3d833393c8134e32422d0af27884ffe9cef F ext/fts5/test/fts5tok2.test dcacb32d4a2a3f0dd3215d4a3987f78ae4be21a2 F ext/fts5/test/fts5tokenizer.test 7937cec672b148223fff8746d21d3e7ed0965fd7caf35ccdc888a005bb452f98 -F ext/fts5/test/fts5tokenizer2.test 9c1ad8ef0465076cbc9ff5c764782594329b3bce3e0f6a931a026902d006f495 -F ext/fts5/test/fts5trigram.test 6c4e37864f3e7d90673db5563d9736d7e40080ab94d10ebdffa94c1b77941da0 -F ext/fts5/test/fts5trigram2.test c91f0a94f7e1ff859682228646abeab4c0eba2effc46af2cbc8f0f48b05a0566 +F ext/fts5/test/fts5tokenizer2.test ddb8b10fbe4b84b2a75812671f127774c1d2e3e2bf82d2e0e4f0bb1cd8a2b2d6 +F ext/fts5/test/fts5trigram.test be914555deb8504dde682bd5aa343d00c4da37dfad20709a5bac30d5f97f2ef5 +F ext/fts5/test/fts5trigram2.test 9be01ec340a61869931a23ec109d189e589e2b807d574e1fc1f0cf2c23765c42 F ext/fts5/test/fts5ubsan.test 9a2dcf399dc8d0e0de661f0d93884d1d27e5b7f0693cfceb97dd24d818df5dd2 F ext/fts5/test/fts5umlaut.test a42fe2fe6387c40c49ab27ccbd070e1ae38e07f38d05926482cc0bccac9ad602 F ext/fts5/test/fts5unicode.test 41898f7e476e6515cd4b737c02a442cda5a580a74509788aa9072a2074948e0e @@ -2203,8 +2203,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 533a6251f188805363f0e39613ea03b1bfd758eaea00e0855803238585bdfec7 -R a7a477ca379232403aa066474b0e57d0 +P 769e32a69b7b7c04225afa0371f139b2ed29aaee5a7a4159a30d600ed9f25c57 +R f82e2089204b40d7709881ee6cd588a3 U drh -Z 01918af4ac385e19f077c5342eefac64 +Z e2400150d004e016a710bc2ae395399e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index c7ef415a77..0cc2838448 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -769e32a69b7b7c04225afa0371f139b2ed29aaee5a7a4159a30d600ed9f25c57 +d9f726ade6b258f8723f90d0b04a4682e885e30939eb29773913e4dfc8e85503 From eaa560f3fce32619cd0ca017278b9ad94ebba0e8 Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 6 Aug 2024 23:09:37 +0000 Subject: [PATCH 24/45] Remove unused test cases from FTS5, as they interfere with "grep". FossilOrigin-Name: 048a71bae48aacdfc91e59330db4d4b3d663f00665f51a7110ea82e0508758ec --- ext/fts5/test/fts5unicode2.test | 116 -------------------------------- manifest | 12 ++-- manifest.uuid | 2 +- 3 files changed, 7 insertions(+), 123 deletions(-) diff --git a/ext/fts5/test/fts5unicode2.test b/ext/fts5/test/fts5unicode2.test index dccaff0b1c..3fc1f673a4 100644 --- a/ext/fts5/test/fts5unicode2.test +++ b/ext/fts5/test/fts5unicode2.test @@ -470,120 +470,4 @@ do_execsql_test 8.2.3 { SELECT rowid FROM t4 WHERE t4 MATCH 'a' ORDER BY rowid ASC; } {2 4} -#------------------------------------------------------------------------- -# -if 0 { -foreach {tn sql} { - 1 { - CREATE VIRTUAL TABLE t5 USING fts4(tokenize=unicode61 [tokenchars= .]); - CREATE VIRTUAL TABLE t6 USING fts4( - tokenize=unicode61 [tokenchars=="] "tokenchars=[]"); - CREATE VIRTUAL TABLE t7 USING fts4(tokenize=unicode61 [separators=x\xC4]); - } - 2 { - CREATE VIRTUAL TABLE t5 USING fts4(tokenize=unicode61 "tokenchars= ."); - CREATE VIRTUAL TABLE t6 USING fts4(tokenize=unicode61 "tokenchars=[=""]"); - CREATE VIRTUAL TABLE t7 USING fts4(tokenize=unicode61 "separators=x\xC4"); - } - 3 { - CREATE VIRTUAL TABLE t5 USING fts4(tokenize=unicode61 'tokenchars= .'); - CREATE VIRTUAL TABLE t6 USING fts4(tokenize=unicode61 'tokenchars=="[]'); - CREATE VIRTUAL TABLE t7 USING fts4(tokenize=unicode61 'separators=x\xC4'); - } - 4 { - CREATE VIRTUAL TABLE t5 USING fts4(tokenize=unicode61 `tokenchars= .`); - CREATE VIRTUAL TABLE t6 USING fts4(tokenize=unicode61 `tokenchars=[="]`); - CREATE VIRTUAL TABLE t7 USING fts4(tokenize=unicode61 `separators=x\xC4`); - } -} { - do_execsql_test 9.$tn.0 { - DROP TABLE IF EXISTS t5; - DROP TABLE IF EXISTS t5aux; - DROP TABLE IF EXISTS t6; - DROP TABLE IF EXISTS t6aux; - DROP TABLE IF EXISTS t7; - DROP TABLE IF EXISTS t7aux; - } - do_execsql_test 9.$tn.1 $sql - - do_execsql_test 9.$tn.2 { - CREATE VIRTUAL TABLE t5aux USING fts4aux(t5); - INSERT INTO t5 VALUES('one two three/four.five.six'); - SELECT * FROM t5aux; - } { - four.five.six * 1 1 four.five.six 0 1 1 - {one two three} * 1 1 {one two three} 0 1 1 - } - - do_execsql_test 9.$tn.3 { - CREATE VIRTUAL TABLE t6aux USING fts4aux(t6); - INSERT INTO t6 VALUES('alpha=beta"gamma/delta[epsilon]zeta'); - SELECT * FROM t6aux; - } { - {alpha=beta"gamma} * 1 1 {alpha=beta"gamma} 0 1 1 - {delta[epsilon]zeta} * 1 1 {delta[epsilon]zeta} 0 1 1 - } - - do_execsql_test 9.$tn.4 { - CREATE VIRTUAL TABLE t7aux USING fts4aux(t7); - INSERT INTO t7 VALUES('alephxbeth\xC4gimel'); - SELECT * FROM t7aux; - } { - aleph * 1 1 aleph 0 1 1 - beth * 1 1 beth 0 1 1 - gimel * 1 1 gimel 0 1 1 - } -} - -# Check that multiple options are handled correctly. -# -do_execsql_test 10.1 { - DROP TABLE IF EXISTS t1; - CREATE VIRTUAL TABLE t1 USING fts4(tokenize=unicode61 - "tokenchars=xyz" "tokenchars=.=" "separators=.=" "separators=xy" - "separators=a" "separators=a" "tokenchars=a" "tokenchars=a" - ); - - INSERT INTO t1 VALUES('oneatwoxthreeyfour'); - INSERT INTO t1 VALUES('a.single=word'); - CREATE VIRTUAL TABLE t1aux USING fts4aux(t1); - SELECT * FROM t1aux; -} { - .single=word * 1 1 .single=word 0 1 1 - four * 1 1 four 0 1 1 - one * 1 1 one 0 1 1 - three * 1 1 three 0 1 1 - two * 1 1 two 0 1 1 -} - -# Test that case folding happens after tokenization, not before. -# -do_execsql_test 10.2 { - DROP TABLE IF EXISTS t2; - CREATE VIRTUAL TABLE t2 USING fts4(tokenize=unicode61 "separators=aB"); - INSERT INTO t2 VALUES('oneatwoBthree'); - INSERT INTO t2 VALUES('onebtwoAthree'); - CREATE VIRTUAL TABLE t2aux USING fts4aux(t2); - SELECT * FROM t2aux; -} { - one * 1 1 one 0 1 1 - onebtwoathree * 1 1 onebtwoathree 0 1 1 - three * 1 1 three 0 1 1 - two * 1 1 two 0 1 1 -} - -# Test that the tokenchars and separators options work with the -# fts3tokenize table. -# -do_execsql_test 11.1 { - CREATE VIRTUAL TABLE ft1 USING fts3tokenize( - "unicode61", "tokenchars=@.", "separators=1234567890" - ); - SELECT token FROM ft1 WHERE input = 'berlin@street123sydney.road'; -} { - berlin@street sydney.road -} - -} - finish_test diff --git a/manifest b/manifest index dcbcb3f3ae..182a5add47 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improved\srobustness\sof\sparsing\sof\stokenize=\sarguments\sin\sFTS5.\n[forum:/forumpost/171bcc2bcd|Forum\spost\s171bcc2bcd]. -D 2024-08-06T22:49:01.135 +C Remove\sunused\stest\scases\sfrom\sFTS5,\sas\sthey\sinterfere\swith\s"grep". +D 2024-08-06T23:09:37.114 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -235,7 +235,7 @@ F ext/fts5/test/fts5trigram2.test 9be01ec340a61869931a23ec109d189e589e2b807d574e F ext/fts5/test/fts5ubsan.test 9a2dcf399dc8d0e0de661f0d93884d1d27e5b7f0693cfceb97dd24d818df5dd2 F ext/fts5/test/fts5umlaut.test a42fe2fe6387c40c49ab27ccbd070e1ae38e07f38d05926482cc0bccac9ad602 F ext/fts5/test/fts5unicode.test 41898f7e476e6515cd4b737c02a442cda5a580a74509788aa9072a2074948e0e -F ext/fts5/test/fts5unicode2.test 3ff7ea5d27310d65441779d9919055084cdbb570ed7743af1f8f4eeca1a3be26 +F ext/fts5/test/fts5unicode2.test a5c38179b311a188b24376772309389b073c996f52b79bb9ca760a19e62043ea F ext/fts5/test/fts5unicode3.test f4891a3dac3b49c3d7c0fdb29566e9eb0ecff35263370c89f9661b1952b20818 F ext/fts5/test/fts5unicode4.test 728c8f0caafb05567f524ad313d9f8b780fa45987b8a8df04eff87923c74b4d0 F ext/fts5/test/fts5unindexed.test 168838d2c385e131120bbf5b516d2432a5fabc4caa2259c932e1d49ae209a4ae @@ -2203,8 +2203,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 769e32a69b7b7c04225afa0371f139b2ed29aaee5a7a4159a30d600ed9f25c57 -R f82e2089204b40d7709881ee6cd588a3 +P d9f726ade6b258f8723f90d0b04a4682e885e30939eb29773913e4dfc8e85503 +R 8883991defb511b18c50a1c79414e20d U drh -Z e2400150d004e016a710bc2ae395399e +Z 52ae6209c36ddaa63cf3a7ae6e99cfb1 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0cc2838448..e3862d0484 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d9f726ade6b258f8723f90d0b04a4682e885e30939eb29773913e4dfc8e85503 +048a71bae48aacdfc91e59330db4d4b3d663f00665f51a7110ea82e0508758ec From 92d317f787fdc8342a60aee494217914e417b766 Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 7 Aug 2024 14:54:54 +0000 Subject: [PATCH 25/45] Fix a harmless compiler warning in an assert(). FossilOrigin-Name: 5e4c9a74b2efa74ace67f644fb6bb37e07f5982f8faaca9463e3daa50b0469d7 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/vdbesort.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 182a5add47..1c1ed26a5e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sunused\stest\scases\sfrom\sFTS5,\sas\sthey\sinterfere\swith\s"grep". -D 2024-08-06T23:09:37.114 +C Fix\sa\sharmless\scompiler\swarning\sin\san\sassert(). +D 2024-08-07T14:54:54.630 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -837,7 +837,7 @@ F src/vdbeapi.c 80235ac380e9467fec1cb0883354d841f2a771976e766995f7e0c77f845406df F src/vdbeaux.c 25d685cafe119ff890c94345e884ea558a6b5d823bfa52ba708eb8ff3c70aa71 F src/vdbeblob.c 13f9287b55b6356b4b1845410382d6bede203ceb29ef69388a4a3d007ffacbe5 F src/vdbemem.c 831a244831eaa45335f9ae276b50a7a82ee10d8c46c2c72492d4eb8c98d94d89 -F src/vdbesort.c 237840ca1947511fa59bd4e18b9eeae93f2af2468c34d2427b059f896230a547 +F src/vdbesort.c 218fb7358e6c4ca3c843171d989ff31b4bc0b708c10e6a095ae7e9aa3335cfae F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823 F src/vdbevtab.c fc46b9cbd759dc013f0b3724549cc0d71379183c667df3a5988f7e2f1bd485f3 F src/vtab.c 5fb499d20494b7eecaadb7584634af9afcb374cb0524912b475fcb1712458a1b @@ -2203,8 +2203,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P d9f726ade6b258f8723f90d0b04a4682e885e30939eb29773913e4dfc8e85503 -R 8883991defb511b18c50a1c79414e20d +P 048a71bae48aacdfc91e59330db4d4b3d663f00665f51a7110ea82e0508758ec +R 29c7af48e92a52bfc015cef89b4e9b80 U drh -Z 52ae6209c36ddaa63cf3a7ae6e99cfb1 +Z 823f9a62b624b3de6573555750300eee # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index e3862d0484..7494572243 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -048a71bae48aacdfc91e59330db4d4b3d663f00665f51a7110ea82e0508758ec +5e4c9a74b2efa74ace67f644fb6bb37e07f5982f8faaca9463e3daa50b0469d7 diff --git a/src/vdbesort.c b/src/vdbesort.c index 0083690308..2a4be0f4cf 100644 --- a/src/vdbesort.c +++ b/src/vdbesort.c @@ -556,7 +556,7 @@ static int vdbePmaReadBlob( while( nRem>0 ){ int rc; /* vdbePmaReadBlob() return code */ int nCopy; /* Number of bytes to copy */ - u8 *aNext; /* Pointer to buffer to copy data from */ + u8 *aNext = 0; /* Pointer to buffer to copy data from */ nCopy = nRem; if( nRem>p->nBuffer ) nCopy = p->nBuffer; From c76520c5b917e5ad108ec264328e6ab7ad08cec8 Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 7 Aug 2024 15:17:37 +0000 Subject: [PATCH 26/45] Add a new assert() to help static analyzers understand that a pointer is never NULL. FossilOrigin-Name: 433f2b942ee6f79d50ebe9b08fa3ea8162db6a10ce9d80e2bc193124baa1b083 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/vdbesort.c | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 1c1ed26a5e..bdd89ab3f8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sharmless\scompiler\swarning\sin\san\sassert(). -D 2024-08-07T14:54:54.630 +C Add\sa\snew\sassert()\sto\shelp\sstatic\sanalyzers\sunderstand\sthat\sa\spointer\sis\nnever\sNULL. +D 2024-08-07T15:17:37.116 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -837,7 +837,7 @@ F src/vdbeapi.c 80235ac380e9467fec1cb0883354d841f2a771976e766995f7e0c77f845406df F src/vdbeaux.c 25d685cafe119ff890c94345e884ea558a6b5d823bfa52ba708eb8ff3c70aa71 F src/vdbeblob.c 13f9287b55b6356b4b1845410382d6bede203ceb29ef69388a4a3d007ffacbe5 F src/vdbemem.c 831a244831eaa45335f9ae276b50a7a82ee10d8c46c2c72492d4eb8c98d94d89 -F src/vdbesort.c 218fb7358e6c4ca3c843171d989ff31b4bc0b708c10e6a095ae7e9aa3335cfae +F src/vdbesort.c d0a3c7056c081703c8b6d91ad60f17da5e062a5c64bf568ed0fa1b5f4cae311f F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823 F src/vdbevtab.c fc46b9cbd759dc013f0b3724549cc0d71379183c667df3a5988f7e2f1bd485f3 F src/vtab.c 5fb499d20494b7eecaadb7584634af9afcb374cb0524912b475fcb1712458a1b @@ -2203,8 +2203,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 048a71bae48aacdfc91e59330db4d4b3d663f00665f51a7110ea82e0508758ec -R 29c7af48e92a52bfc015cef89b4e9b80 +P 5e4c9a74b2efa74ace67f644fb6bb37e07f5982f8faaca9463e3daa50b0469d7 +R 563f140a9b39903a75648b155c162aef U drh -Z 823f9a62b624b3de6573555750300eee +Z 2831e995241ff77754cf2f0030919a15 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 7494572243..f5c40f5049 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5e4c9a74b2efa74ace67f644fb6bb37e07f5982f8faaca9463e3daa50b0469d7 +433f2b942ee6f79d50ebe9b08fa3ea8162db6a10ce9d80e2bc193124baa1b083 diff --git a/src/vdbesort.c b/src/vdbesort.c index 2a4be0f4cf..239c0a0f36 100644 --- a/src/vdbesort.c +++ b/src/vdbesort.c @@ -563,6 +563,7 @@ static int vdbePmaReadBlob( rc = vdbePmaReadBlob(p, nCopy, &aNext); if( rc!=SQLITE_OK ) return rc; assert( aNext!=p->aAlloc ); + assert( aNext!=0 ); memcpy(&p->aAlloc[nByte - nRem], aNext, nCopy); nRem -= nCopy; } From 5cd01c30b4486a90c5d139ebf6ca5d3d4bb0dee8 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 7 Aug 2024 21:20:08 +0000 Subject: [PATCH 27/45] Fix a broken assert in fts5_expr.c. FossilOrigin-Name: 08cc5488404d068e59378b82988460793710df43ec21b4a83a794b497abd035f --- ext/fts5/fts5_expr.c | 1 + ext/fts5/test/fts5trigram2.test | 14 ++++++++++++++ manifest | 16 ++++++++-------- manifest.uuid | 2 +- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/ext/fts5/fts5_expr.c b/ext/fts5/fts5_expr.c index 732d4cf893..176d4e6a5f 100644 --- a/ext/fts5/fts5_expr.c +++ b/ext/fts5/fts5_expr.c @@ -2457,6 +2457,7 @@ Fts5ExprNode *sqlite3Fts5ParseImplicitAnd( assert( pRight->eType==FTS5_STRING || pRight->eType==FTS5_TERM || pRight->eType==FTS5_EOF + || (pRight->eType==FTS5_AND && pParse->bPhraseToAnd) ); if( pLeft->eType==FTS5_AND ){ diff --git a/ext/fts5/test/fts5trigram2.test b/ext/fts5/test/fts5trigram2.test index 33c07d3f8b..c81684a22b 100644 --- a/ext/fts5/test/fts5trigram2.test +++ b/ext/fts5/test/fts5trigram2.test @@ -120,4 +120,18 @@ do_execsql_test 4.2 { SELECT rowid FROM t4 WHERE z LIKE '%abc%' } {1} +#------------------------------------------------------------------------- +reset_db +do_execsql_test 5.0 { + CREATE VIRTUAL TABLE t5 USING fts5( + c1, tokenize='trigram', detail='none' + ); + INSERT INTO t5(rowid, c1) VALUES(1, 'abc_____xyx_yxz'); + INSERT INTO t5(rowid, c1) VALUES(2, 'abc_____xyxz'); + INSERT INTO t5(rowid, c1) VALUES(3, 'ac_____xyxz'); +} {} +do_execsql_test 5.1 { + SELECT rowid FROM t5 WHERE c1 LIKE 'abc%xyxz' +} {2} + finish_test diff --git a/manifest b/manifest index bdd89ab3f8..49d8819fe6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\snew\sassert()\sto\shelp\sstatic\sanalyzers\sunderstand\sthat\sa\spointer\sis\nnever\sNULL. -D 2024-08-07T15:17:37.116 +C Fix\sa\sbroken\sassert\sin\sfts5_expr.c. +D 2024-08-07T21:20:08.849 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -97,7 +97,7 @@ F ext/fts5/fts5Int.h 41fb3a2dd40e818cc96c6f4176dbdf2aaa8f57043cfc9a8f2676e7e6a72 F ext/fts5/fts5_aux.c 4584e88878e54828bf7d4d0d83deedd232ec60628b7731be02bad6adb62304b1 F ext/fts5/fts5_buffer.c 0eec58bff585f1a44ea9147eae5da2447292080ea435957f7488c70673cb6f09 F ext/fts5/fts5_config.c 68cb87a49215f8e7028000b681df4057c430a4a6afbd676463886da94c9e1c37 -F ext/fts5/fts5_expr.c c7336d5f9ecc0e2b014d700be2bec0ea383b0e82c494a7c5c4ac622327c2bfad +F ext/fts5/fts5_expr.c 29558460f161b0bee816fdfb6547cdcaefc7b61c64a1bf78d50052932a210201 F ext/fts5/fts5_hash.c adda4272be401566a6e0ba1acbe70ee5cb97fce944bc2e04dc707152a0ec91b1 F ext/fts5/fts5_index.c eb9a0dda3bc6ef969a6be8d2746af56856e67251810ddba08622b45be8477abe F ext/fts5/fts5_main.c 77fefb37e7931095a5ff271a28fbe4f73ec46d5492ef1f35d405d98e137ad8ed @@ -231,7 +231,7 @@ F ext/fts5/test/fts5tok2.test dcacb32d4a2a3f0dd3215d4a3987f78ae4be21a2 F ext/fts5/test/fts5tokenizer.test 7937cec672b148223fff8746d21d3e7ed0965fd7caf35ccdc888a005bb452f98 F ext/fts5/test/fts5tokenizer2.test ddb8b10fbe4b84b2a75812671f127774c1d2e3e2bf82d2e0e4f0bb1cd8a2b2d6 F ext/fts5/test/fts5trigram.test be914555deb8504dde682bd5aa343d00c4da37dfad20709a5bac30d5f97f2ef5 -F ext/fts5/test/fts5trigram2.test 9be01ec340a61869931a23ec109d189e589e2b807d574e1fc1f0cf2c23765c42 +F ext/fts5/test/fts5trigram2.test 6fde9de7f63a6b4aa18dc731be56dbd6be4e755c9b13dcd55479e200d1df0e61 F ext/fts5/test/fts5ubsan.test 9a2dcf399dc8d0e0de661f0d93884d1d27e5b7f0693cfceb97dd24d818df5dd2 F ext/fts5/test/fts5umlaut.test a42fe2fe6387c40c49ab27ccbd070e1ae38e07f38d05926482cc0bccac9ad602 F ext/fts5/test/fts5unicode.test 41898f7e476e6515cd4b737c02a442cda5a580a74509788aa9072a2074948e0e @@ -2203,8 +2203,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 5e4c9a74b2efa74ace67f644fb6bb37e07f5982f8faaca9463e3daa50b0469d7 -R 563f140a9b39903a75648b155c162aef -U drh -Z 2831e995241ff77754cf2f0030919a15 +P 433f2b942ee6f79d50ebe9b08fa3ea8162db6a10ce9d80e2bc193124baa1b083 +R 4344cfe486b9af9c627d27d1110ce2f0 +U dan +Z 57ed22c9ed030aee910e69827579449e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f5c40f5049..a97e2bbfc9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -433f2b942ee6f79d50ebe9b08fa3ea8162db6a10ce9d80e2bc193124baa1b083 +08cc5488404d068e59378b82988460793710df43ec21b4a83a794b497abd035f From 6d02d2647b4f1bbc455b252ef8794aa8b5708586 Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 8 Aug 2024 10:10:38 +0000 Subject: [PATCH 28/45] Add the --memory option to the ".parameter init" CLI command. When present, the --memory option causes the sqlite_parameters table to be created in a completely independent :memory: database. This can be done to avoid parameter binding queries from being affected by debug settings such as ".wheretrace", ".treetrace", "PRAGMA vdbe_addoptrace=on", and similar. FossilOrigin-Name: 4e69dce2093b75b7db4fbdca4953b664b907be15d991ed352ea1d87c64fbf9d2 --- manifest | 14 ++-- manifest.uuid | 2 +- src/shell.c.in | 185 ++++++++++++++++++++++++++++++++----------------- 3 files changed, 128 insertions(+), 73 deletions(-) diff --git a/manifest b/manifest index 49d8819fe6..587d9af3bb 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sbroken\sassert\sin\sfts5_expr.c. -D 2024-08-07T21:20:08.849 +C Add\sthe\s--memory\soption\sto\sthe\s".parameter\sinit"\sCLI\scommand.\s\sWhen\spresent,\nthe\s--memory\soption\scauses\sthe\ssqlite_parameters\stable\sto\sbe\screated\sin\sa\ncompletely\sindependent\s:memory:\sdatabase.\s\sThis\scan\sbe\sdone\sto\savoid\nparameter\sbinding\squeries\sfrom\sbeing\saffected\sby\sdebug\ssettings\ssuch\sas\n".wheretrace",\s".treetrace",\s"PRAGMA\svdbe_addoptrace=on",\sand\ssimilar. +D 2024-08-08T10:10:38.385 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -760,7 +760,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 7e8d23ce7cdbfedf351a47e759f2722e8182ca10fd7580be43f4ce1f1a228145 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 6a95a2bffa6c09584dea99db5a7ae10c813305c09c92920ffc54f6eae2ba399e -F src/shell.c.in 664d443867c2a6d3f17da7dd864af5660012750847a985d0b22ee0c8cd6fc18a +F src/shell.c.in 8b1a82ddbcf93580f991eecec0a22e8edc7d62fa856388d9bed2392da1cbfa42 F src/sqlite.h.in 1ad9110150773c38ebababbad11b5cb361bcd3997676dec1c91ac5e0416a7b86 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 @@ -2203,8 +2203,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 433f2b942ee6f79d50ebe9b08fa3ea8162db6a10ce9d80e2bc193124baa1b083 -R 4344cfe486b9af9c627d27d1110ce2f0 -U dan -Z 57ed22c9ed030aee910e69827579449e +P 08cc5488404d068e59378b82988460793710df43ec21b4a83a794b497abd035f +R d4d35f38c7731eed804015561204e2a7 +U drh +Z 252eafc7dac030f0d53111914f8dbebb # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index a97e2bbfc9..950203b129 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -08cc5488404d068e59378b82988460793710df43ec21b4a83a794b497abd035f +4e69dce2093b75b7db4fbdca4953b664b907be15d991ed352ea1d87c64fbf9d2 diff --git a/src/shell.c.in b/src/shell.c.in index 4434a97aba..2d6c76d3b0 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -1356,6 +1356,8 @@ struct ShellState { #endif } aAuxDb[5], /* Array of all database connections */ *pAuxDb; /* Currently active database connection */ + sqlite3 *dbParam; /* Database to use for query parameters. Often the + ** same as "db", but might be different. */ int *aiIndent; /* Array of indents used in MODE_Explain */ int nIndent; /* Size of array aiIndent[] */ int iIndent; /* Index of current op in aiIndent[] */ @@ -3480,22 +3482,44 @@ static void restore_debug_trace_modes(void){ sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 3, &savedWhereTrace); } -/* Create the TEMP table used to store parameter bindings */ -static void bind_table_init(ShellState *p){ +/* Create the TEMP table used to store parameter bindings. +** +** If bInMemory is true, create a separate in-memory database for +** the parameter binding table. +** +** The database that stores the sqlite_parameter table will be +** p->dbParam. This might be a copy of p->db. Or it might be a +** completely separate database (if bInMemory is true, because of +** the ".param init --memory" command). +*/ +static void bind_table_init(ShellState *p, int bInMemory){ int wrSchema = 0; int defensiveMode = 0; - sqlite3_db_config(p->db, SQLITE_DBCONFIG_DEFENSIVE, -1, &defensiveMode); - sqlite3_db_config(p->db, SQLITE_DBCONFIG_DEFENSIVE, 0, 0); - sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, -1, &wrSchema); - sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, 1, 0); - sqlite3_exec(p->db, + sqlite3 *dbx; + if( p->dbParam ) return; + if( sqlite3_table_column_metadata(p->db, "TEMP", "sqlite_parameters", + "key", 0, 0, 0, 0, 0)==SQLITE_OK ){ + return; + } + if( bInMemory && p->dbParam==0 ){ + sqlite3_open(":memory:", &p->dbParam); + }else{ + p->dbParam = p->db; + } + dbx = p->dbParam; + + sqlite3_db_config(dbx, SQLITE_DBCONFIG_DEFENSIVE, -1, &defensiveMode); + sqlite3_db_config(dbx, SQLITE_DBCONFIG_DEFENSIVE, 0, 0); + sqlite3_db_config(dbx, SQLITE_DBCONFIG_WRITABLE_SCHEMA, -1, &wrSchema); + sqlite3_db_config(dbx, SQLITE_DBCONFIG_WRITABLE_SCHEMA, 1, 0); + sqlite3_exec(dbx, "CREATE TABLE IF NOT EXISTS temp.sqlite_parameters(\n" " key TEXT PRIMARY KEY,\n" " value\n" ") WITHOUT ROWID;", 0, 0, 0); - sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, wrSchema, 0); - sqlite3_db_config(p->db, SQLITE_DBCONFIG_DEFENSIVE, defensiveMode, 0); + sqlite3_db_config(dbx, SQLITE_DBCONFIG_WRITABLE_SCHEMA, wrSchema, 0); + sqlite3_db_config(dbx, SQLITE_DBCONFIG_DEFENSIVE, defensiveMode, 0); } /* @@ -3518,12 +3542,14 @@ static void bind_prepared_stmt(ShellState *pArg, sqlite3_stmt *pStmt){ nVar = sqlite3_bind_parameter_count(pStmt); if( nVar==0 ) return; /* Nothing to do */ - if( sqlite3_table_column_metadata(pArg->db, "TEMP", "sqlite_parameters", - "key", 0, 0, 0, 0, 0)!=SQLITE_OK ){ + if( pArg->dbParam==0 + || sqlite3_table_column_metadata(pArg->dbParam, "TEMP", "sqlite_parameters", + "key", 0, 0, 0, 0, 0)!=SQLITE_OK + ){ rc = SQLITE_NOTFOUND; pQ = 0; }else{ - rc = sqlite3_prepare_v2(pArg->db, + rc = sqlite3_prepare_v2(pArg->dbParam, "SELECT value FROM temp.sqlite_parameters" " WHERE key=?1", -1, &pQ, 0); } @@ -4829,7 +4855,7 @@ static const char *(azHelp[]) = { #endif ".parameter CMD ... Manage SQL parameter bindings", " clear Erase all bindings", - " init Initialize the TEMP table that holds bindings", + " init ?--memory? Initialize the TEMP table that holds bindings", " list List the current parameter bindings", " set PARAMETER VALUE Given SQL parameter PARAMETER a value of VALUE", " PARAMETER should start with one of: $ : @ ?", @@ -5485,9 +5511,17 @@ static void open_db(ShellState *p, int openFlags){ /* ** Attempt to close the database connection. Report errors. +** +** If dbParam is not NULL and is different from db, then close it +** too. No error checking is done on the close of dbParam, as it +** should be a :memory: database which cannot really fail on close. */ -void close_db(sqlite3 *db){ - int rc = sqlite3_close(db); +void close_db(sqlite3 *db, sqlite3 *dbParam){ + int rc; + if( dbParam && dbParam!=db ){ + sqlite3_close(dbParam); + } + rc = sqlite3_close(db); if( rc ){ eputf("Error: sqlite3_close() returns %d: %s\n", rc, sqlite3_errmsg(db)); } @@ -6146,7 +6180,7 @@ static void tryToClone(ShellState *p, const char *zNewDb){ sqlite3_exec(newDb, "COMMIT;", 0, 0, 0); sqlite3_exec(p->db, "PRAGMA writable_schema=OFF;", 0, 0, 0); } - close_db(newDb); + close_db(newDb, 0); } #ifndef SQLITE_SHELL_FIDDLE @@ -7581,7 +7615,7 @@ static int arDotCommand( } end_ar_command: if( cmd.db!=pState->db ){ - close_db(cmd.db); + close_db(cmd.db, 0); } sqlite3_free(cmd.zSrcTable); @@ -8106,7 +8140,7 @@ static int do_meta_command(char *zLine, ShellState *p){ SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE, zVfs); if( rc!=SQLITE_OK ){ eputf("Error: cannot open \"%s\"\n", zDestFile); - close_db(pDest); + close_db(pDest, 0); return 1; } if( bAsync ){ @@ -8117,7 +8151,7 @@ static int do_meta_command(char *zLine, ShellState *p){ pBackup = sqlite3_backup_init(pDest, "main", p->db, zDb); if( pBackup==0 ){ eputf("Error: %s\n", sqlite3_errmsg(pDest)); - close_db(pDest); + close_db(pDest, 0); return 1; } while( (rc = sqlite3_backup_step(pBackup,100))==SQLITE_OK ){} @@ -8128,7 +8162,7 @@ static int do_meta_command(char *zLine, ShellState *p){ eputf("Error: %s\n", sqlite3_errmsg(pDest)); rc = 1; } - close_db(pDest); + close_db(pDest, 0); }else #endif /* !defined(SQLITE_SHELL_FIDDLE) */ @@ -8268,7 +8302,7 @@ static int do_meta_command(char *zLine, ShellState *p){ rc = 1; }else if( p->aAuxDb[i].db ){ session_close_all(p, i); - close_db(p->aAuxDb[i].db); + close_db(p->aAuxDb[i].db, 0); p->aAuxDb[i].db = 0; } }else{ @@ -9558,8 +9592,8 @@ static int do_meta_command(char *zLine, ShellState *p){ /* Close the existing database */ session_close_all(p, -1); - close_db(p->db); - p->db = 0; + close_db(p->db, p->dbParam); + p->db = p->dbParam = 0; p->pAuxDb->zDbFilename = 0; sqlite3_free(p->pAuxDb->zFreeOnClose); p->pAuxDb->zFreeOnClose = 0; @@ -9725,8 +9759,15 @@ static int do_meta_command(char *zLine, ShellState *p){ ** Clear all bind parameters by dropping the TEMP table that holds them. */ if( nArg==2 && cli_strcmp(azArg[1],"clear")==0 ){ - sqlite3_exec(p->db, "DROP TABLE IF EXISTS temp.sqlite_parameters;", - 0, 0, 0); + if( p->dbParam==0 ){ + /* no-op */ + }else if( p->dbParam==p->db ){ + sqlite3_exec(p->db, "DROP TABLE IF EXISTS temp.sqlite_parameters;", + 0, 0, 0); + }else{ + sqlite3_close(p->dbParam); + } + p->dbParam = 0; }else /* .parameter list @@ -9736,33 +9777,45 @@ static int do_meta_command(char *zLine, ShellState *p){ sqlite3_stmt *pStmt = 0; int rx; int len = 0; - rx = sqlite3_prepare_v2(p->db, - "SELECT max(length(key)) " - "FROM temp.sqlite_parameters;", -1, &pStmt, 0); - if( rx==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){ - len = sqlite3_column_int(pStmt, 0); - if( len>40 ) len = 40; - } - sqlite3_finalize(pStmt); - pStmt = 0; - if( len ){ - rx = sqlite3_prepare_v2(p->db, - "SELECT key, quote(value) " - "FROM temp.sqlite_parameters;", -1, &pStmt, 0); - while( rx==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){ - oputf("%-*s %s\n", len, sqlite3_column_text(pStmt,0), - sqlite3_column_text(pStmt,1)); + if( p->dbParam ){ + rx = sqlite3_prepare_v2(p->dbParam, + "SELECT max(length(key)) " + "FROM temp.sqlite_parameters;", -1, &pStmt, 0); + if( rx==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){ + len = sqlite3_column_int(pStmt, 0); + if( len>40 ) len = 40; } sqlite3_finalize(pStmt); + pStmt = 0; + if( len ){ + rx = sqlite3_prepare_v2(p->db, + "SELECT key, quote(value) " + "FROM temp.sqlite_parameters;", -1, &pStmt, 0); + while( rx==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){ + oputf("%-*s %s\n", len, sqlite3_column_text(pStmt,0), + sqlite3_column_text(pStmt,1)); + } + sqlite3_finalize(pStmt); + } } }else - /* .parameter init + /* .parameter init ?--memory? ** Make sure the TEMP table used to hold bind parameters exists. ** Create it if necessary. + ** + ** If the --memory option is specified, the sqlite_parameters table + ** is held in a separate database so that parameter binding queries + ** do not show up in debugging output from .treetrace, .wheretrace, + ** PRAGMA vdbe_addoptrace=on, and similar. */ if( nArg==2 && cli_strcmp(azArg[1],"init")==0 ){ - bind_table_init(p); + bind_table_init(p, 0); + }else + if( nArg==3 && cli_strcmp(azArg[1],"init")==0 + && cli_strcmp(azArg[2],"--memory")==0 + ){ + bind_table_init(p, 1); }else /* .parameter set NAME VALUE @@ -9777,28 +9830,30 @@ static int do_meta_command(char *zLine, ShellState *p){ sqlite3_stmt *pStmt; const char *zKey = azArg[2]; const char *zValue = azArg[3]; - bind_table_init(p); - zSql = sqlite3_mprintf( - "REPLACE INTO temp.sqlite_parameters(key,value)" - "VALUES(%Q,%s);", zKey, zValue); - shell_check_oom(zSql); - pStmt = 0; - rx = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); - sqlite3_free(zSql); - if( rx!=SQLITE_OK ){ - sqlite3_finalize(pStmt); - pStmt = 0; + bind_table_init(p, 0); + if( p->dbParam ){ zSql = sqlite3_mprintf( - "REPLACE INTO temp.sqlite_parameters(key,value)" - "VALUES(%Q,%Q);", zKey, zValue); + "REPLACE INTO temp.sqlite_parameters(key,value)" + "VALUES(%Q,%s);", zKey, zValue); shell_check_oom(zSql); - rx = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); + pStmt = 0; + rx = sqlite3_prepare_v2(p->dbParam, zSql, -1, &pStmt, 0); sqlite3_free(zSql); if( rx!=SQLITE_OK ){ - oputf("Error: %s\n", sqlite3_errmsg(p->db)); sqlite3_finalize(pStmt); pStmt = 0; - rc = 1; + zSql = sqlite3_mprintf( + "REPLACE INTO temp.sqlite_parameters(key,value)" + "VALUES(%Q,%Q);", zKey, zValue); + shell_check_oom(zSql); + rx = sqlite3_prepare_v2(p->dbParam, zSql, -1, &pStmt, 0); + sqlite3_free(zSql); + if( rx!=SQLITE_OK ){ + oputf("Error: %s\n", sqlite3_errmsg(p->db)); + sqlite3_finalize(pStmt); + pStmt = 0; + rc = 1; + } } } sqlite3_step(pStmt); @@ -9813,7 +9868,7 @@ static int do_meta_command(char *zLine, ShellState *p){ char *zSql = sqlite3_mprintf( "DELETE FROM temp.sqlite_parameters WHERE key=%Q", azArg[2]); shell_check_oom(zSql); - sqlite3_exec(p->db, zSql, 0, 0, 0); + if( p->dbParam ) sqlite3_exec(p->dbParam, zSql, 0, 0, 0); sqlite3_free(zSql); }else /* If no command name matches, show a syntax error */ @@ -9951,14 +10006,14 @@ static int do_meta_command(char *zLine, ShellState *p){ rc = sqlite3_open(zSrcFile, &pSrc); if( rc!=SQLITE_OK ){ eputf("Error: cannot open \"%s\"\n", zSrcFile); - close_db(pSrc); + close_db(pSrc, 0); return 1; } open_db(p, 0); pBackup = sqlite3_backup_init(p->db, zDb, pSrc, "main"); if( pBackup==0 ){ eputf("Error: %s\n", sqlite3_errmsg(p->db)); - close_db(pSrc); + close_db(pSrc, 0); return 1; } while( (rc = sqlite3_backup_step(pBackup,100))==SQLITE_OK @@ -9978,7 +10033,7 @@ static int do_meta_command(char *zLine, ShellState *p){ eputf("Error: %s\n", sqlite3_errmsg(p->db)); rc = 1; } - close_db(pSrc); + close_db(pSrc, 0); }else #endif /* !defined(SQLITE_SHELL_FIDDLE) */ @@ -12845,13 +12900,13 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ set_table_name(&data, 0); if( data.db ){ session_close_all(&data, -1); - close_db(data.db); + close_db(data.db, data.dbParam); } for(i=0; i Date: Thu, 8 Aug 2024 10:51:56 +0000 Subject: [PATCH 29/45] Move a misplaced va_end, as reported in [forum:702c79e9da|forum post 702c79e9da]. FossilOrigin-Name: daa25fb35fd7bdd482d51214439f38b0b9a7df93f689a2b3d30a113daa9f2a1a --- ext/recover/sqlite3recover.c | 2 +- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ext/recover/sqlite3recover.c b/ext/recover/sqlite3recover.c index 1d858c0ab9..afa1ae8619 100644 --- a/ext/recover/sqlite3recover.c +++ b/ext/recover/sqlite3recover.c @@ -363,8 +363,8 @@ static int recoverError( va_start(ap, zFmt); if( zFmt ){ z = sqlite3_vmprintf(zFmt, ap); - va_end(ap); } + va_end(ap); sqlite3_free(p->zErrMsg); p->zErrMsg = z; p->errCode = errCode; diff --git a/manifest b/manifest index 587d9af3bb..be8df9916c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\s--memory\soption\sto\sthe\s".parameter\sinit"\sCLI\scommand.\s\sWhen\spresent,\nthe\s--memory\soption\scauses\sthe\ssqlite_parameters\stable\sto\sbe\screated\sin\sa\ncompletely\sindependent\s:memory:\sdatabase.\s\sThis\scan\sbe\sdone\sto\savoid\nparameter\sbinding\squeries\sfrom\sbeing\saffected\sby\sdebug\ssettings\ssuch\sas\n".wheretrace",\s".treetrace",\s"PRAGMA\svdbe_addoptrace=on",\sand\ssimilar. -D 2024-08-08T10:10:38.385 +C Move\sa\smisplaced\sva_end,\sas\sreported\sin\s[forum:702c79e9da|forum\spost\s702c79e9da]. +D 2024-08-08T10:51:56.875 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -496,7 +496,7 @@ F ext/recover/recoverpgsz.test 88766fcb810e52ee05335c456d4e5fb06d02b73d3ccb48c52 F ext/recover/recoverrowid.test f948bf4024a5f41b0e21b8af80c60564c5b5d78c05a8d64fc00787715ff9f45f F ext/recover/recoverslowidx.test 5205a9742dd9490ee99950dabb622307355ef1662dea6a3a21030057bfd81411 F ext/recover/recoversql.test e66d01f95302a223bcd3fd42b5ee58dc2b53d70afa90b0d00e41e4b8eab20486 -F ext/recover/sqlite3recover.c 65ef0f56301a16c0536c9839fb7e23540c9c4f75da0afe3b7b4d163c8f624404 +F ext/recover/sqlite3recover.c 2dcf6b56c5e0e2b43fc4c6115b689ab194c374ced7f7f8380ad9a24d8ef24ac9 F ext/recover/sqlite3recover.h 011c799f02deb70ab685916f6f538e6bb32c4e0025e79bfd0e24ff9c74820959 F ext/recover/test_recover.c 072260d7452a3b81aba995b2b3269e7ec2aa7f06725544ba4c25b1b0a1dbc61a F ext/repair/README.md 92f5e8aae749a4dae14f02eea8e1bb42d4db2b6ce5e83dbcdd6b1446997e0c15 @@ -2203,8 +2203,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 08cc5488404d068e59378b82988460793710df43ec21b4a83a794b497abd035f -R d4d35f38c7731eed804015561204e2a7 -U drh -Z 252eafc7dac030f0d53111914f8dbebb +P 4e69dce2093b75b7db4fbdca4953b664b907be15d991ed352ea1d87c64fbf9d2 +R 935874f09c4ed9cbbe850ee6abdc733e +U stephan +Z 89ea814313a09066a5db1ffe092c64f9 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 950203b129..3b9c763676 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4e69dce2093b75b7db4fbdca4953b664b907be15d991ed352ea1d87c64fbf9d2 +daa25fb35fd7bdd482d51214439f38b0b9a7df93f689a2b3d30a113daa9f2a1a From 6e7a0c2d86bc143d45333d9f60c04d08c4ce5cae Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 8 Aug 2024 12:08:36 +0000 Subject: [PATCH 30/45] In the CLI, recognize magic parameter names "$int_NNN" and "$text_TTT" and bind them with integer value NNN and text value TTT respectively. Intended for testing and debugging use only. FossilOrigin-Name: a929cdb00ff74d77cdf55087d32abf53578f7127b36276f89b64ccbef1d4a9a4 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/shell.c.in | 8 ++++++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index be8df9916c..4e8e40977e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Move\sa\smisplaced\sva_end,\sas\sreported\sin\s[forum:702c79e9da|forum\spost\s702c79e9da]. -D 2024-08-08T10:51:56.875 +C In\sthe\sCLI,\srecognize\smagic\sparameter\snames\s"$int_NNN"\sand\s"$text_TTT"\sand\nbind\sthem\swith\sinteger\svalue\sNNN\sand\stext\svalue\sTTT\srespectively.\s\sIntended\nfor\stesting\sand\sdebugging\suse\sonly. +D 2024-08-08T12:08:36.854 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -760,7 +760,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 7e8d23ce7cdbfedf351a47e759f2722e8182ca10fd7580be43f4ce1f1a228145 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 6a95a2bffa6c09584dea99db5a7ae10c813305c09c92920ffc54f6eae2ba399e -F src/shell.c.in 8b1a82ddbcf93580f991eecec0a22e8edc7d62fa856388d9bed2392da1cbfa42 +F src/shell.c.in 1dfa62d27d77aa8c436d0dfc62920e2e2a2294548ffd078aee0f87b7ab95cc28 F src/sqlite.h.in 1ad9110150773c38ebababbad11b5cb361bcd3997676dec1c91ac5e0416a7b86 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 @@ -2203,8 +2203,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 4e69dce2093b75b7db4fbdca4953b664b907be15d991ed352ea1d87c64fbf9d2 -R 935874f09c4ed9cbbe850ee6abdc733e -U stephan -Z 89ea814313a09066a5db1ffe092c64f9 +P daa25fb35fd7bdd482d51214439f38b0b9a7df93f689a2b3d30a113daa9f2a1a +R 659621e574300f0e8637eafa75ce3615 +U drh +Z 38571f620a01d4193af4068fe3fcd87f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 3b9c763676..f43ac8b8ad 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -daa25fb35fd7bdd482d51214439f38b0b9a7df93f689a2b3d30a113daa9f2a1a +a929cdb00ff74d77cdf55087d32abf53578f7127b36276f89b64ccbef1d4a9a4 diff --git a/src/shell.c.in b/src/shell.c.in index 2d6c76d3b0..5e89be57aa 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -3571,6 +3571,14 @@ static void bind_prepared_stmt(ShellState *pArg, sqlite3_stmt *pStmt){ }else if( sqlite3_strlike("_INF", zVar, 0)==0 ){ sqlite3_bind_double(pStmt, i, INFINITY); #endif + }else if( strncmp(zVar, "$int_", 5)==0 ){ + sqlite3_bind_int(pStmt, i, atoi(&zVar[5])); + }else if( strncmp(zVar, "$text_", 6)==0 ){ + char *zBuf = sqlite3_malloc64( strlen(zVar)-5 ); + if( zBuf ){ + memcpy(zBuf, &zVar[6], strlen(zVar)-5); + sqlite3_bind_text64(pStmt, i, zBuf, -1, sqlite3_free, SQLITE_UTF8); + } }else{ sqlite3_bind_null(pStmt, i); } From 35c6f58dce05a727ba13697bff9b254379cb7a25 Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 8 Aug 2024 12:14:07 +0000 Subject: [PATCH 31/45] Back out the --memory option to ".parameter init" in the CLI, as the capability is no longer needed for testing due to the new "$int_N" and "$text_T" automatic bindings, and the "init --memory" is hence just added complication. FossilOrigin-Name: 3b1b0c141993eb0f8749f54ea40d6014f9bdccbe0fdb3ccccad971a0baea8d3c --- manifest | 13 ++-- manifest.uuid | 2 +- src/shell.c.in | 187 +++++++++++++++++-------------------------------- 3 files changed, 74 insertions(+), 128 deletions(-) diff --git a/manifest b/manifest index 4e8e40977e..c751b57718 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sthe\sCLI,\srecognize\smagic\sparameter\snames\s"$int_NNN"\sand\s"$text_TTT"\sand\nbind\sthem\swith\sinteger\svalue\sNNN\sand\stext\svalue\sTTT\srespectively.\s\sIntended\nfor\stesting\sand\sdebugging\suse\sonly. -D 2024-08-08T12:08:36.854 +C Back\sout\sthe\s--memory\soption\sto\s".parameter\sinit"\sin\sthe\sCLI,\sas\sthe\ncapability\sis\sno\slonger\sneeded\sfor\stesting\sdue\sto\sthe\snew\s"$int_N"\sand\n"$text_T"\sautomatic\sbindings,\sand\sthe\s"init\s--memory"\sis\shence\sjust\nadded\scomplication. +D 2024-08-08T12:14:07.897 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -760,7 +760,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 7e8d23ce7cdbfedf351a47e759f2722e8182ca10fd7580be43f4ce1f1a228145 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 6a95a2bffa6c09584dea99db5a7ae10c813305c09c92920ffc54f6eae2ba399e -F src/shell.c.in 1dfa62d27d77aa8c436d0dfc62920e2e2a2294548ffd078aee0f87b7ab95cc28 +F src/shell.c.in 94571558b0fb28c37a5cf6dbd6ea27285341023a28a8cb5795cd2768fab67704 F src/sqlite.h.in 1ad9110150773c38ebababbad11b5cb361bcd3997676dec1c91ac5e0416a7b86 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 @@ -2203,8 +2203,9 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P daa25fb35fd7bdd482d51214439f38b0b9a7df93f689a2b3d30a113daa9f2a1a -R 659621e574300f0e8637eafa75ce3615 +P a929cdb00ff74d77cdf55087d32abf53578f7127b36276f89b64ccbef1d4a9a4 +Q -4e69dce2093b75b7db4fbdca4953b664b907be15d991ed352ea1d87c64fbf9d2 +R 80ba63bff6bb194482fa92e681f77bdc U drh -Z 38571f620a01d4193af4068fe3fcd87f +Z 15b4994c5694541199c17b609b4ae0e5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f43ac8b8ad..60de4ef9d1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a929cdb00ff74d77cdf55087d32abf53578f7127b36276f89b64ccbef1d4a9a4 +3b1b0c141993eb0f8749f54ea40d6014f9bdccbe0fdb3ccccad971a0baea8d3c diff --git a/src/shell.c.in b/src/shell.c.in index 5e89be57aa..5b0a1a84b0 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -1356,8 +1356,6 @@ struct ShellState { #endif } aAuxDb[5], /* Array of all database connections */ *pAuxDb; /* Currently active database connection */ - sqlite3 *dbParam; /* Database to use for query parameters. Often the - ** same as "db", but might be different. */ int *aiIndent; /* Array of indents used in MODE_Explain */ int nIndent; /* Size of array aiIndent[] */ int iIndent; /* Index of current op in aiIndent[] */ @@ -3482,44 +3480,22 @@ static void restore_debug_trace_modes(void){ sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 3, &savedWhereTrace); } -/* Create the TEMP table used to store parameter bindings. -** -** If bInMemory is true, create a separate in-memory database for -** the parameter binding table. -** -** The database that stores the sqlite_parameter table will be -** p->dbParam. This might be a copy of p->db. Or it might be a -** completely separate database (if bInMemory is true, because of -** the ".param init --memory" command). -*/ -static void bind_table_init(ShellState *p, int bInMemory){ +/* Create the TEMP table used to store parameter bindings */ +static void bind_table_init(ShellState *p){ int wrSchema = 0; int defensiveMode = 0; - sqlite3 *dbx; - if( p->dbParam ) return; - if( sqlite3_table_column_metadata(p->db, "TEMP", "sqlite_parameters", - "key", 0, 0, 0, 0, 0)==SQLITE_OK ){ - return; - } - if( bInMemory && p->dbParam==0 ){ - sqlite3_open(":memory:", &p->dbParam); - }else{ - p->dbParam = p->db; - } - dbx = p->dbParam; - - sqlite3_db_config(dbx, SQLITE_DBCONFIG_DEFENSIVE, -1, &defensiveMode); - sqlite3_db_config(dbx, SQLITE_DBCONFIG_DEFENSIVE, 0, 0); - sqlite3_db_config(dbx, SQLITE_DBCONFIG_WRITABLE_SCHEMA, -1, &wrSchema); - sqlite3_db_config(dbx, SQLITE_DBCONFIG_WRITABLE_SCHEMA, 1, 0); - sqlite3_exec(dbx, + sqlite3_db_config(p->db, SQLITE_DBCONFIG_DEFENSIVE, -1, &defensiveMode); + sqlite3_db_config(p->db, SQLITE_DBCONFIG_DEFENSIVE, 0, 0); + sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, -1, &wrSchema); + sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, 1, 0); + sqlite3_exec(p->db, "CREATE TABLE IF NOT EXISTS temp.sqlite_parameters(\n" " key TEXT PRIMARY KEY,\n" " value\n" ") WITHOUT ROWID;", 0, 0, 0); - sqlite3_db_config(dbx, SQLITE_DBCONFIG_WRITABLE_SCHEMA, wrSchema, 0); - sqlite3_db_config(dbx, SQLITE_DBCONFIG_DEFENSIVE, defensiveMode, 0); + sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, wrSchema, 0); + sqlite3_db_config(p->db, SQLITE_DBCONFIG_DEFENSIVE, defensiveMode, 0); } /* @@ -3542,14 +3518,12 @@ static void bind_prepared_stmt(ShellState *pArg, sqlite3_stmt *pStmt){ nVar = sqlite3_bind_parameter_count(pStmt); if( nVar==0 ) return; /* Nothing to do */ - if( pArg->dbParam==0 - || sqlite3_table_column_metadata(pArg->dbParam, "TEMP", "sqlite_parameters", - "key", 0, 0, 0, 0, 0)!=SQLITE_OK - ){ + if( sqlite3_table_column_metadata(pArg->db, "TEMP", "sqlite_parameters", + "key", 0, 0, 0, 0, 0)!=SQLITE_OK ){ rc = SQLITE_NOTFOUND; pQ = 0; }else{ - rc = sqlite3_prepare_v2(pArg->dbParam, + rc = sqlite3_prepare_v2(pArg->db, "SELECT value FROM temp.sqlite_parameters" " WHERE key=?1", -1, &pQ, 0); } @@ -4863,7 +4837,7 @@ static const char *(azHelp[]) = { #endif ".parameter CMD ... Manage SQL parameter bindings", " clear Erase all bindings", - " init ?--memory? Initialize the TEMP table that holds bindings", + " init Initialize the TEMP table that holds bindings", " list List the current parameter bindings", " set PARAMETER VALUE Given SQL parameter PARAMETER a value of VALUE", " PARAMETER should start with one of: $ : @ ?", @@ -5519,17 +5493,9 @@ static void open_db(ShellState *p, int openFlags){ /* ** Attempt to close the database connection. Report errors. -** -** If dbParam is not NULL and is different from db, then close it -** too. No error checking is done on the close of dbParam, as it -** should be a :memory: database which cannot really fail on close. */ -void close_db(sqlite3 *db, sqlite3 *dbParam){ - int rc; - if( dbParam && dbParam!=db ){ - sqlite3_close(dbParam); - } - rc = sqlite3_close(db); +void close_db(sqlite3 *db){ + int rc = sqlite3_close(db); if( rc ){ eputf("Error: sqlite3_close() returns %d: %s\n", rc, sqlite3_errmsg(db)); } @@ -6188,7 +6154,7 @@ static void tryToClone(ShellState *p, const char *zNewDb){ sqlite3_exec(newDb, "COMMIT;", 0, 0, 0); sqlite3_exec(p->db, "PRAGMA writable_schema=OFF;", 0, 0, 0); } - close_db(newDb, 0); + close_db(newDb); } #ifndef SQLITE_SHELL_FIDDLE @@ -7623,7 +7589,7 @@ static int arDotCommand( } end_ar_command: if( cmd.db!=pState->db ){ - close_db(cmd.db, 0); + close_db(cmd.db); } sqlite3_free(cmd.zSrcTable); @@ -8148,7 +8114,7 @@ static int do_meta_command(char *zLine, ShellState *p){ SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE, zVfs); if( rc!=SQLITE_OK ){ eputf("Error: cannot open \"%s\"\n", zDestFile); - close_db(pDest, 0); + close_db(pDest); return 1; } if( bAsync ){ @@ -8159,7 +8125,7 @@ static int do_meta_command(char *zLine, ShellState *p){ pBackup = sqlite3_backup_init(pDest, "main", p->db, zDb); if( pBackup==0 ){ eputf("Error: %s\n", sqlite3_errmsg(pDest)); - close_db(pDest, 0); + close_db(pDest); return 1; } while( (rc = sqlite3_backup_step(pBackup,100))==SQLITE_OK ){} @@ -8170,7 +8136,7 @@ static int do_meta_command(char *zLine, ShellState *p){ eputf("Error: %s\n", sqlite3_errmsg(pDest)); rc = 1; } - close_db(pDest, 0); + close_db(pDest); }else #endif /* !defined(SQLITE_SHELL_FIDDLE) */ @@ -8310,7 +8276,7 @@ static int do_meta_command(char *zLine, ShellState *p){ rc = 1; }else if( p->aAuxDb[i].db ){ session_close_all(p, i); - close_db(p->aAuxDb[i].db, 0); + close_db(p->aAuxDb[i].db); p->aAuxDb[i].db = 0; } }else{ @@ -9600,8 +9566,8 @@ static int do_meta_command(char *zLine, ShellState *p){ /* Close the existing database */ session_close_all(p, -1); - close_db(p->db, p->dbParam); - p->db = p->dbParam = 0; + close_db(p->db); + p->db = 0; p->pAuxDb->zDbFilename = 0; sqlite3_free(p->pAuxDb->zFreeOnClose); p->pAuxDb->zFreeOnClose = 0; @@ -9767,15 +9733,8 @@ static int do_meta_command(char *zLine, ShellState *p){ ** Clear all bind parameters by dropping the TEMP table that holds them. */ if( nArg==2 && cli_strcmp(azArg[1],"clear")==0 ){ - if( p->dbParam==0 ){ - /* no-op */ - }else if( p->dbParam==p->db ){ - sqlite3_exec(p->db, "DROP TABLE IF EXISTS temp.sqlite_parameters;", - 0, 0, 0); - }else{ - sqlite3_close(p->dbParam); - } - p->dbParam = 0; + sqlite3_exec(p->db, "DROP TABLE IF EXISTS temp.sqlite_parameters;", + 0, 0, 0); }else /* .parameter list @@ -9785,45 +9744,33 @@ static int do_meta_command(char *zLine, ShellState *p){ sqlite3_stmt *pStmt = 0; int rx; int len = 0; - if( p->dbParam ){ - rx = sqlite3_prepare_v2(p->dbParam, - "SELECT max(length(key)) " - "FROM temp.sqlite_parameters;", -1, &pStmt, 0); - if( rx==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){ - len = sqlite3_column_int(pStmt, 0); - if( len>40 ) len = 40; + rx = sqlite3_prepare_v2(p->db, + "SELECT max(length(key)) " + "FROM temp.sqlite_parameters;", -1, &pStmt, 0); + if( rx==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){ + len = sqlite3_column_int(pStmt, 0); + if( len>40 ) len = 40; + } + sqlite3_finalize(pStmt); + pStmt = 0; + if( len ){ + rx = sqlite3_prepare_v2(p->db, + "SELECT key, quote(value) " + "FROM temp.sqlite_parameters;", -1, &pStmt, 0); + while( rx==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){ + oputf("%-*s %s\n", len, sqlite3_column_text(pStmt,0), + sqlite3_column_text(pStmt,1)); } sqlite3_finalize(pStmt); - pStmt = 0; - if( len ){ - rx = sqlite3_prepare_v2(p->db, - "SELECT key, quote(value) " - "FROM temp.sqlite_parameters;", -1, &pStmt, 0); - while( rx==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){ - oputf("%-*s %s\n", len, sqlite3_column_text(pStmt,0), - sqlite3_column_text(pStmt,1)); - } - sqlite3_finalize(pStmt); - } } }else - /* .parameter init ?--memory? + /* .parameter init ** Make sure the TEMP table used to hold bind parameters exists. ** Create it if necessary. - ** - ** If the --memory option is specified, the sqlite_parameters table - ** is held in a separate database so that parameter binding queries - ** do not show up in debugging output from .treetrace, .wheretrace, - ** PRAGMA vdbe_addoptrace=on, and similar. */ if( nArg==2 && cli_strcmp(azArg[1],"init")==0 ){ - bind_table_init(p, 0); - }else - if( nArg==3 && cli_strcmp(azArg[1],"init")==0 - && cli_strcmp(azArg[2],"--memory")==0 - ){ - bind_table_init(p, 1); + bind_table_init(p); }else /* .parameter set NAME VALUE @@ -9838,30 +9785,28 @@ static int do_meta_command(char *zLine, ShellState *p){ sqlite3_stmt *pStmt; const char *zKey = azArg[2]; const char *zValue = azArg[3]; - bind_table_init(p, 0); - if( p->dbParam ){ - zSql = sqlite3_mprintf( - "REPLACE INTO temp.sqlite_parameters(key,value)" - "VALUES(%Q,%s);", zKey, zValue); - shell_check_oom(zSql); + bind_table_init(p); + zSql = sqlite3_mprintf( + "REPLACE INTO temp.sqlite_parameters(key,value)" + "VALUES(%Q,%s);", zKey, zValue); + shell_check_oom(zSql); + pStmt = 0; + rx = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); + sqlite3_free(zSql); + if( rx!=SQLITE_OK ){ + sqlite3_finalize(pStmt); pStmt = 0; - rx = sqlite3_prepare_v2(p->dbParam, zSql, -1, &pStmt, 0); + zSql = sqlite3_mprintf( + "REPLACE INTO temp.sqlite_parameters(key,value)" + "VALUES(%Q,%Q);", zKey, zValue); + shell_check_oom(zSql); + rx = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); sqlite3_free(zSql); if( rx!=SQLITE_OK ){ + oputf("Error: %s\n", sqlite3_errmsg(p->db)); sqlite3_finalize(pStmt); pStmt = 0; - zSql = sqlite3_mprintf( - "REPLACE INTO temp.sqlite_parameters(key,value)" - "VALUES(%Q,%Q);", zKey, zValue); - shell_check_oom(zSql); - rx = sqlite3_prepare_v2(p->dbParam, zSql, -1, &pStmt, 0); - sqlite3_free(zSql); - if( rx!=SQLITE_OK ){ - oputf("Error: %s\n", sqlite3_errmsg(p->db)); - sqlite3_finalize(pStmt); - pStmt = 0; - rc = 1; - } + rc = 1; } } sqlite3_step(pStmt); @@ -9876,7 +9821,7 @@ static int do_meta_command(char *zLine, ShellState *p){ char *zSql = sqlite3_mprintf( "DELETE FROM temp.sqlite_parameters WHERE key=%Q", azArg[2]); shell_check_oom(zSql); - if( p->dbParam ) sqlite3_exec(p->dbParam, zSql, 0, 0, 0); + sqlite3_exec(p->db, zSql, 0, 0, 0); sqlite3_free(zSql); }else /* If no command name matches, show a syntax error */ @@ -10014,14 +9959,14 @@ static int do_meta_command(char *zLine, ShellState *p){ rc = sqlite3_open(zSrcFile, &pSrc); if( rc!=SQLITE_OK ){ eputf("Error: cannot open \"%s\"\n", zSrcFile); - close_db(pSrc, 0); + close_db(pSrc); return 1; } open_db(p, 0); pBackup = sqlite3_backup_init(p->db, zDb, pSrc, "main"); if( pBackup==0 ){ eputf("Error: %s\n", sqlite3_errmsg(p->db)); - close_db(pSrc, 0); + close_db(pSrc); return 1; } while( (rc = sqlite3_backup_step(pBackup,100))==SQLITE_OK @@ -10041,7 +9986,7 @@ static int do_meta_command(char *zLine, ShellState *p){ eputf("Error: %s\n", sqlite3_errmsg(p->db)); rc = 1; } - close_db(pSrc, 0); + close_db(pSrc); }else #endif /* !defined(SQLITE_SHELL_FIDDLE) */ @@ -12908,13 +12853,13 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ set_table_name(&data, 0); if( data.db ){ session_close_all(&data, -1); - close_db(data.db, data.dbParam); + close_db(data.db); } for(i=0; i Date: Thu, 8 Aug 2024 14:45:50 +0000 Subject: [PATCH 32/45] Do not let the number of terms on a VALUES clause be limited by SQLITE_LIMIT_COMPOUND_SELECT, even if the VALUES clause contains elements that appear to be variables due to the use of double-quoted string literals. [https://issues.chromium.org/issues/358174302|Chromium issue 358174302]. FossilOrigin-Name: 670beb133eb203065a75022f0c6db7c605a4e0e22c8ef6d6b4724be2663ff3dc --- manifest | 17 ++++++++--------- manifest.uuid | 2 +- src/insert.c | 1 + src/parse.y | 6 +++--- test/select7.test | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 45 insertions(+), 13 deletions(-) diff --git a/manifest b/manifest index c751b57718..81f7e54a26 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Back\sout\sthe\s--memory\soption\sto\s".parameter\sinit"\sin\sthe\sCLI,\sas\sthe\ncapability\sis\sno\slonger\sneeded\sfor\stesting\sdue\sto\sthe\snew\s"$int_N"\sand\n"$text_T"\sautomatic\sbindings,\sand\sthe\s"init\s--memory"\sis\shence\sjust\nadded\scomplication. -D 2024-08-08T12:14:07.897 +C Do\snot\slet\sthe\snumber\sof\sterms\son\sa\sVALUES\sclause\sbe\slimited\sby\nSQLITE_LIMIT_COMPOUND_SELECT,\seven\sif\sthe\sVALUES\sclause\scontains\selements\nthat\sappear\sto\sbe\svariables\sdue\sto\sthe\suse\sof\sdouble-quoted\sstring\sliterals.\n[https://issues.chromium.org/issues/358174302|Chromium\sissue\s358174302]. +D 2024-08-08T14:45:50.247 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -718,7 +718,7 @@ F src/hash.c 9ee4269fb1d6632a6fecfb9479c93a1f29271bddbbaf215dd60420bcb80c7220 F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51 F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6 F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 -F src/insert.c 4bd7c7e54a1062dcd0214b7a6296f7194eb10fb14d3ddca1ed20b01c2a86a18c +F src/insert.c 8ff11e9e54c5fc1fe89707b3d41cf44ad2822f712bd3b5da68338ea42518847e F src/json.c 5b6a1d6015997b9ee848a32948720bdb26a0ef2de5a2127ebf7355ce66dbdc0d F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 7432c944ff197046d67a1207790a1b13eec4548c85a9457eb0896bb3641dfb36 @@ -748,7 +748,7 @@ F src/os_win.c 6ff43bac175bd9ed79e7c0f96840b139f2f51d01689a638fd05128becf94908a F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a F src/pager.c b08600ebf0db90b6d1e9b8b6577c6fa3877cbe1a100bd0b2899e4c6e9adad4b3 F src/pager.h 4b1140d691860de0be1347474c51fee07d5420bd7f802d38cbab8ea4ab9f538a -F src/parse.y 2bd540b3b1e79017eb41fca2396633a75e7dd430c05383c61fe52c6f4e97c6d8 +F src/parse.y 318ef86fbe358b1a93262a42e152f37b97b3fddae8d319dffbd24ce2300f6c88 F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484 F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5 F src/pcache1.c 49516ad7718a3626f28f710fa7448ef1fce3c07fd169acbb4817341950264319 @@ -1591,7 +1591,7 @@ F test/select3.test 180223af31e1ca5537dd395ef9708ae18e651a233777fd366fd0d75469fc F test/select4.test f0684d3da3bccacbe2a1ebadf6fb49d9df6f53acb4c6ebc228a88d0d6054cc7b F test/select5.test 8afc5e5dcdebc2be54472e73ebd9cd1adef1225fd15d37a1c62f969159f390ae F test/select6.test 9b2fb4ffedf52e1b5703cfcae1212e7a4a063f014c0458d78d29aca3db766d1f -F test/select7.test f659f231489349e8c5734e610803d7654207318f +F test/select7.test b825420da8a0b5722fdb77f3369f6396a3d198c46e8787eb26ff9425d4ac9d27 F test/select8.test 8c8f5ae43894c891efc5755ed905467d1d67ad5d F test/select9.test f7586b207ce2304ab80dc93d3146469a28fd4403621dd3a82d06644563d3c812 F test/selectA.test 1da8ce3884c326e11d2855baffb76436b0d7e044404af8a2a70d1399a4ff7e29 @@ -2203,9 +2203,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P a929cdb00ff74d77cdf55087d32abf53578f7127b36276f89b64ccbef1d4a9a4 -Q -4e69dce2093b75b7db4fbdca4953b664b907be15d991ed352ea1d87c64fbf9d2 -R 80ba63bff6bb194482fa92e681f77bdc +P 3b1b0c141993eb0f8749f54ea40d6014f9bdccbe0fdb3ccccad971a0baea8d3c +R 3c5d070c449c1fcf67b35bba7df06bed U drh -Z 15b4994c5694541199c17b609b4ae0e5 +Z dd212a4a681e0046af843c3dc6922a44 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 60de4ef9d1..6b708e5668 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3b1b0c141993eb0f8749f54ea40d6014f9bdccbe0fdb3ccccad971a0baea8d3c +670beb133eb203065a75022f0c6db7c605a4e0e22c8ef6d6b4724be2663ff3dc diff --git a/src/insert.c b/src/insert.c index 072386e656..a7e94420bf 100644 --- a/src/insert.c +++ b/src/insert.c @@ -717,6 +717,7 @@ Select *sqlite3MultiValues(Parse *pParse, Select *pLeft, ExprList *pRow){ pRet->pSrc->nSrc = 1; pRet->pPrior = pLeft->pPrior; pRet->op = pLeft->op; + if( pRet->pPrior ) pRet->selFlags |= SF_Values; pLeft->pPrior = 0; pLeft->op = TK_SELECT; assert( pLeft->pNext==0 ); diff --git a/src/parse.y b/src/parse.y index de8282e81f..68c00f0a7f 100644 --- a/src/parse.y +++ b/src/parse.y @@ -532,9 +532,9 @@ cmd ::= select(X). { break; } } - if( (p->selFlags & SF_MultiValue)==0 && - (mxSelect = pParse->db->aLimit[SQLITE_LIMIT_COMPOUND_SELECT])>0 && - cnt>mxSelect + if( (p->selFlags & (SF_MultiValue|SF_Values))==0 + && (mxSelect = pParse->db->aLimit[SQLITE_LIMIT_COMPOUND_SELECT])>0 + && cnt>mxSelect ){ sqlite3ErrorMsg(pParse, "too many terms in compound SELECT"); } diff --git a/test/select7.test b/test/select7.test index d705ebfaf4..0c4051006a 100644 --- a/test/select7.test +++ b/test/select7.test @@ -155,6 +155,38 @@ if {[clang_sanitize_address]==0} { } } +# https://issues.chromium.org/issues/358174302 +# Need to support an unlimited number of terms in a VALUES clause, even +# if some of those terms contain double-quoted string literals. +# +do_execsql_test select7-6.5 { + DROP TABLE IF EXISTS t1; + CREATE TABLE t1(a,b,c); +} +sqlite3_limit db SQLITE_LIMIT_COMPOUND_SELECT 10 +sqlite3_db_config db SQLITE_DBCONFIG_DQS_DML 0 +do_catchsql_test select7-6.6 { + INSERT INTO t1 VALUES + (NULL,0,""), (X'',0.0,0.0), (X'',X'',""), (0.0,0.0,""), (NULL,NULL,0.0), + (0,"",0), (0.0,X'',0), ("",X'',0.0), (0.0,X'',NULL), (0,NULL,""), + (0,"",NULL), (0.0,NULL,X''), ("",X'',NULL), (NULL,0,""), + (0,NULL,0), (X'',X'',0.0); +} {1 {no such column: "" - should this be a string literal in single-quotes?}} +do_execsql_test select7-6.7 { + SELECT count(*) FROM t1; +} {0} +sqlite3_db_config db SQLITE_DBCONFIG_DQS_DML 1 +do_catchsql_test select7-6.8 { + INSERT INTO t1 VALUES + (NULL,0,""), (X'',0.0,0.0), (X'',X'',""), (0.0,0.0,""), (NULL,NULL,0.0), + (0,"",0), (0.0,X'',0), ("",X'',0.0), (0.0,X'',NULL), (0,NULL,""), + (0,"",NULL), (0.0,NULL,X''), ("",X'',NULL), (NULL,0,""), + (0,NULL,0), (X'',X'',0.0); +} {0 {}} +do_execsql_test select7-6.9 { + SELECT count(*) FROM t1; +} {16} + # This block of tests verifies that bug aa92c76cd4 is fixed. # do_test select7-7.1 { From 679f5d458ec173381f4bb4ab981e2054d2341242 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 8 Aug 2024 15:07:27 +0000 Subject: [PATCH 33/45] Add assert() statements and reorganize code slightly in fts3 and fts5 to make it easier to follow. FossilOrigin-Name: 797b0a13fd7a42b0a48ecbf0cd1961aa932da3e9c9ccffd903a3a4d963d0cc54 --- ext/fts3/fts3_snippet.c | 1 + ext/fts5/fts5_expr.c | 11 +++++++-- ext/fts5/test/fts5expr.test | 48 +++++++++++++++++++++++++++++++++++++ manifest | 19 ++++++++------- manifest.uuid | 2 +- test/fts3snippet.test | 5 +++- 6 files changed, 73 insertions(+), 13 deletions(-) create mode 100644 ext/fts5/test/fts5expr.test diff --git a/ext/fts3/fts3_snippet.c b/ext/fts3/fts3_snippet.c index f6caabf4c9..80f62eb3bb 100644 --- a/ext/fts3/fts3_snippet.c +++ b/ext/fts3/fts3_snippet.c @@ -398,6 +398,7 @@ static int fts3SnippetNextCandidate(SnippetIter *pIter){ return 1; } + assert( pIter->nSnippet>=0 ); pIter->iCurrent = iStart = iEnd - pIter->nSnippet + 1; for(i=0; inPhrase; i++){ SnippetPhrase *pPhrase = &pIter->aPhrase[i]; diff --git a/ext/fts5/fts5_expr.c b/ext/fts5/fts5_expr.c index 176d4e6a5f..a39cc16bbf 100644 --- a/ext/fts5/fts5_expr.c +++ b/ext/fts5/fts5_expr.c @@ -2263,6 +2263,9 @@ static void fts5ExprAssignXNext(Fts5ExprNode *pNode){ } } +/* +** Add pSub as a child of p. +*/ static void fts5ExprAddChildren(Fts5ExprNode *p, Fts5ExprNode *pSub){ int ii = p->nChild; if( p->eType!=FTS5_NOT && pSub->eType==p->eType ){ @@ -2407,19 +2410,23 @@ Fts5ExprNode *sqlite3Fts5ParseNode( "fts5: %s queries are not supported (detail!=full)", pNear->nPhrase==1 ? "phrase": "NEAR" ); - sqlite3_free(pRet); + sqlite3Fts5ParseNodeFree(pRet); pRet = 0; + pNear = 0; + assert( pLeft==0 && pRight==0 ); } } }else{ + assert( pNear==0 ); fts5ExprAddChildren(pRet, pLeft); fts5ExprAddChildren(pRet, pRight); + pLeft = pRight = 0; if( pRet->iHeight>SQLITE_FTS5_MAX_EXPR_DEPTH ){ sqlite3Fts5ParseError(pParse, "fts5 expression tree is too large (maximum depth %d)", SQLITE_FTS5_MAX_EXPR_DEPTH ); - sqlite3_free(pRet); + sqlite3Fts5ParseNodeFree(pRet); pRet = 0; } } diff --git a/ext/fts5/test/fts5expr.test b/ext/fts5/test/fts5expr.test new file mode 100644 index 0000000000..e3938beb0f --- /dev/null +++ b/ext/fts5/test/fts5expr.test @@ -0,0 +1,48 @@ +# 2024 August 8 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#************************************************************************* +# This file implements regression tests for SQLite library. The +# focus of this script is testing the FTS5 module. +# + +source [file join [file dirname [info script]] fts5_common.tcl] +set testprefix fts5expr + +# If SQLITE_ENABLE_FTS5 is not defined, omit this file. +ifcapable !fts5 { + finish_test + return +} + +do_execsql_test 1.0 { + CREATE VIRTUAL TABLE x1 USING fts5(a); + INSERT INTO x1(rowid, a) VALUES (113, 'fts5 expr test'); +} + +do_execsql_test 1.1 { + SELECT rowid FROM x1('expr'); +} {113} + +for {set ii 0} {$ii < 300} {incr ii} { + set expr "expr " + append expr [string repeat "NOT abcd " $ii] + + if {$ii<257} { + set res {0 113} + } else { + set res {1 {fts5 expression tree is too large (maximum depth 256)}} + } + do_catchsql_test 1.1.$ii { + SELECT rowid FROM x1($expr) + } $res +} + +finish_test + diff --git a/manifest b/manifest index 81f7e54a26..6482db0f73 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Do\snot\slet\sthe\snumber\sof\sterms\son\sa\sVALUES\sclause\sbe\slimited\sby\nSQLITE_LIMIT_COMPOUND_SELECT,\seven\sif\sthe\sVALUES\sclause\scontains\selements\nthat\sappear\sto\sbe\svariables\sdue\sto\sthe\suse\sof\sdouble-quoted\sstring\sliterals.\n[https://issues.chromium.org/issues/358174302|Chromium\sissue\s358174302]. -D 2024-08-08T14:45:50.247 +C Add\sassert()\sstatements\sand\sreorganize\scode\sslightly\sin\sfts3\sand\sfts5\sto\smake\sit\seasier\sto\sfollow. +D 2024-08-08T15:07:27.410 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -74,7 +74,7 @@ F ext/fts3/fts3_hash.c 8b6e31bfb0844c27dc6092c2620bdb1fca17ed613072db057d96952c6 F ext/fts3/fts3_hash.h 39cf6874dc239d6b4e30479b1975fe5b22a3caaf F ext/fts3/fts3_icu.c 305ce7fb6036484085b5556a9c8e62acdc7763f0f4cdf5fd538212a9f3720116 F ext/fts3/fts3_porter.c e19807ce0ae31c1c6e9898e89ecc93183d7ec224ea101af039722a4f49e5f2b8 -F ext/fts3/fts3_snippet.c 610328fe128c047c6b0eba77768982ccf3933daae095d497949a75c9dfd47409 +F ext/fts3/fts3_snippet.c c38117a2e4dcc9485a170a57a6134423955247b230fef7073c46fa9c51239540 F ext/fts3/fts3_term.c 6a96027ad364001432545fe43322b6af04ed28bb5619ec51af1f59d0710d6d69 F ext/fts3/fts3_test.c 7a9cb3d61774134211bf4bfdf1adcb581a1a0377f2d050a121ae7ab44baef0e3 F ext/fts3/fts3_tokenize_vtab.c 7fd9ef364f257b97218b9c331f2378e307375c592f70fd541f714e747d944962 @@ -97,7 +97,7 @@ F ext/fts5/fts5Int.h 41fb3a2dd40e818cc96c6f4176dbdf2aaa8f57043cfc9a8f2676e7e6a72 F ext/fts5/fts5_aux.c 4584e88878e54828bf7d4d0d83deedd232ec60628b7731be02bad6adb62304b1 F ext/fts5/fts5_buffer.c 0eec58bff585f1a44ea9147eae5da2447292080ea435957f7488c70673cb6f09 F ext/fts5/fts5_config.c 68cb87a49215f8e7028000b681df4057c430a4a6afbd676463886da94c9e1c37 -F ext/fts5/fts5_expr.c 29558460f161b0bee816fdfb6547cdcaefc7b61c64a1bf78d50052932a210201 +F ext/fts5/fts5_expr.c 3a24c6ab5b7545312a5ec03085ae705ede820a08f9a63f1d72829ed4a35da6f6 F ext/fts5/fts5_hash.c adda4272be401566a6e0ba1acbe70ee5cb97fce944bc2e04dc707152a0ec91b1 F ext/fts5/fts5_index.c eb9a0dda3bc6ef969a6be8d2746af56856e67251810ddba08622b45be8477abe F ext/fts5/fts5_main.c 77fefb37e7931095a5ff271a28fbe4f73ec46d5492ef1f35d405d98e137ad8ed @@ -159,6 +159,7 @@ F ext/fts5/test/fts5dlidx.test a7c42b0a74dc7c8aa1a46d586e0aadda4b6cc42c24450f8d3 F ext/fts5/test/fts5doclist.test b7cb84758504519746957802db9cd31187bb4e0028b89d9087ba06e26cc4155f F ext/fts5/test/fts5ea.test cefdf66024550fa7920c03395c71ce5046235ed1a1a7a469d79b19e7aad5afb5 F ext/fts5/test/fts5eb.test 401f756fdb77083aeba8b696c1e0ad4d834c39dbd6f17e492bb55a2ad64b4296 +F ext/fts5/test/fts5expr.test 7e1b2d075b63b727a624a378c2c09f94296a93dc4ae968aad67f8d9f3810c266 F ext/fts5/test/fts5fault1.test d28a65caee75db6897c3cf1358c5230d3bb2a3bf7fb31062c19c7e5382b3d2bd F ext/fts5/test/fts5fault2.test 69c8fdbef830cd0d450908d4504d5bb86609e255af99c421c20a0756251fe344 F ext/fts5/test/fts5fault3.test da2f9e3e56ff5740d68ebdd6877c97089e7ed28ddff28a0da87a6afea27e5522 @@ -1212,7 +1213,7 @@ F test/fts3query.test 45806a302921b245a9dba5d85c9d51fb98b3f137eea6e6bf6eae4883e0 F test/fts3rank.test cd99bc83a3c923c8d52afd90d86979cf05fc41849f892faeac3988055ef37b99 F test/fts3rnd.test 1320d8826a845e38a96e769562bf83d7a92a15d0 F test/fts3shared.test 57e26a801f21027b7530da77db54286a6fe4997e -F test/fts3snippet.test 0887196d67cffbe365edde535b95ecc642a532ce8551ccd9a73aab5999c3ffae +F test/fts3snippet.test 560c7f38c5fa591d88e367eac1313b64e503625616708ff61da9d5f52cbf75e5 F test/fts3snippet2.test 03f6738ab3897bea2ba6be424a0613872e167acbf37a66200d655d737b470f65 F test/fts3sort.test ed34c716a11cc2009a35210e84ad5f9c102362ca F test/fts3tok1.test a663f4cac22a9505400bc22aacb818d7055240409c28729669ea7d4cc2120d15 @@ -2203,8 +2204,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3b1b0c141993eb0f8749f54ea40d6014f9bdccbe0fdb3ccccad971a0baea8d3c -R 3c5d070c449c1fcf67b35bba7df06bed -U drh -Z dd212a4a681e0046af843c3dc6922a44 +P 670beb133eb203065a75022f0c6db7c605a4e0e22c8ef6d6b4724be2663ff3dc +R 312db3aeda520a84f3f575d1adc99854 +U dan +Z f0731ccfa7622c7f28b0888a2de2dbf2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 6b708e5668..e25e0856c1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -670beb133eb203065a75022f0c6db7c605a4e0e22c8ef6d6b4724be2663ff3dc +797b0a13fd7a42b0a48ecbf0cd1961aa932da3e9c9ccffd903a3a4d963d0cc54 diff --git a/test/fts3snippet.test b/test/fts3snippet.test index ae022b68a6..ad1fbb3bef 100644 --- a/test/fts3snippet.test +++ b/test/fts3snippet.test @@ -561,7 +561,6 @@ do_test 4.3 { }] } {64} - #------------------------------------------------------------------------- # Request a snippet from a query with more than 64 phrases. # @@ -588,5 +587,9 @@ do_execsql_test 5.1 { {[a70] [a71] [a72]} } +do_execsql_test 5.2 { + SELECT snippet(t5, '[', ']', -1, 0) FROM t5 WHERE t5 MATCH 'a5' +} {{a4 [a5] a6}} + set sqlite_fts3_enable_parentheses 0 finish_test From 0c8c9a64b388c52f18df5b20900bb67d87ee0412 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 8 Aug 2024 15:26:11 +0000 Subject: [PATCH 34/45] Ensure sqlite3expert.c unregisters any SQL user-functions it registers with the database handle before returning. FossilOrigin-Name: 123b154ce3b6fee1bbf483704812bd6f8538966f9687520b4470d700f0270719 --- ext/expert/expert1.test | 7 +++++++ ext/expert/sqlite3expert.c | 20 ++++++++++++-------- manifest | 14 +++++++------- manifest.uuid | 2 +- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/ext/expert/expert1.test b/ext/expert/expert1.test index c456c30c52..72c4fd72cd 100644 --- a/ext/expert/expert1.test +++ b/ext/expert/expert1.test @@ -465,6 +465,13 @@ do_execsql_test 5.3 { t2 t2_idx_0001295b {100 20 5} } +do_catchsql_test 5.4 { + SELECT sqlite_expert_rem(123, 123); +} {1 {no such function: sqlite_expert_rem}} +do_catchsql_test 5.5 { + SELECT sqlite_expert_sample(); +} {1 {no such function: sqlite_expert_sample}} + if 0 { do_test expert1-6.0 { catchcmd :memory: { diff --git a/ext/expert/sqlite3expert.c b/ext/expert/sqlite3expert.c index 276c2cc9fe..b59a59728d 100644 --- a/ext/expert/sqlite3expert.c +++ b/ext/expert/sqlite3expert.c @@ -626,7 +626,7 @@ static int expertFilter( pCsr->pData = 0; if( rc==SQLITE_OK ){ rc = idxPrintfPrepareStmt(pExpert->db, &pCsr->pData, &pVtab->base.zErrMsg, - "SELECT * FROM main.%Q WHERE sample()", pVtab->pTab->zName + "SELECT * FROM main.%Q WHERE sqlite_expert_sample()", pVtab->pTab->zName ); } @@ -1500,7 +1500,7 @@ struct IdxRemCtx { }; /* -** Implementation of scalar function rem(). +** Implementation of scalar function sqlite_expert_rem(). */ static void idxRemFunc( sqlite3_context *pCtx, @@ -1513,7 +1513,7 @@ static void idxRemFunc( assert( argc==2 ); iSlot = sqlite3_value_int(argv[0]); - assert( iSlot<=p->nSlot ); + assert( iSlotnSlot ); pSlot = &p->aSlot[iSlot]; switch( pSlot->eType ){ @@ -1624,7 +1624,8 @@ static int idxPopulateOneStat1( const char *zName = (const char*)sqlite3_column_text(pIndexXInfo, 0); const char *zColl = (const char*)sqlite3_column_text(pIndexXInfo, 1); zCols = idxAppendText(&rc, zCols, - "%sx.%Q IS rem(%d, x.%Q) COLLATE %s", zComma, zName, nCol, zName, zColl + "%sx.%Q IS sqlite_expert_rem(%d, x.%Q) COLLATE %s", + zComma, zName, nCol, zName, zColl ); zOrder = idxAppendText(&rc, zOrder, "%s%d", zComma, ++nCol); } @@ -1757,13 +1758,13 @@ static int idxPopulateStat1(sqlite3expert *p, char **pzErr){ if( rc==SQLITE_OK ){ sqlite3 *dbrem = (p->iSample==100 ? p->db : p->dbv); - rc = sqlite3_create_function( - dbrem, "rem", 2, SQLITE_UTF8, (void*)pCtx, idxRemFunc, 0, 0 + rc = sqlite3_create_function(dbrem, "sqlite_expert_rem", + 2, SQLITE_UTF8, (void*)pCtx, idxRemFunc, 0, 0 ); } if( rc==SQLITE_OK ){ - rc = sqlite3_create_function( - p->db, "sample", 0, SQLITE_UTF8, (void*)&samplectx, idxSampleFunc, 0, 0 + rc = sqlite3_create_function(p->db, "sqlite_expert_sample", + 0, SQLITE_UTF8, (void*)&samplectx, idxSampleFunc, 0, 0 ); } @@ -1815,6 +1816,9 @@ static int idxPopulateStat1(sqlite3expert *p, char **pzErr){ rc = sqlite3_exec(p->dbm, "ANALYZE sqlite_schema", 0, 0, 0); } + sqlite3_create_function(p->db, "sqlite_expert_rem", 2, SQLITE_UTF8, 0,0,0,0); + sqlite3_create_function(p->db, "sqlite_expert_sample", 0,SQLITE_UTF8,0,0,0,0); + sqlite3_exec(p->db, "DROP TABLE IF EXISTS temp."UNIQUE_TABLE_NAME,0,0,0); return rc; } diff --git a/manifest b/manifest index 6482db0f73..173aea971f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sassert()\sstatements\sand\sreorganize\scode\sslightly\sin\sfts3\sand\sfts5\sto\smake\sit\seasier\sto\sfollow. -D 2024-08-08T15:07:27.410 +C Ensure\ssqlite3expert.c\sunregisters\sany\sSQL\suser-functions\sit\sregisters\swith\sthe\sdatabase\shandle\sbefore\sreturning. +D 2024-08-08T15:26:11.708 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -57,8 +57,8 @@ F ext/consio/console_io.c f32b757c9ee7fdf68e7586bee306f8368759e7cd12febb2a683919 F ext/consio/console_io.h 0548b83d7c4b7270ad544a67f2bb90cebc519637fa39b1838df4744cf0d87646 F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3 F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4 -F ext/expert/expert1.test 53a749de08939e3bc14f804e97410927d46fa772cbce0247d7e8fa6fc2523b0c -F ext/expert/sqlite3expert.c c8cea5ff15fbe792cccc4992a9b40b706411c41d32611f617897fecac6ff06a4 +F ext/expert/expert1.test 661f873fd451127edf822ef0d520088faa319135f6a15bd10be6801ac284ac9b +F ext/expert/sqlite3expert.c 8b09aeb2b95a9fca8b6628b522bf4d69aa746ff64c38eb1e99a9b5fad8cf03b9 F ext/expert/sqlite3expert.h ca81efc2679a92373a13a3e76a6138d0310e32be53d6c3bfaedabd158ea8969b F ext/expert/test_expert.c b767b2039a0df707eb3147e86bcf68b252d8455d9a41774b1a836cd052ceca70 F ext/fts3/README.content b9078d0843a094d86af0d48dffbff13c906702b4c3558012e67b9c7cc3bf59ee @@ -2204,8 +2204,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 670beb133eb203065a75022f0c6db7c605a4e0e22c8ef6d6b4724be2663ff3dc -R 312db3aeda520a84f3f575d1adc99854 +P 797b0a13fd7a42b0a48ecbf0cd1961aa932da3e9c9ccffd903a3a4d963d0cc54 +R 524433c41a8ffc46e95c387bd9dc2975 U dan -Z f0731ccfa7622c7f28b0888a2de2dbf2 +Z fa7382f01ce16aee65751b978df534e7 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index e25e0856c1..f7625aad27 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -797b0a13fd7a42b0a48ecbf0cd1961aa932da3e9c9ccffd903a3a4d963d0cc54 +123b154ce3b6fee1bbf483704812bd6f8538966f9687520b4470d700f0270719 From caa7a625917f574cd3adffd22d44eaec6d27150b Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 9 Aug 2024 12:19:11 +0000 Subject: [PATCH 35/45] Remove unused static var cBadGroup from ext/consio/console_io.c to resolve a compiler warning reported in the fossil forum. This is a build fix, not a functional change. FossilOrigin-Name: fa047c3ea7a03d76afd6a11f58ef7b84c653f583ed795e0de5be2a6b986e558e --- ext/consio/console_io.c | 5 ----- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/ext/consio/console_io.c b/ext/consio/console_io.c index 3e2f556f52..3fa613ba9d 100755 --- a/ext/consio/console_io.c +++ b/ext/consio/console_io.c @@ -53,11 +53,6 @@ # define CIO_WIN_WC_XLATE 0 /* Not exposing translation routines at all */ #endif -#if CIO_WIN_WC_XLATE -/* Character used to represent a known-incomplete UTF-8 char group (�) */ -static WCHAR cBadGroup = 0xfffd; -#endif - #if CIO_WIN_WC_XLATE static HANDLE handleOfFile(FILE *pf){ int fileDesc = _fileno(pf); diff --git a/manifest b/manifest index 173aea971f..0de0ea94dd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Ensure\ssqlite3expert.c\sunregisters\sany\sSQL\suser-functions\sit\sregisters\swith\sthe\sdatabase\shandle\sbefore\sreturning. -D 2024-08-08T15:26:11.708 +C Remove\sunused\sstatic\svar\scBadGroup\sfrom\sext/consio/console_io.c\sto\sresolve\sa\scompiler\swarning\sreported\sin\sthe\sfossil\sforum.\sThis\sis\sa\sbuild\sfix,\snot\sa\sfunctional\schange. +D 2024-08-09T12:19:11.913 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -53,7 +53,7 @@ F ext/README.md fd5f78013b0a2bc6f0067afb19e6ad040e89a10179b4f6f03eee58fac5f169bd F ext/async/README.txt e12275968f6fde133a80e04387d0e839b0c51f91 F ext/async/sqlite3async.c 6f247666b495c477628dd19364d279c78ea48cd90c72d9f9b98ad1aff3294f94 F ext/async/sqlite3async.h 46b47c79357b97ad85d20d2795942c0020dc20c532114a49808287f04aa5309a -F ext/consio/console_io.c f32b757c9ee7fdf68e7586bee306f8368759e7cd12febb2a6839199b1c1af395 x +F ext/consio/console_io.c b4885dfea71ed583315de8f0792a29d5fc7c7460b4a26c0aebe5cda5da8b38f8 x F ext/consio/console_io.h 0548b83d7c4b7270ad544a67f2bb90cebc519637fa39b1838df4744cf0d87646 F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3 F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4 @@ -2204,8 +2204,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 797b0a13fd7a42b0a48ecbf0cd1961aa932da3e9c9ccffd903a3a4d963d0cc54 -R 524433c41a8ffc46e95c387bd9dc2975 -U dan -Z fa7382f01ce16aee65751b978df534e7 +P 123b154ce3b6fee1bbf483704812bd6f8538966f9687520b4470d700f0270719 +R dfb7fc0d7f5895fabd0ef74030340b71 +U stephan +Z 5f05148caae955ae7f0f151431a9b4b8 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f7625aad27..367363b980 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -123b154ce3b6fee1bbf483704812bd6f8538966f9687520b4470d700f0270719 +fa047c3ea7a03d76afd6a11f58ef7b84c653f583ed795e0de5be2a6b986e558e From 1107b4b9cf9ea0ab3c7d2f2f344745fc77b710bf Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 9 Aug 2024 12:35:27 +0000 Subject: [PATCH 36/45] Bind the new debug parameters in fuzzinvariants.c. FossilOrigin-Name: 7e1dc263051cf50db04643d1a2aa9f91559b2b121859b750ce4446012d5f3c3e --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/fuzzinvariants.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 0de0ea94dd..10fc3d74d8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sunused\sstatic\svar\scBadGroup\sfrom\sext/consio/console_io.c\sto\sresolve\sa\scompiler\swarning\sreported\sin\sthe\sfossil\sforum.\sThis\sis\sa\sbuild\sfix,\snot\sa\sfunctional\schange. -D 2024-08-09T12:19:11.913 +C Bind\sthe\snew\sdebug\sparameters\sin\sfuzzinvariants.c. +D 2024-08-09T12:35:27.067 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -1272,7 +1272,7 @@ F test/fuzzdata8.db 4a53b6d077c6a5c23b609d8d3ac66996fa55ba3f8d02f9b6efdd0214a767 F test/fuzzer1.test 3d4c4b7e547aba5e5511a2991e3e3d07166cfbb8 F test/fuzzer2.test a85ef814ce071293bce1ad8dffa217cbbaad4c14 F test/fuzzerfault.test f64c4aef4c9e9edf1d6dc0d3f1e65dcc81e67c996403c88d14f09b74807a42bc -F test/fuzzinvariants.c 0729b9d8ed77ad0f8c5c7601168a707d5803087d2da030ede9057c51c809cc6c +F test/fuzzinvariants.c 81167c9a7e82c0539a1d704aeb3384046d01f4108cda160a2447cb2a149d6362 F test/gcfault.test 4ea410ac161e685f17b19e1f606f58514a2850e806c65b846d05f60d436c5b0d F test/gencol1.test e169bdfa11c7ed5e9f322a98a7db3afe9e66235750b68c923efee8e1876b46ec F test/genesis.tcl 1e2e2e8e5cc4058549a154ff1892fe5c9de19f98 @@ -2204,8 +2204,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 123b154ce3b6fee1bbf483704812bd6f8538966f9687520b4470d700f0270719 -R dfb7fc0d7f5895fabd0ef74030340b71 -U stephan -Z 5f05148caae955ae7f0f151431a9b4b8 +P fa047c3ea7a03d76afd6a11f58ef7b84c653f583ed795e0de5be2a6b986e558e +R 4385e87b815ad1924711e2dcdab3d5bb +U drh +Z 5861d6c430a2b6c91eb7ed0d9c3ba80b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 367363b980..c2f77959c0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fa047c3ea7a03d76afd6a11f58ef7b84c653f583ed795e0de5be2a6b986e558e +7e1dc263051cf50db04643d1a2aa9f91559b2b121859b750ce4446012d5f3c3e diff --git a/test/fuzzinvariants.c b/test/fuzzinvariants.c index 80eb4aecb7..36121963f5 100644 --- a/test/fuzzinvariants.c +++ b/test/fuzzinvariants.c @@ -38,6 +38,31 @@ static void reportInvariantFailed( int noOpt /* True if opt flags inverted for pTest */ ); +/* +** Special parameter binding, for testing and debugging purposes. +** +** $int_NNN -> integer value NNN +** $text_TTTT -> floating point value TTT with destructor +*/ +static void bindDebugParameters(sqlite3_stmt *pStmt){ + int nVar = sqlite3_bind_parameter_count(pStmt); + int i; + for(i=0; i Date: Fri, 9 Aug 2024 17:09:18 +0000 Subject: [PATCH 37/45] Do not attempt to use a covering index based purely on columns-used when doing an UPDATE or DELETE of a WITHOUT ROWID table. Raise an SQLITE_INTERNAL error if there is ever a situation where a table reference cannot be converted into an index reference when the query planner thinks that a covering index is appropriate. FossilOrigin-Name: fae39ae9320c0f4fcc2e3b3baf0a4170ba2b9a04634a0a1fa41dd4918a74b106 --- manifest | 15 +++++++------ manifest.uuid | 2 +- src/where.c | 58 ++++++++++++++++----------------------------------- 3 files changed, 28 insertions(+), 47 deletions(-) diff --git a/manifest b/manifest index 10fc3d74d8..3b74d15e9f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Bind\sthe\snew\sdebug\sparameters\sin\sfuzzinvariants.c. -D 2024-08-09T12:35:27.067 +C Do\snot\sattempt\sto\suse\sa\scovering\sindex\sbased\spurely\son\scolumns-used\nwhen\sdoing\san\sUPDATE\sor\sDELETE\sof\sa\sWITHOUT\sROWID\stable.\s\sRaise\san\nSQLITE_INTERNAL\serror\sif\sthere\sis\sever\sa\ssituation\swhere\sa\stable\sreference\ncannot\sbe\sconverted\sinto\san\sindex\sreference\swhen\sthe\squery\splanner\sthinks\nthat\sa\scovering\sindex\sis\sappropriate. +D 2024-08-09T17:09:18.697 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -846,7 +846,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/wal.c 887fc4ca3f020ebb2e376f222069570834ac63bf50111ef0cbf3ae417048ed89 F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452 F src/walker.c 7c7ea0115345851c3da4e04e2e239a29983b61fb5b038b94eede6aba462640e2 -F src/where.c 5bbe53db73ae6c8ee34a5eab693a5586ad8ff4f094ff0e524df965b683bec884 +F src/where.c 5fa17ec4e344e57cf43dd7b2977c95a518bfc2d43edb42df0cd1d5c2b42cee04 F src/whereInt.h 002adc3aa2cc10733b9b27958fdbe893987cd989fab25a9853941c1f9b9b0a65 F src/wherecode.c c9cac0b0b8e809c5e7e79d7796918907fb685ad99be2aaa9737f9787aa47349c F src/whereexpr.c 7d0d34b42b9edfd8e8ca66beb3a6ef63fe211c001af54caf2ccbcd989b783290 @@ -2204,8 +2204,11 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P fa047c3ea7a03d76afd6a11f58ef7b84c653f583ed795e0de5be2a6b986e558e -R 4385e87b815ad1924711e2dcdab3d5bb +P 7e1dc263051cf50db04643d1a2aa9f91559b2b121859b750ce4446012d5f3c3e +R a22c0892de474f9ba14db4c65993edff +T *branch * covering-index-patch +T *sym-covering-index-patch * +T -sym-trunk * U drh -Z 5861d6c430a2b6c91eb7ed0d9c3ba80b +Z b1c9594c16be220e78f6cfe69b132d52 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index c2f77959c0..30b7a517ca 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7e1dc263051cf50db04643d1a2aa9f91559b2b121859b750ce4446012d5f3c3e +fae39ae9320c0f4fcc2e3b3baf0a4170ba2b9a04634a0a1fa41dd4918a74b106 diff --git a/src/where.c b/src/where.c index c850121c34..15f5fe7d96 100644 --- a/src/where.c +++ b/src/where.c @@ -4047,7 +4047,9 @@ static int whereLoopAddBtree( " according to whereIsCoveringIndex()\n", pProbe->zName)); } } - }else if( m==0 ){ + }else if( m==0 + && (HasRowid(pTab) || pWInfo->pSelect!=0 || sqlite3FaultSim(700)) + ){ WHERETRACE(0x200, ("-> %s a covering index according to bitmasks\n", pProbe->zName, m==0 ? "is" : "is not")); @@ -7078,26 +7080,6 @@ whereBeginError: } #endif -#ifdef SQLITE_DEBUG -/* -** Return true if cursor iCur is opened by instruction k of the -** bytecode. Used inside of assert() only. -*/ -static int cursorIsOpen(Vdbe *v, int iCur, int k){ - while( k>=0 ){ - VdbeOp *pOp = sqlite3VdbeGetOp(v,k--); - if( pOp->p1!=iCur ) continue; - if( pOp->opcode==OP_Close ) return 0; - if( pOp->opcode==OP_OpenRead ) return 1; - if( pOp->opcode==OP_OpenWrite ) return 1; - if( pOp->opcode==OP_OpenDup ) return 1; - if( pOp->opcode==OP_OpenAutoindex ) return 1; - if( pOp->opcode==OP_OpenEphemeral ) return 1; - } - return 0; -} -#endif /* SQLITE_DEBUG */ - /* ** Generate the end of the WHERE loop. See comments on ** sqlite3WhereBegin() for additional information. @@ -7376,18 +7358,20 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){ assert( pIdx->pTable==pTab ); #ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC if( pOp->opcode==OP_Offset ){ - /* Do not need to translate the column number */ + x = 0; }else #endif - if( !HasRowid(pTab) ){ - Index *pPk = sqlite3PrimaryKeyIndex(pTab); - x = pPk->aiColumn[x]; - assert( x>=0 ); - }else{ - testcase( x!=sqlite3StorageColumnToTable(pTab,x) ); - x = sqlite3StorageColumnToTable(pTab,x); + { + if( !HasRowid(pTab) ){ + Index *pPk = sqlite3PrimaryKeyIndex(pTab); + x = pPk->aiColumn[x]; + assert( x>=0 ); + }else{ + testcase( x!=sqlite3StorageColumnToTable(pTab,x) ); + x = sqlite3StorageColumnToTable(pTab,x); + } + x = sqlite3TableColumnToIndex(pIdx, x); } - x = sqlite3TableColumnToIndex(pIdx, x); if( x>=0 ){ pOp->p2 = x; pOp->p1 = pLevel->iIdxCur; @@ -7397,16 +7381,10 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){ ** reference. Verify that this is harmless - that the ** table being referenced really is open. */ -#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC - assert( (pLoop->wsFlags & WHERE_IDX_ONLY)==0 - || cursorIsOpen(v,pOp->p1,k) - || pOp->opcode==OP_Offset - ); -#else - assert( (pLoop->wsFlags & WHERE_IDX_ONLY)==0 - || cursorIsOpen(v,pOp->p1,k) - ); -#endif + if( pLoop->wsFlags & WHERE_IDX_ONLY ){ + sqlite3ErrorMsg(pParse, "internal query planner error"); + pParse->rc = SQLITE_INTERNAL; + } } }else if( pOp->opcode==OP_Rowid ){ pOp->p1 = pLevel->iIdxCur; From 610a5bafe24ed186a3741fec09d136d5fc3d5eac Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 9 Aug 2024 18:18:11 +0000 Subject: [PATCH 38/45] Fix the internal routine sqlite3ResolveExprListNames() so that it returns SQLITE_OK or SQLITE_ERROR instead of WRC_Continue or WRC_Abort. Without this fix, some times of obscure syntax errors end up returning SQLITE_INTERNAL rather than SQLITE_ERROR. FossilOrigin-Name: 9052187efd1f78abd9b285ac94269a3ba4d65b6aa74c9fa34002ee0628c83919 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/resolve.c | 11 +++++++---- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 10fc3d74d8..1939d75760 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Bind\sthe\snew\sdebug\sparameters\sin\sfuzzinvariants.c. -D 2024-08-09T12:35:27.067 +C Fix\sthe\sinternal\sroutine\ssqlite3ResolveExprListNames()\sso\sthat\sit\sreturns\nSQLITE_OK\sor\sSQLITE_ERROR\sinstead\sof\sWRC_Continue\sor\sWRC_Abort.\s\sWithout\sthis\nfix,\ssome\stimes\sof\sobscure\ssyntax\serrors\send\sup\sreturning\sSQLITE_INTERNAL\nrather\sthan\sSQLITE_ERROR. +D 2024-08-09T18:18:11.368 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -758,7 +758,7 @@ F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7 F src/prepare.c d99931f45416652895e502328ca49fe782cfc4e1ebdcda13b3736d991ebf42ce F src/printf.c 8b250972305e14b365561be5117ed0fd364e4fd58968776df1ce64c6280b90f9 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c -F src/resolve.c 7e8d23ce7cdbfedf351a47e759f2722e8182ca10fd7580be43f4ce1f1a228145 +F src/resolve.c 0aee8a2e5340ba95a966917305dfaff5147fcad78d0839cd364b16e4746b8bcb F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 6a95a2bffa6c09584dea99db5a7ae10c813305c09c92920ffc54f6eae2ba399e F src/shell.c.in 94571558b0fb28c37a5cf6dbd6ea27285341023a28a8cb5795cd2768fab67704 @@ -2204,8 +2204,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P fa047c3ea7a03d76afd6a11f58ef7b84c653f583ed795e0de5be2a6b986e558e -R 4385e87b815ad1924711e2dcdab3d5bb +P 7e1dc263051cf50db04643d1a2aa9f91559b2b121859b750ce4446012d5f3c3e +R c2e409b8bb5a5130f0d0a1d7f8083bf5 U drh -Z 5861d6c430a2b6c91eb7ed0d9c3ba80b +Z 115f5c56758e5bdc8ade5fed3254bde0 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index c2f77959c0..e2642285da 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7e1dc263051cf50db04643d1a2aa9f91559b2b121859b750ce4446012d5f3c3e +9052187efd1f78abd9b285ac94269a3ba4d65b6aa74c9fa34002ee0628c83919 diff --git a/src/resolve.c b/src/resolve.c index d5c1515a74..dbb54198cb 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -2154,6 +2154,9 @@ int sqlite3ResolveExprNames( ** Resolve all names for all expression in an expression list. This is ** just like sqlite3ResolveExprNames() except that it works for an expression ** list rather than a single expression. +** +** The return value is SQLITE_OK (0) for success or SQLITE_ERROR (1) for a +** failure. */ int sqlite3ResolveExprListNames( NameContext *pNC, /* Namespace to resolve expressions in. */ @@ -2162,7 +2165,7 @@ int sqlite3ResolveExprListNames( int i; int savedHasAgg = 0; Walker w; - if( pList==0 ) return WRC_Continue; + if( pList==0 ) return SQLITE_OK; w.pParse = pNC->pParse; w.xExprCallback = resolveExprStep; w.xSelectCallback = resolveSelectStep; @@ -2176,7 +2179,7 @@ int sqlite3ResolveExprListNames( #if SQLITE_MAX_EXPR_DEPTH>0 w.pParse->nHeight += pExpr->nHeight; if( sqlite3ExprCheckHeight(w.pParse, w.pParse->nHeight) ){ - return WRC_Abort; + return SQLITE_ERROR; } #endif sqlite3WalkExprNN(&w, pExpr); @@ -2193,10 +2196,10 @@ int sqlite3ResolveExprListNames( (NC_HasAgg|NC_MinMaxAgg|NC_HasWin|NC_OrderAgg); pNC->ncFlags &= ~(NC_HasAgg|NC_MinMaxAgg|NC_HasWin|NC_OrderAgg); } - if( w.pParse->nErr>0 ) return WRC_Abort; + if( w.pParse->nErr>0 ) return SQLITE_ERROR; } pNC->ncFlags |= savedHasAgg; - return WRC_Continue; + return SQLITE_OK; } /* From c60c928717aa56cce9b70c95c7c505756aded9c5 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 9 Aug 2024 18:42:01 +0000 Subject: [PATCH 39/45] Fix another instance where ALTER TABLE was returning SQLITE_INTERNAL instead of SQLITE_ERROR one malformed input. FossilOrigin-Name: b416756320dfb46ad72b843a7fbf18807d3fd1966251c320de626280b5238a5c --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/alter.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 1939d75760..ea58ba7fcd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\sinternal\sroutine\ssqlite3ResolveExprListNames()\sso\sthat\sit\sreturns\nSQLITE_OK\sor\sSQLITE_ERROR\sinstead\sof\sWRC_Continue\sor\sWRC_Abort.\s\sWithout\sthis\nfix,\ssome\stimes\sof\sobscure\ssyntax\serrors\send\sup\sreturning\sSQLITE_INTERNAL\nrather\sthan\sSQLITE_ERROR. -D 2024-08-09T18:18:11.368 +C Fix\sanother\sinstance\swhere\sALTER\sTABLE\swas\sreturning\sSQLITE_INTERNAL\sinstead\nof\sSQLITE_ERROR\sone\smalformed\sinput. +D 2024-08-09T18:42:01.488 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -692,7 +692,7 @@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b F sqlite3.1 acdff36db796e2d00225b911d3047d580cd136547298435426ce9d40347973cc F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a F sqlite_cfg.h.in baf2e409c63d4e7a765e17769b6ff17c5a82bbd9cbf1e284fd2e4cefaff3fcf2 -F src/alter.c e1b6782b85dd758f89e5c588e4e3eb82638c2dafc0c857b79a43bb8ec1746fca +F src/alter.c bb663fddf1fe0e2e6d8758b2b7fb6374e7c057a6ca3955f37a48986806029765 F src/analyze.c 5c4e2bfd0aa8e5157f7fb91a17d86905510a74397326dc5767ec4e0588a4eea5 F src/attach.c cc9d00d30da916ff656038211410ccf04ed784b7564639b9b61d1839ed69fd39 F src/auth.c 19b7ccacae3dfba23fc6f1d0af68134fa216e9040e53b0681b4715445ea030b4 @@ -2204,8 +2204,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 7e1dc263051cf50db04643d1a2aa9f91559b2b121859b750ce4446012d5f3c3e -R c2e409b8bb5a5130f0d0a1d7f8083bf5 +P 9052187efd1f78abd9b285ac94269a3ba4d65b6aa74c9fa34002ee0628c83919 +R cfcbe2c3b80f7c18c681a7771600d22b U drh -Z 115f5c56758e5bdc8ade5fed3254bde0 +Z 27325e8a3b0694b1cf9e0c044251f29f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index e2642285da..eda87af4fe 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9052187efd1f78abd9b285ac94269a3ba4d65b6aa74c9fa34002ee0628c83919 +b416756320dfb46ad72b843a7fbf18807d3fd1966251c320de626280b5238a5c diff --git a/src/alter.c b/src/alter.c index c1e0a295a4..a8556d115e 100644 --- a/src/alter.c +++ b/src/alter.c @@ -1320,7 +1320,7 @@ static int renameResolveTrigger(Parse *pParse){ /* ALWAYS() because if the table of the trigger does not exist, the ** error would have been hit before this point */ if( ALWAYS(pParse->pTriggerTab) ){ - rc = sqlite3ViewGetColumnNames(pParse, pParse->pTriggerTab); + rc = sqlite3ViewGetColumnNames(pParse, pParse->pTriggerTab)!=0; } /* Resolve symbols in WHEN clause */ From 555aaa432c8845ef379b58ce9284c956d565ec40 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 9 Aug 2024 22:48:11 +0000 Subject: [PATCH 40/45] Fix a few minor TCL9 compatibilities issues. FossilOrigin-Name: 69eed19914ef52bc0101f4ae1c7b242df4ee28675b3581e1f4d60a35494f9f76 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/test1.c | 14 +++++++------- src/test_tclvar.c | 8 ++++---- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/manifest b/manifest index ea58ba7fcd..a4248c360b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sanother\sinstance\swhere\sALTER\sTABLE\swas\sreturning\sSQLITE_INTERNAL\sinstead\nof\sSQLITE_ERROR\sone\smalformed\sinput. -D 2024-08-09T18:42:01.488 +C Fix\sa\sfew\sminor\sTCL9\scompatibilities\sissues. +D 2024-08-09T22:48:11.754 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -771,7 +771,7 @@ F src/status.c cb11f8589a6912af2da3bb1ec509a94dd8ef27df4d4c1a97e0bcf2309ece972b F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 F src/tclsqlite.c c6888598f08dee3d9112a38ef42c8f5c89ca7f3190f4694744d0b84250f4bf8c F src/tclsqlite.h c6af51f31a2b2172d674608763a4b98fdf5cd587e4025053e546fb8077757262 -F src/test1.c 51159784f29d3dfd4b50fd6ed9c43c8f7f36925c501a3ad3083528e5e5544bd7 +F src/test1.c be8cc208c0d50b3a7e570049e55f25ae40c1dfec8165b7ce12c2c8ed9f5b3030 F src/test2.c 7ebc518e6735939d8979273a6f7b1d9b5702babf059f6ad62499f7f60a9eb9a3 F src/test3.c e7573aa0f78ee4e070a4bc8c3493941c1aa64d5c66d4825c74c0f055451f432b F src/test4.c 13e57ae7ec7a959ee180970aef09deed141252fe9bb07c61054f0dfa4f1dfd5d @@ -813,7 +813,7 @@ F src/test_sqllog.c 540feaea7280cd5f926168aee9deb1065ae136d0bbbe7361e2ef3541783e F src/test_superlock.c 18355ca274746aa6909e3744163e5deb1196a85d5bc64b9cd377273cef626da7 F src/test_syscall.c 9ad7ab39910c16d29411678d91b0d27a7a996a718df5ee93dcd635e846d0275c F src/test_tclsh.c 6077f2bdc6b4ea2bace2a0cd6ea48e0a4651007ae7382c13efc0c495eb0c6956 -F src/test_tclvar.c 2c42fe9a74af0f3c8f87a339f66d9d3bd3a967fb5db1ed2500348055b954e391 +F src/test_tclvar.c ae873248a0188459b1c16ca7cc431265dacce524399e8b46725c2b3b7e048424 F src/test_thread.c d7a8bcea7445f37cc2a1f7f81dd6059634f45e0c61bfe80182b02872fb0328bb F src/test_vdbecov.c 5c426d9cd2b351f5f9ceb30cabf8c64a63bfcad644c507e0bd9ce2f6ae1a3bf3 F src/test_vfs.c f298475e468c7e14945b20af885917181090c265aa3c4ade897849c9fbd396f2 @@ -2204,8 +2204,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 9052187efd1f78abd9b285ac94269a3ba4d65b6aa74c9fa34002ee0628c83919 -R cfcbe2c3b80f7c18c681a7771600d22b +P b416756320dfb46ad72b843a7fbf18807d3fd1966251c320de626280b5238a5c +R 3713bfe5df240ec97ce0810792e582f6 U drh -Z 27325e8a3b0694b1cf9e0c044251f29f +Z 6bb203e3c3683b4f2854978314b46998 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index eda87af4fe..5c8d9489dc 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b416756320dfb46ad72b843a7fbf18807d3fd1966251c320de626280b5238a5c +69eed19914ef52bc0101f4ae1c7b242df4ee28675b3581e1f4d60a35494f9f76 diff --git a/src/test1.c b/src/test1.c index 88bfdc06d2..9def739f4c 100644 --- a/src/test1.c +++ b/src/test1.c @@ -8324,7 +8324,7 @@ static int SQLITE_TCLAPI sorter_test_sort4_helper( for(iStep=0; iStepi2++; Tcl_ListObjLength(0, pCur->pList2, &n); - if( pCur->i2>=(int)n ){ + if( pCur->i2>=n ){ Tcl_DecrRefCount(pCur->pList2); pCur->pList2 = 0; pCur->i2 = 0; @@ -170,7 +170,7 @@ static int tclvarNext(sqlite3_vtab_cursor *cur){ Tcl_Interp *interp = ((tclvar_vtab *)(cur->pVtab))->interp; Tcl_ListObjLength(0, pCur->pList1, &n); - while( !ok && pCur->i1<(int)n ){ + while( !ok && pCur->i1pList1, pCur->i1, &pObj); ok = next2(interp, pCur, pObj); if( !ok ){ From 4098aa5d198e891e10a7de57abdf3c34c22633d2 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 10 Aug 2024 09:56:36 +0000 Subject: [PATCH 41/45] Add an assert() to fix a harmless compiler warning in the recovery extension. FossilOrigin-Name: 2502339339f3c831966479a400c2b1a531fb4d990b1776b4dc4870cf734c3fcd --- ext/recover/dbdata.c | 1 + manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ext/recover/dbdata.c b/ext/recover/dbdata.c index 109aeef2d6..001840b17e 100644 --- a/ext/recover/dbdata.c +++ b/ext/recover/dbdata.c @@ -679,6 +679,7 @@ static int dbdataNext(sqlite3_vtab_cursor *pCursor){ ** near the end of a corrupt record. */ rc = dbdataBufferSize(&pCsr->rec, nPayload+DBDATA_PADDING_BYTES); if( rc!=SQLITE_OK ) return rc; + assert( pCsr->rec.aBuf!=0 ); assert( nPayload!=0 ); /* Load the nLocal bytes of payload */ diff --git a/manifest b/manifest index a4248c360b..6a5cc4cb81 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sfew\sminor\sTCL9\scompatibilities\sissues. -D 2024-08-09T22:48:11.754 +C Add\san\sassert()\sto\sfix\sa\sharmless\scompiler\swarning\sin\sthe\srecovery\nextension. +D 2024-08-10T09:56:36.016 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -481,7 +481,7 @@ F ext/rbu/rbuvacuum4.test ffccd22f67e2d0b380d2889685742159dfe0d19a3880ca3d2d1d69 F ext/rbu/sqlite3rbu.c 4a3376c0fb9a844a799ac529fb81260523f6b13c9f629bc270c632dbae5fc1f8 F ext/rbu/sqlite3rbu.h 9d923eb135c5d04aa6afd7c39ca47b0d1d0707c100e02f19fdde6a494e414304 F ext/rbu/test_rbu.c b9727c3394307d058e806c1da0f8bb7b24daf3c6bb94cb10cca88ea4d5c806c0 -F ext/recover/dbdata.c a22ecd689f00ff2ad33b5633c4ef84c8f088c65faeac18d4eb73c128395c7aec +F ext/recover/dbdata.c 5295f4f922b60d7035b6b9fd5846b13071b9d97ed7fad8496837bb7640d24771 F ext/recover/recover1.test e16d78e94183562abff569967b18b7c77451d7044365516cd0fe14713a284851 F ext/recover/recover_common.tcl a61306c1eb45c0c3fc45652c35b2d4ec19729e340bdf65a272ce4c229cefd85a F ext/recover/recoverbuild.test c74170e0f7b02456af41838afeb5353fdb985a48cc2331d661bbabbca7c6b8e3 @@ -2204,8 +2204,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b416756320dfb46ad72b843a7fbf18807d3fd1966251c320de626280b5238a5c -R 3713bfe5df240ec97ce0810792e582f6 +P 69eed19914ef52bc0101f4ae1c7b242df4ee28675b3581e1f4d60a35494f9f76 +R 1a957c9b84a4c71fe646dcbf28d160e3 U drh -Z 6bb203e3c3683b4f2854978314b46998 +Z fb95dff972d2b07ca88b4d892cd693f5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5c8d9489dc..9adeda1d93 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -69eed19914ef52bc0101f4ae1c7b242df4ee28675b3581e1f4d60a35494f9f76 +2502339339f3c831966479a400c2b1a531fb4d990b1776b4dc4870cf734c3fcd From 6010980914207275bcc82e58e534d2923667f631 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 10 Aug 2024 14:53:21 +0000 Subject: [PATCH 42/45] Fix behavior change in the offset() SQL function introduced by check-in [f0b671183f44d0ae]. FossilOrigin-Name: c2ac17f183082d6388336338b8d5c0b334095e5f77a27bc08419431f37471d22 --- manifest | 13 ++++++------- manifest.uuid | 2 +- src/where.c | 20 +++++++++----------- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/manifest b/manifest index 8f752559c5..6396d44aca 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhancements\sto\scovering-index\sprediction.\s\sIn\sparticular,\savoid\sthe\nfalse-positive\sprediction\sdescribed\sby\n[forum:/forumpost/e60e4c295d22f8ce|forum\spost\se60e4c295d22f8ce].\nAdd\searly\sdetection\sof\sover-prediction\sof\scovering-indexes\sso\sthat\nsqlite3_prepare()\swill\sreturn\san\serror\srather\sthan\sjust\sgenerate\sbad\nbytecode. -D 2024-08-10T10:05:22.244 +C Fix\sbehavior\schange\sin\sthe\soffset()\sSQL\sfunction\sintroduced\sby\s\ncheck-in\s[f0b671183f44d0ae]. +D 2024-08-10T14:53:21.552 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -846,7 +846,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/wal.c 887fc4ca3f020ebb2e376f222069570834ac63bf50111ef0cbf3ae417048ed89 F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452 F src/walker.c 7c7ea0115345851c3da4e04e2e239a29983b61fb5b038b94eede6aba462640e2 -F src/where.c 5fa17ec4e344e57cf43dd7b2977c95a518bfc2d43edb42df0cd1d5c2b42cee04 +F src/where.c 3556ef464ac78f4730f40c085aa0b6729ffe44306c0daaaffe9370c981a66d1d F src/whereInt.h 002adc3aa2cc10733b9b27958fdbe893987cd989fab25a9853941c1f9b9b0a65 F src/wherecode.c c9cac0b0b8e809c5e7e79d7796918907fb685ad99be2aaa9737f9787aa47349c F src/whereexpr.c 7d0d34b42b9edfd8e8ca66beb3a6ef63fe211c001af54caf2ccbcd989b783290 @@ -2204,9 +2204,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 2502339339f3c831966479a400c2b1a531fb4d990b1776b4dc4870cf734c3fcd 1de3e5883613ff6093203720f3cdcf6b3a3e626c99735284fae95a438e1ce24f -R aaaa5a801913afe54fe71ced56170454 -T +closed 1de3e5883613ff6093203720f3cdcf6b3a3e626c99735284fae95a438e1ce24f +P f0b671183f44d0ae294956e7651a1653f47bd6219f9636872d15993f30f28dfb +R df8366cfe7188a7576fdab4cc318948f U drh -Z ad30efef8eafa3ff536c4ae2785bb388 +Z 7afdd89a9e0f36ed074dbb50e50b24a5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index e7d37495c7..dd5d8ea8dd 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f0b671183f44d0ae294956e7651a1653f47bd6219f9636872d15993f30f28dfb +c2ac17f183082d6388336338b8d5c0b334095e5f77a27bc08419431f37471d22 diff --git a/src/where.c b/src/where.c index 15f5fe7d96..98e9f117f9 100644 --- a/src/where.c +++ b/src/where.c @@ -7358,20 +7358,18 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){ assert( pIdx->pTable==pTab ); #ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC if( pOp->opcode==OP_Offset ){ - x = 0; + /* Do not need to translate the column number */ }else #endif - { - if( !HasRowid(pTab) ){ - Index *pPk = sqlite3PrimaryKeyIndex(pTab); - x = pPk->aiColumn[x]; - assert( x>=0 ); - }else{ - testcase( x!=sqlite3StorageColumnToTable(pTab,x) ); - x = sqlite3StorageColumnToTable(pTab,x); - } - x = sqlite3TableColumnToIndex(pIdx, x); + if( !HasRowid(pTab) ){ + Index *pPk = sqlite3PrimaryKeyIndex(pTab); + x = pPk->aiColumn[x]; + assert( x>=0 ); + }else{ + testcase( x!=sqlite3StorageColumnToTable(pTab,x) ); + x = sqlite3StorageColumnToTable(pTab,x); } + x = sqlite3TableColumnToIndex(pIdx, x); if( x>=0 ){ pOp->p2 = x; pOp->p1 = pLevel->iIdxCur; From 4a9a5cbbe93611bec814eac20ffacee3bc352220 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 10 Aug 2024 15:05:22 +0000 Subject: [PATCH 43/45] Fix harmless compiler warning related to the TCL8-to-TCL9 transition. This change in testing code only and is not relevante to the core SQLite. FossilOrigin-Name: c86ef65545485eae6aca23b4582e8115d4edfdd6084afa77858e11b21aa270f6 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/test_hexio.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 6396d44aca..c9a5d32dfa 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sbehavior\schange\sin\sthe\soffset()\sSQL\sfunction\sintroduced\sby\s\ncheck-in\s[f0b671183f44d0ae]. -D 2024-08-10T14:53:21.552 +C Fix\sharmless\scompiler\swarning\srelated\sto\sthe\sTCL8-to-TCL9\stransition.\s\sThis\nchange\sin\stesting\scode\sonly\sand\sis\snot\srelevante\sto\sthe\score\sSQLite. +D 2024-08-10T15:05:22.550 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -791,7 +791,7 @@ F src/test_demovfs.c 3efa2adf4f21e10d95521721687d5ca047aea91fa62dd8cc22ac9e5a9c9 F src/test_devsym.c 649434ed34d0b03fbd5a6b42df80f0f9a7e53f94dd1710aad5dd8831e91c4e86 F src/test_fs.c c411c40baba679536fc34e2679349f59d8225570aed3488b5b3ef1908525a3d5 F src/test_func.c 8c0e89192f70fac307822d1ac2911ee51751288780b3db0c5ab5ca75fa0fe851 -F src/test_hexio.c af6db9300edd2d7b786a2d40d64177cad4b8ee22085e8ca5fe812cdeffdb6502 +F src/test_hexio.c 0f777bf9fbb2684bb4978372bacc90ef7337d5d9e3cebe067a9409941e88bacf F src/test_init.c 17313332d58e90defc527129d5eda4a08bd6b6e8de7207a231523c8d98fb445e F src/test_intarray.c e4216aadee9df2de7d1aee7e70f6b22c80ee79ece72a63d57105db74217639e5 F src/test_intarray.h 6c3534641108cd1bea517a8e117dcba237081310a29a4c35bd2190caa8972293 @@ -2204,8 +2204,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P f0b671183f44d0ae294956e7651a1653f47bd6219f9636872d15993f30f28dfb -R df8366cfe7188a7576fdab4cc318948f +P c2ac17f183082d6388336338b8d5c0b334095e5f77a27bc08419431f37471d22 +R cab61c0a74c96f8f1dca2569723fe61f U drh -Z 7afdd89a9e0f36ed074dbb50e50b24a5 +Z e34acd82ee8d24fbce707e518d148a3f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index dd5d8ea8dd..46703a088f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c2ac17f183082d6388336338b8d5c0b334095e5f77a27bc08419431f37471d22 +c86ef65545485eae6aca23b4582e8115d4edfdd6084afa77858e11b21aa270f6 diff --git a/src/test_hexio.c b/src/test_hexio.c index 8999d84d27..3c856b3306 100644 --- a/src/test_hexio.c +++ b/src/test_hexio.c @@ -401,7 +401,7 @@ static int SQLITE_TCLAPI make_fts3record( } for(i=0; i<(int)nArg; i++){ - sqlite3_int64 iVal; + Tcl_WideInt iVal; if( TCL_OK==Tcl_GetWideIntFromObj(0, aArg[i], &iVal) ){ if( nOut+10>nAlloc ){ int nNew = nAlloc?nAlloc*2:128; From 5af9fd53f420e0b73796bc30935586eb55af5dca Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 10 Aug 2024 15:46:57 +0000 Subject: [PATCH 44/45] Revision to check-in [d9f726ade6b258f8] so that OOM and other unrelated failures are not overridden by a syntax error in the tokenizer spec. FossilOrigin-Name: 3778b2a9ca1cc12a88ef6c32a1ee7c58a0a829ed9715a3d32a225d377d7527ef --- ext/fts5/fts5_tokenize.c | 6 +++--- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ext/fts5/fts5_tokenize.c b/ext/fts5/fts5_tokenize.c index 08de0d60d7..9f5cd24c3c 100644 --- a/ext/fts5/fts5_tokenize.c +++ b/ext/fts5/fts5_tokenize.c @@ -90,7 +90,7 @@ static int fts5AsciiCreate( rc = SQLITE_ERROR; } } - if( iiFoldParam!=0 && pNew->bFold==0 ){ rc = SQLITE_ERROR; diff --git a/manifest b/manifest index c9a5d32dfa..8e63952a76 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sharmless\scompiler\swarning\srelated\sto\sthe\sTCL8-to-TCL9\stransition.\s\sThis\nchange\sin\stesting\scode\sonly\sand\sis\snot\srelevante\sto\sthe\score\sSQLite. -D 2024-08-10T15:05:22.550 +C Revision\sto\scheck-in\s[d9f726ade6b258f8]\sso\sthat\sOOM\sand\sother\sunrelated\sfailures\nare\snot\soverridden\sby\sa\ssyntax\serror\sin\sthe\stokenizer\sspec. +D 2024-08-10T15:46:57.398 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -105,7 +105,7 @@ F ext/fts5/fts5_storage.c 1d7e08d4331da2f3f7e78e70eef2ed6a013d91ba16175c651adbc5 F ext/fts5/fts5_tcl.c 5ca3e3e35010d326f5b821a563e4fcde3913e052935f5c2c72c264122a26b48f F ext/fts5/fts5_test_mi.c 08c11ec968148d4cb4119d96d819f8c1f329812c568bac3684f5464be177d3ee F ext/fts5/fts5_test_tok.c 3cb0a9b508b30d17ef025ccddd26ae3dc8ddffbe76c057616e59a9aa85d36f3b -F ext/fts5/fts5_tokenize.c b1c3dc4de28f2532d9ee7be7182a96f943fa09fcc31c6f271d69dce72874ff8c +F ext/fts5/fts5_tokenize.c 63ebe9057ed3f4dfc49944bc4aee3d3b745cc2faff73bc152ed3554ed3bf9cf4 F ext/fts5/fts5_unicode2.c eca63dbc797f8ff0572e97caf4631389c0ab900d6364861b915bdd4735973f00 F ext/fts5/fts5_varint.c e64d2113f6e1bfee0032972cffc1207b77af63319746951bf1d09885d1dadf80 F ext/fts5/fts5_vocab.c e4830b00809e5da53bc10f93adc59e321407b0f801c7f4167c0e47f5552267e0 @@ -2204,8 +2204,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c2ac17f183082d6388336338b8d5c0b334095e5f77a27bc08419431f37471d22 -R cab61c0a74c96f8f1dca2569723fe61f +P c86ef65545485eae6aca23b4582e8115d4edfdd6084afa77858e11b21aa270f6 +R ebd14146d6fe15d97f2e7243900bc453 U drh -Z e34acd82ee8d24fbce707e518d148a3f +Z fd712f59ba7388bc8eea12ab1bbe8630 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 46703a088f..ee6795d147 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c86ef65545485eae6aca23b4582e8115d4edfdd6084afa77858e11b21aa270f6 +3778b2a9ca1cc12a88ef6c32a1ee7c58a0a829ed9715a3d32a225d377d7527ef From 195ef6baca68b52b4321a5d8b780b11b25f59d8a Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 10 Aug 2024 19:57:28 +0000 Subject: [PATCH 45/45] Prevent the fts5 xPhraseNext() or xPhraseFirst() APIs from returning an out-of-range column number, even if the database is corrupt. FossilOrigin-Name: d4014c87ba9b011a6a04c2bf85879b668dc762ebcbbfb50a2f8a417ce594ef88 --- ext/fts5/fts5_main.c | 9 ++++++--- ext/fts5/test/fts5corrupt3.test | 13 +++++++++---- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/ext/fts5/fts5_main.c b/ext/fts5/fts5_main.c index c6e7e346aa..c862e2f956 100644 --- a/ext/fts5/fts5_main.c +++ b/ext/fts5/fts5_main.c @@ -2235,11 +2235,10 @@ static void *fts5ApiGetAuxdata(Fts5Context *pCtx, int bClear){ } static void fts5ApiPhraseNext( - Fts5Context *pUnused, + Fts5Context *pCtx, Fts5PhraseIter *pIter, int *piCol, int *piOff ){ - UNUSED_PARAM(pUnused); if( pIter->a>=pIter->b ){ *piCol = -1; *piOff = -1; @@ -2247,8 +2246,12 @@ static void fts5ApiPhraseNext( int iVal; pIter->a += fts5GetVarint32(pIter->a, iVal); if( iVal==1 ){ + /* Avoid returning a (*piCol) value that is too large for the table, + ** even if the position-list is corrupt. The caller might not be + ** expecting it. */ + int nCol = ((Fts5Table*)(((Fts5Cursor*)pCtx)->base.pVtab))->pConfig->nCol; pIter->a += fts5GetVarint32(pIter->a, iVal); - *piCol = iVal; + *piCol = (iVal>=nCol ? nCol-1 : iVal); *piOff = 0; pIter->a += fts5GetVarint32(pIter->a, iVal); } diff --git a/ext/fts5/test/fts5corrupt3.test b/ext/fts5/test/fts5corrupt3.test index e2a91e51ef..cfe1438eda 100644 --- a/ext/fts5/test/fts5corrupt3.test +++ b/ext/fts5/test/fts5corrupt3.test @@ -8958,7 +8958,6 @@ do_catchsql_test 61.2 { SELECT * FROM t3 ORDER BY rowid; } {/*malformed database schema*/} -breakpoint #------------------------------------------------------------------------- do_test 62.0 { sqlite3 db {} @@ -10768,6 +10767,7 @@ do_catchsql_test 73.1 { reset_db do_test 74.0 { sqlite3 db {} + sqlite3_fts5_register_matchinfo db db deserialize [decode_hexdb { | size 106496 pagesize 4096 filename x.db | page 1 offset 0 @@ -14587,14 +14587,19 @@ do_test 74.0 { | end x.db }]} {} -do_catchsql_test 74.1 { - SELECT rowid, quote(matchinfo(t1,'p�xyb