From 9c8235b1bd62faa9afbcf85523980be8b908f075 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 18 Nov 2024 13:29:16 +0000 Subject: [PATCH 01/20] Fix minor problems in testrunner.tcl that pop up when the command-line arguments are such that no tests are run. FossilOrigin-Name: 321ded32f67550e964cd64d61aa0cbc0029ce2fdee4588a46b01dbb5aa87150b --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/testrunner.tcl | 3 +++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 209310638f..187a7787d8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\sthe\s--vfstrace\soutput\sfrom\sthe\sCLI\sgo\sto\sthe\ssame\soutput\schannel\sas\neverything\selse. -D 2024-11-17T11:42:43.363 +C Fix\sminor\sproblems\sin\stestrunner.tcl\sthat\spop\sup\swhen\sthe\scommand-line\sarguments\nare\ssuch\sthat\sno\stests\sare\srun. +D 2024-11-18T13:29:16.826 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -1719,7 +1719,7 @@ F test/temptable2.test 76821347810ecc88203e6ef0dd6897b6036ac788e9dd3e6b04fd4d163 F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637 F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc F test/tester.tcl 7b44f1a9b9a2de8112695b908afc21dd9a68cd2d44e84b73f1b27b53492c0d59 -F test/testrunner.tcl c40d5700578f8c9d00e0e15f105f645c471bc2c48eb8b013bd2953400f2c6bf0 x +F test/testrunner.tcl 90ed8b6c2b26dc1f6af08aeb04670a5df86172f3d9828d8af000f972afa50061 x F test/testrunner_data.tcl ba4aeea28aa03cfa6fe7e57782ddecb7a7b91c3a0b3251583cb4f0ee002de6a6 F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899 F test/thread002.test c24c83408e35ba5a952a3638b7ac03ccdf1ce4409289c54a050ac4c5f1de7502 @@ -2198,8 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d07be336eaeb9a5d56ac6e1b63f4d8e50d3ac236f5953cc178ef34542a7cd8fa -R 173665514e770745563aa2982f85029a +P f71d4900205ae6ee41f849c4026d0fe4d6cf281dfc3bac8105fc8e242d128b67 +R c842f5cfce9a13599fcce2ed5a6b5bb2 U drh -Z d67df32afae4b3e2bba6c9bfe32d205b +Z c55681dc305689429003d496466dfaa7 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 611653469b..527bf0148d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f71d4900205ae6ee41f849c4026d0fe4d6cf281dfc3bac8105fc8e242d128b67 +321ded32f67550e964cd64d61aa0cbc0029ce2fdee4588a46b01dbb5aa87150b diff --git a/test/testrunner.tcl b/test/testrunner.tcl index 889bfeaffd..d365092e05 100755 --- a/test/testrunner.tcl +++ b/test/testrunner.tcl @@ -465,6 +465,7 @@ if {[string compare -nocase script [lindex $argv 0]]==0} { # number of milliseconds in the argument. # proc elapsetime {ms} { + if {$ms==""} {set ms 0} set s [expr {int(($ms+500.0)*0.001)}] set hr [expr {$s/3600}] set mn [expr {($s/60)%60}] @@ -1603,6 +1604,8 @@ proc run_testset {} { SELECT pltfm, count(*) FROM jobs WHERE pltfm IS NOT NULL ORDER BY 2 DESC LIMIT 1 } break + if {$totalerr==""} {set totalerr 0} + if {$totaltest==""} {set totaltest 0} puts "$totalerr errors out of $totaltest tests in $et $pltfm" trdb eval { SELECT DISTINCT substr(svers,1,79) as v1 FROM jobs WHERE svers IS NOT NULL From de8aa17eb51b420488235556f37300a31cfee673 Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 18 Nov 2024 14:08:42 +0000 Subject: [PATCH 02/20] Fix a "applying zero offset to null pointer" usan error in the fts5 trigram tokenizer. FossilOrigin-Name: 9b79b999d4192a3a250bf343825f61e9cb83203e4d94dcfa20c320d5f1386d69 --- ext/fts5/fts5_tokenize.c | 2 +- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ext/fts5/fts5_tokenize.c b/ext/fts5/fts5_tokenize.c index f10c2379de..b8a1136465 100644 --- a/ext/fts5/fts5_tokenize.c +++ b/ext/fts5/fts5_tokenize.c @@ -1353,7 +1353,7 @@ static int fts5TriTokenize( char *zOut = aBuf; int ii; const unsigned char *zIn = (const unsigned char*)pText; - const unsigned char *zEof = &zIn[nText]; + const unsigned char *zEof = (zIn ? &zIn[nText] : 0); u32 iCode = 0; int aStart[3]; /* Input offset of each character in aBuf[] */ diff --git a/manifest b/manifest index 187a7787d8..63d697d849 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sminor\sproblems\sin\stestrunner.tcl\sthat\spop\sup\swhen\sthe\scommand-line\sarguments\nare\ssuch\sthat\sno\stests\sare\srun. -D 2024-11-18T13:29:16.826 +C Fix\sa\s"applying\szero\soffset\sto\snull\spointer"\susan\serror\sin\sthe\sfts5\strigram\stokenizer. +D 2024-11-18T14:08:42.960 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -116,7 +116,7 @@ F ext/fts5/fts5_storage.c 337b05e4c66fc822d031e264d65bde807ec2fab08665ca2cc8aaf9 F ext/fts5/fts5_tcl.c 7fb5a3d3404099075aaa2457307cb459bbc257c0de3dbd52b1e80a5b503e0329 F ext/fts5/fts5_test_mi.c 08c11ec968148d4cb4119d96d819f8c1f329812c568bac3684f5464be177d3ee F ext/fts5/fts5_test_tok.c 3cb0a9b508b30d17ef025ccddd26ae3dc8ddffbe76c057616e59a9aa85d36f3b -F ext/fts5/fts5_tokenize.c 87ab719f0556172da3414f1741c11bb4d333ebecde157945a55478bfe6e46c44 +F ext/fts5/fts5_tokenize.c 49aea8cc400a690a6c4f83c4cedc67f4f8830c6789c4ee343404f62bcaebca7b F ext/fts5/fts5_unicode2.c 6f9b0fb79a8facaed76628ffd4eb9c16d7f2b84b52872784f617cf3422a9b043 F ext/fts5/fts5_varint.c e64d2113f6e1bfee0032972cffc1207b77af63319746951bf1d09885d1dadf80 F ext/fts5/fts5_vocab.c e4830b00809e5da53bc10f93adc59e321407b0f801c7f4167c0e47f5552267e0 @@ -2198,8 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P f71d4900205ae6ee41f849c4026d0fe4d6cf281dfc3bac8105fc8e242d128b67 -R c842f5cfce9a13599fcce2ed5a6b5bb2 -U drh -Z c55681dc305689429003d496466dfaa7 +P 321ded32f67550e964cd64d61aa0cbc0029ce2fdee4588a46b01dbb5aa87150b +R 9bcf58276e7ecc61be5b475731de0f25 +U dan +Z 37f8f1c1585e0f2f0b48eafeda549304 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 527bf0148d..9c97ee409c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -321ded32f67550e964cd64d61aa0cbc0029ce2fdee4588a46b01dbb5aa87150b +9b79b999d4192a3a250bf343825f61e9cb83203e4d94dcfa20c320d5f1386d69 From 0df847cc776131919935658230fe2e629906dabb Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 18 Nov 2024 14:15:08 +0000 Subject: [PATCH 03/20] Remove the .POSIX entries from the makefiles because they cause portability problems rather than solve them. FossilOrigin-Name: e1330ecf170436678c5c235557fb95b8acbf4fad62583edba4af03aff49afbc5 --- Makefile.in | 1 - main.mk | 1 - manifest | 16 ++++++++-------- manifest.uuid | 2 +- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Makefile.in b/Makefile.in index 500b5eb0b7..b374bd4838 100644 --- a/Makefile.in +++ b/Makefile.in @@ -9,7 +9,6 @@ # The docs for many of its variables are in the primary static # makefile, main.mk (which this one includes at runtime). # -.POSIX: #maintenance reminder: X:=Y is not POSIX-portable all: ######################################################################## # diff --git a/main.mk b/main.mk index 83efa78249..a22c0fe775 100644 --- a/main.mk +++ b/main.mk @@ -18,7 +18,6 @@ # invoked. This file will use defaults, very possibly invalid, for any # which are not defined. ######################################################################## -.POSIX: #maintenance reminder: X:=Y is not POSIX-portable all: # # $(TOP) = diff --git a/manifest b/manifest index 63d697d849..6aeda5c46f 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Fix\sa\s"applying\szero\soffset\sto\snull\spointer"\susan\serror\sin\sthe\sfts5\strigram\stokenizer. -D 2024-11-18T14:08:42.960 +C Remove\sthe\s.POSIX\sentries\sfrom\sthe\smakefiles\sbecause\sthey\scause\sportability\sproblems\srather\sthan\ssolve\sthem. +D 2024-11-18T14:15:08.975 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d -F Makefile.in 2c90ab3183f810086878a784c323b7816238a5e6943d267c25a71edc623a05a3 +F Makefile.in c3a01e98bd2ae6a4631df02f11249ac07ffa3d540d3034e2675f66cc259f2ea7 F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0 F Makefile.msc a92237976eb92c5efaa0dd2524746aec12c196e12df8d4dbff9543a4648c3312 F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159 @@ -696,7 +696,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make bc8bb227f35d5bd3863a7bd2233437c37472a0d81585979f058f9b9b503bef35 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk e2287ed82f924c9d54493634dc7bb10797b8ef69ce7becef62d6a453337d5a45 +F main.mk c4e37e3015f9c2d8fd20fa3071ba86e7396959c8d5960e37e95aa85421e2b739 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2198,8 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 321ded32f67550e964cd64d61aa0cbc0029ce2fdee4588a46b01dbb5aa87150b -R 9bcf58276e7ecc61be5b475731de0f25 -U dan -Z 37f8f1c1585e0f2f0b48eafeda549304 +P 9b79b999d4192a3a250bf343825f61e9cb83203e4d94dcfa20c320d5f1386d69 +R 327f4f8a7444c4d4336a89e4ec576fd8 +U stephan +Z e12fcd84e46ac65f835dccb3914d7b22 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9c97ee409c..82e8bdd0a3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9b79b999d4192a3a250bf343825f61e9cb83203e4d94dcfa20c320d5f1386d69 +e1330ecf170436678c5c235557fb95b8acbf4fad62583edba4af03aff49afbc5 From 5cad859f61145644513cdf901afbb8d88dcc9b9b Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 18 Nov 2024 16:44:26 +0000 Subject: [PATCH 04/20] Attempt to reduce divergence with begin-concurrent. FossilOrigin-Name: f783d90187fb326faa3d0244b30138b023c4a8483486f260b7a022a927c13f3a --- manifest | 18 +++++++++--------- manifest.uuid | 2 +- src/parse.y | 11 +++++++++-- test/corruptN.test | 9 --------- test/wal_common.tcl | 40 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 59 insertions(+), 21 deletions(-) diff --git a/manifest b/manifest index 6aeda5c46f..4cb717bf18 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sthe\s.POSIX\sentries\sfrom\sthe\smakefiles\sbecause\sthey\scause\sportability\sproblems\srather\sthan\ssolve\sthem. -D 2024-11-18T14:15:08.975 +C Attempt\sto\sreduce\sdivergence\swith\sbegin-concurrent. +D 2024-11-18T16:44:26.814 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -763,7 +763,7 @@ F src/os_win.c db4baa8f62bbfe3967c71b008cea31a8f2ff337c1667ff4d8a677e697315ff0d F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a F src/pager.c 9656ad4e8331efb8a4f94f7a0c6440b98caea073950a367ea0c728a53b8e62c9 F src/pager.h 4b1140d691860de0be1347474c51fee07d5420bd7f802d38cbab8ea4ab9f538a -F src/parse.y 8ec56598aa0df92428627502267d0d1c9778cc27308f8ffd31dfb2d017a8755f +F src/parse.y dcf45a81b61223ac93e61fdfe9b22d635dd371c446e8222634d90aa37e25e5f6 F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484 F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5 F src/pcache1.c 49516ad7718a3626f28f710fa7448ef1fce3c07fd169acbb4817341950264319 @@ -1041,7 +1041,7 @@ F test/corruptJ.test 4d5ccc4bf959464229a836d60142831ef76a5aa4 F test/corruptK.test ac13504593d89d69690d45479547616ed12644d42b5cb7eeb2e759a76fc23dcb F test/corruptL.test 652fc8ac0763a6fd3eb28b951d481924167b2d9936083bcc68253b2274a0c8fe F test/corruptM.test 7d574320e08c1b36caa3e47262061f186367d593a7e305d35f15289cc2c3e067 -F test/corruptN.test 40bc47aee4af9aadff902be43f14d69dc17b3731448dad6c7cc722da913f1455 +F test/corruptN.test a034bb217bebd8d007625dfb078e76ec3d53515052dbceb68bd47b2c27674d5c F test/cost.test cc434a026b1e9d0d98137a147e24e5daf1b1ad09e9ff7da63b34c83ddd136d92 F test/count.test cd4bd531066e8d77ef8fe1e3fc8253d042072e117ccab214b290cf83f1602249 F test/countofview.test 4088e461a10ee33e69803c177a69aa1d7bba81a9ffc2df66d76465a22ca7fdfc @@ -1995,7 +1995,7 @@ F test/wal64k.test 2a525c0f45d709bae3765c71045ccec5df7d100ccbd3a7860fdba46c9addb F test/wal7.test 2ae8f427d240099cc4b2dfef63cff44e2a68a1bd F test/wal8.test d9df3fba4caad5854ed69ed673c68482514203c8 F test/wal9.test 378e76a9ad09cd9bee06c172ad3547b0129a6750 -F test/wal_common.tcl 4589f701d5527ace2eba43823c96c2177e1f9dd2a6098256ee2203a0a313c13a +F test/wal_common.tcl 204d1721ac13c5e0c7fae6380315b5ab7f4e8423f580d826c5e9df1995cb018d F test/walbak.test 018d4e5a3d45c6298d11b99f09a8ef6876527946 F test/walbig.test f437473a16cfb314867c6b5d1dbcd519e73e3434 F test/walblock.test be48f3a75eff0b4456209f26b3ce186c2015497d @@ -2198,8 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9b79b999d4192a3a250bf343825f61e9cb83203e4d94dcfa20c320d5f1386d69 -R 327f4f8a7444c4d4336a89e4ec576fd8 -U stephan -Z e12fcd84e46ac65f835dccb3914d7b22 +P e1330ecf170436678c5c235557fb95b8acbf4fad62583edba4af03aff49afbc5 +R f888b7564d00e145c0007eac37a11cdd +U drh +Z 42957bc99f867ff6f91e562cbfd36cd8 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 82e8bdd0a3..a9ea9de121 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e1330ecf170436678c5c235557fb95b8acbf4fad62583edba4af03aff49afbc5 +f783d90187fb326faa3d0244b30138b023c4a8483486f260b7a022a927c13f3a diff --git a/src/parse.y b/src/parse.y index 8fdea9bfa3..b8d904d12c 100644 --- a/src/parse.y +++ b/src/parse.y @@ -43,7 +43,7 @@ %syntax_error { UNUSED_PARAMETER(yymajor); /* Silence some compiler warnings */ if( TOKEN.z[0] ){ - sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN); + parserSyntaxError(pParse, &TOKEN); }else{ sqlite3ErrorMsg(pParse, "incomplete input"); } @@ -111,6 +111,13 @@ struct TrigEvent { int a; IdList * b; }; struct FrameBound { int eType; Expr *pExpr; }; +/* +** Generate a syntax error +*/ +static void parserSyntaxError(Parse *pParse, Token *p){ + sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", p); +} + /* ** Disable lookaside memory allocation for objects that might be ** shared across database connections. @@ -1156,7 +1163,7 @@ expr(A) ::= VARIABLE(X). { Token t = X; /*A-overwrites-X*/ assert( t.n>=2 ); if( pParse->nested==0 ){ - sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t); + parserSyntaxError(pParse, &t); A = 0; }else{ A = sqlite3PExpr(pParse, TK_REGISTER, 0, 0); diff --git a/test/corruptN.test b/test/corruptN.test index 8108609c09..2297991aba 100644 --- a/test/corruptN.test +++ b/test/corruptN.test @@ -141,15 +141,6 @@ do_test 2.0 { | end c-b92b.txt.db }]} {} -# This test only works with the legacy RC4 PRNG -if 0 { - prng_seed 0 db - do_catchsql_test 2.1 { - SELECT count(*) FROM sqlite_schema; - WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<1000) - INSERT INTO t1(a) SELECT randomblob(null) FROM c; - } {1 {database disk image is malformed}} -} reset_db if {![info exists ::G(perm:presql)]} { diff --git a/test/wal_common.tcl b/test/wal_common.tcl index cdba53b5b2..d31131aa02 100644 --- a/test/wal_common.tcl +++ b/test/wal_common.tcl @@ -87,3 +87,43 @@ proc wal_fix_walindex_cksum {hdrvar} { lset hdr 10 $c1 lset hdr 11 $c2 } + +# This command assumes that $file is the name of a database file opened +# in wal mode using a [testvfs] VFS. It returns a list of the 12 32-bit +# integers that make up the wal-index-header for the named file. +# +proc set_tvfs_hdr {file args} { + + # Set $nHdr to the number of bytes in the wal-index header: + set nHdr 48 + set nInt [expr {$nHdr/4}] + + if {[llength $args]>2} { + error {wrong # args: should be "set_tvfs_hdr fileName ?val1? ?val2?"} + } + + set blob [tvfs shm $file] + if {$::tcl_platform(byteOrder)=="bigEndian"} {set fmt I} {set fmt i} + + if {[llength $args]} { + set ia [lindex $args 0] + set ib $ia + if {[llength $args]==2} { + set ib [lindex $args 1] + } + binary scan $blob a[expr $nHdr*2]a* dummy tail + set blob [binary format ${fmt}${nInt}${fmt}${nInt}a* $ia $ib $tail] + tvfs shm $file $blob + } + + binary scan $blob ${fmt}${nInt} ints + return $ints +} + +proc incr_tvfs_hdr {file idx incrval} { + set ints [set_tvfs_hdr $file] + set v [lindex $ints $idx] + incr v $incrval + lset ints $idx $v + set_tvfs_hdr $file $ints +} From 12599d566bd3f905e70e991839d08638101e9e50 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 18 Nov 2024 17:05:45 +0000 Subject: [PATCH 05/20] Attempt to reduce divergence with the wal2 branch. FossilOrigin-Name: e0d8f9916c2d899094b71af74f44e089a97db6d80f09eb80a5d8be733c1bf942 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/test_hexio.c | 22 +++++++++++++++++----- test/savepoint6.test | 17 ++++++++++++++--- 4 files changed, 39 insertions(+), 16 deletions(-) diff --git a/manifest b/manifest index 4cb717bf18..8984444fe6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Attempt\sto\sreduce\sdivergence\swith\sbegin-concurrent. -D 2024-11-18T16:44:26.814 +C Attempt\sto\sreduce\sdivergence\swith\sthe\swal2\sbranch. +D 2024-11-18T17:05:45.350 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -804,7 +804,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 0f777bf9fbb2684bb4978372bacc90ef7337d5d9e3cebe067a9409941e88bacf +F src/test_hexio.c 7449504e4bde876ba91b202617a9228c7c8c2e7bd8b957302f3803ac0e9e353c F src/test_init.c 17313332d58e90defc527129d5eda4a08bd6b6e8de7207a231523c8d98fb445e F src/test_intarray.c e4216aadee9df2de7d1aee7e70f6b22c80ee79ece72a63d57105db74217639e5 F src/test_intarray.h 6c3534641108cd1bea517a8e117dcba237081310a29a4c35bd2190caa8972293 @@ -1583,7 +1583,7 @@ F test/savepoint.test 6e9804a17767f08432c7a5e738b9a8f4b891d243110b63d3a41d270d3d F test/savepoint2.test 9b8543940572a2f01a18298c3135ad0c9f4f67d7 F test/savepoint4.test c8f8159ade6d2acd9128be61e1230f1c1edc6cc0 F test/savepoint5.test 0735db177e0ebbaedc39812c8d065075d563c4fd -F test/savepoint6.test f41279c5e137139fa5c21485773332c7adb98cd7 +F test/savepoint6.test 48a645a7bb3a59a6fcf06a7364cfe5b655c336760de39068f7c241b0fc80d963 F test/savepoint7.test cde525ea3075283eb950cdcdefe23ead4f700daa F test/savepointfault.test f044eac64b59f09746c7020ee261734de82bf9b2 F test/scanstatus.test b249328caf4d317e71058006872b8012598a5fa045b30bf24a81eeff650ab49e @@ -2198,8 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e1330ecf170436678c5c235557fb95b8acbf4fad62583edba4af03aff49afbc5 -R f888b7564d00e145c0007eac37a11cdd +P f783d90187fb326faa3d0244b30138b023c4a8483486f260b7a022a927c13f3a +R 6377acb59760f57785ee6902b4729fcf U drh -Z 42957bc99f867ff6f91e562cbfd36cd8 +Z a7e2057b268c20267be2a2d81b2bdc9a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index a9ea9de121..d63c796f20 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f783d90187fb326faa3d0244b30138b023c4a8483486f260b7a022a927c13f3a +e0d8f9916c2d899094b71af74f44e089a97db6d80f09eb80a5d8be733c1bf942 diff --git a/src/test_hexio.c b/src/test_hexio.c index 3c856b3306..1a21e89aa0 100644 --- a/src/test_hexio.c +++ b/src/test_hexio.c @@ -187,7 +187,7 @@ static int SQLITE_TCLAPI hexio_write( } /* -** USAGE: hexio_get_int HEXDATA +** USAGE: hexio_get_int [-littleendian] HEXDATA ** ** Interpret the HEXDATA argument as a big-endian integer. Return ** the value of that integer. HEXDATA can contain between 2 and 8 @@ -205,12 +205,20 @@ static int SQLITE_TCLAPI hexio_get_int( const unsigned char *zIn; unsigned char *aOut; unsigned char aNum[4]; + int bLittle = 0; - if( objc!=2 ){ - Tcl_WrongNumArgs(interp, 1, objv, "HEXDATA"); + if( objc==3 ){ + Tcl_Size n; + char *z = Tcl_GetStringFromObj(objv[1], &n); + if( n>=2 && n<=13 && memcmp(z, "-littleendian", n)==0 ){ + bLittle = 1; + } + } + if( (objc-bLittle)!=2 ){ + Tcl_WrongNumArgs(interp, 1, objv, "[-littleendian] HEXDATA"); return TCL_ERROR; } - zIn = (const unsigned char *)Tcl_GetStringFromObj(objv[1], &nIn); + zIn = (const unsigned char *)Tcl_GetStringFromObj(objv[1+bLittle], &nIn); aOut = sqlite3_malloc64( 1 + nIn/2 ); if( aOut==0 ){ return TCL_ERROR; @@ -223,7 +231,11 @@ static int SQLITE_TCLAPI hexio_get_int( memcpy(&aNum[4-nOut], aOut, nOut); } sqlite3_free(aOut); - val = (aNum[0]<<24) | (aNum[1]<<16) | (aNum[2]<<8) | aNum[3]; + if( bLittle ){ + val = (int)((u32)aNum[3]<<24) | (aNum[2]<<16) | (aNum[1]<<8) | aNum[0]; + }else{ + val = (int)((u32)aNum[0]<<24) | (aNum[1]<<16) | (aNum[2]<<8) | aNum[3]; + } Tcl_SetObjResult(interp, Tcl_NewIntObj(val)); return TCL_OK; } diff --git a/test/savepoint6.test b/test/savepoint6.test index b1d0d46f5c..6b41ef2da9 100644 --- a/test/savepoint6.test +++ b/test/savepoint6.test @@ -15,6 +15,10 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl proc sql {zSql} { + if {0 && $::debug_op} { + puts stderr "$zSql ;" + flush stderr + } uplevel db eval [list $zSql] #puts stderr "$zSql ;" } @@ -67,11 +71,13 @@ proc x_to_y {x} { # delete_rows XVALUES # proc savepoint {zName} { + if {$::debug_op} { puts stderr "savepoint $zName" ; flush stderr } catch { sql "SAVEPOINT $zName" } lappend ::lSavepoint [list $zName [array get ::aEntry]] } proc rollback {zName} { + if {$::debug_op} { puts stderr "rollback $zName" ; flush stderr } catch { sql "ROLLBACK TO $zName" } for {set i [expr {[llength $::lSavepoint]-1}]} {$i>=0} {incr i -1} { set zSavepoint [lindex $::lSavepoint $i 0] @@ -89,6 +95,7 @@ proc rollback {zName} { } proc release {zName} { + if {$::debug_op} { puts stderr "release $zName" ; flush stderr } catch { sql "RELEASE $zName" } for {set i [expr {[llength $::lSavepoint]-1}]} {$i>=0} {incr i -1} { set zSavepoint [lindex $::lSavepoint $i 0] @@ -104,6 +111,7 @@ proc release {zName} { } proc insert_rows {lX} { + if {$::debug_op} { puts stderr "insert_rows $lX" ; flush stderr } foreach x $lX { set y [x_to_y $x] @@ -116,6 +124,7 @@ proc insert_rows {lX} { } proc delete_rows {lX} { + if {$::debug_op} { puts stderr "delete_rows $lX" ; flush stderr } foreach x $lX { # Update database [db] sql "DELETE FROM t1 WHERE x = $x" @@ -164,6 +173,11 @@ proc random_integers {nRes nRange} { } #------------------------------------------------------------------------- +set ::debug_op 0 +proc debug_ops {} { + set ::debug_op 1 +} + proc database_op {} { set i [expr int(rand()*2)] if {$i==0} { @@ -185,9 +199,6 @@ proc savepoint_op {} { set C [lindex $cmds [expr int(rand()*6)]] set N [lindex $names [expr int(rand()*5)]] - #puts stderr " $C $N ; " - #flush stderr - $C $N return ok } From ea206ad17ba0b40ff69539ffc61067396a024ce2 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 18 Nov 2024 18:45:31 +0000 Subject: [PATCH 06/20] Reduce divergence from begin-concurrent. FossilOrigin-Name: 84d41e9d04c62601e84621e8edb3b81abbacc366a6b5e7059f8b6796fade7ffa --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/wal2.test | 37 ------------------------------------- 3 files changed, 7 insertions(+), 44 deletions(-) diff --git a/manifest b/manifest index 8984444fe6..42c69a71fa 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Attempt\sto\sreduce\sdivergence\swith\sthe\swal2\sbranch. -D 2024-11-18T17:05:45.350 +C Reduce\sdivergence\sfrom\sbegin-concurrent. +D 2024-11-18T18:45:31.904 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -1986,7 +1986,7 @@ F test/vtabdistinct.test 7688f0889358f849fd60bbfde1ded38b014b18066076d4bfbb75395 F test/vtabdrop.test 65d4cf6722972e5499bdaf0c0d70ee3b8133944a4e4bc31862563f32a7edca12 F test/vtabrhs1.test 9b5ecbc74a689500c33a4b2b36761f9bcc22fcc4e3f9d21066ee0c9c74cf5f6c F test/wal.test 519c550255c78f55959e9159b93ebbfad2b4e9f36f5b76284da41f572f9d27da -F test/wal2.test 44fe1cb4935dbbddfa0a34c2c4fd90f0ba8654d59b83c4136eb90fb327fd264f +F test/wal2.test e89ca97593b5e92849039f6b68ce1719a853ef20fa22c669ec1ac452fbc31cab F test/wal3.test 5de023bb862fd1eb9d2ad26fa8d9c43abb5370582e5b08b2ae0d6f93661bc310 F test/wal4.test 4744e155cd6299c6bd99d3eab1c82f77db9cdb3c F test/wal5.test 9c11da7aeccd83a46d79a556ad11a18d3cb15aa9 @@ -2198,8 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P f783d90187fb326faa3d0244b30138b023c4a8483486f260b7a022a927c13f3a -R 6377acb59760f57785ee6902b4729fcf +P e0d8f9916c2d899094b71af74f44e089a97db6d80f09eb80a5d8be733c1bf942 +R 15b624443bf22191f7b1a220224ff1ba U drh -Z a7e2057b268c20267be2a2d81b2bdc9a +Z e17d5ca17fa701911504cdcf5a540396 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d63c796f20..125d18f312 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e0d8f9916c2d899094b71af74f44e089a97db6d80f09eb80a5d8be733c1bf942 +84d41e9d04c62601e84621e8edb3b81abbacc366a6b5e7059f8b6796fade7ffa diff --git a/test/wal2.test b/test/wal2.test index 5e4c4ebc27..5ef303edc6 100644 --- a/test/wal2.test +++ b/test/wal2.test @@ -35,43 +35,6 @@ proc cond_incr_sync_count {adj} { } } -proc set_tvfs_hdr {file args} { - - # Set $nHdr to the number of bytes in the wal-index header: - set nHdr 48 - set nInt [expr {$nHdr/4}] - - if {[llength $args]>2} { - error {wrong # args: should be "set_tvfs_hdr fileName ?val1? ?val2?"} - } - - set blob [tvfs shm $file] - if {$::tcl_platform(byteOrder)=="bigEndian"} {set fmt I} {set fmt i} - - if {[llength $args]} { - set ia [lindex $args 0] - set ib $ia - if {[llength $args]==2} { - set ib [lindex $args 1] - } - binary scan $blob a[expr $nHdr*2]a* dummy tail - set blob [binary format ${fmt}${nInt}${fmt}${nInt}a* $ia $ib $tail] - tvfs shm $file $blob - } - - binary scan $blob ${fmt}${nInt} ints - return $ints -} - -proc incr_tvfs_hdr {file idx incrval} { - set ints [set_tvfs_hdr $file] - set v [lindex $ints $idx] - incr v $incrval - lset ints $idx $v - set_tvfs_hdr $file $ints -} - - #------------------------------------------------------------------------- # Test case wal2-1.*: # From fefc7b1bf77b9dda26266205a93adf496b36f454 Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 19 Nov 2024 11:58:32 +0000 Subject: [PATCH 07/20] Fix a problem handling OOM errors in fts3 that could occur when parsing multi-token strings. FossilOrigin-Name: 4c4d1db00bd2c522165876dcf1606116a72525d9ffc891b266213704e25cde55 --- ext/fts3/fts3_expr.c | 33 ++++++++++++++++----------------- manifest | 16 ++++++++-------- manifest.uuid | 2 +- test/fts3fault.test | 8 ++++++++ 4 files changed, 33 insertions(+), 26 deletions(-) diff --git a/ext/fts3/fts3_expr.c b/ext/fts3/fts3_expr.c index ea8167c595..9e201b1684 100644 --- a/ext/fts3/fts3_expr.c +++ b/ext/fts3/fts3_expr.c @@ -319,10 +319,11 @@ static int getNextString( Fts3PhraseToken *pToken; p = fts3ReallocOrFree(p, nSpace + ii*sizeof(Fts3PhraseToken)); - if( !p ) goto no_mem; - zTemp = fts3ReallocOrFree(zTemp, nTemp + nByte); - if( !zTemp ) goto no_mem; + if( !zTemp || !p ){ + rc = SQLITE_NOMEM; + goto getnextstring_out; + } assert( nToken==ii ); pToken = &((Fts3Phrase *)(&p[1]))->aToken[ii]; @@ -337,9 +338,6 @@ static int getNextString( nToken = ii+1; } } - - pModule->xClose(pCursor); - pCursor = 0; } if( rc==SQLITE_DONE ){ @@ -347,7 +345,10 @@ static int getNextString( char *zBuf = 0; p = fts3ReallocOrFree(p, nSpace + nToken*sizeof(Fts3PhraseToken) + nTemp); - if( !p ) goto no_mem; + if( !p ){ + rc = SQLITE_NOMEM; + goto getnextstring_out; + } memset(p, 0, (char *)&(((Fts3Phrase *)&p[1])->aToken[0])-(char *)p); p->eType = FTSQUERY_PHRASE; p->pPhrase = (Fts3Phrase *)&p[1]; @@ -355,11 +356,9 @@ static int getNextString( p->pPhrase->nToken = nToken; zBuf = (char *)&p->pPhrase->aToken[nToken]; + assert( nTemp==0 || zTemp ); if( zTemp ){ memcpy(zBuf, zTemp, nTemp); - sqlite3_free(zTemp); - }else{ - assert( nTemp==0 ); } for(jj=0; jjpPhrase->nToken; jj++){ @@ -369,17 +368,17 @@ static int getNextString( rc = SQLITE_OK; } - *ppExpr = p; - return rc; -no_mem: - + getnextstring_out: if( pCursor ){ pModule->xClose(pCursor); } sqlite3_free(zTemp); - sqlite3_free(p); - *ppExpr = 0; - return SQLITE_NOMEM; + if( rc!=SQLITE_OK ){ + sqlite3_free(p); + p = 0; + } + *ppExpr = p; + return rc; } /* diff --git a/manifest b/manifest index 42c69a71fa..0ed54a2c71 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Reduce\sdivergence\sfrom\sbegin-concurrent. -D 2024-11-18T18:45:31.904 +C Fix\sa\sproblem\shandling\sOOM\serrors\sin\sfts3\sthat\scould\soccur\swhen\sparsing\smulti-token\sstrings. +D 2024-11-19T11:58:32.252 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -80,7 +80,7 @@ F ext/fts3/fts3.c 9f8ce82bbf4ec0636e6170e58f17b04817fa4c39b2d5126ac06f005d485f6d F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe F ext/fts3/fts3Int.h 968f7d7cae541a6926146e9fd3fb2b2ccbd3845b7890a8ed03de0c06ac776682 F ext/fts3/fts3_aux.c 7eab82a9cf0830f6551ba3abfdbe73ed39e322a4d3940ee82fbf723674ecd9f3 -F ext/fts3/fts3_expr.c 903bfb9433109fffb10e910d7066c49cbf8eeae316adc93f0499c4da7dfc932a +F ext/fts3/fts3_expr.c 365849a2a1185e19028a9db2d9f1ea63efe909a3a6aca7ec86fc26a13a60bd58 F ext/fts3/fts3_hash.c 8b6e31bfb0844c27dc6092c2620bdb1fca17ed613072db057d96952c6bdb48b7 F ext/fts3/fts3_hash.h 39cf6874dc239d6b4e30479b1975fe5b22a3caaf F ext/fts3/fts3_icu.c 305ce7fb6036484085b5556a9c8e62acdc7763f0f4cdf5fd538212a9f3720116 @@ -1204,7 +1204,7 @@ F test/fts3expr3.test c4d4a7d6327418428c96e0a3a1137c251b8dfbf8 F test/fts3expr4.test 6c7675bbdbffe6ffc95e9e861500b8ac3f739c4d004ffda812f138eeb1b45529 F test/fts3expr5.test a5b9a053becbdb8e973fbf4d6d3abaabeb42d511d1848bd57931f3e0a1cf983e F test/fts3f.test 8c438d5e1cab526b0021988fb1dc70cf3597b006a33ffd6c955ee89929077fe3 -F test/fts3fault.test f4e1342acfe6d216a001490e8cd52afac1f9ffe4a11bbcdcb296129a45c5df45 +F test/fts3fault.test 9228f00cd69e2a5d2ed0f06c181981f4f90bd36da9f86b73f3a58b4b23451fd4 F test/fts3fault2.test 7b2741e5095367238380b0fcdb837f36c24484c7a5f353659b387df63cf039ec F test/fts3fault3.test ccdd2292dd2d4e21e30fc5f4c8e064f79e516087eec5ff57ab6bc4f6a7714097 F test/fts3first.test dbdedd20914c8d539aa3206c9b34a23775644641 @@ -2198,8 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e0d8f9916c2d899094b71af74f44e089a97db6d80f09eb80a5d8be733c1bf942 -R 15b624443bf22191f7b1a220224ff1ba -U drh -Z e17d5ca17fa701911504cdcf5a540396 +P 84d41e9d04c62601e84621e8edb3b81abbacc366a6b5e7059f8b6796fade7ffa +R 15d5c68f2ffe8e979f466eec5e117ba3 +U dan +Z 7f81f47d67e456b494dfb3b575661f30 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 125d18f312..dea58b2d92 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -84d41e9d04c62601e84621e8edb3b81abbacc366a6b5e7059f8b6796fade7ffa +4c4d1db00bd2c522165876dcf1606116a72525d9ffc891b266213704e25cde55 diff --git a/test/fts3fault.test b/test/fts3fault.test index 21defd282f..20e5f25de5 100644 --- a/test/fts3fault.test +++ b/test/fts3fault.test @@ -216,6 +216,14 @@ do_faultsim_test 8.4 -prep { } -test { faultsim_test_result {0 3} } +do_faultsim_test 8.5 -prep { + faultsim_restore_and_reopen + db func mit mit +} -body { + execsql { SELECT mit(matchinfo(t8, 'l')) FROM t8 WHERE t8 MATCH '"a b c"' } +} -test { + faultsim_test_result {0 3} +} do_test 9.0 { faultsim_delete_and_reopen From fbd9de1830209ec810ef1bac614c2c57031728bf Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 19 Nov 2024 15:20:47 +0000 Subject: [PATCH 08/20] Initial configure support for linking certain binaries to libsqlite3.so instead of embedding it dynamically (which they typically do). This currently applies only to sqldiff, but support for adding the same for other tools is planned. This requires disabling the soname because setting it causes the build to link to whatever libsqlite3.so.0 is installed system-wide, so the soname now defaults to off. FossilOrigin-Name: 9192c146e2898456a6b8ea43a6f02c0227ddce5b584374fbeb2d63bd2ecd5d8c --- Makefile.in | 1 + auto.def | 8 ++++++-- main.mk | 15 +++++++++++++-- manifest | 21 ++++++++++++--------- manifest.uuid | 2 +- 5 files changed, 33 insertions(+), 14 deletions(-) diff --git a/Makefile.in b/Makefile.in index b374bd4838..219347c301 100644 --- a/Makefile.in +++ b/Makefile.in @@ -287,6 +287,7 @@ AS_AUTO_DEF = $(TOP)/auto.def AS_AUTORECONFIG = @SQLITE_AUTORECONFIG@ USE_AMALGAMATION ?= @USE_AMALGAMATION@ +LINK_TOOLS_DYNAMICALLY ?= @LINK_TOOLS_DYNAMICALLY@ AMALGAMATION_GEN_FLAGS ?= --linemacros=@AMALGAMATION_LINE_MACROS@ # diff --git a/auto.def b/auto.def index 919df0101f..addaf408e3 100644 --- a/auto.def +++ b/auto.def @@ -198,7 +198,9 @@ set flags { linemacros => {Enable #line macros in the amalgamation} dev => {Enable dev-mode build: automatically enables certain other flags} dump-defines=0 => {Dump autosetup defines to $DUMP_DEFINES_TXT (for build debugging)} - soname:=legacy => {SONAME for libsqlite3.so. Must be one of: none, auto, legacy} + link-tools-dynamically => {Dynamically link libsqlite3 to certain tools which normally statically embed it.} + soname:=none => {SONAME for libsqlite3.so. Must be one of: none, auto, legacy} + # --soname has a long story behind it, as well as no small amount of uncertainty. # } if {"" ne $DUMP_DEFINES_JSON} { @@ -327,6 +329,8 @@ proj-if-opt-truthy dev { define CFLAGS [get-env CFLAGS {-O0 -g}] } +define LINK_TOOLS_DYNAMICALLY [proj-opt-was-provided link-tools-dynamically] + ######################################################################## # Handle --with-wasi-sdk=DIR # @@ -468,7 +472,7 @@ apply {{} { if {[proj-opt-was-provided soname]} { set soname [opt-val soname] } else { - set soname legacy + set soname none; # enabling soname breaks linking for the --link-tools-dynamically feature } switch -exact -- $soname { none { return 0 } diff --git a/main.mk b/main.mk index a22c0fe775..20a54adfc3 100644 --- a/main.mk +++ b/main.mk @@ -205,6 +205,14 @@ ENABLE_STATIC ?= 1 # USE_AMALGAMATION ?= 1 # +# $(LINK_TOOLS_DYNAMICALLY) +# +# If true, certain binaries which typically statically link against +# libsqlite3 or its component object files will instead link against +# the DLL. +# +LINK_TOOLS_DYNAMICALLY ?= 0 +# # $(AMALGAMATION_GEN_FLAGS) = # # Optional flags for the amalgamation generator. @@ -1950,8 +1958,11 @@ install-shell-0: sqlite3$(T.exe) $(install-dir.bin) install-shell-1 install-shell-: install: install-shell-$(HAVE_WASI_SDK) -sqldiff$(T.exe): $(TOP)/tool/sqldiff.c $(TOP)/ext/misc/sqlite3_stdio.h sqlite3.o sqlite3.h - $(T.link) -o $@ $(TOP)/tool/sqldiff.c sqlite3.o $(LDFLAGS.libsqlite3) +sqldiff$(T.exe): sqldiff.$(LINK_TOOLS_DYNAMICALLY) +sqldiff.0: $(TOP)/tool/sqldiff.c $(TOP)/ext/misc/sqlite3_stdio.h sqlite3.o sqlite3.h + $(T.link) -o sqldiff$(T.exe) $(TOP)/tool/sqldiff.c sqlite3.o $(LDFLAGS.libsqlite3) +sqldiff.1: $(TOP)/tool/sqldiff.c $(TOP)/ext/misc/sqlite3_stdio.h $(libsqlite3.SO) + $(T.link) -o sqldiff$(T.exe) $(TOP)/tool/sqldiff.c -L. -lsqlite3 $(LDFLAGS.configure) install-diff: sqldiff$(T.exe) $(install-dir.bin) $(INSTALL) -s sqldiff$(T.exe) "$(install-dir.bin)" diff --git a/manifest b/manifest index 0ed54a2c71..5d62160222 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Fix\sa\sproblem\shandling\sOOM\serrors\sin\sfts3\sthat\scould\soccur\swhen\sparsing\smulti-token\sstrings. -D 2024-11-19T11:58:32.252 +C Initial\sconfigure\ssupport\sfor\slinking\scertain\sbinaries\sto\slibsqlite3.so\sinstead\sof\sembedding\sit\sdynamically\s(which\sthey\stypically\sdo).\sThis\scurrently\sapplies\sonly\sto\ssqldiff,\sbut\ssupport\sfor\sadding\sthe\ssame\sfor\sother\stools\sis\splanned.\sThis\srequires\sdisabling\sthe\ssoname\sbecause\ssetting\sit\scauses\sthe\sbuild\sto\slink\sto\swhatever\slibsqlite3.so.0\sis\sinstalled\ssystem-wide,\sso\sthe\ssoname\snow\sdefaults\sto\soff. +D 2024-11-19T15:20:47.506 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d -F Makefile.in c3a01e98bd2ae6a4631df02f11249ac07ffa3d540d3034e2675f66cc259f2ea7 +F Makefile.in 5461b1125a3039fef49f4896519d164ebe22ee394d20d69913ab0fdc8c464b63 F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0 F Makefile.msc a92237976eb92c5efaa0dd2524746aec12c196e12df8d4dbff9543a4648c3312 F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159 @@ -13,7 +13,7 @@ F art/icon-80x90.gif 65509ce3e5f86a9cd64fe7fca2d23954199f31fe44c1e09e208c80fb83d F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 -F auto.def 94f0f4a697e8221d5c7ca561771a3afabb0e707922daad89b60908b87a8e399b +F auto.def 6aa362ceeeaaf2521b0c781a44489d6f5bd6c7a147e9a6e8e6ae68a928158357 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac @@ -696,7 +696,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make bc8bb227f35d5bd3863a7bd2233437c37472a0d81585979f058f9b9b503bef35 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk c4e37e3015f9c2d8fd20fa3071ba86e7396959c8d5960e37e95aa85421e2b739 +F main.mk d82de0fbdb6b7521c55e47feced1e76204058a19d860266a7c77b194cb298321 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2198,8 +2198,11 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 84d41e9d04c62601e84621e8edb3b81abbacc366a6b5e7059f8b6796fade7ffa -R 15d5c68f2ffe8e979f466eec5e117ba3 -U dan -Z 7f81f47d67e456b494dfb3b575661f30 +P 4c4d1db00bd2c522165876dcf1606116a72525d9ffc891b266213704e25cde55 +R 4e525e0050af78dd77407fe8fd687f7e +T *branch * link-tools-dynamically +T *sym-link-tools-dynamically * +T -sym-trunk * Cancelled\sby\sbranch. +U stephan +Z 39424480882931664661450c95279514 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index dea58b2d92..d1e075f2be 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4c4d1db00bd2c522165876dcf1606116a72525d9ffc891b266213704e25cde55 +9192c146e2898456a6b8ea43a6f02c0227ddce5b584374fbeb2d63bd2ecd5d8c From 5ef61df185a26ea826aa79c94d6eee9329048f91 Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 19 Nov 2024 16:40:49 +0000 Subject: [PATCH 09/20] Reformulate sqldiff deps and rules so that the target matches the resulting file name, to avoid rebuilding it on every make invocation. Apply the same treatment to the sqlite3 CLI shell. FossilOrigin-Name: 9a17b83f859ef14629cb78d8c9af1b3f2493b0c8756bc2ebcf92f0872fb507c3 --- auto.def | 2 +- main.mk | 48 +++++++++++++++++++++++++++++------------------- manifest | 17 +++++++---------- manifest.uuid | 2 +- 4 files changed, 38 insertions(+), 31 deletions(-) diff --git a/auto.def b/auto.def index addaf408e3..1e388ac20e 100644 --- a/auto.def +++ b/auto.def @@ -199,7 +199,7 @@ set flags { dev => {Enable dev-mode build: automatically enables certain other flags} dump-defines=0 => {Dump autosetup defines to $DUMP_DEFINES_TXT (for build debugging)} link-tools-dynamically => {Dynamically link libsqlite3 to certain tools which normally statically embed it.} - soname:=none => {SONAME for libsqlite3.so. Must be one of: none, auto, legacy} + soname:=legacy => {SONAME for libsqlite3.so. Must be one of: none, auto, legacy} # --soname has a long story behind it, as well as no small amount of uncertainty. # } diff --git a/main.mk b/main.mk index 20a54adfc3..af616086be 100644 --- a/main.mk +++ b/main.mk @@ -1930,11 +1930,26 @@ xbin: threadtest5 # special compile-time options that are interpreted by individual # source files within the amalgamation. # -sqlite3$(T.exe): shell.c sqlite3.c - $(T.link) -o $@ \ - shell.c sqlite3.c \ - $(CFLAGS.readline) $(SHELL_OPT) $(CFLAGS.icu) \ - $(LDFLAGS.libsqlite3) $(LDFLAGS.readline) +# How/whether we build sqlite3$(T.exe) depends on both +# $(HAVE_WASI_SDK) and $(LINK_TOOLS_DYNAMICALLY), thus there are +# several targets here, only one of which the sqlite3$(T.exe) target +# indirectly resolves to. +# +sqlite3-shell.0.0.deps = shell.c sqlite3.c +sqlite3-shell.0.0.rules = \ + $(T.link) -o $@ \ + shell.c sqlite3.c \ + $(CFLAGS.readline) $(SHELL_OPT) $(CFLAGS.icu) \ + $(LDFLAGS.libsqlite3) $(LDFLAGS.readline) +sqlite3-shell.0.1.deps = shell.c $(libsqlite3.SO) +sqlite3-shell.0.1.rules = \ + $(T.link) -o $@ \ + shell.c -L. -lsqlite3 \ + $(CFLAGS.readline) $(SHELL_OPT) $(CFLAGS.icu) \ + $(LDFLAGS.configure) $(LDFLAGS.readline) $(LDFLAGS.zlib) +sqlite3$(T.exe): $(sqlite3-shell.$(HAVE_WASI_SDK).$(LINK_TOOLS_DYNAMICALLY).deps) + $(sqlite3-shell.$(HAVE_WASI_SDK).$(LINK_TOOLS_DYNAMICALLY).rules) +all: sqlite3$(T.exe) # The "sqlite3d" CLI is build using separate source files. This # is useful during development and debugging. @@ -1945,24 +1960,19 @@ sqlite3d$(T.exe): shell.c $(LIBOBJS0) $(CFLAGS.readline) $(SHELL_OPT) \ $(LDFLAGS.libsqlite3) $(LDFLAGS.readline) -# -# Build sqlite3$(T.exe) by default except in wasi-sdk builds. Yes, the -# semantics of 0 and 1 are confusingly swapped here. -# -sqlite3$(T.exe)-1: -sqlite3$(T.exe)-0 sqlite3$(T.exe)-: sqlite3$(T.exe) -all: sqlite3$(T.exe)-$(HAVE_WASI_SDK) - install-shell-0: sqlite3$(T.exe) $(install-dir.bin) $(INSTALL) -s sqlite3$(T.exe) "$(install-dir.bin)" -install-shell-1 install-shell-: +install-shell-1: install: install-shell-$(HAVE_WASI_SDK) -sqldiff$(T.exe): sqldiff.$(LINK_TOOLS_DYNAMICALLY) -sqldiff.0: $(TOP)/tool/sqldiff.c $(TOP)/ext/misc/sqlite3_stdio.h sqlite3.o sqlite3.h - $(T.link) -o sqldiff$(T.exe) $(TOP)/tool/sqldiff.c sqlite3.o $(LDFLAGS.libsqlite3) -sqldiff.1: $(TOP)/tool/sqldiff.c $(TOP)/ext/misc/sqlite3_stdio.h $(libsqlite3.SO) - $(T.link) -o sqldiff$(T.exe) $(TOP)/tool/sqldiff.c -L. -lsqlite3 $(LDFLAGS.configure) +# How to build sqldiff$(T.exe) depends on $(LINK_TOOLS_DYNAMICALLY) +# +sqldiff.0.deps = $(TOP)/tool/sqldiff.c $(TOP)/ext/misc/sqlite3_stdio.h sqlite3.o sqlite3.h +sqldiff.0.rules = $(T.link) -o $@ $(TOP)/tool/sqldiff.c sqlite3.o $(LDFLAGS.libsqlite3) +sqldiff.1.deps = $(TOP)/tool/sqldiff.c $(TOP)/ext/misc/sqlite3_stdio.h $(libsqlite3.SO) +sqldiff.1.rules = $(T.link) -o $@ $(TOP)/tool/sqldiff.c -L. -lsqlite3 $(LDFLAGS.configure) +sqldiff$(T.exe): $(sqldiff.$(LINK_TOOLS_DYNAMICALLY).deps) + $(sqldiff.$(LINK_TOOLS_DYNAMICALLY).rules) install-diff: sqldiff$(T.exe) $(install-dir.bin) $(INSTALL) -s sqldiff$(T.exe) "$(install-dir.bin)" diff --git a/manifest b/manifest index 5d62160222..3cfb99819a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Initial\sconfigure\ssupport\sfor\slinking\scertain\sbinaries\sto\slibsqlite3.so\sinstead\sof\sembedding\sit\sdynamically\s(which\sthey\stypically\sdo).\sThis\scurrently\sapplies\sonly\sto\ssqldiff,\sbut\ssupport\sfor\sadding\sthe\ssame\sfor\sother\stools\sis\splanned.\sThis\srequires\sdisabling\sthe\ssoname\sbecause\ssetting\sit\scauses\sthe\sbuild\sto\slink\sto\swhatever\slibsqlite3.so.0\sis\sinstalled\ssystem-wide,\sso\sthe\ssoname\snow\sdefaults\sto\soff. -D 2024-11-19T15:20:47.506 +C Reformulate\ssqldiff\sdeps\sand\srules\sso\sthat\sthe\starget\smatches\sthe\sresulting\sfile\sname,\sto\savoid\srebuilding\sit\son\severy\smake\sinvocation.\sApply\sthe\ssame\streatment\sto\sthe\ssqlite3\sCLI\sshell. +D 2024-11-19T16:40:49.154 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -13,7 +13,7 @@ F art/icon-80x90.gif 65509ce3e5f86a9cd64fe7fca2d23954199f31fe44c1e09e208c80fb83d F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 -F auto.def 6aa362ceeeaaf2521b0c781a44489d6f5bd6c7a147e9a6e8e6ae68a928158357 +F auto.def b6fc55bf238320b58d06d6e5364374722aae3b8320c4f928e0e6c208405f2cfd F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac @@ -696,7 +696,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make bc8bb227f35d5bd3863a7bd2233437c37472a0d81585979f058f9b9b503bef35 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk d82de0fbdb6b7521c55e47feced1e76204058a19d860266a7c77b194cb298321 +F main.mk 8ef1c08eb0e644df88978d2b1db4e2af9efc430a0fe3dd152d00fa21593fee41 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2198,11 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 4c4d1db00bd2c522165876dcf1606116a72525d9ffc891b266213704e25cde55 -R 4e525e0050af78dd77407fe8fd687f7e -T *branch * link-tools-dynamically -T *sym-link-tools-dynamically * -T -sym-trunk * Cancelled\sby\sbranch. +P 9192c146e2898456a6b8ea43a6f02c0227ddce5b584374fbeb2d63bd2ecd5d8c +R 9e3125f578c182d0fd3f116bcadb353b U stephan -Z 39424480882931664661450c95279514 +Z c9c941efe50c477f477a1622a4a0493c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d1e075f2be..5cd2262fb1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9192c146e2898456a6b8ea43a6f02c0227ddce5b584374fbeb2d63bd2ecd5d8c +9a17b83f859ef14629cb78d8c9af1b3f2493b0c8756bc2ebcf92f0872fb507c3 From 3cd93a0b67ccd688864782c2a2148d987f1c3001 Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 19 Nov 2024 17:41:13 +0000 Subject: [PATCH 10/20] Revert linking the shell to the dll for reasons explained in new makefile comments. Move the --with-debug configure flag into the developer options set and add commentary about why it should never be used for production builds. FossilOrigin-Name: 7b14309be42be4204c4d30e9741d56d75ab8ec34686791d032612337fe1c4dcf --- auto.def | 9 +++++++-- autosetup/proj.tcl | 10 +++++----- main.mk | 44 ++++++++++++++++++++++---------------------- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 5 files changed, 43 insertions(+), 38 deletions(-) diff --git a/auto.def b/auto.def index 1e388ac20e..eee8c5aeff 100644 --- a/auto.def +++ b/auto.def @@ -123,7 +123,6 @@ set DUMP_DEFINES_JSON ""; #./config.defines.json ######################################################################## set flags { # - with-debug:=1 => {Enable debug build flags} shared=1 => {Disable build of shared libary} static=1 => {Disable build of static library (mostly)} amalgamation=1 => {Disable the amalgamation and instead build all files separately.} @@ -193,10 +192,16 @@ set flags { with-emsdk:=auto => {Top-most dir of the Emscripten SDK installation. Default = EMSDK env var.} # # + + # --with-debug does more than simply builds with a -g compilation + # flag and will impact performance by as much as 4x, as it includes + # large numbers of assert()s in performance-critical loops. Never + # use --with-debug for production builds. + with-debug:=1 => {Enable debug build flags} + dev => {Enable dev-mode build: automatically enables certain other flags} test-status => {Enable status of tests} gcov=0 => {Enable coverage testing using gcov} linemacros => {Enable #line macros in the amalgamation} - dev => {Enable dev-mode build: automatically enables certain other flags} dump-defines=0 => {Dump autosetup defines to $DUMP_DEFINES_TXT (for build debugging)} link-tools-dynamically => {Dynamically link libsqlite3 to certain tools which normally statically embed it.} soname:=legacy => {SONAME for libsqlite3.so. Must be one of: none, auto, legacy} diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index 863962c2f8..7da0b0fa35 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -311,11 +311,11 @@ proc proj-first-bin-of {args} { ######################################################################## # @proj-opt-was-provided key # -# Returns 1 if the user specifically provided the given configure -# flag, else 0. This can be used to distinguish between options which -# have a default value and those which were explicitly provided by the -# user, even if the latter is done in a way which uses the default -# value. +# Returns 1 if the user specifically provided the given configure flag +# or if it was specifically set using proj-opt-set, else 0. This can +# be used to distinguish between options which have a default value +# and those which were explicitly provided by the user, even if the +# latter is done in a way which uses the default value. # # For example, with a configure flag defined like: # diff --git a/main.mk b/main.mk index af616086be..3193e531d1 100644 --- a/main.mk +++ b/main.mk @@ -901,6 +901,9 @@ TESTOPTS = --verbose=file --output=test-out.txt # # Extra compiler options for various shell tools # +# Note that some of these will only apply when embedding sqlite3.c +# into the shell, as these flags are not otherwise passed on to the +# library. SHELL_OPT += -DSQLITE_DQS=0 SHELL_OPT += -DSQLITE_ENABLE_FTS4 #SHELL_OPT += -DSQLITE_ENABLE_FTS5 @@ -1926,30 +1929,27 @@ threadtest5: sqlite3.c $(TOP)/test/threadtest5.c $(T.link) $(TOP)/test/threadtest5.c sqlite3.c -o $@ $(LDFLAGS.libsqlite3) xbin: threadtest5 -# The standard CLI is built using the amalgamation since it uses -# special compile-time options that are interpreted by individual -# source files within the amalgamation. # -# How/whether we build sqlite3$(T.exe) depends on both -# $(HAVE_WASI_SDK) and $(LINK_TOOLS_DYNAMICALLY), thus there are -# several targets here, only one of which the sqlite3$(T.exe) target -# indirectly resolves to. +# When building sqlite3$(T.exe) we specifically embed a copy of +# sqlite3.c, and not link to libsqlite3.so or libsqlite3.a, because +# the shell needs to be able to enable arbitrary library features, +# some of which have significant performance impacts. For example,, +# SQLITE_ENABLE_EXPLAIN_COMMENTS has been measured as having a 5.2% +# runtime performance hit, which is fine for use in the shell but is +# not appropriate for the canonical library build. # -sqlite3-shell.0.0.deps = shell.c sqlite3.c -sqlite3-shell.0.0.rules = \ - $(T.link) -o $@ \ - shell.c sqlite3.c \ - $(CFLAGS.readline) $(SHELL_OPT) $(CFLAGS.icu) \ - $(LDFLAGS.libsqlite3) $(LDFLAGS.readline) -sqlite3-shell.0.1.deps = shell.c $(libsqlite3.SO) -sqlite3-shell.0.1.rules = \ - $(T.link) -o $@ \ - shell.c -L. -lsqlite3 \ - $(CFLAGS.readline) $(SHELL_OPT) $(CFLAGS.icu) \ - $(LDFLAGS.configure) $(LDFLAGS.readline) $(LDFLAGS.zlib) -sqlite3$(T.exe): $(sqlite3-shell.$(HAVE_WASI_SDK).$(LINK_TOOLS_DYNAMICALLY).deps) - $(sqlite3-shell.$(HAVE_WASI_SDK).$(LINK_TOOLS_DYNAMICALLY).rules) -all: sqlite3$(T.exe) +sqlite3$(T.exe): shell.c sqlite3.c + $(T.link) -o $@ \ + shell.c sqlite3.c \ + $(CFLAGS.readline) $(SHELL_OPT) $(CFLAGS.icu) \ + $(LDFLAGS.libsqlite3) $(LDFLAGS.readline) +# +# Build sqlite3$(T.exe) by default except in wasi-sdk builds. Yes, the +# semantics of 0 and 1 are confusingly swapped here. +# +sqlite3$(T.exe)-1: +sqlite3$(T.exe)-0: sqlite3$(T.exe) +all: sqlite3$(T.exe)-$(HAVE_WASI_SDK) # The "sqlite3d" CLI is build using separate source files. This # is useful during development and debugging. diff --git a/manifest b/manifest index 3cfb99819a..e7c415ad2b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Reformulate\ssqldiff\sdeps\sand\srules\sso\sthat\sthe\starget\smatches\sthe\sresulting\sfile\sname,\sto\savoid\srebuilding\sit\son\severy\smake\sinvocation.\sApply\sthe\ssame\streatment\sto\sthe\ssqlite3\sCLI\sshell. -D 2024-11-19T16:40:49.154 +C Revert\slinking\sthe\sshell\sto\sthe\sdll\sfor\sreasons\sexplained\sin\snew\smakefile\scomments.\sMove\sthe\s--with-debug\sconfigure\sflag\sinto\sthe\sdeveloper\soptions\sset\sand\sadd\scommentary\sabout\swhy\sit\sshould\snever\sbe\sused\sfor\sproduction\sbuilds. +D 2024-11-19T17:41:13.115 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -13,7 +13,7 @@ F art/icon-80x90.gif 65509ce3e5f86a9cd64fe7fca2d23954199f31fe44c1e09e208c80fb83d F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 -F auto.def b6fc55bf238320b58d06d6e5364374722aae3b8320c4f928e0e6c208405f2cfd +F auto.def 4f5ae3ed11bb110b1eda2a6b7ee46489b7371bc8f7c19f0ed944613c170e4951 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac @@ -49,7 +49,7 @@ F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1d F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f F autosetup/jimsh0.c d40e381ea4526a067590e7b91bd4b2efa6d4980d286f908054c647b3df4aee14 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl 96fe16b87c9feb9c1cf2682280f678c659bc52c09fca5de02afc2f7ec5bfb154 +F autosetup/proj.tcl 22556a325c964aa5377d4d881722385f41fcd7c1b60102ba8965f7814c83e9ce F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -696,7 +696,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make bc8bb227f35d5bd3863a7bd2233437c37472a0d81585979f058f9b9b503bef35 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk 8ef1c08eb0e644df88978d2b1db4e2af9efc430a0fe3dd152d00fa21593fee41 +F main.mk 7cb02ba61e74ccab3ad6775b9207b12c6a26bbe3b2dd280039bc0cd532a52ceb F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2198,8 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9192c146e2898456a6b8ea43a6f02c0227ddce5b584374fbeb2d63bd2ecd5d8c -R 9e3125f578c182d0fd3f116bcadb353b +P 9a17b83f859ef14629cb78d8c9af1b3f2493b0c8756bc2ebcf92f0872fb507c3 +R 0effbfea81177717d860b06a74ce79d8 U stephan -Z c9c941efe50c477f477a1622a4a0493c +Z aa386346708361b0b61a6d6560bd2986 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5cd2262fb1..2cf57950de 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9a17b83f859ef14629cb78d8c9af1b3f2493b0c8756bc2ebcf92f0872fb507c3 +7b14309be42be4204c4d30e9741d56d75ab8ec34686791d032612337fe1c4dcf From 5608fb36ec84f1378cbfcc32e004b0343fd26070 Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 19 Nov 2024 18:26:47 +0000 Subject: [PATCH 11/20] Enhancements to tool/mkccode.tcl such that it recognizes -D command line arguments and can use them in internal IFDEF and IFNDEF macros. Update the tool/sqlite3_analyzer.c.in script such that it omits the SQLite amalgamation if -DSQLITE_ENABLE_DBSTAT_VTAB is defined. FossilOrigin-Name: 7fec209290aa1a6dbbca8de154edaac5d8d0ce042bc0617d27fb2095c8d580f1 --- manifest | 16 ++++---- manifest.uuid | 2 +- tool/mkccode.tcl | 79 +++++++++++++++++++++++++++++++++++--- tool/sqlite3_analyzer.c.in | 6 ++- 4 files changed, 86 insertions(+), 17 deletions(-) diff --git a/manifest b/manifest index 0ed54a2c71..87bdfbdd5f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\shandling\sOOM\serrors\sin\sfts3\sthat\scould\soccur\swhen\sparsing\smulti-token\sstrings. -D 2024-11-19T11:58:32.252 +C Enhancements\sto\stool/mkccode.tcl\ssuch\sthat\sit\srecognizes\s-D\scommand\sline\narguments\sand\scan\suse\sthem\sin\sinternal\sIFDEF\sand\sIFNDEF\smacros.\s\sUpdate\nthe\stool/sqlite3_analyzer.c.in\sscript\ssuch\sthat\sit\somits\sthe\sSQLite\samalgamation\nif\s-DSQLITE_ENABLE_DBSTAT_VTAB\sis\sdefined. +D 2024-11-19T18:26:47.422 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -2135,7 +2135,7 @@ F tool/logest.c c34e5944318415de513d29a6098df247a9618c96d83c38d4abd88641fe46e669 F tool/max-limits.c cbb635fbb37ae4d05f240bfb5b5270bb63c54439 F tool/merge-test.tcl de76b62f2de2a92d4c1ca4f976bce0aea6899e0229e250479b229b2a1914b176 F tool/mkautoconfamal.sh cbdcf993fa83dccbef7fb77b39cdeb31ef9f77d9d88c9e343b58d35ca3898a6a -F tool/mkccode.tcl 4cb8ad7e7330aaed052b0657a1bfacbc67103c400e41860aff643a482cfc2d3e x +F tool/mkccode.tcl b0ddad168362ba6225c9372856ba0db90145734e882a9a5bb8951ef0d5bc6331 x F tool/mkctimec.tcl ef6a67ec82e5b6fc19152a4c79f237227b18bf67ff16d155bac7adb94355d9cf x F tool/mkkeywordhash.c 6b0be901c47f9ad42215fc995eb2f4384ac49213b1fba395102ec3e999acf559 F tool/mkmsvcmin.tcl d76c45efda1cce2d4005bcea7b8a22bb752e3256009f331120fb4fecb14ebb7a @@ -2178,7 +2178,7 @@ F tool/speedtest8inst1.c 7ce07da76b5e745783e703a834417d725b7d45fd F tool/spellsift.tcl 52b4b04dc4333c7ab024f09d9d66ed6b6f7c6eb00b38497a09f338fa55d40618 x F tool/split-sqlite3c.tcl 5aa60643afca558bc732b1444ae81a522326f91e1dc5665b369c54f09e20de60 F tool/sqldiff.c 2a0987d183027c795ced13d6749061c1d2f38e24eddb428f56fa64c3a8f51e4b -F tool/sqlite3_analyzer.c.in 348ba349bbdc93c9866439f9f935d7284866a2a4e6898bc906ae1204ade56918 +F tool/sqlite3_analyzer.c.in 39690af454d2866e87e2b475ec5eabee366f211f2307e90b918345f35bb1a643 F tool/sqlite3_rsync.c 9a1cca2ab1271c59b37a6493c15dc1bcd0ab9149197a9125926bc08dd26b83fb F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaaef898 F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848 @@ -2198,8 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 84d41e9d04c62601e84621e8edb3b81abbacc366a6b5e7059f8b6796fade7ffa -R 15d5c68f2ffe8e979f466eec5e117ba3 -U dan -Z 7f81f47d67e456b494dfb3b575661f30 +P 4c4d1db00bd2c522165876dcf1606116a72525d9ffc891b266213704e25cde55 +R cdb63603c9c3a16b29feb4bae93e8b25 +U drh +Z 2a605008d2464811e071ed45a95c8ad5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index dea58b2d92..643a526325 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4c4d1db00bd2c522165876dcf1606116a72525d9ffc891b266213704e25cde55 +7fec209290aa1a6dbbca8de154edaac5d8d0ce042bc0617d27fb2095c8d580f1 diff --git a/tool/mkccode.tcl b/tool/mkccode.tcl index e847c8d3b8..457865b66f 100755 --- a/tool/mkccode.tcl +++ b/tool/mkccode.tcl @@ -6,7 +6,7 @@ # # Usage example: # -# tclsh mkccode.tcl demoapp.c.in >demoapp.c +# tclsh mkccode.tcl -DENABLE_FEATURE_XYZ demoapp.c.in >demoapp.c # # The demoapp.c.in file contains a mixture of C code, TCL script, and # processing directives used by mktclsqliteprog.tcl to build the final C-code @@ -33,29 +33,63 @@ # then all of the text in the input file is converted into C-language # string literals. # +# IFDEF macro +# IFNDEF macro +# ELSE +# ENDIF +# +# The text from "IFDEF macro" down to the next ELSE or ENDIF is +# included only if -Dmacro appears as a command-line argument. +# The "IFNDEF macro" simply inverts the initial test. +# # None of the control directives described above will nest. Only the # top-level input file ("demoapp.c.in" in the example) is interpreted. # referenced files are copied verbatim. # -if {[llength $argv]!=1} { - puts stderr "Usage: $argv0 TEMPLATE >OUTPUT" +proc usage {} { + puts stderr "Usage: $::argv0 \[OPTIONS\] TEMPLATE >OUTPUT" exit 1 } -set infile [lindex $argv 0] +set infile {} +foreach ax $argv { + if {[string match -D* $ax]} { + if {[string match *=* $ax]} { + regexp {-D([^=]+)=(.*)} ax all name value + set DEF($name) $value + } else { + set DEF([string range $ax 2 end]) 1 + } + continue + } + if {[string match -* $ax]} { + puts stderr "$::argv0: Unknown option \"$ax\"" + usage + } + if {$infile!=""} { + puts stderr "$::argv0: Surplus argument: \"$ax\"" + usage + } + set infile $ax +} set ROOT [file normalize [file dir $argv0]/..] set HOME [file normalize [file dir $infile]] set in [open $infile rb] puts [subst {/* DO NOT EDIT ** -** This file was generated by \"$argv0 $infile\". +** This file was generated by \"$argv0 $argv\". ** To make changes, edit $infile then rerun the generator ** command. */}] set instr 0 +set omit {} +set nomit 0 +set ln 0 while {1} { set line [gets $in] + incr ln if {[eof $in]} break if {[regexp {^INCLUDE (.*)} $line all path]} { + if {$nomit>0 && [string match *1* $omit]} continue if {0} { # https://github.com/msteveb/jimtcl/issues/320 regsub {^\$ROOT\y} $path $ROOT path @@ -91,10 +125,43 @@ while {1} { puts "/* END_STRING */" continue } - if {$instr} { + if {[regexp {^IFNDEF +([A-Za-z_]+)} $line all name]} { + set omit $omit[info exists DEF($name)] + incr nomit + continue + } + if {[regexp {^IFDEF +([A-Za-z_]+)} $line all name]} { + set omit $omit[expr {![info exists DEF($name)]}] + incr nomit + continue + } + if {[regexp {^ELSE} $line]} { + if {!$nomit} { + puts stderr "$infile:$ln: ELSE without a prior IFDEF" + exit 1 + } + set omit [string range $omit 0 end-1][expr {![string index $omit end]}] + continue + } + if {[regexp {^ENDIF} $line]} { + if {!$nomit} { + puts stderr "$infile:$ln: ENDIF without a prior IFDEF" + exit 1 + } + incr nomit -1 + set omit [string range $omit 0 [expr {$nomit-1}]] + continue + } + if {$nomit>0 && [string match *1* $omit]} { + # noop + } elseif {$instr} { set x [string map "\\\\ \\\\\\\\ \\\" \\\\\"" $line] puts "\"$x\\n\"" } else { puts $line } } +if {$nomit} { + puts stderr "$infile:$ln: One or more unterminated IFDEFs" + exit 1 +} diff --git a/tool/sqlite3_analyzer.c.in b/tool/sqlite3_analyzer.c.in index 1c9fc836a1..a934f05700 100644 --- a/tool/sqlite3_analyzer.c.in +++ b/tool/sqlite3_analyzer.c.in @@ -3,6 +3,7 @@ ** text on standard output. */ #define TCLSH_INIT_PROC sqlite3_analyzer_init_proc +IFNDEF SQLITE_ENABLE_DBSTAT_VTAB #define SQLITE_ENABLE_DBSTAT_VTAB 1 #undef SQLITE_THREADSAFE #define SQLITE_THREADSAFE 0 @@ -14,9 +15,10 @@ #define SQLITE_DEFAULT_MEMSTATUS 0 #define SQLITE_MAX_EXPR_DEPTH 0 #define SQLITE_OMIT_LOAD_EXTENSION 1 -#if !defined(SQLITE_AMALGAMATION) && !defined(USE_EXTERNAL_SQLITE) INCLUDE sqlite3.c -#endif +ELSE +#include "sqlite3.h" +ENDIF INCLUDE $ROOT/src/tclsqlite.c #if defined(_WIN32) From c73b85c156b93911ceb62a435b1566b0b6f41bcb Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 19 Nov 2024 19:47:51 +0000 Subject: [PATCH 12/20] Get sqlite3_analyzer optionally linking against libsqlite3.so instead of embedding sqlite3.c. Patch mkccode.tcl to accept digits in its IFDEF/IFNDEF checks and sqlite3_analyzer.c.in to only include sqlite3.c if -DINCLUDE_SQLITE3_C is passed to mkccode.tcl. FossilOrigin-Name: 80f3bf8c2ee31ba1ab9187d64d5dcbbf97a61845a21b036f89ea9133153575c0 --- main.mk | 31 ++++++++++++++++++++++++++----- manifest | 16 ++++++++-------- manifest.uuid | 2 +- tool/mkccode.tcl | 4 ++-- tool/sqlite3_analyzer.c.in | 3 ++- 5 files changed, 39 insertions(+), 17 deletions(-) diff --git a/main.mk b/main.mk index 3193e531d1..878be92ae6 100644 --- a/main.mk +++ b/main.mk @@ -1741,13 +1741,34 @@ smoketest: $(TESTPROGS) fuzzcheck$(T.exe) shelltest: $(TCLSH_CMD) $(TOP)/test/testrunner.tcl release shell +# +# sqlite3_analyzer.c build depends on $(LINK_TOOLS_DYNAMICALLY). +# +sqlite3_analyzer.c.flags.0 = -DINCLUDE_SQLITE3_C=1 +sqlite3_analyzer.c.flags.1 = sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl \ - $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in has_tclsh85 - $(B.tclsh) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in >sqlite3_analyzer.c + $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in + $(B.tclsh) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in \ + $(sqlite3_analyzer.c.flags.$(LINK_TOOLS_DYNAMICALLY)) \ + $(OPT_FEATURE_FLAGS) \ + > $@ -sqlite3_analyzer$(T.exe): $(T.tcl.env.sh) sqlite3_analyzer.c - $(T.link.tcl) sqlite3_analyzer.c -o $@ $$TCL_LIB_SPEC $$TCL_INCLUDE_SPEC \ - $(LDFLAGS.libsqlite3) +# +# sqlite3_analyzer's build mode depends on $(LINK_TOOLS_DYNAMICALLY). +# +sqlite3_analyzer.flags.1 = -L. -lsqlite3 $(LDFLAGS.math) +sqlite3_analyzer.flags.0 = $(LDFLAGS.libsqlite3) +sqlite3_analyzer.deps.1 = $(libsqlite3.SO) +sqlite3_analyzer.deps.0 = +sqlite3_analyzer$(T.exe): $(T.tcl.env.sh) sqlite3_analyzer.c \ + $(sqlite3_analyzer.deps.$(LINK_TOOLS_DYNAMICALLY)) + $(T.link.tcl) sqlite3_analyzer.c -o $@ \ + $(sqlite3_analyzer.flags.$(LINK_TOOLS_DYNAMICALLY)) \ + $$TCL_LIB_SPEC $$TCL_INCLUDE_SPEC +# ^^^^ the order of those flags is relevant for +# $(sqlite3_analyzer.flags.1): if the $$TCL_... flags come first they +# can cause the $@ to link to an out-of-tree libsqlite3.so, which may +# or may not fail or otherwise cause confusion. sqltclsh.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/sqltclsh.tcl \ $(TOP)/ext/misc/appendvfs.c $(TOP)/tool/mkccode.tcl \ diff --git a/manifest b/manifest index efd82a70ad..8c13ab27c3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\strunk\sinto\sthis\sbranch.\sFix\sa\ssmall\sjimtcl/tclsh\sregex\sincompatibility\sin\smkccode.tcl. -D 2024-11-19T19:16:58.734 +C Get\ssqlite3_analyzer\soptionally\slinking\sagainst\slibsqlite3.so\sinstead\sof\sembedding\ssqlite3.c.\sPatch\smkccode.tcl\sto\saccept\sdigits\sin\sits\sIFDEF/IFNDEF\schecks\sand\ssqlite3_analyzer.c.in\sto\sonly\sinclude\ssqlite3.c\sif\s-DINCLUDE_SQLITE3_C\sis\spassed\sto\smkccode.tcl. +D 2024-11-19T19:47:51.323 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -696,7 +696,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make bc8bb227f35d5bd3863a7bd2233437c37472a0d81585979f058f9b9b503bef35 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk 7cb02ba61e74ccab3ad6775b9207b12c6a26bbe3b2dd280039bc0cd532a52ceb +F main.mk b1f78ccd8b6db3fbc6a7e9952fc3e60433ad8d25798eb0b55632b1eb502ab30a F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2135,7 +2135,7 @@ F tool/logest.c c34e5944318415de513d29a6098df247a9618c96d83c38d4abd88641fe46e669 F tool/max-limits.c cbb635fbb37ae4d05f240bfb5b5270bb63c54439 F tool/merge-test.tcl de76b62f2de2a92d4c1ca4f976bce0aea6899e0229e250479b229b2a1914b176 F tool/mkautoconfamal.sh cbdcf993fa83dccbef7fb77b39cdeb31ef9f77d9d88c9e343b58d35ca3898a6a -F tool/mkccode.tcl 0e7488b7218128271b93a4b16e60a169097b6cb555446ce4d6a131be039bb536 x +F tool/mkccode.tcl 210159febe0ef0ecbc53c79833500663ceaba0115b2b374405818dc835b5f84b x F tool/mkctimec.tcl ef6a67ec82e5b6fc19152a4c79f237227b18bf67ff16d155bac7adb94355d9cf x F tool/mkkeywordhash.c 6b0be901c47f9ad42215fc995eb2f4384ac49213b1fba395102ec3e999acf559 F tool/mkmsvcmin.tcl d76c45efda1cce2d4005bcea7b8a22bb752e3256009f331120fb4fecb14ebb7a @@ -2178,7 +2178,7 @@ F tool/speedtest8inst1.c 7ce07da76b5e745783e703a834417d725b7d45fd F tool/spellsift.tcl 52b4b04dc4333c7ab024f09d9d66ed6b6f7c6eb00b38497a09f338fa55d40618 x F tool/split-sqlite3c.tcl 5aa60643afca558bc732b1444ae81a522326f91e1dc5665b369c54f09e20de60 F tool/sqldiff.c 2a0987d183027c795ced13d6749061c1d2f38e24eddb428f56fa64c3a8f51e4b -F tool/sqlite3_analyzer.c.in 39690af454d2866e87e2b475ec5eabee366f211f2307e90b918345f35bb1a643 +F tool/sqlite3_analyzer.c.in fc7735c499d226a49d843d8209b2543e4e5229eeb71a674c331323a2217b65b4 F tool/sqlite3_rsync.c 9a1cca2ab1271c59b37a6493c15dc1bcd0ab9149197a9125926bc08dd26b83fb F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaaef898 F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848 @@ -2198,8 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 7b14309be42be4204c4d30e9741d56d75ab8ec34686791d032612337fe1c4dcf 7fec209290aa1a6dbbca8de154edaac5d8d0ce042bc0617d27fb2095c8d580f1 -R 0da2647f2e208e5fa5304d40f71239b4 +P 7fb3ebfec634e0508267049fddb2b513201dbefce4d378ca3ec261c5d8336d7f +R 631735400a3a45c7eca237a47c49e579 U stephan -Z bed720f65fe4f336de4e69b585a4a039 +Z b91791961d3936264eb9b5de6178a0fb # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d9f567ad70..22db0ea473 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7fb3ebfec634e0508267049fddb2b513201dbefce4d378ca3ec261c5d8336d7f +80f3bf8c2ee31ba1ab9187d64d5dcbbf97a61845a21b036f89ea9133153575c0 diff --git a/tool/mkccode.tcl b/tool/mkccode.tcl index b95f0c679d..ecafbdadb9 100755 --- a/tool/mkccode.tcl +++ b/tool/mkccode.tcl @@ -125,12 +125,12 @@ while {1} { puts "/* END_STRING */" continue } - if {[regexp {^IFNDEF +([A-Za-z_]+)} $line all name]} { + if {[regexp {^IFNDEF +([A-Za-z_0-9]+)} $line all name]} { set omit $omit[info exists DEF($name)] incr nomit continue } - if {[regexp {^IFDEF +([A-Za-z_]+)} $line all name]} { + if {[regexp {^IFDEF +([A-Za-z_0-9]+)} $line all name]} { set omit $omit[expr {![info exists DEF($name)]}] incr nomit continue diff --git a/tool/sqlite3_analyzer.c.in b/tool/sqlite3_analyzer.c.in index a934f05700..9c11752b81 100644 --- a/tool/sqlite3_analyzer.c.in +++ b/tool/sqlite3_analyzer.c.in @@ -3,7 +3,8 @@ ** text on standard output. */ #define TCLSH_INIT_PROC sqlite3_analyzer_init_proc -IFNDEF SQLITE_ENABLE_DBSTAT_VTAB +IFDEF INCLUDE_SQLITE3_C +#undef SQLITE_ENABLE_DBSTAT_VTAB #define SQLITE_ENABLE_DBSTAT_VTAB 1 #undef SQLITE_THREADSAFE #define SQLITE_THREADSAFE 0 From b81e11b25ba63403b26f5ed54d221861af730d8c Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 19 Nov 2024 20:14:31 +0000 Subject: [PATCH 13/20] Move the in-comment-code commentary about --with-debug, from [7b14309be4], into the --help text for that flag, where it's readily visible. FossilOrigin-Name: c938e5d783b3f015b2a1b9f3711664b13497c4b71e4a890c65d6665539522ff8 --- auto.def | 11 +++++------ manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/auto.def b/auto.def index eee8c5aeff..d5f1b694f9 100644 --- a/auto.def +++ b/auto.def @@ -192,12 +192,11 @@ set flags { with-emsdk:=auto => {Top-most dir of the Emscripten SDK installation. Default = EMSDK env var.} # # - - # --with-debug does more than simply builds with a -g compilation - # flag and will impact performance by as much as 4x, as it includes - # large numbers of assert()s in performance-critical loops. Never - # use --with-debug for production builds. - with-debug:=1 => {Enable debug build flags} + with-debug:=1 => {Enable debug build flags. --with-debug does more + than simply builds with a -g compilation flag and will impact + performance by as much as 4x, as it includes large numbers of + assert()s in performance-critical loops. Never use --with-debug + for production builds.} dev => {Enable dev-mode build: automatically enables certain other flags} test-status => {Enable status of tests} gcov=0 => {Enable coverage testing using gcov} diff --git a/manifest b/manifest index 8c13ab27c3..4cb68a5e80 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Get\ssqlite3_analyzer\soptionally\slinking\sagainst\slibsqlite3.so\sinstead\sof\sembedding\ssqlite3.c.\sPatch\smkccode.tcl\sto\saccept\sdigits\sin\sits\sIFDEF/IFNDEF\schecks\sand\ssqlite3_analyzer.c.in\sto\sonly\sinclude\ssqlite3.c\sif\s-DINCLUDE_SQLITE3_C\sis\spassed\sto\smkccode.tcl. -D 2024-11-19T19:47:51.323 +C Move\sthe\sin-comment-code\scommentary\sabout\s--with-debug,\sfrom\s[7b14309be4],\sinto\sthe\s--help\stext\sfor\sthat\sflag,\swhere\sit's\sreadily\svisible. +D 2024-11-19T20:14:31.784 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -13,7 +13,7 @@ F art/icon-80x90.gif 65509ce3e5f86a9cd64fe7fca2d23954199f31fe44c1e09e208c80fb83d F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 -F auto.def 4f5ae3ed11bb110b1eda2a6b7ee46489b7371bc8f7c19f0ed944613c170e4951 +F auto.def 87c3d42428225c89dba75d399ea83c756f4a21b5c6ed591436d6c930c8d6c73a F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac @@ -2198,8 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 7fb3ebfec634e0508267049fddb2b513201dbefce4d378ca3ec261c5d8336d7f -R 631735400a3a45c7eca237a47c49e579 +P 80f3bf8c2ee31ba1ab9187d64d5dcbbf97a61845a21b036f89ea9133153575c0 +R 07c8458360fbc34333a873b33b8ca43f U stephan -Z b91791961d3936264eb9b5de6178a0fb +Z 3761f0fd6432507d765cfeef5912a493 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 22db0ea473..53fbd282cc 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -80f3bf8c2ee31ba1ab9187d64d5dcbbf97a61845a21b036f89ea9133153575c0 +c938e5d783b3f015b2a1b9f3711664b13497c4b71e4a890c65d6665539522ff8 From 457d9384a22d943abb9239a4043466feb2f88005 Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 19 Nov 2024 20:21:40 +0000 Subject: [PATCH 14/20] Rename --link-tools-dynamically to --dynlink-tools, per discussion. FossilOrigin-Name: 50b9f6fde44f9afda27e47badde6115ab6d9ccd5e22b446a8d8127499848815f --- auto.def | 6 +++--- main.mk | 5 ++++- manifest | 14 +++++++------- manifest.uuid | 2 +- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/auto.def b/auto.def index d5f1b694f9..e6c6dfc00a 100644 --- a/auto.def +++ b/auto.def @@ -202,7 +202,7 @@ set flags { gcov=0 => {Enable coverage testing using gcov} linemacros => {Enable #line macros in the amalgamation} dump-defines=0 => {Dump autosetup defines to $DUMP_DEFINES_TXT (for build debugging)} - link-tools-dynamically => {Dynamically link libsqlite3 to certain tools which normally statically embed it.} + dynlink-tools => {Dynamically link libsqlite3 to certain tools which normally statically embed it.} soname:=legacy => {SONAME for libsqlite3.so. Must be one of: none, auto, legacy} # --soname has a long story behind it, as well as no small amount of uncertainty. # @@ -333,7 +333,7 @@ proj-if-opt-truthy dev { define CFLAGS [get-env CFLAGS {-O0 -g}] } -define LINK_TOOLS_DYNAMICALLY [proj-opt-was-provided link-tools-dynamically] +define LINK_TOOLS_DYNAMICALLY [proj-opt-was-provided dynlink-tools] ######################################################################## # Handle --with-wasi-sdk=DIR @@ -476,7 +476,7 @@ apply {{} { if {[proj-opt-was-provided soname]} { set soname [opt-val soname] } else { - set soname none; # enabling soname breaks linking for the --link-tools-dynamically feature + set soname none; # enabling soname breaks linking for the --dynlink-tools feature } switch -exact -- $soname { none { return 0 } diff --git a/main.mk b/main.mk index 878be92ae6..f1c36b3575 100644 --- a/main.mk +++ b/main.mk @@ -209,7 +209,10 @@ USE_AMALGAMATION ?= 1 # # If true, certain binaries which typically statically link against # libsqlite3 or its component object files will instead link against -# the DLL. +# the DLL. The caveat is that running such builds from the source tree +# may require that the user specifically prepend "." to their +# $LD_LIBRARY_PATH so that the dynamic linker does not pick up a +# libsqlite3.so from outside the source tree. # LINK_TOOLS_DYNAMICALLY ?= 0 # diff --git a/manifest b/manifest index 4cb68a5e80..52a4d101ec 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Move\sthe\sin-comment-code\scommentary\sabout\s--with-debug,\sfrom\s[7b14309be4],\sinto\sthe\s--help\stext\sfor\sthat\sflag,\swhere\sit's\sreadily\svisible. -D 2024-11-19T20:14:31.784 +C Rename\s--link-tools-dynamically\sto\s--dynlink-tools,\sper\sdiscussion. +D 2024-11-19T20:21:40.498 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -13,7 +13,7 @@ F art/icon-80x90.gif 65509ce3e5f86a9cd64fe7fca2d23954199f31fe44c1e09e208c80fb83d F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 -F auto.def 87c3d42428225c89dba75d399ea83c756f4a21b5c6ed591436d6c930c8d6c73a +F auto.def b81388775c7596c22d19ce7c5e0692d8cb6beb89ae591e2684a238084acabf61 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac @@ -696,7 +696,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make bc8bb227f35d5bd3863a7bd2233437c37472a0d81585979f058f9b9b503bef35 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk b1f78ccd8b6db3fbc6a7e9952fc3e60433ad8d25798eb0b55632b1eb502ab30a +F main.mk de4824958a997377f0b661329699eb0b58e81c3076d68bf45898305d074fd3ee F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2198,8 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 80f3bf8c2ee31ba1ab9187d64d5dcbbf97a61845a21b036f89ea9133153575c0 -R 07c8458360fbc34333a873b33b8ca43f +P c938e5d783b3f015b2a1b9f3711664b13497c4b71e4a890c65d6665539522ff8 +R 2438fd2896d39f35fc299b3fd744f13f U stephan -Z 3761f0fd6432507d765cfeef5912a493 +Z e384122113bfcbb2fa4bae830787db35 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 53fbd282cc..ae727ec259 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c938e5d783b3f015b2a1b9f3711664b13497c4b71e4a890c65d6665539522ff8 +50b9f6fde44f9afda27e47badde6115ab6d9ccd5e22b446a8d8127499848815f From 18c9e2638eed17bb3ed35581d0054c7404e56f33 Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 19 Nov 2024 21:14:48 +0000 Subject: [PATCH 15/20] Add missing $TCL_LIBS to the link for sqlite3_analyzer. FossilOrigin-Name: bfab759611b0562837d8733ce56591854db08c122956524799dc1d5b3e2d0279 --- main.mk | 2 +- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/main.mk b/main.mk index f1c36b3575..144c1e2b58 100644 --- a/main.mk +++ b/main.mk @@ -1767,7 +1767,7 @@ sqlite3_analyzer$(T.exe): $(T.tcl.env.sh) sqlite3_analyzer.c \ $(sqlite3_analyzer.deps.$(LINK_TOOLS_DYNAMICALLY)) $(T.link.tcl) sqlite3_analyzer.c -o $@ \ $(sqlite3_analyzer.flags.$(LINK_TOOLS_DYNAMICALLY)) \ - $$TCL_LIB_SPEC $$TCL_INCLUDE_SPEC + $$TCL_LIB_SPEC $$TCL_INCLUDE_SPEC $$TCL_LIBS # ^^^^ the order of those flags is relevant for # $(sqlite3_analyzer.flags.1): if the $$TCL_... flags come first they # can cause the $@ to link to an out-of-tree libsqlite3.so, which may diff --git a/manifest b/manifest index 52a4d101ec..fa0500c459 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Rename\s--link-tools-dynamically\sto\s--dynlink-tools,\sper\sdiscussion. -D 2024-11-19T20:21:40.498 +C Add\smissing\s$TCL_LIBS\sto\sthe\slink\sfor\ssqlite3_analyzer. +D 2024-11-19T21:14:48.228 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -696,7 +696,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make bc8bb227f35d5bd3863a7bd2233437c37472a0d81585979f058f9b9b503bef35 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk de4824958a997377f0b661329699eb0b58e81c3076d68bf45898305d074fd3ee +F main.mk 4e437d2c9cd67db9c1a0715b70e3c9f6b20f54cd97bd21b1b1a40a6181dfe874 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2198,8 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P c938e5d783b3f015b2a1b9f3711664b13497c4b71e4a890c65d6665539522ff8 -R 2438fd2896d39f35fc299b3fd744f13f -U stephan -Z e384122113bfcbb2fa4bae830787db35 +P 50b9f6fde44f9afda27e47badde6115ab6d9ccd5e22b446a8d8127499848815f +R 550a68b5ea9d3db22b4d7e049a260626 +U drh +Z 02a349b181e8372ee68443f7fc5c2aa7 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index ae727ec259..a1aef6a738 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -50b9f6fde44f9afda27e47badde6115ab6d9ccd5e22b446a8d8127499848815f +bfab759611b0562837d8733ce56591854db08c122956524799dc1d5b3e2d0279 From a34fbd1b9b1817a9fc26b6231c1d5f8b9cb5601b Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 19 Nov 2024 21:19:12 +0000 Subject: [PATCH 16/20] Add fix from [bfab759611b0] to sqltclsh. Remove some now-unneeded has_tclsh84/5 checks in cases where jimsh can be used. FossilOrigin-Name: 9d389b998317c5006876f2f40d56cd763d1555bbeaf48b2bca9bd46dcd02b80e --- main.mk | 30 +++++++++++++++--------------- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/main.mk b/main.mk index 144c1e2b58..e2458c5481 100644 --- a/main.mk +++ b/main.mk @@ -1031,7 +1031,7 @@ T.link.tcl = $(T.tcl.env.source); $(T.link) # all that automatic generation. # .target_source: $(MAKE_SANITY_CHECK) $(SRC) $(TOP)/tool/vdbe-compress.tcl \ - fts5.c $(B.tclsh) # has_tclsh84 + fts5.c $(B.tclsh) rm -rf tsrc mkdir tsrc cp -f $(SRC) tsrc @@ -1057,19 +1057,19 @@ mksourceid$(B.exe): $(MAKE_SANITY_CHECK) $(TOP)/tool/mksourceid.c sqlite3.h: $(MAKE_SANITY_CHECK) $(TOP)/src/sqlite.h.in \ $(TOP)/manifest mksourceid$(B.exe) \ - $(TOP)/VERSION $(B.tclsh) # has_tclsh84 + $(TOP)/VERSION $(B.tclsh) $(B.tclsh) $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h sqlite3.c: .target_source sqlite3.h $(TOP)/tool/mksqlite3c.tcl src-verify$(B.exe) \ - $(B.tclsh) # has_tclsh84 + $(B.tclsh) $(B.tclsh) $(TOP)/tool/mksqlite3c.tcl $(AMALGAMATION_GEN_FLAGS) $(EXTRA_SRC) cp tsrc/sqlite3ext.h . cp $(TOP)/ext/session/sqlite3session.h . -sqlite3r.h: sqlite3.h $(B.tclsh) # has_tclsh84 +sqlite3r.h: sqlite3.h $(B.tclsh) $(B.tclsh) $(TOP)/tool/mksqlite3h.tcl $(TOP) --enable-recover >sqlite3r.h -sqlite3r.c: sqlite3.c sqlite3r.h $(B.tclsh) # has_tclsh84 +sqlite3r.c: sqlite3.c sqlite3r.h $(B.tclsh) cp $(TOP)/ext/recover/sqlite3recover.c tsrc/ cp $(TOP)/ext/recover/sqlite3recover.h tsrc/ cp $(TOP)/ext/recover/dbdata.c tsrc/ @@ -1356,11 +1356,11 @@ tcl: tclsqlite3$(T.exe)-$(HAVE_TCL) # Rules to build opcodes.c and opcodes.h # -opcodes.c: opcodes.h $(TOP)/tool/mkopcodec.tcl $(B.tclsh) # has_tclsh84 +opcodes.c: opcodes.h $(TOP)/tool/mkopcodec.tcl $(B.tclsh) $(B.tclsh) $(TOP)/tool/mkopcodec.tcl opcodes.h >opcodes.c opcodes.h: parse.h $(TOP)/src/vdbe.c \ - $(TOP)/tool/mkopcodeh.tcl $(B.tclsh) # has_tclsh84 + $(TOP)/tool/mkopcodeh.tcl $(B.tclsh) cat parse.h $(TOP)/src/vdbe.c | $(B.tclsh) $(TOP)/tool/mkopcodeh.tcl >opcodes.h # Rules to build parse.c and parse.h - the outputs of lemon. @@ -1371,7 +1371,7 @@ parse.c: $(TOP)/src/parse.y lemon$(B.exe) cp $(TOP)/src/parse.y . ./lemon$(B.exe) $(OPT_FEATURE_FLAGS) $(OPTS) -S parse.y -sqlite3rc.h: $(TOP)/src/sqlite3.rc $(TOP)/VERSION $(B.tclsh) # has_tclsh84 +sqlite3rc.h: $(TOP)/src/sqlite3.rc $(TOP)/VERSION $(B.tclsh) echo '#ifndef SQLITE_RESOURCE_VERSION' >$@ echo -n '#define SQLITE_RESOURCE_VERSION ' >>$@ cat $(TOP)/VERSION | $(B.tclsh) $(TOP)/tool/replace.tcl exact . , >>$@ @@ -1385,7 +1385,7 @@ keywordhash.h: mkkeywordhash$(B.exe) # # sqlite3.c split into many smaller files. # -sqlite3-all.c: sqlite3.c $(TOP)/tool/split-sqlite3c.tcl $(B.tclsh) # has_tclsh84 +sqlite3-all.c: sqlite3.c $(TOP)/tool/split-sqlite3c.tcl $(B.tclsh) $(B.tclsh) $(TOP)/tool/split-sqlite3c.tcl # @@ -1591,7 +1591,7 @@ fts5parse.c: $(TOP)/ext/fts5/fts5parse.y lemon$(B.exe) fts5parse.h: fts5parse.c -fts5.c: $(FTS5_SRC) $(B.tclsh) # has_tclsh84 +fts5.c: $(FTS5_SRC) $(B.tclsh) $(B.tclsh) $(TOP)/ext/fts5/tool/mkfts5c.tcl cp $(TOP)/ext/fts5/fts5.h . @@ -1759,7 +1759,7 @@ sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl \ # # sqlite3_analyzer's build mode depends on $(LINK_TOOLS_DYNAMICALLY). # -sqlite3_analyzer.flags.1 = -L. -lsqlite3 $(LDFLAGS.math) +sqlite3_analyzer.flags.1 = -L. -lsqlite3 sqlite3_analyzer.flags.0 = $(LDFLAGS.libsqlite3) sqlite3_analyzer.deps.1 = $(libsqlite3.SO) sqlite3_analyzer.deps.0 = @@ -1775,12 +1775,12 @@ sqlite3_analyzer$(T.exe): $(T.tcl.env.sh) sqlite3_analyzer.c \ sqltclsh.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/sqltclsh.tcl \ $(TOP)/ext/misc/appendvfs.c $(TOP)/tool/mkccode.tcl \ - $(TOP)/tool/sqltclsh.c.in has_tclsh85 + $(TOP)/tool/sqltclsh.c.in $(B.tclsh) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in >sqltclsh.c sqltclsh$(T.exe): $(T.tcl.env.sh) sqltclsh.c $(T.link.tcl) sqltclsh.c -o $@ $$TCL_INCLUDE_SPEC $(CFLAGS.libsqlite3) \ - $$TCL_LIB_SPEC $(LDFLAGS.libsqlite3) + $(LDFLAGS.libsqlite3) $$TCL_LIB_SPEC $$TCL_LIBS # xbin: target for generic binaries which aren't usually built. It is # used primarily for testing the build process. xbin: sqltclsh$(T.exe) sqlite3_analyzer$(T.exe) @@ -1801,7 +1801,7 @@ CHECKER_DEPS =\ $(TOP)/ext/misc/btreeinfo.c \ $(TOP)/ext/repair/sqlite3_checker.c.in -sqlite3_checker.c: $(CHECKER_DEPS) has_tclsh85 +sqlite3_checker.c: $(CHECKER_DEPS) $(B.tclsh) $(TOP)/tool/mkccode.tcl $(TOP)/ext/repair/sqlite3_checker.c.in >$@ sqlite3_checker$(T.exe): $(T.tcl.env.sh) sqlite3_checker.c @@ -2177,7 +2177,7 @@ SHELL_DEP = \ $(TOP)/src/test_windirent.c \ $(TOP)/src/test_windirent.h -shell.c: $(SHELL_DEP) $(TOP)/tool/mkshellc.tcl $(B.tclsh) # has_tclsh84 +shell.c: $(SHELL_DEP) $(TOP)/tool/mkshellc.tcl $(B.tclsh) $(B.tclsh) $(TOP)/tool/mkshellc.tcl >shell.c # diff --git a/manifest b/manifest index fa0500c459..3c0334288c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\smissing\s$TCL_LIBS\sto\sthe\slink\sfor\ssqlite3_analyzer. -D 2024-11-19T21:14:48.228 +C Add\sfix\sfrom\s[bfab759611b0]\sto\ssqltclsh.\sRemove\ssome\snow-unneeded\shas_tclsh84/5\schecks\sin\scases\swhere\sjimsh\scan\sbe\sused. +D 2024-11-19T21:19:12.706 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -696,7 +696,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make bc8bb227f35d5bd3863a7bd2233437c37472a0d81585979f058f9b9b503bef35 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk 4e437d2c9cd67db9c1a0715b70e3c9f6b20f54cd97bd21b1b1a40a6181dfe874 +F main.mk 87ce967497ff2fc81406fc91c290b1faf3dfa8bb7724e3980be297381369b4f8 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2198,8 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 50b9f6fde44f9afda27e47badde6115ab6d9ccd5e22b446a8d8127499848815f -R 550a68b5ea9d3db22b4d7e049a260626 -U drh -Z 02a349b181e8372ee68443f7fc5c2aa7 +P bfab759611b0562837d8733ce56591854db08c122956524799dc1d5b3e2d0279 +R 0f52e38972daef31ec132c6a8f286547 +U stephan +Z 58d6b35becabf99bb64f154abaacc201 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index a1aef6a738..b0f59a8497 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -bfab759611b0562837d8733ce56591854db08c122956524799dc1d5b3e2d0279 +9d389b998317c5006876f2f40d56cd763d1555bbeaf48b2bca9bd46dcd02b80e From 95669823282326526772ae51289f26aa1753e57c Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 20 Nov 2024 11:34:16 +0000 Subject: [PATCH 17/20] Do not report an sqlite3_error_offset() for errors that occur inside of views or triggers, since the text of those elements is not part of the original query. FossilOrigin-Name: bf66c6dfc25c2562a4e6a5b24dd1660213a8fefbb5763e7583b87fb06dbaaf43 --- manifest | 13 +++++++------ manifest.uuid | 2 +- src/printf.c | 1 + test/errofst1.test | 31 +++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 test/errofst1.test diff --git a/manifest b/manifest index 87bdfbdd5f..09bf32dd9b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhancements\sto\stool/mkccode.tcl\ssuch\sthat\sit\srecognizes\s-D\scommand\sline\narguments\sand\scan\suse\sthem\sin\sinternal\sIFDEF\sand\sIFNDEF\smacros.\s\sUpdate\nthe\stool/sqlite3_analyzer.c.in\sscript\ssuch\sthat\sit\somits\sthe\sSQLite\samalgamation\nif\s-DSQLITE_ENABLE_DBSTAT_VTAB\sis\sdefined. -D 2024-11-19T18:26:47.422 +C Do\snot\sreport\san\ssqlite3_error_offset()\sfor\serrors\sthat\soccur\sinside\sof\nviews\sor\striggers,\ssince\sthe\stext\sof\sthose\selements\sis\snot\spart\sof\sthe\noriginal\squery. +D 2024-11-20T11:34:16.309 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -770,7 +770,7 @@ F src/pcache1.c 49516ad7718a3626f28f710fa7448ef1fce3c07fd169acbb4817341950264319 F src/pragma.c a2ec3657a953fa7dea7c1e680e4358b6ce6ae570b6c5234e0f5ef219d308d223 F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7 F src/prepare.c 1832be043fce7d489959aae6f994c452d023914714c4d5457beaed51c0f3d126 -F src/printf.c 6a87534ebfb9e5346011191b1f3a7ebc457f5938c7e4feeea478ecf53f6a41b2 +F src/printf.c 96f7f8baeedc7639da94e4e7a4a2c200e2537c4eec9e5e1c2ffc821f40eb3105 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c c8a5372b97b2a2e972a280676f06ddb5b74e885d3b1f5ce383f839907b57ef68 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 @@ -1124,6 +1124,7 @@ F test/enc4.test c8f1ce3618508fd0909945beb8b8831feef2c020 F test/eqp.test 82f221e8cd588434d7f3bba9a0f4c78cbe7a541615a41632e12f50608bfb4a99 F test/eqp2.test 6e8996148de88f0e7670491e92e712a2920a369b4406f21a27c3c9b6a46b68dd F test/errmsg.test eae9f091eb39ce7e20305de45d8e5d115b68fa856fba4ea6757b6ca3705ff7f9 +F test/errofst1.test 6da78363739ba8991f498396ab331b5d64e7ab5c4172c12b5884683ef523ac53 F test/eval.test 73969a2d43a511bf44080c44485a8c4d796b6a4f038d19e491867081155692c0 F test/exclusive.test 7ff63be7503990921838d5c9f77f6e33e68e48ed1a9d48cd28745bf650bf0747 F test/exclusive2.test cd70b1d9c6fffd336f9795b711dcc5d9ceba133ad3f7001da3fda63615bdc91e @@ -2198,8 +2199,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 4c4d1db00bd2c522165876dcf1606116a72525d9ffc891b266213704e25cde55 -R cdb63603c9c3a16b29feb4bae93e8b25 +P 7fec209290aa1a6dbbca8de154edaac5d8d0ce042bc0617d27fb2095c8d580f1 +R 9836fa6ecc3ea6cb30fb659606cd39d3 U drh -Z 2a605008d2464811e071ed45a95c8ad5 +Z 6d36dcf7e943a68e08518adf95cc789e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 643a526325..0e8a1efe30 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7fec209290aa1a6dbbca8de154edaac5d8d0ce042bc0617d27fb2095c8d580f1 +bf66c6dfc25c2562a4e6a5b24dd1660213a8fefbb5763e7583b87fb06dbaaf43 diff --git a/src/printf.c b/src/printf.c index a140565146..71363f91b4 100644 --- a/src/printf.c +++ b/src/printf.c @@ -938,6 +938,7 @@ void sqlite3RecordErrorOffsetOfExpr(sqlite3 *db, const Expr *pExpr){ pExpr = pExpr->pLeft; } if( pExpr==0 ) return; + if( ExprHasProperty(pExpr, EP_FromDDL) ) return; db->errByteOffset = pExpr->w.iOfst; } diff --git a/test/errofst1.test b/test/errofst1.test new file mode 100644 index 0000000000..f8876316e5 --- /dev/null +++ b/test/errofst1.test @@ -0,0 +1,31 @@ +# 2024-11-20 +# +# 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. +# +#*********************************************************************** +# +# Test cases for sqlite3_error_offset() +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +do_execsql_test errofst1-1.1 { + CREATE TABLE t1 as select 1 as aa; + CREATE VIEW t2 AS + WITH t3 AS (SELECT 1 FROM t1 AS bb, t1 AS cc WHERE cc.aa <= sts.aa) + SELECT 1 FROM t3 AS dd; +} +do_catchsql_test errofst1-1.2 { + SELECT * FROM t2; +} {1 {no such column: sts.aa}} +do_test errofst1-1.3 { + sqlite3_error_offset db +} {-1} + +finish_test From d4a65cfc51c5dffebc23d29a91cd369c36943f4c Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 20 Nov 2024 14:19:44 +0000 Subject: [PATCH 18/20] Provide the sqlite3ShowWhereTerm() interface callable interactively from a debugger, when compiling with SQLITE_DEBUG. FossilOrigin-Name: c77a4a42f2e3d16427a69295436efe36335e56e97abd0efba814092498a8dea8 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/treeview.c | 4 ++++ src/where.c | 5 ++++- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 09bf32dd9b..624360ce4e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Do\snot\sreport\san\ssqlite3_error_offset()\sfor\serrors\sthat\soccur\sinside\sof\nviews\sor\striggers,\ssince\sthe\stext\sof\sthose\selements\sis\snot\spart\sof\sthe\noriginal\squery. -D 2024-11-20T11:34:16.309 +C Provide\sthe\ssqlite3ShowWhereTerm()\sinterface\scallable\sinteractively\sfrom\na\sdebugger,\swhen\scompiling\swith\sSQLITE_DEBUG. +D 2024-11-20T14:19:44.523 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -836,7 +836,7 @@ F src/test_window.c 6d80e11fba89a1796525e6f0048ff0c7789aa2c6b0b11c80827dc1437bd8 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c F src/tokenize.c 3f703cacdab728d7741e5a6ac242006d74fe1c2754d4f03ed889d7253259bd68 -F src/treeview.c 88aa39b754f5ef7214385c1bbbdd2f3dc20efafeed0cf590e8d1199b9c6e44aa +F src/treeview.c 4eeb155abefd88a60d0c37cc00bcfac38a8dd566970f019e4af7e02672ee2599 F src/trigger.c 0bb986a5b96047fd597c6aac28588853df56064e576e6b81ba777ef2ccaac461 F src/update.c 0e01aa6a3edf9ec112b33eb714b9016a81241497b1fb7c3e74332f4f71756508 F src/upsert.c 215328c3f91623c520ec8672c44323553f12caeb4f01b1090ebdca99fdf7b4f1 @@ -858,7 +858,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/wal.c 8b7e309a8012659ac9275ad8cdcc6acaf73fa04b1090e38a01335f230fd10681 F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452 F src/walker.c d5006d6b005e4ea7302ad390957a8d41ed83faa177e412f89bc5600a7462a014 -F src/where.c 4de9e7ca5f49e4a21c1d733e2b2fbbc8b62b1a157a58a562c569da84cfcb005b +F src/where.c 504d72098437ab97dfd3a71cea85e554381650f9dffde277c66603f3e34daddc F src/whereInt.h 1e36ec50392f7cc3d93d1152d4338064cd522b87156a0739388b7e273735f0ca F src/wherecode.c 81b9af89f4f85c8097d0da6a31499f015eabc4d3584963d30ba7b7b782e26514 F src/whereexpr.c 0f93a29cabd3a338d09a1f5c6770620a1ac51ec1157f3229502a7e7767c60b6f @@ -2199,8 +2199,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 7fec209290aa1a6dbbca8de154edaac5d8d0ce042bc0617d27fb2095c8d580f1 -R 9836fa6ecc3ea6cb30fb659606cd39d3 +P bf66c6dfc25c2562a4e6a5b24dd1660213a8fefbb5763e7583b87fb06dbaaf43 +R 0752d1ca03189356b3058d9f9278a405 U drh -Z 6d36dcf7e943a68e08518adf95cc789e +Z 314628466d5a8713bca43ea5e20a45da # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0e8a1efe30..b84bf19c0e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -bf66c6dfc25c2562a4e6a5b24dd1660213a8fefbb5763e7583b87fb06dbaaf43 +c77a4a42f2e3d16427a69295436efe36335e56e97abd0efba814092498a8dea8 diff --git a/src/treeview.c b/src/treeview.c index de67161229..865de9991c 100644 --- a/src/treeview.c +++ b/src/treeview.c @@ -1302,6 +1302,10 @@ void sqlite3TreeViewTrigger( ** accessible to the debugging, and to avoid warnings about unused ** functions. But these routines only exist in debugging builds, so they ** do not contaminate the interface. +** +** See Also: +** +** sqlite3ShowWhereTerm() in where.c */ void sqlite3ShowExpr(const Expr *p){ sqlite3TreeViewExpr(0,p,0); } void sqlite3ShowExprList(const ExprList *p){ sqlite3TreeViewExprList(0,p,0,0);} diff --git a/src/where.c b/src/where.c index f24cf7f769..1315a8cc37 100644 --- a/src/where.c +++ b/src/where.c @@ -2332,7 +2332,7 @@ static int whereInScanEst( #endif /* SQLITE_ENABLE_STAT4 */ -#ifdef WHERETRACE_ENABLED +#if defined(WHERETRACE_ENABLED) || defined(SQLITE_DEBUG) /* ** Print the content of a WhereTerm object */ @@ -2376,6 +2376,9 @@ void sqlite3WhereTermPrint(WhereTerm *pTerm, int iTerm){ sqlite3TreeViewExpr(0, pTerm->pExpr, 0); } } +void sqlite3ShowWhereTerm(WhereTerm *pTerm){ + sqlite3WhereTermPrint(pTerm, 0); +} #endif #ifdef WHERETRACE_ENABLED From 2722e2e822a26eb62cdf0e12683de1c5f61bf2b9 Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 20 Nov 2024 14:59:32 +0000 Subject: [PATCH 19/20] Bug fix in the SubrtnSig logic from [c9a3498113074bbc], if a subquery is copied and then changes are made to the copy, be sure to give the copy a unique Select.selId value so that the original will not be substituted in place of the modified copy. [forum:/forumpost/0b9ded2f8428ac00|Forum post 0b9ded2f8428ac00]. FossilOrigin-Name: 19d1bede5654bcfa9f7a151b9b2616a3d10873b8e3f8cf54a3a7e810da08f844 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/wherecode.c | 1 + test/in7.test | 27 ++++++++++++++++++++++++++- 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 624360ce4e..6e59cc7243 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Provide\sthe\ssqlite3ShowWhereTerm()\sinterface\scallable\sinteractively\sfrom\na\sdebugger,\swhen\scompiling\swith\sSQLITE_DEBUG. -D 2024-11-20T14:19:44.523 +C Bug\sfix\sin\sthe\sSubrtnSig\slogic\sfrom\s[c9a3498113074bbc],\sif\sa\ssubquery\sis\ncopied\sand\sthen\schanges\sare\smade\sto\sthe\scopy,\sbe\ssure\sto\sgive\sthe\scopy\na\sunique\sSelect.selId\svalue\sso\sthat\sthe\soriginal\swill\snot\sbe\ssubstituted\nin\splace\sof\sthe\smodified\scopy.\n[forum:/forumpost/0b9ded2f8428ac00|Forum\spost\s0b9ded2f8428ac00]. +D 2024-11-20T14:59:32.102 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -860,7 +860,7 @@ F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452 F src/walker.c d5006d6b005e4ea7302ad390957a8d41ed83faa177e412f89bc5600a7462a014 F src/where.c 504d72098437ab97dfd3a71cea85e554381650f9dffde277c66603f3e34daddc F src/whereInt.h 1e36ec50392f7cc3d93d1152d4338064cd522b87156a0739388b7e273735f0ca -F src/wherecode.c 81b9af89f4f85c8097d0da6a31499f015eabc4d3584963d30ba7b7b782e26514 +F src/wherecode.c 0c3d3199a2b769a5e2bb70feb5003dc85b3d86842ecaf903a47f2b4205ca5dab F src/whereexpr.c 0f93a29cabd3a338d09a1f5c6770620a1ac51ec1157f3229502a7e7767c60b6f F src/window.c 6c386af5972a58f9a9847bba9d7ca70c4c682391ab8478d94a6e046b22a0dbb3 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 @@ -1301,7 +1301,7 @@ F test/in3.test 3cbf58c87f4052cee3a58b37b6389777505aa0c0 F test/in4.test bb767ec1cfd1730256f0a83219f0acda36bc251b63f8b8bb7d8c7cff17875a4f F test/in5.test 4fd79c70dfa0681313e8cdca07f5ff0400bdc0e20f808a5c59eaef1e4b48082a F test/in6.test f5f40d6816a8bb7c784424b58a10ac38efb76ab29127a2c17399e0cbeeda0e4b -F test/in7.test 9256cdb30dc487f2078bb4bb30f43f2c1ff4d277a9c7c9a14bd1c9510c9c8cae +F test/in7.test 5050b648510d88bd27ff6b40991a45e1cc277c20e258162e81650e01069a56bb F test/incrblob.test c9b96afc292aeff43d6687bcb09b0280aa599822 F test/incrblob2.test a494c9e848560039a23974b9119cfc2cf3ad3bd15cc2694ee6367ae537ef8f1f F test/incrblob3.test 67621a04b3084113bf38ce03797d70eca012d9d8f948193b8f655df577b0da6f @@ -2199,8 +2199,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P bf66c6dfc25c2562a4e6a5b24dd1660213a8fefbb5763e7583b87fb06dbaaf43 -R 0752d1ca03189356b3058d9f9278a405 +P c77a4a42f2e3d16427a69295436efe36335e56e97abd0efba814092498a8dea8 +R 334ca864785a19dfa280dbef32e35002 U drh -Z 314628466d5a8713bca43ea5e20a45da +Z af9f774053d8dc7c5fd09306a426c7d8 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index b84bf19c0e..507330bbf4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c77a4a42f2e3d16427a69295436efe36335e56e97abd0efba814092498a8dea8 +19d1bede5654bcfa9f7a151b9b2616a3d10873b8e3f8cf54a3a7e810da08f844 diff --git a/src/wherecode.c b/src/wherecode.c index 0bd1733b76..045653aac8 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -615,6 +615,7 @@ static Expr *removeUnindexableInClauseTerms( pNew->pLeft->x.pList = pLhs; } pSelect->pEList = pRhs; + pSelect->selId = ++pParse->nSelect; /* Req'd for SubrtnSig validity */ if( pLhs && pLhs->nExpr==1 ){ /* Take care here not to generate a TK_VECTOR containing only a ** single value. Since the parser never creates such a vector, some diff --git a/test/in7.test b/test/in7.test index 29013ff593..4dc0821d18 100644 --- a/test/in7.test +++ b/test/in7.test @@ -192,6 +192,31 @@ do_execsql_test 3.4 { 1 2 3 4 5 6 } - +# 2024-11-20 https://sqlite.org/forum/forumpost/0b9ded2f8428ac00 +# +# Bug in SubrtnSig logic. If a SELECT statement is copied and the copy +# is subsequently modified, we need to change the Select.selId on the +# copy so that when the copy is used to generate code, the SubrtnSig +# logic won't try to substitute the original SELECT in place of the +# copy which is now different. +# +do_execsql_test 3.5 { + DROP TABLE IF EXISTS t1; + DROP TABLE IF EXISTS t2; + CREATE TABLE t1 (a int UNIQUE); + CREATE TABLE t2 (b int UNIQUE); + INSERT INTO t1 VALUES (1); + INSERT INTO t2 VALUES (1), (2); + SELECT t1.a, t2.b FROM t1, t2 WHERE (t1.a, t2.b) = (1, 1); +} {1 1} +do_execsql_test 3.6 { + SELECT t1.a, t2.b FROM t1, t2 WHERE (t1.a, t2.b) IN ((1, 1)); +} {1 1} +do_execsql_test 3.7 { + SELECT t1.a, t2.b FROM t1, t2 WHERE (t1.a, t2.b) = (1, 2); +} {1 2} +do_execsql_test 3.8 { + SELECT t1.a, t2.b FROM t1, t2 WHERE (t1.a, t2.b) IN ((1, 2)); +} {1 2} finish_test From 914e32f24a4304c3d37766624f39912af10e898e Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 20 Nov 2024 16:17:01 +0000 Subject: [PATCH 20/20] Use shared-library flags, not shared-object flags, to create shared libraries. This makes no difference on Linux, but is required for Mac. FossilOrigin-Name: bfaa3ee7588b6f6be9799882c6ed6472357d988fac31512d5e92fe28f57029c6 --- Makefile.in | 2 +- main.mk | 6 +++--- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Makefile.in b/Makefile.in index 219347c301..3d2e736fd1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -143,7 +143,7 @@ LDFLAGS.configure = @LDFLAGS@ # CFLAGS.core is documented in main.mk. # CFLAGS.core = @SH_CFLAGS@ -LDFLAGS.shobj = @SHOBJ_LDFLAGS@ +LDFLAGS.shlib = @SH_LDFLAGS@ LDFLAGS.zlib = @LDFLAGS_ZLIB@ LDFLAGS.math = @LDFLAGS_MATH@ LDFLAGS.rpath = @LDFLAGS_RPATH@ diff --git a/main.mk b/main.mk index e2458c5481..b1f1635980 100644 --- a/main.mk +++ b/main.mk @@ -159,7 +159,7 @@ LDFLAGS.math ?= -lm LDFLAGS.rpath ?= -Wl,-rpath -Wl,$(prefix)/lib LDFLAGS.pthread ?= -lpthread LDFLAGS.dlopen ?= -ldl -LDFLAGS.shobj ?= -shared +LDFLAGS.shlib ?= -shared LDFLAGS.icu ?= # -licui18n -licuuc -licudata CFLAGS.icu ?= LDFLAGS.soname.libsqlite3 ?= @@ -385,7 +385,7 @@ T.link = $(T.cc.sqlite) $(T.link.extras) # # $(T.link.shared) = $(T.link) invocation specifically for shared libraries # -T.link.shared = $(T.link) $(LDFLAGS.shobj) +T.link.shared = $(T.link) $(LDFLAGS.shlib) # # $(LDFLAGS.libsqlite3) should be used with any deliverable for which @@ -2245,7 +2245,7 @@ sqlite3.def: $(LIBOBJ) | sed 's/^.* _//' >>sqlite3.def sqlite3.dll: $(LIBOBJ) sqlite3.def - $(T.cc.sqlite) $(LDFLAGS.shobj) -o $@ sqlite3.def \ + $(T.cc.sqlite) $(LDFLAGS.shlib) -o $@ sqlite3.def \ -Wl,"--strip-all" $(LIBOBJ) $(LDFLAGS.configure) # diff --git a/manifest b/manifest index 3c0334288c..f1118f4bfd 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Add\sfix\sfrom\s[bfab759611b0]\sto\ssqltclsh.\sRemove\ssome\snow-unneeded\shas_tclsh84/5\schecks\sin\scases\swhere\sjimsh\scan\sbe\sused. -D 2024-11-19T21:19:12.706 +C Use\sshared-library\sflags,\snot\sshared-object\sflags,\sto\screate\sshared\slibraries.\nThis\smakes\sno\sdifference\son\sLinux,\sbut\sis\srequired\sfor\sMac. +D 2024-11-20T16:17:01.857 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d -F Makefile.in 5461b1125a3039fef49f4896519d164ebe22ee394d20d69913ab0fdc8c464b63 +F Makefile.in b22a52dc08b8a727c298af4f93171b2862df1d6fce4c255b15f6ce1011a9ee7d F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0 F Makefile.msc a92237976eb92c5efaa0dd2524746aec12c196e12df8d4dbff9543a4648c3312 F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159 @@ -696,7 +696,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make bc8bb227f35d5bd3863a7bd2233437c37472a0d81585979f058f9b9b503bef35 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk 87ce967497ff2fc81406fc91c290b1faf3dfa8bb7724e3980be297381369b4f8 +F main.mk e3873a2363bef0fb8e3a65a21e548ce1aa9aeeb3795362c3e78346e655d501a4 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2198,8 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P bfab759611b0562837d8733ce56591854db08c122956524799dc1d5b3e2d0279 -R 0f52e38972daef31ec132c6a8f286547 -U stephan -Z 58d6b35becabf99bb64f154abaacc201 +P 9d389b998317c5006876f2f40d56cd763d1555bbeaf48b2bca9bd46dcd02b80e +R 8bdca5a71a238d4249a2b123157a4e29 +U drh +Z 1e9ca84e1d99022a8171dd65daab42e8 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index b0f59a8497..a58ebcec98 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9d389b998317c5006876f2f40d56cd763d1555bbeaf48b2bca9bd46dcd02b80e +bfaa3ee7588b6f6be9799882c6ed6472357d988fac31512d5e92fe28f57029c6