From 4c13878ac2e3dfc782ed398254c8e28caec372a9 Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 20 Mar 2025 11:47:39 +0000 Subject: [PATCH 01/23] Fix a problem in the sqlite_dbpage() table-valued function when it is trying to truncate a file in locking-mode=EXCLUSIVE and the file was obtained via sqlite3_deserialize(). Problem found by dbsqlfuzz. FossilOrigin-Name: 346cf9794c6ce82ac32f7ccabc67240309306626709951593720abd198b103e3 --- manifest | 17 ++++++++--------- manifest.uuid | 2 +- src/dbpage.c | 4 ++-- test/fuzzdata8.db | Bin 4248576 -> 4249600 bytes 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index bcf3f4ed37..fc02250932 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Avoid\srunning\stest\scases\sinvolving\sANSI\scontrol\scharacters\sor\sUnicode\son\sWindows\sin\sa\sslave\sinterpreter,\sas\sthat\scombination\sdoes\snot\swork. -D 2025-03-19T11:53:46.152 +C Fix\sa\sproblem\sin\sthe\ssqlite_dbpage()\stable-valued\sfunction\swhen\sit\sis\ntrying\sto\struncate\sa\sfile\sin\slocking-mode=EXCLUSIVE\sand\sthe\sfile\swas\nobtained\svia\ssqlite3_deserialize().\s\sProblem\sfound\sby\sdbsqlfuzz. +D 2025-03-20T11:47:39.061 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -731,7 +731,7 @@ F src/build.c 3fe9b9d0f411cc2139a2d5ffa1c9b555417f89332f4dbf7f8e311c2e69e40c81 F src/callback.c acae8c8dddda41ee85cfdf19b926eefe830f371069f8aadca3aa39adf5b1c859 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/date.c 9db4d604e699a73e10b8e85a44db074a1f04c0591a77e2abfd77703f50dce1e9 -F src/dbpage.c 2e677acb658a29965e55398bbc61161cb7819da538057c8032adac7ab8e4a8c0 +F src/dbpage.c fcb1aafe00872a8aff9a7aa0ef7ff1b01e5817ec7bbd521f8f3e1e674ac8d609 F src/dbstat.c 73362c0df0f40ad5523a6f5501224959d0976757b511299bf892313e79d14f5c F src/delete.c 03a77ba20e54f0f42ebd8eddf15411ed6bdb06a2c472ac4b6b336521bf7cea42 F src/expr.c 61c3baab38f1b50eb4696e1f37c8f7ae1d1ecbfc1a35d446cfd1886624784131 @@ -1288,7 +1288,7 @@ F test/fuzzdata4.db b502c7d5498261715812dd8b3c2005bad08b3a26e6489414bd13926cd3e4 F test/fuzzdata5.db e35f64af17ec48926481cfaf3b3855e436bd40d1cfe2d59a9474cb4b748a52a5 F test/fuzzdata6.db b8725a5f5cf7a3b7241a9038e57ca7e7cc8c3f4d86b44bd770617bda245ab2b0 F test/fuzzdata7.db 0166b56fd7a6b9636a1d60ef0a060f86ddaecf99400a666bb6e5bbd7199ad1f2 -F test/fuzzdata8.db c6f9cb7d2b808fb10894afe53ef00f51e73e43baa7aabdba7e9af4713fc5b186 +F test/fuzzdata8.db 8f34ae00d8d5d4747dd80983cf46161065e4f78324dcff3c893506ff8db3a4a6 F test/fuzzer1.test 3d4c4b7e547aba5e5511a2991e3e3d07166cfbb8 F test/fuzzer2.test a85ef814ce071293bce1ad8dffa217cbbaad4c14 F test/fuzzerfault.test f64c4aef4c9e9edf1d6dc0d3f1e65dcc81e67c996403c88d14f09b74807a42bc @@ -2215,9 +2215,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 77db4d85e70fbf358ae2321c2601966666bdb4d971d7c113ce30a3e541458ee8 f6745a7355c62ee64c08e23b795f437dd74add903b55e1255c1d03f9a811170d -R a46056f95f3aa69f0dfc1aefc7391930 -T +closed f6745a7355c62ee64c08e23b795f437dd74add903b55e1255c1d03f9a811170d Closed\sby\sintegrate-merge. -U stephan -Z b755d7eda21c9f2918bebcee085f28b7 +P c7fd71c77f1716c9c85d0f41a07ebd7c96f2e9d5e4c1392fefa1fb53f3cbb746 +R 4634b7df48b729bfd4bde6753f06dc09 +U drh +Z 6107a05db82cfd1bf03b9f66e2d05b45 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 2846cf474a..0a3688252d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c7fd71c77f1716c9c85d0f41a07ebd7c96f2e9d5e4c1392fefa1fb53f3cbb746 +346cf9794c6ce82ac32f7ccabc67240309306626709951593720abd198b103e3 diff --git a/src/dbpage.c b/src/dbpage.c index eb5ab33fe1..f9fdcc5a37 100644 --- a/src/dbpage.c +++ b/src/dbpage.c @@ -395,8 +395,8 @@ static int dbpageUpdate( /* "INSERT INTO dbpage($PGNO,NULL)" causes page number $PGNO and ** all subsequent pages to be deleted. */ pTab->iDbTrunc = iDb; - pgno--; - pTab->pgnoTrunc = pgno; + pTab->pgnoTrunc = pgno-1; + pgno = 1; }else{ zErr = "bad page value"; goto update_fail; diff --git a/test/fuzzdata8.db b/test/fuzzdata8.db index 469df2c681a13064074d0a6e2fac0cf5939dbbcc..bfa3e3ecd09c7ef66a63cc958568e341dbdbd4a0 100644 GIT binary patch delta 3168 zcmZvedsGzH9mn_1?6SMC%4}Fc5q1_>z(qioHxXtAZCWX)a3pP_pbK0d5j>G58hg^y zK=rnbNqhw5XCf-7HR2AlewUMm906sfi*cRioA30i#=B&iVfSxcAQ7 z&;8Et_nWEMx|pkISj?>$X-?2+gk;T=%Wq|Lf-XT5yHu#e1S5huf_Z|q1nUU)B3Mtb zfnX!S-URy)Y$A9F!9xl5C0HQXOz=|#`w?s*co@O{1P2g2oZt}z2NFDz;2?s73APd} z5^N(lgy2wu!w9w$98Pcq!I1=yYQm1%+lE(=iD3!JaA?i&L{RQH_Huj<{ppTlG>4)f z;+|tvfe=l~*pg6E%HnV`m&Kvv1s1hrjz;7A6PeB8zsM{WFA>b*8B)UHF;dLpVN%56 zKH_3=2bsZQEh%JiEt$sRJAc`B&%qSMG@2=zDTXPQX$(^wlanc)DS;`GDTyhWDTOJO zDUIoArm;-vblbg*f*iv+4fjXn)|{*ATzE|XCol56R;G_M(Y8s?=Hxh{N5w}k zii~uO^&UTY;>4`{vEJ03C5isc>E@%H;q7QLRjb)tP}MlgM%iW-)a;UywYq6q%?2+v zID+P5X*;ibmz{ncWUdOAA!eqd^*#Oti8rn0!O-@LKhL-Rk$i6$=1VJmp1L>qP zsfkA$z#T66K|`#so?7QiiUAeU8H=RboT0AHObWD`55c@H!vep1ReDQT!#3CmD@*OA z&^6f}L~XhDKO=}*CJ|V1G2KMBR7+D4)ZQ>?wQS`ksGM(qj=I)J>)GG}lR$^QEA=37 z-Rhg)40X%xGoWLvJrb7HNEaw3(gqIwjk+f}LPz`Cu{T;0x{1!Ouk)l0WH-Fxg9?}NK$r~_I#`6XJrLn`6XF32m^PockU zkaqB>f!19~8;$6gCh07P8lm!-Uk=UPEA7#vJs|wj?^iUtRocs=4`BW)d;pjnmOp^_ zw*QxOL7TLULrqY$epmn<*)Cn>xn>(6F(aUAy49b?pO89vADWVwmYA4S66cJA%wK4u zpuUzbtuD6KP`Oh&%Avhfdsdof^m1u6cU?(f?o`G>S4BWJ?A+*ozxuNDP`8^M;Q%da zNgaZy*)8>O=pd9AK7EbexFT72)B>5;q{C40mUR})|6WR^Mc+yrIdll>z77h6uHe)h zb-0jz@}0C(?_H$TT$-EokX=yzjnPSW{UGJ?y8Ud6BT&Qz$I!U@*29Q)-X%X@fzay;v4zHO_` zT1@8{6QJgx@(y(wT~_f%SzAlkK64nWOTTM<&t>4NfV_Ny_tg`@WM+RezhrdZ zg7ZcB_?`+2dBk09wXIgM{|(NE*3)pfNt~^|_K$l_z6M9GWMo4{q+9{Y7Wp*G#^TpEb%(4s}D`SK>mb9U+$i%h`Nbep<9pWf;ra z=DjknMLmON#;pOF@k9Rv{;|LR{~6r>+n)a4dF;P|{`#!Ek4JZ(_}|p7r1op0={9(ksx__jHAo+vlF0BzFxhEicW_(p7e(M8H-e93 zB`t&l>dDAdt2vaTvzID02t|NMW}5+&n_{r~%u!G|MvR2qI60rbwn|yTBer&je2HFcRYYE05k>PF1AMSEi|b`ImOW!lYE9(y^T`m6KSkV z-j3+5HYJ}!>|elb351{7S`g(vRkV7qdCcdvc3>Z(bu@09asq*^(dbpxV5wA}5%WJ% C35gQ` delta 3074 zcmZvedsI}%9mjX>-DP)S(YvyOBJ5pYSzHiY5D=rxy_lRf79()voVEs(g;A-*Q>l;k zw6?;Dlbkg1N#f5aD)>kuih>BEMtr0u(P|V;Ont1Cnny_bdM!>k^iPRh_deFm)MDlmt@}LWzZvP)Y_+GLRC95-TNxC<&v)M#*4G!YPTMWC$fgDT$r(F$&3=qzp{=x?|UrRCg;bf!)>@GhOf?LX;sZoi;q+@7JO+#aP~ zZV%8BZuih>+-{>&x!pjExLxyV!#y`wB3BaE2(DzV6t0n690B9HnOvi} zvbe@@J;ODYYaDC1mt8c`v_&WU1^IMaYECZz)5;O_*LvONqMGIz4tVrDmLa4Jf6sgq zupHh-aHifcMX%cs#D|Bn!g9P#G`!8xY9Z&%cmp7U0GR1aaQK2ENE(v zkAmF0Lo5)rJU)_5nuA+Kv>tr%I1HLn1{#@t9#&1Lh)r9FZwscndMkZVuloS3>#}X| zyG3}3VJ+XF9#&L1E1)ya8O0p=&Q}m5uEZ3UUmRy)@2tU75Y*i;>Ggc(MyQ_S{1q#y z#q0UY`4)){SdY6Al-%ka-vsr`oYSCVtTO?Y*5M0`yoNUjXfyLoa?1#$ho%F}w*#otTNV0T+oN9g%qB-FUl*cCz{_W0DXXxfg#XpeCq37B-RP@5e1hvIG= z)B;%3h3at)6a&|<`RC_o}>%gbQkhan3 zW75+z$~>ta$azkm2wUsKidCidTBe-EM+C%}{v4id4w|Od-7U!g>sfU?bXG;=LgU8p z`>QVFM}}s8gni80o)wCi^(yWb(ECtX{LDA(#x-mc(SFFefe%8}68j98a}#GV@3(lP zfZCz{a#SRAMrTdbUKg{EyKtj1xJ0kJG%Mo~f1vWJIhF0agY!khUcSX4@Cwn%%yZv< z5V5WYI7~o?!FydSXTKe;tPqW*nPd2@55NnN(NNN$>|`B!Wt52iR&zQp4pP$OIQD`^ zX%UT?X_P2)Ms%?%5;ONed)u`SS(Ft~Vm#iSB z8kBZH%h^wAa^hT1aN0z45^ipl{{;L*&qM7Y^=(!Xs%#R_DSxJpK1`?mnN+3Q6jW-^ zRj(e$4p%B;1vBA09pm~8nq4N(Q>TUYFr4j!`8jaR^XyWg;u6t60uj&kK`hn~&-)`@ z@JA$?+b;SemMgbRsEqBeRGt+KpK`JalC7gI#)T~Qe~r$!B^QGZ)x2BhSW#)Q*f|Vo~gzCqaH8+2M%A!&V{NZ zr3%yr<&>6>r9C6xfK;P)L2{bx)N=A#&&&TpOo$Q#i3ios!IQ24)Vbv8>~^DK5zx0_ z&9#k$j)!6}%rUcYqr`_MfIq$8`6#qDN2YLR<4xp1i_O;YNoT ze&AQSp+6`o$REn4@~SrmKuIP)sP7bB_2&Meg8iXF0--GaP+CQ?_e0fZg&>LNpfs>w zHmMJrHIQvkAX`}fY&L(k!B5#(UcTnBaDTWFD)-m`PBru=UE8bjt{vH@YfHoYyLP$C zyLME+U0aIo?b>rx-nH%iJn~bX-T*rMaTcmwrl46`NvpjLGK7py=X683;#hN6^oKoH ziX=e3OH9zb=>*iBoud_VtiWb2RcjH72Vasbueu;lg0I@uF0sR){a^%$CJ z)XAbN)eQy5O|iX~4Rlx?CQxt6(b}R3P(4ykfc$i&kS$uRE*8;nC}>hHv5QAkS=45@ zS;1~)HewaW)MZ*%kP>^3A$@8{V7Z&s@n%%PmNu%Df+3cVCbQ=IcKjpzp&iN&?VA+H z85m-F+(kQE)i?o-WX*b|t%r7k_WyeGwV3DtLZ|j=D%3x~^MJ#(vy8*)Ndcv?6iGQF zYVJ+cW{hGfMA?Se&SPq!fYQP0vqi#>c Date: Thu, 20 Mar 2025 13:41:08 +0000 Subject: [PATCH 02/23] Teach the configure script to be able find a default installation of libreadline on Haiku OS. FossilOrigin-Name: 260e9884118172ef76457a34042ace301f20abab4ced172f6b6135010c446a68 --- autosetup/sqlite-config.tcl | 24 ++++++++++++++++++++++-- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 42b4382cfa..9461e7f89d 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -928,6 +928,11 @@ proc sqlite-handle-emsdk {} { ######################################################################## # Internal helper for [sqlite-check-line-editing]. Returns a list of # potential locations under which readline.h might be found. +# +# On some environments this function may perform extra work to help +# sqlite-check-line-editing figure out how to find libreadline and +# friends. It will communicate those results via means other than the +# result value, e.g. by modifying configure --flags. proc sqlite-get-readline-dir-list {} { # Historical note: the dirs list, except for the inclusion of # $prefix and some platform-specific dirs, originates from the @@ -944,6 +949,17 @@ proc sqlite-get-readline-dir-list {} { *-mingw64 { lappend dirs /mingw64 /mingw } + *-haiku { + lappend dirs /boot/system/develop/headers + if {[opt-val with-readline-ldflags] in {auto ""}} { + # If the user did not supply their own --with-readline-ldflags + # value, hijack that flag to inject options which are known to + # work on a default Haiku installation. + if {"" ne [glob -nocomplain /boot/system/lib/libreadline*]} { + proj-opt-set with-readline-ldflags {-L/boot/system/lib -lreadline} + } + } + } } lappend dirs /usr /usr/local /usr/local/readline /usr/contrib set rv {} @@ -1091,7 +1107,9 @@ proc sqlite-check-line-editing {} { proj-warn "Skipping check for readline.h because we're cross-compiling." } else { set dirs [sqlite-get-readline-dir-list] - set subdirs "include/$editLibName" + set subdirs [list \ + include/$editLibName \ + readline] if {"editline" eq $editLibName} { lappend subdirs include/readline # ^^^ editline, on some systems, does not have its own header, @@ -1099,7 +1117,8 @@ proc sqlite-check-line-editing {} { } lappend subdirs include set rlInc [proj-search-for-header-dir readline.h \ - -dirs $dirs -subdirs $subdirs] + -dirs $dirs -subdirs $subdirs] + #msg-debug "rlInc=$rlInc" if {"" ne $rlInc} { if {[string match */readline $rlInc]} { set rlInc [file dirname $rlInc]; # CLI shell: #include @@ -1124,6 +1143,7 @@ proc sqlite-check-line-editing {} { set rlLib "" if {"" ne $rlInc} { set rlLib [opt-val with-readline-ldflags] + #msg-debug "rlLib=$rlLib" if {$rlLib eq "auto" || $rlLib eq ""} { set rlLib "" set libTerm "" diff --git a/manifest b/manifest index fc02250932..07acc0acad 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\sin\sthe\ssqlite_dbpage()\stable-valued\sfunction\swhen\sit\sis\ntrying\sto\struncate\sa\sfile\sin\slocking-mode=EXCLUSIVE\sand\sthe\sfile\swas\nobtained\svia\ssqlite3_deserialize().\s\sProblem\sfound\sby\sdbsqlfuzz. -D 2025-03-20T11:47:39.061 +C Teach\sthe\sconfigure\sscript\sto\sbe\sable\sfind\sa\sdefault\sinstallation\sof\slibreadline\son\sHaiku\sOS. +D 2025-03-20T13:41:08.243 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl bdf0489d4ce8110fc1d4a09b1e2e274e50dd51711637b55c7c63a6a7ecec2aa5 -F autosetup/sqlite-config.tcl a2eb8234de355233787ad7bc926d8a622ef9f97594749374c4360b63c37fc223 +F autosetup/sqlite-config.tcl 4f4f666382c68a01617a4b75cb7cfc2690f49760d683836332bbee9c5bd6d47b F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl eb4c6578e08dd353263958da0dc620f8400b869a50d06e271ab0be85a51a08d3 @@ -2215,8 +2215,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 c7fd71c77f1716c9c85d0f41a07ebd7c96f2e9d5e4c1392fefa1fb53f3cbb746 -R 4634b7df48b729bfd4bde6753f06dc09 -U drh -Z 6107a05db82cfd1bf03b9f66e2d05b45 +P 346cf9794c6ce82ac32f7ccabc67240309306626709951593720abd198b103e3 +R a0ddd543c9b9478028e92dd9961c6514 +U stephan +Z 2ec32e826afbcab9328d3272b3136b96 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0a3688252d..cdf4059c1b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -346cf9794c6ce82ac32f7ccabc67240309306626709951593720abd198b103e3 +260e9884118172ef76457a34042ace301f20abab4ced172f6b6135010c446a68 From eb6997fbac02e942ac19d2baa77571df2414b942 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 21 Mar 2025 16:06:16 +0000 Subject: [PATCH 03/23] Proxy configure's msg-debug with proc-debug, which works the same except that it prepends the name of the calling proc to the debug message. No functional changes. FossilOrigin-Name: f0298c773d3490ad3a5b53d2ceeff1bd90e1a7bb5deeba2d24f681ec1bc10510 --- autosetup/proj.tcl | 9 +++++++++ autosetup/sqlite-config.tcl | 23 +++++++++++++++-------- manifest | 14 +++++++------- manifest.uuid | 2 +- 4 files changed, 32 insertions(+), 16 deletions(-) diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index ba5427b6a5..3698c8c1f4 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -1365,3 +1365,12 @@ proc proj-env-file {flag {dflt ""}} { proc proj-get-env {var {dflt ""}} { return [get-env $var [proj-env-file $var $dflt]] } + +######################################################################## +# @proj-current-proc-name +# +# Returns the name of the _calling_ proc from $lvl levels up the call +# stack. Derived from: https://stackoverflow.com/questions/10012851 +proc proj-current-proc-name {{lvl 1}} { + uplevel $lvl {lindex [info level 0] 0} +} diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 9461e7f89d..48155af496 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -481,6 +481,13 @@ proc msg-debug {msg} { puts stderr [proj-bold "** DEBUG: $msg"] } } +######################################################################## +# A [msg-debug] proxy which prepends the name of the current proc to +# the debug message. It is not legal to call this from the global +# scope. +proc proc-debug {msg} { + msg-debug "\[[proj-current-proc-name 2]\]: $msg" +} ######################################################################## # Sets up the SQLITE_AUTORECONFIG define. @@ -797,7 +804,7 @@ proc sqlite-handle-soname {} { } } } - msg-debug "soname=$soname" + proc-debug "soname=$soname" if {[proj-check-soname $soname]} { define LDFLAGS_LIBSQLITE3_SONAME [get-define LDFLAGS_SONAME_PREFIX]$soname msg-result "Setting SONAME using: [get-define LDFLAGS_LIBSQLITE3_SONAME]" @@ -966,7 +973,7 @@ proc sqlite-get-readline-dir-list {} { foreach d $dirs { if {[file isdir $d]} {lappend rv $d} } - #msg-debug "sqlite-get-readline-dir-list dirs=$rv" + #proc-debug "dirs=$rv" return $rv } @@ -1118,7 +1125,7 @@ proc sqlite-check-line-editing {} { lappend subdirs include set rlInc [proj-search-for-header-dir readline.h \ -dirs $dirs -subdirs $subdirs] - #msg-debug "rlInc=$rlInc" + #proc-debug "rlInc=$rlInc" if {"" ne $rlInc} { if {[string match */readline $rlInc]} { set rlInc [file dirname $rlInc]; # CLI shell: #include @@ -1143,7 +1150,7 @@ proc sqlite-check-line-editing {} { set rlLib "" if {"" ne $rlInc} { set rlLib [opt-val with-readline-ldflags] - #msg-debug "rlLib=$rlLib" + #proc-debug "rlLib=$rlLib" if {$rlLib eq "auto" || $rlLib eq ""} { set rlLib "" set libTerm "" @@ -1780,14 +1787,14 @@ proc sqlite-check-tcl {} { if {"prefix" eq $with_tcl} { set with_tcl [get-define prefix] } - msg-debug "sqlite-check-tcl: use_tcl ${use_tcl}" - msg-debug "sqlite-check-tcl: with_tclsh=${with_tclsh}" - msg-debug "sqlite-check-tcl: with_tcl=$with_tcl" + proc-debug "use_tcl ${use_tcl}" + proc-debug "with_tclsh=${with_tclsh}" + proc-debug "with_tcl=$with_tcl" if {"" eq $with_tclsh && "" eq $with_tcl} { # If neither --with-tclsh nor --with-tcl are provided, try to find # a workable tclsh. set with_tclsh [proj-first-bin-of tclsh9.0 tclsh8.6 tclsh] - msg-debug "sqlite-check-tcl: with_tclsh=${with_tclsh}" + proc-debug "with_tclsh=${with_tclsh}" } set doConfigLookup 1 ; # set to 0 to test the tclConfig.sh-not-found cases diff --git a/manifest b/manifest index 07acc0acad..b02a1c56e5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Teach\sthe\sconfigure\sscript\sto\sbe\sable\sfind\sa\sdefault\sinstallation\sof\slibreadline\son\sHaiku\sOS. -D 2025-03-20T13:41:08.243 +C Proxy\sconfigure's\smsg-debug\swith\sproc-debug,\swhich\sworks\sthe\ssame\sexcept\sthat\sit\sprepends\sthe\sname\sof\sthe\scalling\sproc\sto\sthe\sdebug\smessage.\sNo\sfunctional\schanges. +D 2025-03-21T16:06:16.983 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -49,8 +49,8 @@ F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1d F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl bdf0489d4ce8110fc1d4a09b1e2e274e50dd51711637b55c7c63a6a7ecec2aa5 -F autosetup/sqlite-config.tcl 4f4f666382c68a01617a4b75cb7cfc2690f49760d683836332bbee9c5bd6d47b +F autosetup/proj.tcl 2753b2ca95d3f91d4facc447b61a3090a0aea86a41c33ef8ad9db8d0bb0d464d +F autosetup/sqlite-config.tcl 27ac8b7634a4d54e93a61bc13d56985b890e58e24c77c4bab93b53a5d1843973 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl eb4c6578e08dd353263958da0dc620f8400b869a50d06e271ab0be85a51a08d3 @@ -2215,8 +2215,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 346cf9794c6ce82ac32f7ccabc67240309306626709951593720abd198b103e3 -R a0ddd543c9b9478028e92dd9961c6514 +P 260e9884118172ef76457a34042ace301f20abab4ced172f6b6135010c446a68 +R e20098aa98dd2dc6f5c975996659e451 U stephan -Z 2ec32e826afbcab9328d3272b3136b96 +Z eacd552cb3abab15f251e0a9034bd2ad # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index cdf4059c1b..c77f3fbe4b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -260e9884118172ef76457a34042ace301f20abab4ced172f6b6135010c446a68 +f0298c773d3490ad3a5b53d2ceeff1bd90e1a7bb5deeba2d24f681ec1bc10510 From 11d5bea2108f51f5aefd2fc2748e6916cce362ca Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 21 Mar 2025 16:49:32 +0000 Subject: [PATCH 04/23] Flesh out the new proc-debug and its infrastructure a bit. FossilOrigin-Name: ba7f1ff0d7d1d3fb79fc298d99fd27b65f639fb1691a1a9cdc9c006b8ff41212 --- autosetup/proj.tcl | 9 +++++---- autosetup/sqlite-config.tcl | 2 +- manifest | 14 +++++++------- manifest.uuid | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index 3698c8c1f4..d6d42678eb 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -1369,8 +1369,9 @@ proc proj-get-env {var {dflt ""}} { ######################################################################## # @proj-current-proc-name # -# Returns the name of the _calling_ proc from $lvl levels up the call -# stack. Derived from: https://stackoverflow.com/questions/10012851 -proc proj-current-proc-name {{lvl 1}} { - uplevel $lvl {lindex [info level 0] 0} +# Returns the name of the _calling_ proc from ($lvl + 1) levels up the +# call stack (where the caller's level will be 1 below _this_ +# call). It is not legal to call this from the top scope. +proc proj-current-proc-name {{lvl 0}} { + uplevel [expr $lvl + 1] {lindex [info level 0] 0} } diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 48155af496..5bf9e34c4b 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -486,7 +486,7 @@ proc msg-debug {msg} { # the debug message. It is not legal to call this from the global # scope. proc proc-debug {msg} { - msg-debug "\[[proj-current-proc-name 2]\]: $msg" + msg-debug "\[[proj-current-proc-name 1]\]: $msg" } ######################################################################## diff --git a/manifest b/manifest index b02a1c56e5..aa6df8a09f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Proxy\sconfigure's\smsg-debug\swith\sproc-debug,\swhich\sworks\sthe\ssame\sexcept\sthat\sit\sprepends\sthe\sname\sof\sthe\scalling\sproc\sto\sthe\sdebug\smessage.\sNo\sfunctional\schanges. -D 2025-03-21T16:06:16.983 +C Flesh\sout\sthe\snew\sproc-debug\sand\sits\sinfrastructure\sa\sbit. +D 2025-03-21T16:49:32.629 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -49,8 +49,8 @@ F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1d F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl 2753b2ca95d3f91d4facc447b61a3090a0aea86a41c33ef8ad9db8d0bb0d464d -F autosetup/sqlite-config.tcl 27ac8b7634a4d54e93a61bc13d56985b890e58e24c77c4bab93b53a5d1843973 +F autosetup/proj.tcl 8282fd8f14fa94be79a2f832a1c36d919ce4465216ce209d96820c6eb9a864e4 +F autosetup/sqlite-config.tcl ff39112eddc68e9505562c6aefc0b505190fe1fe93b2273e0b50ce5c7bbf6e64 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl eb4c6578e08dd353263958da0dc620f8400b869a50d06e271ab0be85a51a08d3 @@ -2215,8 +2215,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 260e9884118172ef76457a34042ace301f20abab4ced172f6b6135010c446a68 -R e20098aa98dd2dc6f5c975996659e451 +P f0298c773d3490ad3a5b53d2ceeff1bd90e1a7bb5deeba2d24f681ec1bc10510 +R 3cc891ff71296fb59fcd1fa5eb66bbd2 U stephan -Z eacd552cb3abab15f251e0a9034bd2ad +Z 05c9795d3fb61aee80553fe96bed0bc9 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index c77f3fbe4b..8597b0b793 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f0298c773d3490ad3a5b53d2ceeff1bd90e1a7bb5deeba2d24f681ec1bc10510 +ba7f1ff0d7d1d3fb79fc298d99fd27b65f639fb1691a1a9cdc9c006b8ff41212 From 7f4efdcb65524c1983350ae2cca80934906a21aa Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 21 Mar 2025 18:15:13 +0000 Subject: [PATCH 05/23] Teach the CLI that VT100-escape codes that do things like change font colors have zero-width for the purpose of laying out the columns of a table. FossilOrigin-Name: 2d0a8a6c38981552748ff5fc2eeba86590e0f116abac260a7fc9318de0a0dbda --- manifest | 15 ++++++++------- manifest.uuid | 2 +- src/shell.c.in | 43 ++++++++++++++++++++++++++++++++++++++----- test/vt100-a.sql | 19 +++++++++++++++++++ 4 files changed, 66 insertions(+), 13 deletions(-) create mode 100644 test/vt100-a.sql diff --git a/manifest b/manifest index aa6df8a09f..6b242f7484 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Flesh\sout\sthe\snew\sproc-debug\sand\sits\sinfrastructure\sa\sbit. -D 2025-03-21T16:49:32.629 +C Teach\sthe\sCLI\sthat\sVT100-escape\scodes\sthat\sdo\sthings\slike\schange\sfont\ncolors\shave\szero-width\sfor\sthe\spurpose\sof\slaying\sout\sthe\scolumns\sof\sa\ntable. +D 2025-03-21T18:15:13.290 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -784,7 +784,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 20e1fbe8f840ffc0cd835e33f68a802a22e34faa918d7a269f3de242fda02f99 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c bfe14cdfceba54744b1c6c29099313f5173a0793dfaff0cd484774e9d05dbeab -F src/shell.c.in 248050551cad788f8bb4b4728e00d8e36a10130d2d101e55cd51cfee03df91ff +F src/shell.c.in 9d1b46e09c1b933b0c7afaf4ae27030dc356ee19ae4f95ce8bf3647035b9635b F src/sqlite.h.in fd70afd92948cf7cc93f687ac960bad1b0b6fbc436752419eff2fd65a1809380 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 @@ -1972,6 +1972,7 @@ F test/view.test 3c23d7a068e9e4a0c4e6907498042772adea725f0630c3d9638ffd4e5a08b92 F test/view2.test db32c8138b5b556f610b35dfddd38c5a58a292f07fda5281eedb0851b2672679 F test/view3.test ad8a8290ee2b55ff6ce66c9ef1ce3f1e47926273a3814e1c425293e128a95456 F test/vt02.c 5b44ac67b1a283fedecf2d6e2ceda61e7a157f01d44dcb4490dcb1e87d057060 +F test/vt100-a.sql 631eeab18c5adb531bab79aecf64eee3934b42c75a309ee395c814717a6a7651 F test/vtab1.test 09a72330d0f31eda2ffaa828b06a6b917fb86250ee72de0301570af725774c07 F test/vtab2.test 14d4ab26cee13ba6cf5c5601b158e4f57552d3b055cdd9406cf7f711e9c84082 F test/vtab3.test b45f47d20f225ccc9c28dc915d92740c2dee311e @@ -2215,8 +2216,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P f0298c773d3490ad3a5b53d2ceeff1bd90e1a7bb5deeba2d24f681ec1bc10510 -R 3cc891ff71296fb59fcd1fa5eb66bbd2 -U stephan -Z 05c9795d3fb61aee80553fe96bed0bc9 +P ba7f1ff0d7d1d3fb79fc298d99fd27b65f639fb1691a1a9cdc9c006b8ff41212 +R 8af62bb2e2dc8ccdf26ae7c0bc939029 +U drh +Z cfacc14c0921c2b298dd0d24d3eebca7 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 8597b0b793..0b4b998c42 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ba7f1ff0d7d1d3fb79fc298d99fd27b65f639fb1691a1a9cdc9c006b8ff41212 +2d0a8a6c38981552748ff5fc2eeba86590e0f116abac260a7fc9318de0a0dbda diff --git a/src/shell.c.in b/src/shell.c.in index 93d73e6ac7..8272956ebd 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -784,6 +784,23 @@ int cli_wcswidth(const char *z){ } #endif +/* +** Check to see if z[] is a valid VT100 escape. If it is, then +** return the number of bytes in the escape sequence. Return 0 if +** z[] is not a VT100 escape. +** +** This routine assumes that z[0] is \033 (ESC). +*/ +static int isVt100(const unsigned char *z){ + int i; + if( z[1]!='[' ) return 0; + i = 2; + while( z[i]>=0x30 && z[i]<=0x3f ){ i++; } + while( z[i]>=0x20 && z[i]<=0x2f ){ i++; } + if( z[i]<0x40 || z[i]>0x7e ) return 0; + return i+1; +} + /* ** Output string zUtf to stdout as w characters. If w is negative, ** then right-justify the text. W is the width in UTF-8 characters, not @@ -799,6 +816,7 @@ static void utf8_width_print(FILE *out, int w, const char *zUtf){ unsigned char c; int i = 0; int n = 0; + int k; int aw = w<0 ? -w : w; if( zUtf==0 ) zUtf = ""; while( (c = a[i])!=0 ){ @@ -811,6 +829,8 @@ static void utf8_width_print(FILE *out, int w, const char *zUtf){ } i += len; n += x; + }else if( c==0x1b && (k = isVt100(&a[i]))>0 ){ + i += k; }else if( n>=aw ){ break; }else{ @@ -3998,9 +4018,14 @@ static char *translateForDisplayAndDup( i++; continue; } - n++; - j += 3; - i++; + if( c==0x1b && p->eEscMode==SHELL_ESC_OFF && (k = isVt100(&z[i]))>0 ){ + i += k; + j += k; + }else{ + n++; + j += 3; + i++; + } } if( n>=mxWidth && bWordWrap ){ /* Perhaps try to back up to a better place to break the line */ @@ -4066,9 +4091,17 @@ static char *translateForDisplayAndDup( zOut[j++] = '^'; zOut[j++] = 0x40 + c; break; - case SHELL_ESC_OFF: - zOut[j++] = c; + case SHELL_ESC_OFF: { + int nn; + if( c==0x1b && (nn = isVt100(&z[i]))>0 ){ + memcpy(&zOut[j], &z[i], nn); + j += nn; + i += nn - 1; + }else{ + zOut[j++] = c; + } break; + } } i++; } diff --git a/test/vt100-a.sql b/test/vt100-a.sql new file mode 100644 index 0000000000..a0d3f46be7 --- /dev/null +++ b/test/vt100-a.sql @@ -0,0 +1,19 @@ +/* +** Run this script using the "sqlite3" command-line shell +** test test formatting of output text that contains +** vt100 escape sequences. +*/ +.mode box -escape off +CREATE TEMP TABLE t1(a,b,c); +INSERT INTO t1 VALUES + ('one','twotwotwo','thirty-three'), + (unistr('\u001b[91mRED\u001b[0m'),'fourfour','fifty-five'), + ('six','seven','eighty-eight'); +.print With -escape off +SELECT * FROM t1; +.mode box -escape ascii +.print With -escape ascii +SELECT * FROM t1; +.mode box -escape symbol +.print With -escape symbol +SELECT * FROM t1; From e02fade10bd2f8eea7259c16f49bdebe0893c4c4 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 21 Mar 2025 21:13:44 +0000 Subject: [PATCH 06/23] Fix a multi-arg expr call in proj-current-proc-name (must be single-arg for portability). FossilOrigin-Name: 914768f3f5d63a891e1cd578afc676960376fc28ee0fa452fcd32cec0ea5cdaf --- autosetup/proj.tcl | 2 +- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index d6d42678eb..68498fb301 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -1373,5 +1373,5 @@ proc proj-get-env {var {dflt ""}} { # call stack (where the caller's level will be 1 below _this_ # call). It is not legal to call this from the top scope. proc proj-current-proc-name {{lvl 0}} { - uplevel [expr $lvl + 1] {lindex [info level 0] 0} + uplevel [expr {$lvl + 1}] {lindex [info level 0] 0} } diff --git a/manifest b/manifest index 6b242f7484..26c8b3bb88 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Teach\sthe\sCLI\sthat\sVT100-escape\scodes\sthat\sdo\sthings\slike\schange\sfont\ncolors\shave\szero-width\sfor\sthe\spurpose\sof\slaying\sout\sthe\scolumns\sof\sa\ntable. -D 2025-03-21T18:15:13.290 +C Fix\sa\smulti-arg\sexpr\scall\sin\sproj-current-proc-name\s(must\sbe\ssingle-arg\sfor\sportability). +D 2025-03-21T21:13:44.763 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -49,7 +49,7 @@ F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1d F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl 8282fd8f14fa94be79a2f832a1c36d919ce4465216ce209d96820c6eb9a864e4 +F autosetup/proj.tcl 60e46519d8fa5da2c8b0226195923543e91b20657c27d33227af2d843f1b3a2a F autosetup/sqlite-config.tcl ff39112eddc68e9505562c6aefc0b505190fe1fe93b2273e0b50ce5c7bbf6e64 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x @@ -2216,8 +2216,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ba7f1ff0d7d1d3fb79fc298d99fd27b65f639fb1691a1a9cdc9c006b8ff41212 -R 8af62bb2e2dc8ccdf26ae7c0bc939029 -U drh -Z cfacc14c0921c2b298dd0d24d3eebca7 +P 2d0a8a6c38981552748ff5fc2eeba86590e0f116abac260a7fc9318de0a0dbda +R 8c92fc288e7af142732c8fe3f14cf5ee +U stephan +Z 96ac08c8317a7dd73f053a8770e6d9bf # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0b4b998c42..857aa289ca 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2d0a8a6c38981552748ff5fc2eeba86590e0f116abac260a7fc9318de0a0dbda +914768f3f5d63a891e1cd578afc676960376fc28ee0fa452fcd32cec0ea5cdaf From 28b7bfc30fa3b46e16078a908a782780f767826a Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 21 Mar 2025 22:14:30 +0000 Subject: [PATCH 07/23] Slightly simplify proj-current-proc-name. FossilOrigin-Name: 6a0ca9f2360d29272d7be97fe9f516c3ac88864f3e729ba65da1ef6211908775 --- autosetup/proj.tcl | 5 +++-- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index 68498fb301..46e845bb8a 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -1370,8 +1370,9 @@ proc proj-get-env {var {dflt ""}} { # @proj-current-proc-name # # Returns the name of the _calling_ proc from ($lvl + 1) levels up the -# call stack (where the caller's level will be 1 below _this_ +# call stack (where the caller's level will be 1 up from _this_ # call). It is not legal to call this from the top scope. proc proj-current-proc-name {{lvl 0}} { - uplevel [expr {$lvl + 1}] {lindex [info level 0] 0} + #uplevel [expr {$lvl + 1}] {lindex [info level 0] 0} + lindex [info level [expr {-$lvl - 1}]] 0 } diff --git a/manifest b/manifest index 26c8b3bb88..3a9273ef0f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\smulti-arg\sexpr\scall\sin\sproj-current-proc-name\s(must\sbe\ssingle-arg\sfor\sportability). -D 2025-03-21T21:13:44.763 +C Slightly\ssimplify\sproj-current-proc-name. +D 2025-03-21T22:14:30.044 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -49,7 +49,7 @@ F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1d F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl 60e46519d8fa5da2c8b0226195923543e91b20657c27d33227af2d843f1b3a2a +F autosetup/proj.tcl 8bb4158e71b5d60070b86af3f7b1edf960c60b77f102ea5d688d89c7d57d8a32 F autosetup/sqlite-config.tcl ff39112eddc68e9505562c6aefc0b505190fe1fe93b2273e0b50ce5c7bbf6e64 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x @@ -2216,8 +2216,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 2d0a8a6c38981552748ff5fc2eeba86590e0f116abac260a7fc9318de0a0dbda -R 8c92fc288e7af142732c8fe3f14cf5ee +P 914768f3f5d63a891e1cd578afc676960376fc28ee0fa452fcd32cec0ea5cdaf +R 5ebc42a335e940672eaf8de2b02c74fc U stephan -Z 96ac08c8317a7dd73f053a8770e6d9bf +Z 11db84ad0c2b37daef67514310a5b653 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 857aa289ca..9ac41ff81c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -914768f3f5d63a891e1cd578afc676960376fc28ee0fa452fcd32cec0ea5cdaf +6a0ca9f2360d29272d7be97fe9f516c3ac88864f3e729ba65da1ef6211908775 From 51aef0e4daece52af0ae44ae1aada1e76f739c7c Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 22 Mar 2025 12:15:13 +0000 Subject: [PATCH 08/23] In the autoconf bundle, do not strip binaries during installation, for parity with the canonical build and the legacy build. Discussed in [forum:9a67df63eda9925c|forum post 9a67df63eda9925c]. A potential TODO here is to add a configure flag which either enables or disables stripping. FossilOrigin-Name: 6d2e57bd34c562a9cd618c178c3f92b869bf5420907057b8d2438b16a7f91d46 --- autoconf/Makefile.in | 9 +++------ manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in index 0fa9065be8..009398617c 100644 --- a/autoconf/Makefile.in +++ b/autoconf/Makefile.in @@ -72,11 +72,8 @@ LDFLAGS.rt = @LDFLAGS_RT@ LDFLAGS.icu = @LDFLAGS_ICU@ CFLAGS.icu = @CFLAGS_ICU@ -# When cross-compiling, we need to avoid the -s flag because it only -# works on the build host's platform. -INSTALL.strip.1 = $(INSTALL) -INSTALL.strip.0 = $(INSTALL) -s -INSTALL.strip = $(INSTALL.strip.@IS_CROSS_COMPILING@) +# INSTALL reminder: we specifically do not strip binaries, +# as discussed in https://sqlite.org/forum/forumpost/9a67df63eda9925c. INSTALL.noexec = $(INSTALL) -m 0644 install-dir.bin = $(DESTDIR)$(bindir) @@ -242,7 +239,7 @@ sqlite3$(T.exe)-0: sqlite3$(T.exe) all: sqlite3$(T.exe)-$(HAVE_WASI_SDK) install-shell-0: sqlite3$(T.exe) $(install-dir.bin) - $(INSTALL.strip) sqlite3$(T.exe) "$(install-dir.bin)" + $(INSTALL) sqlite3$(T.exe) "$(install-dir.bin)" install-shell-1: install: install-shell-$(HAVE_WASI_SDK) diff --git a/manifest b/manifest index 3a9273ef0f..e53dc8b04f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Slightly\ssimplify\sproj-current-proc-name. -D 2025-03-21T22:14:30.044 +C In\sthe\sautoconf\sbundle,\sdo\snot\sstrip\sbinaries\sduring\sinstallation,\sfor\sparity\swith\sthe\scanonical\sbuild\sand\sthe\slegacy\sbuild.\sDiscussed\sin\s[forum:9a67df63eda9925c|forum\spost\s9a67df63eda9925c].\sA\spotential\sTODO\shere\sis\sto\sadd\sa\sconfigure\sflag\swhich\seither\senables\sor\sdisables\sstripping. +D 2025-03-22T12:15:13.411 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -16,7 +16,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 F auto.def 23f0e7eb5eff4cf922963e667ed630793ed60300df59ef9d93c87a23e31c7232 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac -F autoconf/Makefile.in b499f790938d5334a5e22fa9a91af603661e714dea40cd5fb60d03f500b3ae4f +F autoconf/Makefile.in 1fe497c0df20102f7824ec8a3423cc13c26505655456ecd06a7a8ab02f606586 F autoconf/Makefile.msc 5bc67d3912444c40c6f96d003e5c90663e51abb83d204a520110b1b2038dcd8b F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 1a32296d8bbdd67110c79d224c92c05545a0b5bd0c272950025fe3c7c7b49580 @@ -2216,8 +2216,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 914768f3f5d63a891e1cd578afc676960376fc28ee0fa452fcd32cec0ea5cdaf -R 5ebc42a335e940672eaf8de2b02c74fc +P 6a0ca9f2360d29272d7be97fe9f516c3ac88864f3e729ba65da1ef6211908775 +R d1ffac2a55e3dd0a47e636cf53422326 U stephan -Z 11db84ad0c2b37daef67514310a5b653 +Z 5228f6e80ecc00f8456564524a3b87e2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9ac41ff81c..1e0f91aeb5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6a0ca9f2360d29272d7be97fe9f516c3ac88864f3e729ba65da1ef6211908775 +6d2e57bd34c562a9cd618c178c3f92b869bf5420907057b8d2438b16a7f91d46 From d877b56688c01e7a0a2f393fbe62ac60a04fd615 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 22 Mar 2025 12:43:22 +0000 Subject: [PATCH 09/23] Configure script internal cleanups and re-orgs. No functional changes. FossilOrigin-Name: f619e40fb05d3e09dca2ad9d9bbf38c66b4b93dd3d4e7c2071db28e671ee6a9c --- Makefile.in | 1 - auto.def | 1 - autoconf/auto.def | 9 ++ autosetup/proj.tcl | 19 ++-- autosetup/sqlite-config.tcl | 194 ++++++++++++++++-------------------- main.mk | 3 + manifest | 22 ++-- manifest.uuid | 2 +- 8 files changed, 122 insertions(+), 129 deletions(-) diff --git a/Makefile.in b/Makefile.in index 6a2ba323a0..3bb66f13ff 100644 --- a/Makefile.in +++ b/Makefile.in @@ -340,5 +340,4 @@ distclean: distclean-autosetup version-info$(T.exe): $(TOP)/tool/version-info.c Makefile sqlite3.h $(T.link) $(ST_OPT) -o $@ $(TOP)/tool/version-info.c -IS_CROSS_COMPILING = @IS_CROSS_COMPILING@ include $(TOP)/main.mk diff --git a/auto.def b/auto.def index ee852dddf5..a1191cdd1e 100644 --- a/auto.def +++ b/auto.def @@ -12,7 +12,6 @@ # # JimTCL: https://jim.tcl.tk # - use sqlite-config sqlite-configure canonical { proj-if-opt-truthy dev { diff --git a/autoconf/auto.def b/autoconf/auto.def index 5d7ff83913..85fa7d93ed 100644 --- a/autoconf/auto.def +++ b/autoconf/auto.def @@ -8,4 +8,13 @@ sqlite-configure autoconf { sqlite-check-common-bins ;# must come before [sqlite-handle-wasi-sdk] sqlite-handle-wasi-sdk ;# must run relatively early, as it changes the environment sqlite-check-common-system-deps + proj-define-for-opt static-shell ENABLE_STATIC_SHELL \ + "Link library statically into the CLI shell?" + if {![opt-bool shared] && ![opt-bool static-shell]} { + proj-opt-set shared 1 + proj-indented-notice { + NOTICE: ignoring --disable-shared because --disable-static-shell + was specified. + } + } } diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index 46e845bb8a..3e703d007a 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -75,22 +75,22 @@ proc proj-fatal {msg} { } ######################################################################## -# @proj-assert script +# @proj-assert script ?message? # # Kind of like a C assert: if uplevel (eval) of [expr {$script}] is # false, a fatal error is triggered. The error message, by default, -# includes the body of the failed assertion, but if $descr is set then +# includes the body of the failed assertion, but if $msg is set then # that is used instead. -proc proj-assert {script {descr ""}} { +proc proj-assert {script {msg ""}} { if {1 == [get-env proj-assert 0]} { msg-result [proj-bold "asserting: $script"] } set x "expr \{ $script \}" if {![uplevel 1 $x]} { - if {"" eq $descr} { - set descr $script + if {"" eq $msg} { + set msg $script } - proj-fatal "Assertion failed: $descr" + proj-fatal "Assertion failed: $msg" } } @@ -188,7 +188,8 @@ proc proj-lshift_ {listVar {count 1}} { # Expects to receive string input, which it splits on newlines, strips # out any lines which begin with any number of whitespace followed by # a '#', and returns a value containing the [append]ed results of each -# remaining line with a \n between each. +# remaining line with a \n between each. It does not strip out +# comments which appear after the first non-whitespace character. proc proj-strip-hash-comments {val} { set x {} foreach line [split $val \n] { @@ -223,8 +224,8 @@ proc proj-cflags-without-werror {{var CFLAGS}} { # # - Does not make any global changes to the LIBS define. # -# - Strips out -W... warning flags from CFLAGS before running the -# test, as these feature tests will often fail if -Werror is used. +# - Strips out the -Werror flag from CFLAGS before running the test, +# as these feature tests will often fail if -Werror is used. # # Returns the result of cc-check-function-in-lib (i.e. true or false). # The resulting linker flags are stored in the [define] named diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 5bf9e34c4b..15c0995500 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -13,9 +13,11 @@ if {[string first " " $autosetup(builddir)] != -1} { } use proj -# We want this version info to be emitted up front, but we have to -# 'use system' for --prefix=... to work. Ergo, this bit is up here -# instead of in [sqlite-configure]. +# +# We want the package version info to be emitted early on, but doing +# so requires a bit of juggling. We have to [use system] for +# --prefix=... to work and to emit the Host/Build system info, but we +# don't want those to interfere with --help output. define PACKAGE_VERSION [proj-file-content -trim $::autosetup(srcdir)/VERSION] if {"--help" ni $::argv} { msg-result "Configuring SQLite version [get-define PACKAGE_VERSION]" @@ -28,15 +30,23 @@ if {"--help" ni $::argv} { } # -# Object for communicating config-time state across various +# Object for communicating certain config-time state across various # auto.def-related pieces. -# -array set sqliteConfig [proj-strip-hash-comments { +array set sqliteConfig [subst [proj-strip-hash-comments { + # + # Gets set by [sqlite-configure] (the main configure script driver). + build-mode unknown # # Gets set to 1 when using jimsh for code generation. May affect # later decisions. use-jim-for-codegen 0 # + # Set to 1 when cross-compiling This value may be changed by certain + # build options, so it's important that config code which checks for + # cross-compilation uses this var instead of + # [proj-is-cross-compiling]. + is-cross-compiling [proj-is-cross-compiling] + # # Pass msg-debug=1 to configure to enable obnoxiously loud output # from [msg-debug]. msg-debug-enabled 0 @@ -49,15 +59,7 @@ array set sqliteConfig [proj-strip-hash-comments { # (dump-defines-txt) but also a JSON file named after this option's # value. dump-defines-json "" -}] - -# -# Set to 1 when cross-compiling This value may be changed by certain -# build options, so it's important that config code which checks for -# cross-compilation uses this var instead of -# [proj-is-cross-compiling]. -# -set sqliteConfig(is-cross-compiling) [proj-is-cross-compiling] +}]] ######################################################################## # Processes all configure --flags for this build, run build-specific @@ -69,13 +71,18 @@ set sqliteConfig(is-cross-compiling) [proj-is-cross-compiling] # $buildMode, with the caveat that _some_ build-specific code is # encapsulated in the configuration finalization step. # -# The intent is that all build-mode-specific configuration goes inside -# the $configScript argument to this function, and that an auto.def file -# contains only two commands: +# The intent is that all (or almost all) build-mode-specific +# configuration goes inside the $configScript argument to this +# function, and that an auto.def file contains only two commands: # # use sqlite-config # sqlite-configure BUILD_NAME { build-specific configure script } +# +# There are snippets of build-mode-specific decision-making in +# [sqlite-configure-finalize] proc sqlite-configure {buildMode configScript} { + proj-assert {$::sqliteConfig(build-mode) eq "unknown"} \ + "sqlite-configure must not be called more than once" set allBuildModes {canonical autoconf} if {$buildMode ni $allBuildModes} { user-error "Invalid build mode: $buildMode. Expecting one of: $allBuildModes" @@ -172,11 +179,6 @@ proc sqlite-configure {buildMode configScript} { {*} { threadsafe=1 => {Disable mutexing} with-tempstore:=no => {Use an in-RAM database for temporary tables: never,no,yes,always} - largefile=1 - => {This legacy flag has no effect on the library but may influence - the contents of the generated sqlite_cfg.h} - # ^^^ It's not clear that LFS support actually does anything, - # as HAVE_LFS is not checked anywhere in the .c/.h/.in files. load-extension=1 => {Disable loading of external extensions} math=1 => {Disable math functions} json=1 => {Disable JSON functions} @@ -190,6 +192,9 @@ proc sqlite-configure {buildMode configScript} { rtree => {Enable the RTREE extension} session => {Enable the SESSION extension} all => {Enable FTS4, FTS5, Geopoly, RTree, Sessions} + largefile=1 + => {This legacy flag has no effect on the library but may influence + the generated sqlite_cfg.h by adding #define HAVE_LFS} } } @@ -370,84 +375,16 @@ proc sqlite-configure {buildMode configScript} { dict incr xopts -level return {*}$xopts $msg } - sqlite-post-options-init + sqlite-configure-phase1 $buildMode uplevel 1 $configScript sqlite-configure-finalize }; # sqlite-configure ######################################################################## -# Performs late-stage config steps common to all supported -# $::sqliteConfig(build-mode) values. -proc sqlite-configure-finalize {} { - set buildMode $::sqliteConfig(build-mode) - set isCanonical [expr {$buildMode eq "canonical"}] - set isAutoconf [expr {$buildMode eq "autoconf"}] - proj-assert {$isCanonical || $isAutoconf} "Unknown build mode: $buildMode" - - define HAVE_LFS 0 - if {[opt-bool largefile]} { - # - # Insofar as we can determine HAVE_LFS has no effect on the - # library. Perhaps it did back in the early 2000's. The - # --enable/disable-largefile flag is retained because it's - # harmless, but it doesn't do anything useful. It does have - # visible side-effects, though: the generated sqlite_cfg.h may (or - # may not) define HAVE_LFS. - # - cc-check-lfs - } - - if {$isCanonical} { - if {![opt-bool static]} { - proj-indented-notice { - NOTICE: static lib build may be implicitly re-activated by - other components, e.g. some test apps. - } - } - } else { - proj-assert { $isAutoconf } "Invalid build mode" - proj-define-for-opt static-shell ENABLE_STATIC_SHELL \ - "Link library statically into the CLI shell?" - if {![opt-bool shared] && ![opt-bool static-shell]} { - proj-opt-set shared 1 - proj-indented-notice { - NOTICE: ignoring --disable-shared because --disable-static-shell - was specified. - } - } - } - proj-define-for-opt shared ENABLE_LIB_SHARED "Build shared library?" - proj-define-for-opt static ENABLE_LIB_STATIC "Build static library?" - - sqlite-handle-debug - sqlite-handle-rpath - sqlite-handle-soname - sqlite-handle-threadsafe - sqlite-handle-tempstore - sqlite-handle-line-editing - sqlite-handle-load-extension - sqlite-handle-math - sqlite-handle-icu - sqlite-handle-env-quirks - sqlite-handle-common-feature-flags - sqlite-finalize-feature-flags - ######################################################################## - # When cross-compiling, we have to avoid using the -s flag to - # /usr/bin/install: - # https://sqlite.org/forum/forumpost/9a67df63eda9925c - define IS_CROSS_COMPILING $::sqliteConfig(is-cross-compiling) - sqlite-process-dot-in-files - sqlite-post-config-validation - sqlite-dump-defines -}; # sqlite-configure-finalize - -######################################################################## -# Runs some common initialization which must happen immediately after -# autosetup's [options] function is called. This is also a convenient -# place to put some generic pieces common to both the canonical -# top-level build and the "autoconf" build, but it's not intended to -# be a catch-all dumping ground for such. -proc sqlite-post-options-init {} { +# Runs "phase 1" of the configure process: after initial --flags +# handling but before the build-specific parts are run. $buildMode +# must be the mode which was passed to [sqlite-configure]. +proc sqlite-configure-phase1 {buildMode} { define PACKAGE_NAME sqlite define PACKAGE_URL {https://sqlite.org} define PACKAGE_BUGREPORT [get-define PACKAGE_URL]/forum @@ -460,6 +397,8 @@ proc sqlite-post-options-init {} { with-readline-lib => with-readline-ldflags with-debug => debug } + set ::sqliteConfig(msg-debug-enabled) [proj-val-truthy [get-env msg-debug 0]] + proc-debug "msg-debug is enabled" sqlite-autoreconfig proj-file-extensions if {".exe" eq [get-define TARGET_EXEEXT]} { @@ -469,8 +408,49 @@ proc sqlite-post-options-init {} { define SQLITE_OS_UNIX 1 define SQLITE_OS_WIN 0 } - set ::sqliteConfig(msg-debug-enabled) [proj-val-truthy [get-env msg-debug 0]] sqlite-setup-default-cflags + sqlite-handle-debug + define HAVE_LFS 0 + if {[opt-bool largefile]} { + # + # Insofar as we can determine HAVE_LFS has no effect on the + # library. Perhaps it did back in the early 2000's. The + # --enable/disable-largefile flag is retained because it's + # harmless, but it doesn't do anything useful. It does have + # visible side-effects, though: the generated sqlite_cfg.h may (or + # may not) define HAVE_LFS. + cc-check-lfs + } +}; # sqlite-configure-phase1 + +######################################################################## +# Performs late-stage config steps common to all supported +# $::sqliteConfig(build-mode) values. +proc sqlite-configure-finalize {} { + sqlite-handle-rpath + sqlite-handle-soname + sqlite-handle-threadsafe + sqlite-handle-tempstore + sqlite-handle-load-extension + sqlite-handle-math + sqlite-handle-icu + sqlite-handle-line-editing + + proj-define-for-opt shared ENABLE_LIB_SHARED "Build shared library?" + if {![proj-define-for-opt static ENABLE_LIB_STATIC "Build static library?"]} { + # This notice really only applies to the canonical build... + proj-indented-notice { + NOTICE: static lib build may be implicitly re-activated by + other components, e.g. some test apps. + } + } + + sqlite-handle-env-quirks + sqlite-handle-common-feature-flags + sqlite-finalize-feature-flags + sqlite-process-dot-in-files; # do not [define] anything after this + sqlite-post-config-validation + sqlite-dump-defines } ######################################################################## @@ -568,6 +548,10 @@ proc sqlite-check-common-bins {} { ######################################################################## # Run checks for system-level includes and libs which are common to # both the canonical build and the "autoconf" bundle. +# +# For the canonical build this must come after +# [sqlite-handle-wasi-sdk], as that function may change the +# environment in ways which affect this. proc sqlite-check-common-system-deps {} { # Check for needed/wanted data types cc-with {-includes stdint.h} \ @@ -678,7 +662,7 @@ proc sqlite-setup-default-cflags {} { } ######################################################################## -# Handle various SQLITE_ENABLE_... feature flags. +# Handle various SQLITE_ENABLE/OMIT_... feature flags. proc sqlite-handle-common-feature-flags {} { msg-result "Feature flags..." foreach {boolFlag featureFlag ifSetEvalThis} { @@ -738,7 +722,6 @@ proc sqlite-handle-common-feature-flags {} { msg-result " - $boolFlag" } } - } ######################################################################### @@ -762,13 +745,12 @@ proc sqlite-finalize-feature-flags {} { } ######################################################################## -# Checks for the --debug flag, defining SQLITE_DEBUG to 1 if it is -# true. TARGET_DEBUG gets defined either way, with content depending -# on whether --debug is true or false. +# Checks for the --debug flag and [define]s TARGET_DEBUG based on +# that. TARGET_DEBUG is unused in the autoconf build but that is +# arguably a bug. proc sqlite-handle-debug {} { msg-checking "SQLITE_DEBUG build? " proj-if-opt-truthy debug { - define SQLITE_DEBUG 1 define TARGET_DEBUG {-g -DSQLITE_DEBUG=1 -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE -O0 -Wall} proj-opt-set memsys5 msg-result yes @@ -1151,7 +1133,7 @@ proc sqlite-check-line-editing {} { if {"" ne $rlInc} { set rlLib [opt-val with-readline-ldflags] #proc-debug "rlLib=$rlLib" - if {$rlLib eq "auto" || $rlLib eq ""} { + if {$rlLib in {auto ""}} { set rlLib "" set libTerm "" if {[proj-check-function-in-lib tgetent "$editLibName ncurses curses termcap"]} { @@ -1261,7 +1243,7 @@ proc sqlite-handle-icu {} { msg-result "Checking for ICU support..." set icuConfigBin [opt-val with-icu-config] set tryIcuConfigBin 1; # set to 0 if we end up using pkg-config - if {"auto" eq $icuConfigBin || "pkg-config" eq $icuConfigBin} { + if {$icuConfigBin in {auto pkg-config}} { if {[pkg-config-init 0] && [pkg-config icu-io]} { # Maintenance reminder: historical docs say to use both of # (icu-io, icu-uc). icu-uc lacks a required lib and icu-io has @@ -1387,7 +1369,7 @@ proc sqlite-handle-math {} { define LDFLAGS_MATH [get-define lib_ceil] undefine lib_ceil sqlite-add-feature-flag {-DSQLITE_ENABLE_MATH_FUNCTIONS} - msg-result "Enabling math SQL functions [get-define LDFLAGS_MATH]" + msg-result "Enabling math SQL functions" } { define LDFLAGS_MATH "" msg-result "Disabling math SQL functions" diff --git a/main.mk b/main.mk index 93cfe4b7c1..bcdfbd8638 100644 --- a/main.mk +++ b/main.mk @@ -187,6 +187,9 @@ CFLAGS.readline ?= -I$(prefix)/include # during installation, which may break the build of targets which are # built after others are installed. # +# Maintenance reminder: we specifically do not strip binaries, as +# discussed in https://sqlite.org/forum/forumpost/9a67df63eda9925c. +# INSTALL ?= install # # $(ENABLE_LIB_SHARED) = diff --git a/manifest b/manifest index e53dc8b04f..45d50e3329 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C In\sthe\sautoconf\sbundle,\sdo\snot\sstrip\sbinaries\sduring\sinstallation,\sfor\sparity\swith\sthe\scanonical\sbuild\sand\sthe\slegacy\sbuild.\sDiscussed\sin\s[forum:9a67df63eda9925c|forum\spost\s9a67df63eda9925c].\sA\spotential\sTODO\shere\sis\sto\sadd\sa\sconfigure\sflag\swhich\seither\senables\sor\sdisables\sstripping. -D 2025-03-22T12:15:13.411 +C Configure\sscript\sinternal\scleanups\sand\sre-orgs.\sNo\sfunctional\schanges. +D 2025-03-22T12:43:22.020 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d -F Makefile.in 2c4d3c20e42ddd7596432c8d45feeaf709f93b37279e274ea413034912a4f840 +F Makefile.in 86cc5297495fd5ce632cd7ec298c562900f874eef42c44d5890bd22397bb3820 F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0 F Makefile.msc ef04498c7e227a0f459b105bb4952f26cc985d1d6340a367e62d5a79c4689dfb F README.md a953c0cffd6e4f2501a306c00ee2b6e1e6630c25031e094629307fe99dd003d1 @@ -14,13 +14,13 @@ F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 -F auto.def 23f0e7eb5eff4cf922963e667ed630793ed60300df59ef9d93c87a23e31c7232 +F auto.def f769bf3111089ee9471a2a872c47651c4e29e81d104a52867ab544fde5ef6bad F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac F autoconf/Makefile.in 1fe497c0df20102f7824ec8a3423cc13c26505655456ecd06a7a8ab02f606586 F autoconf/Makefile.msc 5bc67d3912444c40c6f96d003e5c90663e51abb83d204a520110b1b2038dcd8b F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 1a32296d8bbdd67110c79d224c92c05545a0b5bd0c272950025fe3c7c7b49580 -F autoconf/auto.def 42d239bda4feffe1cf8a431dae35f83d100f2c17ed4b189edeb12f067bd4fa90 +F autoconf/auto.def 4cb3c39042039bb852034dc1a9d42717d42eef759a687a664ad283db8e6b816e F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 6c396709b45eb2b3be0ae6dc7e40a140d231962e3a2354da6c4dd48b1d9999bc F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 @@ -49,8 +49,8 @@ F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1d F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl 8bb4158e71b5d60070b86af3f7b1edf960c60b77f102ea5d688d89c7d57d8a32 -F autosetup/sqlite-config.tcl ff39112eddc68e9505562c6aefc0b505190fe1fe93b2273e0b50ce5c7bbf6e64 +F autosetup/proj.tcl 49faf960df88a374686234105def663dbfc297ab79c87686df0a0b973dd77018 +F autosetup/sqlite-config.tcl 6e1dce27dfb69910bc28c3d3d4e33470fffc3c68f1d6a87799d34a2cc27f79dd F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl eb4c6578e08dd353263958da0dc620f8400b869a50d06e271ab0be85a51a08d3 @@ -707,7 +707,7 @@ F ext/wasm/tests/opfs/sahpool/sahpool-pausing.js f264925cfc82155de38cecb3d204c36 F ext/wasm/tests/opfs/sahpool/sahpool-worker.js bd25a43fc2ab2d1bafd8f2854ad3943ef673f7c3be03e95ecf1612ff6e8e2a61 F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk 7006135b902177f7c8bca2733a6820b72a0c6f5a47412b2a7c86668f0398f1fd +F main.mk a8930b3338afa3065f89735c6e5f9a9d64d90bd3154fe4580696502a7c2a99ad F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2216,8 +2216,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6a0ca9f2360d29272d7be97fe9f516c3ac88864f3e729ba65da1ef6211908775 -R d1ffac2a55e3dd0a47e636cf53422326 +P 6d2e57bd34c562a9cd618c178c3f92b869bf5420907057b8d2438b16a7f91d46 +R 62beb2007ca701c04bb0d952df27e3be U stephan -Z 5228f6e80ecc00f8456564524a3b87e2 +Z 0c3e870740ca71059ff9bfd7fd177692 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 1e0f91aeb5..3b86c2d55b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6d2e57bd34c562a9cd618c178c3f92b869bf5420907057b8d2438b16a7f91d46 +f619e40fb05d3e09dca2ad9d9bbf38c66b4b93dd3d4e7c2071db28e671ee6a9c From 515b51f635263d0c46f4c541e4aef64b4964ca47 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 22 Mar 2025 16:14:34 +0000 Subject: [PATCH 10/23] Add a mechanism to the configure script to allow certain client-specific builds to extend or override the configure options without having to edit sqlite-config.tcl, the goal being to reduce merge conflicts in those builds when updating sqlite-config.tcl from the canonical copy. FossilOrigin-Name: bafab4ee5545c6cf6eafc5e352a7f25dfcbc7e58d4cc9064d05658c39de2af0d --- autosetup/sqlite-config.tcl | 31 +++++++++++++++++++++++++------ manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 15c0995500..ab2b80956e 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -180,6 +180,8 @@ proc sqlite-configure {buildMode configScript} { threadsafe=1 => {Disable mutexing} with-tempstore:=no => {Use an in-RAM database for temporary tables: never,no,yes,always} load-extension=1 => {Disable loading of external extensions} + # ^^^ one of the downstream custom builds overrides the load-extension default to 0, which + # confuses the --help text generator. https://github.com/msteveb/autosetup/issues/77 math=1 => {Disable math functions} json=1 => {Disable JSON functions} memsys5 => {Enable MEMSYS5} @@ -307,9 +309,9 @@ proc sqlite-configure {buildMode configScript} { # out-implib: https://sqlite.org/forum/forumpost/0c7fc097b2 out-implib:=auto => {Enable use of --out-implib linker flag to generate an - "import library" for the DLL. The output's base name name is - specified by the value, with "auto" meaning to figure out a - name automatically. On some platforms this flag gets + "import library" for the DLL. The output's base name is + specified by this flag's value, with "auto" meaning to figure + out a name automatically. On some platforms this flag gets automatically enabled if it is not provided. Use "none" to explicitly disable this feature on such platforms.} } @@ -353,9 +355,20 @@ proc sqlite-configure {buildMode configScript} { (for build debugging)} } } - }; # $allOpts + }; # $allFlags - # Filter allOpts to create the set of [options] legal for this build + set allFlags [proj-strip-hash-comments $allFlags] + # ^^^ lappend of [sqlite-custom-flags] introduces weirdness if + # we delay [proj-strip-hash-comments] until after that. + + if {[llength [info proc sqlite-custom-flags]] > 0} { + # sqlite-custom-flags is assumed to be imported via a + # client-specific import: autosetup/local.tcl, autosetup/*.auto, + # or autosetup/*/*.auto. + lappend allFlags sqlite-custom-flags [sqlite-custom-flags] + } + + # Filter allFlags to create the set of [options] legal for this build set opts {} foreach {group XY} [subst -nobackslashes -nocommands \ [proj-strip-hash-comments $allFlags]] { @@ -1353,7 +1366,7 @@ proc sqlite-handle-load-extension {} { if {$found} { msg-result "Loadable extension support enabled." } else { - msg-result "Disabling loadable extension support. Use --enable-load-extensions to enable them." + msg-result "Disabling loadable extension support. Use --enable-load-extension to enable them." sqlite-add-feature-flag {-DSQLITE_OMIT_LOAD_EXTENSION=1} } return $found @@ -1579,6 +1592,12 @@ proc sqlite-handle-env-quirks {} { sqlite-handle-dll-basename sqlite-handle-out-implib sqlite-handle-mac-cversion + if {[llength [info proc sqlite-handle-custom-flags]] > 0} { + # sqlite-handle-custom-flags is assumed to be imported via a + # client-specific import: autosetup/local.tcl, autosetup/*.auto, + # or autosetup/*/*.auto. + sqlite-handle-custom-flags + } } ######################################################################## diff --git a/manifest b/manifest index 45d50e3329..aaae7f9c85 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Configure\sscript\sinternal\scleanups\sand\sre-orgs.\sNo\sfunctional\schanges. -D 2025-03-22T12:43:22.020 +C Add\sa\smechanism\sto\sthe\sconfigure\sscript\sto\sallow\scertain\sclient-specific\sbuilds\sto\sextend\sor\soverride\sthe\sconfigure\soptions\swithout\shaving\sto\sedit\ssqlite-config.tcl,\sthe\sgoal\sbeing\sto\sreduce\smerge\sconflicts\sin\sthose\sbuilds\swhen\supdating\ssqlite-config.tcl\sfrom\sthe\scanonical\scopy. +D 2025-03-22T16:14:34.864 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl 49faf960df88a374686234105def663dbfc297ab79c87686df0a0b973dd77018 -F autosetup/sqlite-config.tcl 6e1dce27dfb69910bc28c3d3d4e33470fffc3c68f1d6a87799d34a2cc27f79dd +F autosetup/sqlite-config.tcl c7c8dc9b864f0212bda4a1dfd30777f3757ff12d7b18adce1420c0f717c4c284 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl eb4c6578e08dd353263958da0dc620f8400b869a50d06e271ab0be85a51a08d3 @@ -2216,8 +2216,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6d2e57bd34c562a9cd618c178c3f92b869bf5420907057b8d2438b16a7f91d46 -R 62beb2007ca701c04bb0d952df27e3be +P f619e40fb05d3e09dca2ad9d9bbf38c66b4b93dd3d4e7c2071db28e671ee6a9c +R f67c95dd2f17cb92eaf9fc59dd22ee04 U stephan -Z 0c3e870740ca71059ff9bfd7fd177692 +Z 9a64dbd75b7ea845562f9902f8b1107a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 3b86c2d55b..34f2f2d47f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f619e40fb05d3e09dca2ad9d9bbf38c66b4b93dd3d4e7c2071db28e671ee6a9c +bafab4ee5545c6cf6eafc5e352a7f25dfcbc7e58d4cc9064d05658c39de2af0d From d9535334c651f1c9bd609d29f51d1e03244ff1dd Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 22 Mar 2025 17:00:32 +0000 Subject: [PATCH 11/23] Teach mkautoconfamal.sh to avoid copying autosetup/local.tcl and autosetup/*.auto except for autosetup/lib/CURRENT-BRANCH-NAME.auto (if any), the intent being to use lib/CURRENT-BRANCH-NAME.auto for branch-specific configuration customizations. FossilOrigin-Name: dfe24f13c446de5fdd736ed52fec0fca4637b4151ba008de7a598a2fc9398816 --- manifest | 12 ++++++------ manifest.uuid | 2 +- tool/mkautoconfamal.sh | 17 +++++++++++++++++ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index aaae7f9c85..04fb6abb82 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\smechanism\sto\sthe\sconfigure\sscript\sto\sallow\scertain\sclient-specific\sbuilds\sto\sextend\sor\soverride\sthe\sconfigure\soptions\swithout\shaving\sto\sedit\ssqlite-config.tcl,\sthe\sgoal\sbeing\sto\sreduce\smerge\sconflicts\sin\sthose\sbuilds\swhen\supdating\ssqlite-config.tcl\sfrom\sthe\scanonical\scopy. -D 2025-03-22T16:14:34.864 +C Teach\smkautoconfamal.sh\sto\savoid\scopying\sautosetup/local.tcl\sand\sautosetup/*.auto\sexcept\sfor\sautosetup/lib/CURRENT-BRANCH-NAME.auto\s(if\sany),\sthe\sintent\sbeing\sto\suse\slib/CURRENT-BRANCH-NAME.auto\sfor\sbranch-specific\sconfiguration\scustomizations. +D 2025-03-22T17:00:32.967 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -2151,7 +2151,7 @@ F tool/logest.c c34e5944318415de513d29a6098df247a9618c96d83c38d4abd88641fe46e669 F tool/max-limits.c cbb635fbb37ae4d05f240bfb5b5270bb63c54439 F tool/merge-test.tcl de76b62f2de2a92d4c1ca4f976bce0aea6899e0229e250479b229b2a1914b176 F tool/mkamalzip.tcl 8aa5ebe7973c8b8774062d34e15fea9815c4cc2ceea3a9b184695f005910876a -F tool/mkautoconfamal.sh c5e65fa1c922f2e3b3e4f6cd0331ec7d84bdef085f32cb1c46673cdf95ec8090 +F tool/mkautoconfamal.sh 6b040e008a318c2b92b0b8cf9b7879f2843433aea6834e89897a0f21ebc46e5b F tool/mkccode.tcl c42a8f8cf78f92e83795d5447460dbce7aaf78a3bbf9082f1507dc71a3665f3c x F tool/mkctimec.tcl f76dbfc74cefad8d126384ba3263677939f077bd184fcdf8c592a1daf64f50c3 x F tool/mkkeywordhash.c 6b0be901c47f9ad42215fc995eb2f4384ac49213b1fba395102ec3e999acf559 @@ -2216,8 +2216,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P f619e40fb05d3e09dca2ad9d9bbf38c66b4b93dd3d4e7c2071db28e671ee6a9c -R f67c95dd2f17cb92eaf9fc59dd22ee04 +P bafab4ee5545c6cf6eafc5e352a7f25dfcbc7e58d4cc9064d05658c39de2af0d +R 6b1a45c990d67ff1ce7361064641b32c U stephan -Z 9a64dbd75b7ea845562f9902f8b1107a +Z 2e3346333053a23fc85b7950d2cfe6bb # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 34f2f2d47f..84fd431ba3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -bafab4ee5545c6cf6eafc5e352a7f25dfcbc7e58d4cc9064d05658c39de2af0d +dfe24f13c446de5fdd736ed52fec0fca4637b4151ba008de7a598a2fc9398816 diff --git a/tool/mkautoconfamal.sh b/tool/mkautoconfamal.sh index c26ac8c73c..afe60fd66f 100644 --- a/tool/mkautoconfamal.sh +++ b/tool/mkautoconfamal.sh @@ -24,6 +24,12 @@ TMPSPACE=./mkpkg_tmp_dir VERSION=`cat $TOP/VERSION` HASH=`cut -c1-10 $TOP/manifest.uuid` DATETIME=`grep '^D' $TOP/manifest | tr -c -d '[0-9]' | cut -c1-12` +BRANCH=`fossil whatis $HASH | awk '/tags:/{print $2}'` + +if [ x = "x${BRANCH}" ]; then + echo "Cannot determine the current branch" 1>&2 + exit 1 +fi # Inject the current version into the TEA autoconf file. # @@ -37,6 +43,8 @@ then echo "TEA version number ok" else echo "TEA version number mismatch. Should be $VERSION"; exit 1 fi + + # If this script is given an argument of --snapshot, then generate a # snapshot tarball named for the current checkout SHA hash, rather than # the version number. @@ -59,6 +67,15 @@ fi rm -rf $TMPSPACE cp -R $TOP/autoconf $TMPSPACE cp -R $TOP/autosetup $TMPSPACE +# Do not include build-specific customizations in the autoconf build: +rm -f $TMPSPACE/autosetup/local.tcl $TMPSPACE/autosetup/*.auto $TMPSPACE/autosetup/*/*.auto +# ... unless we find one which matches the current branch name: +bac=$TOP/autosetup/lib/${BRANCH}.auto +if [ -f $bac ]; then + echo "Copying branch-specific autosetup configuration: $bac" + mkdir -p $TMPSPACE/autosetup/lib + cp $bac $TMPSPACE/autosetup/lib +fi cp -p $TOP/configure $TMPSPACE cp sqlite3.c $TMPSPACE cp sqlite3.h $TMPSPACE From 77dc2d8fb1dfe967396c208bb655f83a9128c016 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 22 Mar 2025 17:28:29 +0000 Subject: [PATCH 12/23] Document the new configuration customization approach and extend it to enable sqlite-custom-flags to return an empty string to denote that it does not require any new flags (it may still customize flag default values in such cases). FossilOrigin-Name: b0c7800b0106e90cb7bf7e5d9f48d21f9b058eff6e42339a1621d713ab2dd03c --- autosetup/README.md | 68 +++++++++++++++++++++++++++++++++++++ autosetup/sqlite-config.tcl | 5 ++- manifest | 14 ++++---- manifest.uuid | 2 +- 4 files changed, 80 insertions(+), 9 deletions(-) diff --git a/autosetup/README.md b/autosetup/README.md index a61f94fbda..c0aeff15d0 100644 --- a/autosetup/README.md +++ b/autosetup/README.md @@ -15,6 +15,8 @@ build infrastructure. It is not an [Autosetup][] reference. - Do Not Update Global Shared State - [Updating Autosetup](#updating) - ***[Patching Autosetup for Project-local changes](#patching)*** +- [Branch-specific Customization](#branch-customization) + ------------------------------------------------------------------------ @@ -385,6 +387,72 @@ If autosetup is upgraded and this patch is _not_ applied the invoking `./configure` will fail loudly because of the declaration of the `debug` flag in `auto.def` - duplicated flags are not permitted. + +Branch-specific Customization +======================================================================== + +Certain vendor-specific branches require slight configure script +customization. Rather than editing `sqlite-config.tcl` for this, +which frequently leads to merge conflicts, the following approach +is recommended: + +In the vendor-specific branch, create a file named +`autosetup/lib/THE-BRANCH-NAME.auto`. Autosetup will automatically +load any files named `autosetup/*.auto` or `autosetup/*/*.auto` when +it starts up. + +That file should contain the following content... + +If flag customization is required, add: + +> +``` +proc sqlite-custom-flags {} { + # If any existing --flags require different default values + # then call: + options-defaults { + flag-name new-default-value + } + # ^^^ That will replace the default value but will not update + # the --help text, which may lead to some confusion: + # https://github.com/msteveb/autosetup/issues/77 + + return { + {*} { + new-flag-name {Help text} + ... + } + }; #see below +} +``` + +That function must return either an empty string or a list in the form +used internally by `sqlite-config.tcl:sqlite-configure`. + +Next, define: + +> +``` +proc sqlite-handle-custom-flags {} { + ... do any custom flag handling here ... +} +``` + +That function will be called relatively late in the configure process, +before any filtered files are generated but after all other +significant processing. + +It is important that no more than one `*.auto` or `local.tcl` file +defines these functions. Autosetup will load these in an unspecified +order, and the _last_ one which is loaded will overwrite any procs +defined in files loaded before it. + +When running [mkautoconfamal.sh](/file/tool/mkautoconfamal.sh) +(typically via `make amalgamation-tarball` or `make snapshot-tarball`), +all `autosetup/local.tcl` and `autosetup/[*/]*.auto` files will be +elided from the tarball except for `autosetup/lib/X.auto`, where `X` +is the name of the current checkout's branch. + [Autosetup]: https://msteveb.github.io/autosetup/ [auto.def]: /file/auto.def diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index ab2b80956e..0ead4cd77e 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -365,7 +365,10 @@ proc sqlite-configure {buildMode configScript} { # sqlite-custom-flags is assumed to be imported via a # client-specific import: autosetup/local.tcl, autosetup/*.auto, # or autosetup/*/*.auto. - lappend allFlags sqlite-custom-flags [sqlite-custom-flags] + set scf [sqlite-custom-flags] + if {"" ne $scf} { + lappend allFlags sqlite-custom-flags $scf + } } # Filter allFlags to create the set of [options] legal for this build diff --git a/manifest b/manifest index 04fb6abb82..53b12829eb 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Teach\smkautoconfamal.sh\sto\savoid\scopying\sautosetup/local.tcl\sand\sautosetup/*.auto\sexcept\sfor\sautosetup/lib/CURRENT-BRANCH-NAME.auto\s(if\sany),\sthe\sintent\sbeing\sto\suse\slib/CURRENT-BRANCH-NAME.auto\sfor\sbranch-specific\sconfiguration\scustomizations. -D 2025-03-22T17:00:32.967 +C Document\sthe\snew\sconfiguration\scustomization\sapproach\sand\sextend\sit\sto\senable\ssqlite-custom-flags\sto\sreturn\san\sempty\sstring\sto\sdenote\sthat\sit\sdoes\snot\srequire\sany\snew\sflags\s(it\smay\sstill\scustomize\sflag\sdefault\svalues\sin\ssuch\scases). +D 2025-03-22T17:28:29.220 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -37,7 +37,7 @@ F autoconf/tea/win/rules.vc 94a18c3e453535459b4a643983acca52fb8756e79055bd2ad4b0 F autoconf/tea/win/targets.vc 96a25a1fa6e9e9cfb348fd3760a5395b4ce8acafc8ed10f0412937ec200d5dbd F autosetup/LICENSE 41a26aebdd2cd185d1e2b210f71b7ce234496979f6b35aef2cbf6b80cbed4ce4 F autosetup/README.autosetup a78ff8c4a3d2636a4268736672a74bf14a82f42687fcf0631a70c516075c031e -F autosetup/README.md f98cc827a162a1da4877e9656d749d414ba3f408d457d30e029afc66590c00c3 +F autosetup/README.md 564fd67ce77466e502af1af1967c4b4bc6401558051f7a2f1d9ab67e689f3e6e F autosetup/autosetup 74a9782b68d07934510190fbd03fc6ad92e63f0ea3b5cbffa5f0bd271ad60f01 x F autosetup/autosetup-config.guess dfa101c5e8220e864d5e9c72a85e87110df60260d36cb951ad0a85d6d9eaa463 x F autosetup/autosetup-config.sub a38fb074d0dece01cf919e9fb534a26011608aa8fa606490864295328526cd73 x @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl 49faf960df88a374686234105def663dbfc297ab79c87686df0a0b973dd77018 -F autosetup/sqlite-config.tcl c7c8dc9b864f0212bda4a1dfd30777f3757ff12d7b18adce1420c0f717c4c284 +F autosetup/sqlite-config.tcl 9d4ccbfd24f97be0e7e2be05a211700033521fc1d8d3bab40c1e923028e56e6c F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl eb4c6578e08dd353263958da0dc620f8400b869a50d06e271ab0be85a51a08d3 @@ -2216,8 +2216,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P bafab4ee5545c6cf6eafc5e352a7f25dfcbc7e58d4cc9064d05658c39de2af0d -R 6b1a45c990d67ff1ce7361064641b32c +P dfe24f13c446de5fdd736ed52fec0fca4637b4151ba008de7a598a2fc9398816 +R 8b1428f131d956d6b5e603417734bbed U stephan -Z 2e3346333053a23fc85b7950d2cfe6bb +Z 9e1837e75f17b5dbb42e5442891f4dea # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 84fd431ba3..5dea685a7c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -dfe24f13c446de5fdd736ed52fec0fca4637b4151ba008de7a598a2fc9398816 +b0c7800b0106e90cb7bf7e5d9f48d21f9b058eff6e42339a1621d713ab2dd03c From 0fce9c935fac6c6ac6ccbd5be049e44438900c7b Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 22 Mar 2025 17:56:20 +0000 Subject: [PATCH 13/23] Slight corrections to the new docs in autosetup/README.md. FossilOrigin-Name: 55029e41e03d9b61b8a53f86d7f69afe71459846f3a1a1723f6934e0d37ca77f --- autosetup/README.md | 3 ++- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/autosetup/README.md b/autosetup/README.md index c0aeff15d0..5e37fdfce8 100644 --- a/autosetup/README.md +++ b/autosetup/README.md @@ -412,6 +412,7 @@ proc sqlite-custom-flags {} { # then call: options-defaults { flag-name new-default-value + ... } # ^^^ That will replace the default value but will not update # the --help text, which may lead to some confusion: @@ -419,7 +420,7 @@ proc sqlite-custom-flags {} { return { {*} { - new-flag-name {Help text} + new-flag-name => {Help text} ... } }; #see below diff --git a/manifest b/manifest index 53b12829eb..e4841c914e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Document\sthe\snew\sconfiguration\scustomization\sapproach\sand\sextend\sit\sto\senable\ssqlite-custom-flags\sto\sreturn\san\sempty\sstring\sto\sdenote\sthat\sit\sdoes\snot\srequire\sany\snew\sflags\s(it\smay\sstill\scustomize\sflag\sdefault\svalues\sin\ssuch\scases). -D 2025-03-22T17:28:29.220 +C Slight\scorrections\sto\sthe\snew\sdocs\sin\sautosetup/README.md. +D 2025-03-22T17:56:20.782 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -37,7 +37,7 @@ F autoconf/tea/win/rules.vc 94a18c3e453535459b4a643983acca52fb8756e79055bd2ad4b0 F autoconf/tea/win/targets.vc 96a25a1fa6e9e9cfb348fd3760a5395b4ce8acafc8ed10f0412937ec200d5dbd F autosetup/LICENSE 41a26aebdd2cd185d1e2b210f71b7ce234496979f6b35aef2cbf6b80cbed4ce4 F autosetup/README.autosetup a78ff8c4a3d2636a4268736672a74bf14a82f42687fcf0631a70c516075c031e -F autosetup/README.md 564fd67ce77466e502af1af1967c4b4bc6401558051f7a2f1d9ab67e689f3e6e +F autosetup/README.md 824d12ee3c094419084f31dc5408afc4d950b041497f9f21b357fd2e1070c8c9 F autosetup/autosetup 74a9782b68d07934510190fbd03fc6ad92e63f0ea3b5cbffa5f0bd271ad60f01 x F autosetup/autosetup-config.guess dfa101c5e8220e864d5e9c72a85e87110df60260d36cb951ad0a85d6d9eaa463 x F autosetup/autosetup-config.sub a38fb074d0dece01cf919e9fb534a26011608aa8fa606490864295328526cd73 x @@ -2216,8 +2216,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P dfe24f13c446de5fdd736ed52fec0fca4637b4151ba008de7a598a2fc9398816 -R 8b1428f131d956d6b5e603417734bbed +P b0c7800b0106e90cb7bf7e5d9f48d21f9b058eff6e42339a1621d713ab2dd03c +R 04399760b25701e54cab662a55267fa0 U stephan -Z 9e1837e75f17b5dbb42e5442891f4dea +Z b23822ed77b6b288de67fa220f936c97 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5dea685a7c..8958a86852 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b0c7800b0106e90cb7bf7e5d9f48d21f9b058eff6e42339a1621d713ab2dd03c +55029e41e03d9b61b8a53f86d7f69afe71459846f3a1a1723f6934e0d37ca77f From bf698fd69dcdf5f7a9a21b20549331101eef8fce Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 22 Mar 2025 18:41:48 +0000 Subject: [PATCH 14/23] In the post-configure validation, ensure than no more than one autosetup/lib/*.auto file is found, for reasons explained in the validation's error message. FossilOrigin-Name: 50bbd69a684988a1df4c9c7616b76ae62bc4eb755cde18616de58aa0880fd4a7 --- autosetup/sqlite-config.tcl | 35 +++++++++++++++++++++++++++++++++-- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 40 insertions(+), 9 deletions(-) diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 0ead4cd77e..55c2c0f8d8 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -11,7 +11,7 @@ if {[string first " " $autosetup(builddir)] != -1} { user-error "The pathname of the build directory\ may not contain space characters" } - +#parray ::autosetup; exit 0 use proj # # We want the package version info to be emitted early on, but doing @@ -1634,7 +1634,12 @@ proc sqlite-process-dot-in-files {} { # 1) Ensure that no unresolved @VAR@ placeholders are in files which # use those. # -# 2) TBD +# 2) Ensure that no more than one autosetup/lib/*.auto file is found. +# Those are used for vendor-branch-specific customization of the +# configure process (see autosetup/README.md#branch-customization) +# and having more than one can lead to subtle errors. +# +# 3) TBD proc sqlite-post-config-validation {} { # Check #1: ensure that files which get filtered for @VAR@ do not # contain any unresolved @VAR@ refs. That may indicate an @@ -1652,6 +1657,32 @@ proc sqlite-post-config-validation {} { incr lnno } } + + # Check #2: ensure that no more than one autosetup/lib/*.auto file + # is found. + set libdir $::autosetup(libdir) + set li [glob -nocomplain $libdir/lib/*.auto] + if {[llength $li] > 1} { + puts stderr "Configuration validation error:" + proj-indented-notice -error [subst { + Multiple $libdir/lib/*.auto files found: + + $li + + This probably means one of the following: + + 1) Multiple vendor branches have been merged together, each with + their own configure-script customizations. They will be loaded + and applied in an unpredictable order, so the tree should have, + at most one lib/*.auto file, conventionally named after the + current vendor branch. + + 2) It can also mean that files have been left lying around from + another branch after doing "fossil update", in which case they + can all be deleted, then do "fossil update" again to replace + only the intended one (if any). + }] + } } ######################################################################## diff --git a/manifest b/manifest index e4841c914e..92ae29cb4c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Slight\scorrections\sto\sthe\snew\sdocs\sin\sautosetup/README.md. -D 2025-03-22T17:56:20.782 +C In\sthe\spost-configure\svalidation,\sensure\sthan\sno\smore\sthan\sone\sautosetup/lib/*.auto\sfile\sis\sfound,\sfor\sreasons\sexplained\sin\sthe\svalidation's\serror\smessage. +D 2025-03-22T18:41:48.016 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl 49faf960df88a374686234105def663dbfc297ab79c87686df0a0b973dd77018 -F autosetup/sqlite-config.tcl 9d4ccbfd24f97be0e7e2be05a211700033521fc1d8d3bab40c1e923028e56e6c +F autosetup/sqlite-config.tcl 7349901814106dee86ee2b9daf68afd26c13f7f92be69ffda9f6fdc7aedc442e F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl eb4c6578e08dd353263958da0dc620f8400b869a50d06e271ab0be85a51a08d3 @@ -2216,8 +2216,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b0c7800b0106e90cb7bf7e5d9f48d21f9b058eff6e42339a1621d713ab2dd03c -R 04399760b25701e54cab662a55267fa0 +P 55029e41e03d9b61b8a53f86d7f69afe71459846f3a1a1723f6934e0d37ca77f +R f7433d2d6b9b7224d419751c11759d8c U stephan -Z b23822ed77b6b288de67fa220f936c97 +Z ce4dace35b5c51a050a3591235a1b475 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 8958a86852..1be3a9acb3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -55029e41e03d9b61b8a53f86d7f69afe71459846f3a1a1723f6934e0d37ca77f +50bbd69a684988a1df4c9c7616b76ae62bc4eb755cde18616de58aa0880fd4a7 From 3f911b12e6df9f79468d07c739ceeafa4c837d83 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 22 Mar 2025 19:07:54 +0000 Subject: [PATCH 15/23] Replace use of autosetup/lib/*.auto for sqlite-custom-... features to avoid the possibility of multiple files being loaded (in an unpredictable order) for that purpose. Instead look for autosetup/sqlite-custom.tcl and source it if it exists. The intent is that sqlite-custom.tcl only ever be added in vendor-specific branches and never in the trunk. FossilOrigin-Name: f3c0071284fbe1c0a8c3fe73792a79f9df6be983e5c9bd1a7e2fe71ba7b2d400 --- autosetup/README.md | 23 ++++----------- autosetup/sqlite-config.tcl | 56 +++++++++++-------------------------- manifest | 16 +++++------ manifest.uuid | 2 +- tool/mkautoconfamal.sh | 15 ---------- 5 files changed, 30 insertions(+), 82 deletions(-) diff --git a/autosetup/README.md b/autosetup/README.md index 5e37fdfce8..3301f57395 100644 --- a/autosetup/README.md +++ b/autosetup/README.md @@ -397,9 +397,7 @@ which frequently leads to merge conflicts, the following approach is recommended: In the vendor-specific branch, create a file named -`autosetup/lib/THE-BRANCH-NAME.auto`. Autosetup will automatically -load any files named `autosetup/*.auto` or `autosetup/*/*.auto` when -it starts up. +`autosetup/sqlite-custom.tcl`. That file should contain the following content... @@ -434,25 +432,14 @@ Next, define: > ``` -proc sqlite-handle-custom-flags {} { +proc sqlite-custom-handle-flags {} { ... do any custom flag handling here ... } ``` -That function will be called relatively late in the configure process, -before any filtered files are generated but after all other -significant processing. - -It is important that no more than one `*.auto` or `local.tcl` file -defines these functions. Autosetup will load these in an unspecified -order, and the _last_ one which is loaded will overwrite any procs -defined in files loaded before it. - -When running [mkautoconfamal.sh](/file/tool/mkautoconfamal.sh) -(typically via `make amalgamation-tarball` or `make snapshot-tarball`), -all `autosetup/local.tcl` and `autosetup/[*/]*.auto` files will be -elided from the tarball except for `autosetup/lib/X.auto`, where `X` -is the name of the current checkout's branch. +That function, if defined, will be called relatively late in the +configure process, before any filtered files are generated but after +all other significant processing. [Autosetup]: https://msteveb.github.io/autosetup/ diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 55c2c0f8d8..d1347c0fda 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -361,10 +361,18 @@ proc sqlite-configure {buildMode configScript} { # ^^^ lappend of [sqlite-custom-flags] introduces weirdness if # we delay [proj-strip-hash-comments] until after that. + + ######################################################################## + # sqlite-custom.tcl is intended only for vendor-branch-specific + # customization. See autosetup/README.md#branch-customization for + # details. + if {[file exists $::autosetup(libdir)/sqlite-custom.tcl]} { + uplevel 1 {source $::autosetup(libdir)/sqlite-custom.tcl} + } + if {[llength [info proc sqlite-custom-flags]] > 0} { - # sqlite-custom-flags is assumed to be imported via a - # client-specific import: autosetup/local.tcl, autosetup/*.auto, - # or autosetup/*/*.auto. + # sqlite-custom-flags is assumed to be imported via + # autosetup/sqlite-custom.tcl. set scf [sqlite-custom-flags] if {"" ne $scf} { lappend allFlags sqlite-custom-flags $scf @@ -1595,11 +1603,10 @@ proc sqlite-handle-env-quirks {} { sqlite-handle-dll-basename sqlite-handle-out-implib sqlite-handle-mac-cversion - if {[llength [info proc sqlite-handle-custom-flags]] > 0} { - # sqlite-handle-custom-flags is assumed to be imported via a - # client-specific import: autosetup/local.tcl, autosetup/*.auto, - # or autosetup/*/*.auto. - sqlite-handle-custom-flags + if {[llength [info proc sqlite-custom-handle-flags]] > 0} { + # sqlite-custom-handle-flags is assumed to be imported via a + # client-specific import: autosetup/sqlite-custom.tcl. + sqlite-custom-handle-flags } } @@ -1634,12 +1641,7 @@ proc sqlite-process-dot-in-files {} { # 1) Ensure that no unresolved @VAR@ placeholders are in files which # use those. # -# 2) Ensure that no more than one autosetup/lib/*.auto file is found. -# Those are used for vendor-branch-specific customization of the -# configure process (see autosetup/README.md#branch-customization) -# and having more than one can lead to subtle errors. -# -# 3) TBD +# 2) TBD proc sqlite-post-config-validation {} { # Check #1: ensure that files which get filtered for @VAR@ do not # contain any unresolved @VAR@ refs. That may indicate an @@ -1657,32 +1659,6 @@ proc sqlite-post-config-validation {} { incr lnno } } - - # Check #2: ensure that no more than one autosetup/lib/*.auto file - # is found. - set libdir $::autosetup(libdir) - set li [glob -nocomplain $libdir/lib/*.auto] - if {[llength $li] > 1} { - puts stderr "Configuration validation error:" - proj-indented-notice -error [subst { - Multiple $libdir/lib/*.auto files found: - - $li - - This probably means one of the following: - - 1) Multiple vendor branches have been merged together, each with - their own configure-script customizations. They will be loaded - and applied in an unpredictable order, so the tree should have, - at most one lib/*.auto file, conventionally named after the - current vendor branch. - - 2) It can also mean that files have been left lying around from - another branch after doing "fossil update", in which case they - can all be deleted, then do "fossil update" again to replace - only the intended one (if any). - }] - } } ######################################################################## diff --git a/manifest b/manifest index 92ae29cb4c..b134218cf5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sthe\spost-configure\svalidation,\sensure\sthan\sno\smore\sthan\sone\sautosetup/lib/*.auto\sfile\sis\sfound,\sfor\sreasons\sexplained\sin\sthe\svalidation's\serror\smessage. -D 2025-03-22T18:41:48.016 +C Replace\suse\sof\sautosetup/lib/*.auto\sfor\ssqlite-custom-...\sfeatures\sto\savoid\sthe\spossibility\sof\smultiple\sfiles\sbeing\sloaded\s(in\san\sunpredictable\sorder)\sfor\sthat\spurpose.\sInstead\slook\sfor\sautosetup/sqlite-custom.tcl\sand\ssource\sit\sif\sit\sexists.\sThe\sintent\sis\sthat\ssqlite-custom.tcl\sonly\sever\sbe\sadded\sin\svendor-specific\sbranches\sand\snever\sin\sthe\strunk. +D 2025-03-22T19:07:54.825 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -37,7 +37,7 @@ F autoconf/tea/win/rules.vc 94a18c3e453535459b4a643983acca52fb8756e79055bd2ad4b0 F autoconf/tea/win/targets.vc 96a25a1fa6e9e9cfb348fd3760a5395b4ce8acafc8ed10f0412937ec200d5dbd F autosetup/LICENSE 41a26aebdd2cd185d1e2b210f71b7ce234496979f6b35aef2cbf6b80cbed4ce4 F autosetup/README.autosetup a78ff8c4a3d2636a4268736672a74bf14a82f42687fcf0631a70c516075c031e -F autosetup/README.md 824d12ee3c094419084f31dc5408afc4d950b041497f9f21b357fd2e1070c8c9 +F autosetup/README.md f324bb9f9bf1cc787122034df53fbfdfed28ee2657e6652b763d992ab0d04829 F autosetup/autosetup 74a9782b68d07934510190fbd03fc6ad92e63f0ea3b5cbffa5f0bd271ad60f01 x F autosetup/autosetup-config.guess dfa101c5e8220e864d5e9c72a85e87110df60260d36cb951ad0a85d6d9eaa463 x F autosetup/autosetup-config.sub a38fb074d0dece01cf919e9fb534a26011608aa8fa606490864295328526cd73 x @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl 49faf960df88a374686234105def663dbfc297ab79c87686df0a0b973dd77018 -F autosetup/sqlite-config.tcl 7349901814106dee86ee2b9daf68afd26c13f7f92be69ffda9f6fdc7aedc442e +F autosetup/sqlite-config.tcl a2a786ccdccead789c8e4cc82408257bf7857dcbdf45accab4a1538d641d3070 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl eb4c6578e08dd353263958da0dc620f8400b869a50d06e271ab0be85a51a08d3 @@ -2151,7 +2151,7 @@ F tool/logest.c c34e5944318415de513d29a6098df247a9618c96d83c38d4abd88641fe46e669 F tool/max-limits.c cbb635fbb37ae4d05f240bfb5b5270bb63c54439 F tool/merge-test.tcl de76b62f2de2a92d4c1ca4f976bce0aea6899e0229e250479b229b2a1914b176 F tool/mkamalzip.tcl 8aa5ebe7973c8b8774062d34e15fea9815c4cc2ceea3a9b184695f005910876a -F tool/mkautoconfamal.sh 6b040e008a318c2b92b0b8cf9b7879f2843433aea6834e89897a0f21ebc46e5b +F tool/mkautoconfamal.sh 401f6378a99bb045b63abe8c2dad6bd6fd5a1c2b9c8cded9d7ac5848ea578994 F tool/mkccode.tcl c42a8f8cf78f92e83795d5447460dbce7aaf78a3bbf9082f1507dc71a3665f3c x F tool/mkctimec.tcl f76dbfc74cefad8d126384ba3263677939f077bd184fcdf8c592a1daf64f50c3 x F tool/mkkeywordhash.c 6b0be901c47f9ad42215fc995eb2f4384ac49213b1fba395102ec3e999acf559 @@ -2216,8 +2216,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 55029e41e03d9b61b8a53f86d7f69afe71459846f3a1a1723f6934e0d37ca77f -R f7433d2d6b9b7224d419751c11759d8c +P 50bbd69a684988a1df4c9c7616b76ae62bc4eb755cde18616de58aa0880fd4a7 +R c8205cd2fdc2d6cb1bffef77ec445211 U stephan -Z ce4dace35b5c51a050a3591235a1b475 +Z 9feaa8e098307dad1729b5f1c60b7427 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 1be3a9acb3..5617a3cb74 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -50bbd69a684988a1df4c9c7616b76ae62bc4eb755cde18616de58aa0880fd4a7 +f3c0071284fbe1c0a8c3fe73792a79f9df6be983e5c9bd1a7e2fe71ba7b2d400 diff --git a/tool/mkautoconfamal.sh b/tool/mkautoconfamal.sh index afe60fd66f..9ccf8b6558 100644 --- a/tool/mkautoconfamal.sh +++ b/tool/mkautoconfamal.sh @@ -24,12 +24,6 @@ TMPSPACE=./mkpkg_tmp_dir VERSION=`cat $TOP/VERSION` HASH=`cut -c1-10 $TOP/manifest.uuid` DATETIME=`grep '^D' $TOP/manifest | tr -c -d '[0-9]' | cut -c1-12` -BRANCH=`fossil whatis $HASH | awk '/tags:/{print $2}'` - -if [ x = "x${BRANCH}" ]; then - echo "Cannot determine the current branch" 1>&2 - exit 1 -fi # Inject the current version into the TEA autoconf file. # @@ -67,15 +61,6 @@ fi rm -rf $TMPSPACE cp -R $TOP/autoconf $TMPSPACE cp -R $TOP/autosetup $TMPSPACE -# Do not include build-specific customizations in the autoconf build: -rm -f $TMPSPACE/autosetup/local.tcl $TMPSPACE/autosetup/*.auto $TMPSPACE/autosetup/*/*.auto -# ... unless we find one which matches the current branch name: -bac=$TOP/autosetup/lib/${BRANCH}.auto -if [ -f $bac ]; then - echo "Copying branch-specific autosetup configuration: $bac" - mkdir -p $TMPSPACE/autosetup/lib - cp $bac $TMPSPACE/autosetup/lib -fi cp -p $TOP/configure $TMPSPACE cp sqlite3.c $TMPSPACE cp sqlite3.h $TMPSPACE From 75484481c7764e90b9b7133579fcfb832e641f39 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 22 Mar 2025 22:55:33 +0000 Subject: [PATCH 16/23] Fix the generate_series() enhancement from check-in [d50b784807333c54] so that it works even if the number that "value" is being compared against is a non-integer floating point number. Bug reported by [forum:/forumpost/0d5d63257e3ff4f6|forum post 0d5d63257]. FossilOrigin-Name: c113e31b818d16770bec1edc980f6833dfb27c4d74178e66a778fbb5671c3a13 --- ext/misc/series.c | 50 ++++++++++++++++++++++++++++++--------- manifest | 16 ++++++------- manifest.uuid | 2 +- test/tabfunc01.test | 57 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 105 insertions(+), 20 deletions(-) diff --git a/ext/misc/series.c b/ext/misc/series.c index e8188f1c97..4e328d298c 100644 --- a/ext/misc/series.c +++ b/ext/misc/series.c @@ -115,6 +115,7 @@ SQLITE_EXTENSION_INIT1 #include #include #include +#include #ifndef SQLITE_OMIT_VIRTUALTABLE /* @@ -480,25 +481,52 @@ static int seriesFilter( ** constraints on the "value" column. */ if( idxNum & 0x0080 ){ - iMin = iMax = sqlite3_value_int64(argv[i++]); + if( sqlite3_value_numeric_type(argv[i])==SQLITE_FLOAT ){ + double r = sqlite3_value_double(argv[i++]); + if( r==ceil(r) ){ + iMin = iMax = (sqlite3_int64)r; + }else{ + returnNoRows = 1; + } + }else{ + iMin = iMax = sqlite3_value_int64(argv[i++]); + } }else{ if( idxNum & 0x0300 ){ - iMin = sqlite3_value_int64(argv[i++]); - if( idxNum & 0x0200 ){ - if( iMin==LARGEST_INT64 ){ - returnNoRows = 1; + if( sqlite3_value_numeric_type(argv[i])==SQLITE_FLOAT ){ + double r = sqlite3_value_double(argv[i++]); + if( idxNum & 0x0200 && r==ceil(r) ){ + iMin = (sqlite3_int64)ceil(r+1.0); }else{ - iMin++; + iMin = (sqlite3_int64)ceil(r); + } + }else{ + iMin = sqlite3_value_int64(argv[i++]); + if( idxNum & 0x0200 ){ + if( iMin==LARGEST_INT64 ){ + returnNoRows = 1; + }else{ + iMin++; + } } } } if( idxNum & 0x3000 ){ - iMax = sqlite3_value_int64(argv[i++]); - if( idxNum & 0x2000 ){ - if( iMax==SMALLEST_INT64 ){ - returnNoRows = 1; + if( sqlite3_value_numeric_type(argv[i])==SQLITE_FLOAT ){ + double r = sqlite3_value_double(argv[i++]); + if( (idxNum & 0x2000)!=0 && r==floor(r) ){ + iMax = (sqlite3_int64)(r-1.0); }else{ - iMax--; + iMax = (sqlite3_int64)floor(r); + } + }else{ + iMax = sqlite3_value_int64(argv[i++]); + if( idxNum & 0x2000 ){ + if( iMax==SMALLEST_INT64 ){ + returnNoRows = 1; + }else{ + iMax--; + } } } } diff --git a/manifest b/manifest index b134218cf5..088f57eec8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Replace\suse\sof\sautosetup/lib/*.auto\sfor\ssqlite-custom-...\sfeatures\sto\savoid\sthe\spossibility\sof\smultiple\sfiles\sbeing\sloaded\s(in\san\sunpredictable\sorder)\sfor\sthat\spurpose.\sInstead\slook\sfor\sautosetup/sqlite-custom.tcl\sand\ssource\sit\sif\sit\sexists.\sThe\sintent\sis\sthat\ssqlite-custom.tcl\sonly\sever\sbe\sadded\sin\svendor-specific\sbranches\sand\snever\sin\sthe\strunk. -D 2025-03-22T19:07:54.825 +C Fix\sthe\sgenerate_series()\senhancement\sfrom\scheck-in\s[d50b784807333c54]\nso\sthat\sit\sworks\seven\sif\sthe\snumber\sthat\s"value"\sis\sbeing\scompared\sagainst\nis\sa\snon-integer\sfloating\spoint\snumber.\s\sBug\sreported\sby\n[forum:/forumpost/0d5d63257e3ff4f6|forum\spost\s0d5d63257]. +D 2025-03-22T22:55:33.194 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -436,7 +436,7 @@ F ext/misc/regexp.c 388e7f237307c7dfbfb8dde44e097946f6c437801d63f0d7ad63f3320d4e F ext/misc/remember.c add730f0f7e7436cd15ea3fd6a90fd83c3f706ab44169f7f048438b7d6baa69c F ext/misc/rot13.c 51ac5f51e9d5fd811db58a9c23c628ad5f333c173f1fc53c8491a3603d38556c F ext/misc/scrub.c 2a44b0d44c69584c0580ad2553f6290a307a49df4668941d2812135bfb96a946 -F ext/misc/series.c 076a4c85dde2ae543d040f1080cdab74ebf3da7f3febfe38e0cd45a2217498bf +F ext/misc/series.c 0c285a21821e71b473e701cb52f6cbd708f76aa1adeb30644909a718ba4f0ba5 F ext/misc/sha1.c cb5002148c2661b5946f34561701e9105e9d339b713ec8ac057fd888b196dcb9 F ext/misc/shathree.c fd22d70620f86a0467acfdd3acd8435d5cb54eb1e2d9ff36ae44e389826993df F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52 @@ -1719,7 +1719,7 @@ F test/sync.test 89539f4973c010eda5638407e71ca7fddbcd8e0594f4c9980229f804d433309 F test/sync2.test 8f9f7d4f6d5be8ca8941a8dadcc4299e558cb6a1ff653a9469146c7a76ef2039 F test/syscall.test a067468b43b8cb2305e9f9fe414e5f40c875bb5d2cba5f00b8154396e95fcf37 F test/sysfault.test c9f2b0d8d677558f74de750c75e12a5454719d04 -F test/tabfunc01.test 76da0509b01b9d12f4e71f8af28ee702d38166a5306bd77a955fb1a370dcd8b5 +F test/tabfunc01.test e85679a3800aa632dee787966b8482fce0bd47629dad82f102fd52f319d2c281 F test/table.test 7862a00b58b5541511a26757ea9c5c7c3f8298766e98aa099deec703d9c0a8e0 F test/tableapi.test e37c33e6be2276e3a96bb54b00eea7f321277115d10e5b30fdb52a112b432750 F test/tableopts.test dba698ba97251017b7c80d738c198d39ab747930 @@ -2216,8 +2216,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 50bbd69a684988a1df4c9c7616b76ae62bc4eb755cde18616de58aa0880fd4a7 -R c8205cd2fdc2d6cb1bffef77ec445211 -U stephan -Z 9feaa8e098307dad1729b5f1c60b7427 +P f3c0071284fbe1c0a8c3fe73792a79f9df6be983e5c9bd1a7e2fe71ba7b2d400 +R bb2b8fb97c5254c022b045f9e204d5a8 +U drh +Z 3b840e739e362fa32d6af0f736408d3e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5617a3cb74..c29e8e308c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f3c0071284fbe1c0a8c3fe73792a79f9df6be983e5c9bd1a7e2fe71ba7b2d400 +c113e31b818d16770bec1edc980f6833dfb27c4d74178e66a778fbb5671c3a13 diff --git a/test/tabfunc01.test b/test/tabfunc01.test index c16fb9bec2..5938ec6cb6 100644 --- a/test/tabfunc01.test +++ b/test/tabfunc01.test @@ -194,6 +194,63 @@ do_execsql_test tabfunc01-5.2 { WHERE value=67; } 67 +# 2025-03-22 forum post 0d5d63257e3ff4f6 +# +do_execsql_test tabfunc01-6.1 { + SELECT value FROM generate_series(1,10) WHERE value<5.5; +} {1 2 3 4 5} +do_execsql_test tabfunc01-6.2 { + SELECT value FROM generate_series(1,10) WHERE value<5.0; +} {1 2 3 4} +do_execsql_test tabfunc01-6.3 { + SELECT value FROM generate_series(1,10) WHERE value<=5.5; +} {1 2 3 4 5} +do_execsql_test tabfunc01-6.4 { + SELECT value FROM generate_series(1,10) WHERE value<=5.0; +} {1 2 3 4 5} +do_execsql_test tabfunc01-6.5 { + SELECT value FROM generate_series(1,10) WHERE value>5.5; +} {6 7 8 9 10} +do_execsql_test tabfunc01-6.6 { + SELECT value FROM generate_series(1,10) WHERE value>5.0; +} {6 7 8 9 10} +do_execsql_test tabfunc01-6.7 { + SELECT value FROM generate_series(1,10) WHERE value>=5.5; +} {6 7 8 9 10} +do_execsql_test tabfunc01-6.8 { + SELECT value FROM generate_series(1,10) WHERE value>=5.0; +} {5 6 7 8 9 10} +do_execsql_test tabfunc01-6.9 { + SELECT value FROM generate_series(10,1,-1) WHERE value<5.5; +} {5 4 3 2 1} +do_execsql_test tabfunc01-6.10 { + SELECT value FROM generate_series(10,1,-1) WHERE value<5.0; +} {4 3 2 1} +do_execsql_test tabfunc01-6.11 { + SELECT value FROM generate_series(10,1,-1) WHERE value<=5.5; +} {5 4 3 2 1} +do_execsql_test tabfunc01-6.12 { + SELECT value FROM generate_series(10,1,-1) WHERE value<=5.0; +} {5 4 3 2 1} +do_execsql_test tabfunc01-6.13 { + SELECT value FROM generate_series(10,1,-1) WHERE value>5.5; +} {10 9 8 7 6} +do_execsql_test tabfunc01-6.14 { + SELECT value FROM generate_series(10,1,-1) WHERE value>5.0; +} {10 9 8 7 6} +do_execsql_test tabfunc01-6.15 { + SELECT value FROM generate_series(10,1,-1) WHERE value>=5.5; +} {10 9 8 7 6} +do_execsql_test tabfunc01-6.16 { + SELECT value FROM generate_series(10,1,-1) WHERE value>=5.0; +} {10 9 8 7 6 5} +do_execsql_test tabfunc01-6.17 { + SELECT value FROM generate_series(1,10) WHERE value==5.5; +} {} +do_execsql_test tabfunc01-6.18 { + SELECT value FROM generate_series(1,10) WHERE value==5.0; +} {5} + # The next series of tests is verifying that virtual table are able # to optimize the IN operator, even on terms that are not marked "omit". # When the generate_series virtual table is compiled for the testfixture, From 8d80ca2d1cab1f42a2430e249adcee28c19fd587 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 23 Mar 2025 21:38:28 +0000 Subject: [PATCH 17/23] Internal configure refactoring to support an ongoing conversion of ./autoconf/tea to autosetup. FossilOrigin-Name: e1d483e342670092c3579f2f0975e49a0c74516ae34103a63b4cde156bf5e92b --- {tool => autosetup}/find_tclconfig.tcl | 0 autosetup/proj.tcl | 62 +++++++++++++++++- autosetup/sqlite-config.tcl | 91 +++++++++++++++----------- manifest | 18 ++--- manifest.uuid | 2 +- 5 files changed, 123 insertions(+), 50 deletions(-) rename {tool => autosetup}/find_tclconfig.tcl (100%) diff --git a/tool/find_tclconfig.tcl b/autosetup/find_tclconfig.tcl similarity index 100% rename from tool/find_tclconfig.tcl rename to autosetup/find_tclconfig.tcl diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index 3e703d007a..5ba71bd5cc 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -594,7 +594,7 @@ proc proj-file-content {args} { set trim 1 lassign $args - fname } - set fp [open $fname r] + set fp [open $fname rb] set rc [read $fp] close $fp if {$trim} { return [string trim $rc] } @@ -607,7 +607,7 @@ proc proj-file-content {args} { # Returns the contents of the given file as an array of lines, with # the EOL stripped from each input line. proc proj-file-content-list {fname} { - set fp [open $fname r] + set fp [open $fname rb] set rc {} while { [gets $fp line] >= 0 } { lappend rc $line @@ -616,6 +616,17 @@ proc proj-file-content-list {fname} { return $rc } +######################################################################## +# @proj-file-write fname content +# +# Works like autosetup's [writefile] but explicitly uses binary mode +# to avoid EOL translation on Windows. +proc proj-file-write {fname content} { + set f [open $fname wb] + puts -nonewline $f $content + close $f +} + ######################################################################## # @proj-check-compile-commands ?configFlag? # @@ -1377,3 +1388,50 @@ proc proj-current-proc-name {{lvl 0}} { #uplevel [expr {$lvl + 1}] {lindex [info level 0] 0} lindex [info level [expr {-$lvl - 1}]] 0 } + + +######################################################################## +# Converts parts of tclConfig.sh to autosetup [define]s. +# +# Expects to be passed the name of a value tclConfig.sh or an empty +# string. It converts certain parts of that file's contents to +# [define]s (see the code for the whole list). If $tclConfigSh is an +# empty string then it [define]s the various vars as empty strings. +proc proj-tclConfig-to-autosetup {tclConfigSh} { + set shBody {} + set tclVars { + TCL_INCLUDE_SPEC + TCL_LIB_SPEC + TCL_STUB_LIB_SPEC + TCL_EXEC_PREFIX + TCL_PREFIX + TCL_VERSION + } + lappend shBody "if test x = \"x${tclConfigSh}\"; then" + foreach v $tclVars { + lappend shBody "$v= ;" + } + lappend shBody "else . \"${tclConfigSh}\"; fi" + foreach v $tclVars { + lappend shBody "echo define $v {\$$v} ;" + } + lappend shBody "exit" + set shBody [join $shBody "\n"] + #puts "shBody=$shBody\n"; exit + if {0} { + # This doesn't work but would be preferable to using a temp file... + set fd [open "| sh" "rw"] + #puts "fd = $fd"; exit + puts $fd $shBody + flush $fd + set rd [read $fd] + close $fd + puts "rd=$rd"; exit 1 + eval $rd + } else { + set shName ".tclConfigSh.tcl" + proj-file-write $shName $shBody + eval [exec sh $shName $tclConfigSh] + file delete --force $shName + } +} diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index d1347c0fda..53a21ded9a 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -64,7 +64,7 @@ array set sqliteConfig [subst [proj-strip-hash-comments { ######################################################################## # Processes all configure --flags for this build, run build-specific # config checks, then finalize the configure process. $buildMode must -# be either "canonical" or "autoconf", and others may be added in the +# be one of (canonical, autoconf), and others may be added in the # future. After bootstrapping, $configScript is eval'd in the caller's # scope, then post-configuration finalization is run. $configScript is # intended to hold configure code which is specific to the given @@ -83,7 +83,7 @@ array set sqliteConfig [subst [proj-strip-hash-comments { proc sqlite-configure {buildMode configScript} { proj-assert {$::sqliteConfig(build-mode) eq "unknown"} \ "sqlite-configure must not be called more than once" - set allBuildModes {canonical autoconf} + set allBuildModes {canonical autoconf tcl-extension} if {$buildMode ni $allBuildModes} { user-error "Invalid build mode: $buildMode. Expecting one of: $allBuildModes" } @@ -165,7 +165,7 @@ proc sqlite-configure {buildMode configScript} { # Options for how to build the library build-modes { - {*} { + {canonical autoconf} { shared=1 => {Disable build of shared library} static=1 => {Disable build of static library} } @@ -203,6 +203,13 @@ proc sqlite-configure {buildMode configScript} { # Options for TCL support tcl { {canonical} { + tcl=1 + => {Disable components which require TCL, including all tests. + This tree requires TCL for code generation but can use the in-tree + copy of autosetup/jimsh0.c for that. The SQLite TCL extension and the + test code require a canonical tclsh.} + } + {canonical tcl-extension} { with-tcl:DIR => {Directory containing tclConfig.sh or a directory one level up from that, from which we can derive a directory containing tclConfig.sh. @@ -213,17 +220,12 @@ proc sqlite-configure {buildMode configScript} { tclConfig.sh and (B) all TCL-based code generation. Warning: if its containing dir has multiple tclsh versions, it may select the wrong tclConfig.sh!} - tcl=1 - => {Disable components which require TCL, including all tests. - This tree requires TCL for code generation but can use the in-tree - copy of autosetup/jimsh0.c for that. The SQLite TCL extension and the - test code require a canonical tclsh.} } } # Options for line-editing modes for the CLI shell line-editing { - {*} { + {canonical autoconf} { readline=1 => {Disable readline support} # --with-readline-lib is a backwards-compatible alias for @@ -265,12 +267,12 @@ proc sqlite-configure {buildMode configScript} { # Options for exotic/alternative build modes alternative-builds { - {*} { + {canonical autoconf} { with-wasi-sdk:=/opt/wasi-sdk => {Top-most dir of the wasi-sdk for a WASI build} } - {canonical} { + {canonical} { with-emsdk:=auto => {Top-most dir of the Emscripten SDK installation. Needed only by ext/wasm. Default=EMSDK env var.} @@ -288,7 +290,7 @@ proc sqlite-configure {buildMode configScript} { static-shell=1 => {Link the sqlite3 shell app against the DLL instead of embedding sqlite3.c} } - {*} { + {canonical autoconf} { # A potential TODO without a current use case: #rpath=1 => {Disable use of the rpath linker flag} # soname: https://sqlite.org/src/forumpost/5a3b44f510df8ded @@ -458,17 +460,21 @@ proc sqlite-configure-finalize {} { sqlite-handle-load-extension sqlite-handle-math sqlite-handle-icu - sqlite-handle-line-editing - - proj-define-for-opt shared ENABLE_LIB_SHARED "Build shared library?" - if {![proj-define-for-opt static ENABLE_LIB_STATIC "Build static library?"]} { - # This notice really only applies to the canonical build... - proj-indented-notice { - NOTICE: static lib build may be implicitly re-activated by - other components, e.g. some test apps. + if {[proj-opt-exists readline]} { + sqlite-handle-line-editing + } + if {[proj-opt-exists shared]} { + proj-define-for-opt shared ENABLE_LIB_SHARED "Build shared library?" + } + if {[proj-opt-exists static]} { + if {![proj-define-for-opt static ENABLE_LIB_STATIC "Build static library?"]} { + # This notice really only applies to the canonical build... + proj-indented-notice { + NOTICE: static lib build may be implicitly re-activated by + other components, e.g. some test apps. + } } } - sqlite-handle-env-quirks sqlite-handle-common-feature-flags sqlite-finalize-feature-flags @@ -1225,9 +1231,10 @@ proc sqlite-check-line-editing {} { }; # sqlite-check-line-editing ######################################################################## -# Runs sqlite-check-line-editing and adds a message around it In the +# Runs sqlite-check-line-editing and adds a message around it. In the # canonical build this must not be called before -# sqlite-determine-codegen-tcl. +# sqlite-determine-codegen-tcl for reasons now lost to history (and +# might not still be applicable). proc sqlite-handle-line-editing {} { msg-result "Line-editing support for the sqlite3 shell: [sqlite-check-line-editing]" } @@ -1625,7 +1632,15 @@ proc sqlite-process-dot-in-files {} { # (e.g. [proj-check-rpath]) may do so before we "mangle" them here. proj-remap-autoconf-dir-vars - proj-make-from-dot-in -touch Makefile sqlite3.pc + set srcdir $::autosetup(srcdir)/ + foreach f {Makefile sqlite3.pc} { + if {[file exists $srcdir/$f.in]} { + # ^^^ we do this only so that this block can be made to work for + # multiple builds. e.g. the tea build (under construction) does + # not hae sqlite3.pc.in. + proj-make-from-dot-in -touch $f + } + } make-config-header sqlite_cfg.h \ -bare {SIZEOF_* HAVE_DECL_*} \ -none {HAVE_CFLAG_* LDFLAGS_* SH_* SQLITE_AUTORECONFIG @@ -1695,7 +1710,7 @@ proc sqlite-handle-wasi-sdk {} { threadsafe } { if {[proj-opt-exists $opt] && [opt-bool $opt]} { - # -^^^^ distinguish between canonical and autoconf builds + # -^^^^ not all builds define all of these flags msg-result " --disable-$opt" proj-opt-set $opt 0 } @@ -1772,12 +1787,10 @@ proc sqlite-check-tcl {} { define TCLLIBDIR "" ; # Installation dir for TCL extension lib define TCL_CONFIG_SH ""; # full path to tclConfig.sh - # Clear out all vars which would be set by tclConfigToAutoDef.sh, so + # Clear out all vars which would be set by tclConfigShToAutoDef.sh, so # that the late-config validation of @VARS@ works even if # --disable-tcl is used. - foreach k {TCL_INCLUDE_SPEC TCL_LIB_SPEC TCL_STUB_LIB_SPEC TCL_EXEC_PREFIX TCL_VERSION} { - define $k "" - } + proj-tclConfig-to-autosetup "" file delete -force ".tclenv.sh"; # ensure no stale state from previous configures. if {![opt-bool tcl]} { @@ -1804,7 +1817,7 @@ proc sqlite-check-tcl {} { if {"" eq $with_tclsh && "" eq $with_tcl} { # If neither --with-tclsh nor --with-tcl are provided, try to find # a workable tclsh. - set with_tclsh [proj-first-bin-of tclsh9.0 tclsh8.6 tclsh] + set with_tclsh [proj-first-bin-of tclsh9.1 tclsh9.0 tclsh8.6 tclsh] proc-debug "with_tclsh=${with_tclsh}" } @@ -1819,7 +1832,7 @@ proc sqlite-check-tcl {} { #msg-result "Using tclsh: $with_tclsh" } if {$doConfigLookup && - [catch {exec $with_tclsh $srcdir/tool/find_tclconfig.tcl} result] == 0} { + [catch {exec $with_tclsh $::autosetup(libdir)/find_tclconfig.tcl} result] == 0} { set with_tcl $result } if {"" ne $with_tcl && [file isdir $with_tcl]} { @@ -1830,7 +1843,7 @@ proc sqlite-check-tcl {} { } } set cfg "" - set tclSubdirs {tcl9.0 tcl8.6 lib} + set tclSubdirs {tcl9.1 tcl9.0 tcl8.6 lib} while {$use_tcl} { if {"" ne $with_tcl} { # Ensure that we can find tclConfig.sh under ${with_tcl}/... @@ -1876,9 +1889,7 @@ proc sqlite-check-tcl {} { # Export a subset of tclConfig.sh to the current TCL-space. If $cfg # is an empty string, this emits empty-string entries for the # various options we're interested in. - eval [exec sh "$srcdir/tool/tclConfigShToAutoDef.sh" "$cfg"] - # ---------^^ a Windows/msys workaround, without which it cannot - # exec a .sh file: https://sqlite.org/forum/forumpost/befb352a42a7cd6d + proj-tclConfig-to-autosetup $cfg if {"" eq $with_tclsh && $cfg ne ""} { # We have tclConfig.sh but no tclsh. Attempt to locate a tclsh @@ -2047,10 +2058,14 @@ proc sqlite-determine-codegen-tcl {} { }; # sqlite-determine-codegen-tcl ######################################################################## -# Runs sqlite-check-tcl and sqlite-determine-codegen-tcl. -proc sqlite-handle-tcl {} { +# Runs sqlite-check-tcl and, if $alsoCheckCodeGen is true, +# sqlite-determine-codegen-tcl (intended only for the canonical +# build). +proc sqlite-handle-tcl {{alsoCheckCodeGen 1}} { sqlite-check-tcl - msg-result "TCL for code generation: [sqlite-determine-codegen-tcl]" + if {$alsoCheckCodeGen} { + msg-result "TCL for code generation: [sqlite-determine-codegen-tcl]" + } } ######################################################################## diff --git a/manifest b/manifest index 088f57eec8..7a2d34a15e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\sgenerate_series()\senhancement\sfrom\scheck-in\s[d50b784807333c54]\nso\sthat\sit\sworks\seven\sif\sthe\snumber\sthat\s"value"\sis\sbeing\scompared\sagainst\nis\sa\snon-integer\sfloating\spoint\snumber.\s\sBug\sreported\sby\n[forum:/forumpost/0d5d63257e3ff4f6|forum\spost\s0d5d63257]. -D 2025-03-22T22:55:33.194 +C Internal\sconfigure\srefactoring\sto\ssupport\san\songoing\sconversion\sof\s./autoconf/tea\sto\sautosetup. +D 2025-03-23T21:38:28.791 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -47,10 +47,11 @@ F autosetup/cc-db.tcl 6e0ed90146197a5a05b245e649975c07c548e30926b218ca3e1d4dc034 F autosetup/cc-lib.tcl 493c5935b5dd3bf9bd4eca89b07c8b1b1a9356d61783035144e21795facf7360 F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1de1e5460d78 F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f +F autosetup/find_tclconfig.tcl e64886ffe3b982d4df42cd28ed91fe0b5940c2c5785e126c1821baf61bc86a7e w tool/find_tclconfig.tcl F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl 49faf960df88a374686234105def663dbfc297ab79c87686df0a0b973dd77018 -F autosetup/sqlite-config.tcl a2a786ccdccead789c8e4cc82408257bf7857dcbdf45accab4a1538d641d3070 +F autosetup/proj.tcl 18ab0775dab8864d9f38ad0becb5d2a13b0c3986ecf4f9661de490341085e7b9 +F autosetup/sqlite-config.tcl 45182c777228e92f66357b63b686a80fcedd114e77a86f562e6b27c981454e95 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl eb4c6578e08dd353263958da0dc620f8400b869a50d06e271ab0be85a51a08d3 @@ -2135,7 +2136,6 @@ F tool/enlargedb.c 3e8b2612b985cfa7e3e8800031ee191b43ae80de96abb5abbd5eada62651e F tool/extract-sqlite3h.tcl 069ceab0cee26cba99952bfa08c0b23e35941c837acabe143f0c355d96c9e2eb x F tool/extract.c 054069d81b095fbdc189a6f5d4466e40380505e2 F tool/fast_vacuum.c c129ae2924a48310c7b766810391da9e8fda532b9f6bd3f9a9e3a799a1b42af9 -F tool/find_tclconfig.tcl e64886ffe3b982d4df42cd28ed91fe0b5940c2c5785e126c1821baf61bc86a7e F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439 F tool/fuzzershell.c 41480c8a1e4749351f381431ecfdfceba645396c5d836f8d26b51a33c4a21b33 F tool/genfkey.README e550911fa984c8255ebed2ef97824125d83806eb5232582700de949edf836eb1 @@ -2216,8 +2216,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P f3c0071284fbe1c0a8c3fe73792a79f9df6be983e5c9bd1a7e2fe71ba7b2d400 -R bb2b8fb97c5254c022b045f9e204d5a8 -U drh -Z 3b840e739e362fa32d6af0f736408d3e +P c113e31b818d16770bec1edc980f6833dfb27c4d74178e66a778fbb5671c3a13 +R 309a2c3afab1d662c70990a09672e776 +U stephan +Z fb7c999d8dfb13e08fe006e0a7885fc0 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index c29e8e308c..9a5c1cf815 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c113e31b818d16770bec1edc980f6833dfb27c4d74178e66a778fbb5671c3a13 +e1d483e342670092c3579f2f0975e49a0c74516ae34103a63b4cde156bf5e92b From f58b2c46d002578a32bcf076bfe3099d0f318bf9 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 23 Mar 2025 22:49:00 +0000 Subject: [PATCH 18/23] Remove tool/tclConfigShToAutoDef.sh, as that functionality was moved into autosetup/proj.tcl so that it can be reused in, e.g., autoconf/tea. FossilOrigin-Name: c9c5a15d4d8141aae68d6643869f74879ae053cb86538b805058099af2cec16b --- autosetup/proj.tcl | 2 +- autosetup/sqlite-config.tcl | 10 +++++----- manifest | 17 ++++++++--------- manifest.uuid | 2 +- tool/tclConfigShToAutoDef.sh | 29 ----------------------------- 5 files changed, 15 insertions(+), 45 deletions(-) delete mode 100755 tool/tclConfigShToAutoDef.sh diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index 5ba71bd5cc..39756f5b17 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -1397,7 +1397,7 @@ proc proj-current-proc-name {{lvl 0}} { # string. It converts certain parts of that file's contents to # [define]s (see the code for the whole list). If $tclConfigSh is an # empty string then it [define]s the various vars as empty strings. -proc proj-tclConfig-to-autosetup {tclConfigSh} { +proc proj-tclConfig-sh-to-autosetup {tclConfigSh} { set shBody {} set tclVars { TCL_INCLUDE_SPEC diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 53a21ded9a..67895a2434 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -1787,10 +1787,10 @@ proc sqlite-check-tcl {} { define TCLLIBDIR "" ; # Installation dir for TCL extension lib define TCL_CONFIG_SH ""; # full path to tclConfig.sh - # Clear out all vars which would be set by tclConfigShToAutoDef.sh, so - # that the late-config validation of @VARS@ works even if - # --disable-tcl is used. - proj-tclConfig-to-autosetup "" + # Clear out all vars which would harvest from tclConfig.sh so that + # the late-config validation of @VARS@ works even if --disable-tcl + # is used. + proj-tclConfig-sh-to-autosetup "" file delete -force ".tclenv.sh"; # ensure no stale state from previous configures. if {![opt-bool tcl]} { @@ -1889,7 +1889,7 @@ proc sqlite-check-tcl {} { # Export a subset of tclConfig.sh to the current TCL-space. If $cfg # is an empty string, this emits empty-string entries for the # various options we're interested in. - proj-tclConfig-to-autosetup $cfg + proj-tclConfig-sh-to-autosetup $cfg if {"" eq $with_tclsh && $cfg ne ""} { # We have tclConfig.sh but no tclsh. Attempt to locate a tclsh diff --git a/manifest b/manifest index 7a2d34a15e..ec85a380b3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Internal\sconfigure\srefactoring\sto\ssupport\san\songoing\sconversion\sof\s./autoconf/tea\sto\sautosetup. -D 2025-03-23T21:38:28.791 +C Remove\stool/tclConfigShToAutoDef.sh,\sas\sthat\sfunctionality\swas\smoved\sinto\sautosetup/proj.tcl\sso\sthat\sit\scan\sbe\sreused\sin,\se.g.,\sautoconf/tea. +D 2025-03-23T22:49:00.085 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -47,11 +47,11 @@ F autosetup/cc-db.tcl 6e0ed90146197a5a05b245e649975c07c548e30926b218ca3e1d4dc034 F autosetup/cc-lib.tcl 493c5935b5dd3bf9bd4eca89b07c8b1b1a9356d61783035144e21795facf7360 F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1de1e5460d78 F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f -F autosetup/find_tclconfig.tcl e64886ffe3b982d4df42cd28ed91fe0b5940c2c5785e126c1821baf61bc86a7e w tool/find_tclconfig.tcl +F autosetup/find_tclconfig.tcl e64886ffe3b982d4df42cd28ed91fe0b5940c2c5785e126c1821baf61bc86a7e F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl 18ab0775dab8864d9f38ad0becb5d2a13b0c3986ecf4f9661de490341085e7b9 -F autosetup/sqlite-config.tcl 45182c777228e92f66357b63b686a80fcedd114e77a86f562e6b27c981454e95 +F autosetup/proj.tcl 3fb4df80f4e114a6a5ef2f66c79e9836f8af798be6e5112fa525dd499e297e76 +F autosetup/sqlite-config.tcl 85490e59fb374cf091765308eae96bb96cc85169af46d78e034f3766bdbd0523 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl eb4c6578e08dd353263958da0dc620f8400b869a50d06e271ab0be85a51a08d3 @@ -2207,7 +2207,6 @@ F tool/stack_usage.tcl f8e71b92cdb099a147dad572375595eae55eca43 F tool/stripccomments.c 68d2aa8cb504439f541ce66b8f128067612bdd16f5fb7bfe540f3fcb67c9c197 F tool/symbols-mingw.sh 4dbcea7e74768305384c9fd2ed2b41bbf9f0414d F tool/symbols.sh 1612bd947750e21e7b47befad5f6b3825b06cce0705441f903bf35ced65ae9b9 -F tool/tclConfigShToAutoDef.sh 44ec55046d86a3febb2cb3e099399b41794e80e9cd138eee7b9b016f819e882b x F tool/tclConfigShToMake.sh 7c065d81c2d178e15e45a77372c6e5a38b5a1b08755301cd6f20a3a862db7312 x F tool/varint.c 5d94cb5003db9dbbcbcc5df08d66f16071aee003 F tool/vdbe-compress.tcl fa2f37ab39b2a0087fafb6a7f3ce19503e25e624ffa8ed9951717ab72920c088 @@ -2216,8 +2215,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 c113e31b818d16770bec1edc980f6833dfb27c4d74178e66a778fbb5671c3a13 -R 309a2c3afab1d662c70990a09672e776 +P e1d483e342670092c3579f2f0975e49a0c74516ae34103a63b4cde156bf5e92b +R cd4f41e401426ec770b3b52663dd55f7 U stephan -Z fb7c999d8dfb13e08fe006e0a7885fc0 +Z 2310dd6e43c6cf51b7512d8d58ddf2d8 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9a5c1cf815..2391380602 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e1d483e342670092c3579f2f0975e49a0c74516ae34103a63b4cde156bf5e92b +c9c5a15d4d8141aae68d6643869f74879ae053cb86538b805058099af2cec16b diff --git a/tool/tclConfigShToAutoDef.sh b/tool/tclConfigShToAutoDef.sh deleted file mode 100755 index d12657063e..0000000000 --- a/tool/tclConfigShToAutoDef.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# -# A level of indirection for use soley by the configure script -# (auto.def). -# -# Expects to be passed a full path to a tclConfig.sh. It sources it -# and emits TCL code which sets some vars which are exported by -# tclConfig.sh. -# -# This script expects that the caller has already validated that the -# file exists, is not a directory, and is readable. -# -# If passed no filename, or an empty one, then it emits config code -# suitable for the "config not found" case. -if test x = "x$1"; then - TCL_INCLUDE_SPEC= - TCL_LIB_SPEC= - TCL_STUB_LIB_SPEC= - TCL_EXEC_PREFIX= - TCL_VERSION= -else - . "$1" -fi - -echo "define TCL_INCLUDE_SPEC {$TCL_INCLUDE_SPEC} ;" -echo "define TCL_LIB_SPEC {$TCL_LIB_SPEC} ;" -echo "define TCL_STUB_LIB_SPEC {$TCL_STUB_LIB_SPEC} ;" -echo "define TCL_EXEC_PREFIX {$TCL_EXEC_PREFIX} ;" -echo "define TCL_VERSION {$TCL_VERSION} ;" From 49a015092e0cef820ec0d94d571726c8d939449d Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 23 Mar 2025 23:04:48 +0000 Subject: [PATCH 19/23] Correct a --force flag which should be -force in a TCL file delete call. Some TCL versions (like the one on my system) accepts either but others don't. Problem reported in [forum:c02224d862|forum post c02224d862]. FossilOrigin-Name: 172f4e4772d90f4737eddb43d97a566a6e3b92702c61e23391e43134737cc838 --- autosetup/proj.tcl | 2 +- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index 39756f5b17..ae61ee3a91 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -1432,6 +1432,6 @@ proc proj-tclConfig-sh-to-autosetup {tclConfigSh} { set shName ".tclConfigSh.tcl" proj-file-write $shName $shBody eval [exec sh $shName $tclConfigSh] - file delete --force $shName + file delete -force $shName } } diff --git a/manifest b/manifest index ec85a380b3..b8b552ba15 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\stool/tclConfigShToAutoDef.sh,\sas\sthat\sfunctionality\swas\smoved\sinto\sautosetup/proj.tcl\sso\sthat\sit\scan\sbe\sreused\sin,\se.g.,\sautoconf/tea. -D 2025-03-23T22:49:00.085 +C Correct\sa\s--force\sflag\swhich\sshould\sbe\s-force\sin\sa\sTCL\sfile\sdelete\scall.\sSome\sTCL\sversions\s(like\sthe\sone\son\smy\ssystem)\saccepts\seither\sbut\sothers\sdon't.\sProblem\sreported\sin\s[forum:c02224d862|forum\spost\sc02224d862]. +D 2025-03-23T23:04:48.534 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/find_tclconfig.tcl e64886ffe3b982d4df42cd28ed91fe0b5940c2c5785e126c1821baf61bc86a7e F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl 3fb4df80f4e114a6a5ef2f66c79e9836f8af798be6e5112fa525dd499e297e76 +F autosetup/proj.tcl 4706741184076b3056356324727b7691e3b6877c84224fa05bbf7d804e895e55 F autosetup/sqlite-config.tcl 85490e59fb374cf091765308eae96bb96cc85169af46d78e034f3766bdbd0523 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x @@ -2215,8 +2215,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 e1d483e342670092c3579f2f0975e49a0c74516ae34103a63b4cde156bf5e92b -R cd4f41e401426ec770b3b52663dd55f7 +P c9c5a15d4d8141aae68d6643869f74879ae053cb86538b805058099af2cec16b +R cede8298428fc3b5753dc7441a438a62 U stephan -Z 2310dd6e43c6cf51b7512d8d58ddf2d8 +Z aaca6f130a80cd53a17483fde3862546 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 2391380602..7821fd6fad 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c9c5a15d4d8141aae68d6643869f74879ae053cb86538b805058099af2cec16b +172f4e4772d90f4737eddb43d97a566a6e3b92702c61e23391e43134737cc838 From 1b906dd920ba2fb12fe686782313fa1c40231c36 Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 24 Mar 2025 11:13:18 +0000 Subject: [PATCH 20/23] Add test cases to session1.test. FossilOrigin-Name: dda9d7cf319e74de7703bda1eb77e3e7aa7459d6fa1508cc1d62cdfc7985c368 --- ext/session/session1.test | 68 +++++++++++++++++++++++++++++++++++++++ manifest | 14 ++++---- manifest.uuid | 2 +- 3 files changed, 76 insertions(+), 8 deletions(-) diff --git a/ext/session/session1.test b/ext/session/session1.test index 6da9051791..3262c9bc41 100644 --- a/ext/session/session1.test +++ b/ext/session/session1.test @@ -684,6 +684,74 @@ do_test $tn.14.4 { list [catch {sqlite3session_config invalid 123} msg] $msg } {1 SQLITE_MISUSE} +#------------------------------------------------------------------------- +reset_db + +do_execsql_test $tn.15.0 { + CREATE TABLE records( + idx INTEGER PRIMARY KEY AUTOINCREMENT, + tbl TEXT NOT NULL, + pk TEXT NOT NULL, + value TEXT, + UNIQUE(tbl, pk) + ); + + CREATE TABLE changes( + idx INTEGER PRIMARY KEY AUTOINCREMENT, + tbl TEXT NOT NULL, + pk TEXT NOT NULL, + op TEXT DEFAULT ('='), + path TEXT DEFAULT ('$'), + value TEXT, + UNIQUE(tbl, pk) + ); + + CREATE TRIGGER changes_after_insert + AFTER INSERT ON changes + FOR EACH ROW + BEGIN + INSERT INTO records(tbl, pk, value) + VALUES (NEW.tbl, NEW.pk, NEW.value) + ON CONFLICT(tbl, pk) DO UPDATE SET value = NEW.value; + END; + + CREATE VIEW data_view AS + SELECT *, '=' AS op, '$' AS path FROM records + WHERE tbl = 'data'; + + CREATE TRIGGER data_insert + INSTEAD OF INSERT ON data_view + BEGIN + INSERT INTO changes(tbl, pk, op, path, value) + VALUES (NEW.tbl, NEW.pk, NEW.op, NEW.path, NEW.value); + END; + + CREATE TRIGGER data_update + INSTEAD OF UPDATE ON data_view + BEGIN + INSERT INTO changes(tbl, pk, op, path, value) + VALUES (NEW.tbl, NEW.pk, NEW.op, NEW.path, NEW.value); + END; + + CREATE TRIGGER data_delete + INSTEAD OF DELETE ON data_view + BEGIN + INSERT INTO changes(tbl, pk, op, path, value) + VALUES (NEW.tbl, NEW.pk, NEW.op, NEW.path, NEW.value); + END; +} + +do_iterator_test $tn.15.1 * { + INSERT INTO data_view (tbl, pk, value) VALUES + ('data', '1', 'First'), + ('data', '2', 'Second'); +} { + {INSERT changes 1 X..... {} {i 1 t data t 1 n {} n {} t First}} + {INSERT changes 1 X..... {} {i 2 t data t 2 n {} n {} t Second}} + {INSERT records 1 X... {} {i 1 t data t 1 t First}} + {INSERT records 1 X... {} {i 2 t data t 2 t Second}} +} + }] } diff --git a/manifest b/manifest index b8b552ba15..14172eb3e7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Correct\sa\s--force\sflag\swhich\sshould\sbe\s-force\sin\sa\sTCL\sfile\sdelete\scall.\sSome\sTCL\sversions\s(like\sthe\sone\son\smy\ssystem)\saccepts\seither\sbut\sothers\sdon't.\sProblem\sreported\sin\s[forum:c02224d862|forum\spost\sc02224d862]. -D 2025-03-23T23:04:48.534 +C Add\stest\scases\sto\ssession1.test. +D 2025-03-24T11:13:18.510 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -577,7 +577,7 @@ F ext/rtree/visual01.txt e9c2564083bcd30ec51b07f881bffbf0e12b50a3f6fced0c222c5c1 F ext/session/changeset.c 7a1e6a14c7e92d36ca177e92e88b5281acd709f3b726298dc34ec0fb58869cb5 F ext/session/changesetfuzz.c 227076ab0ae4447d742c01ee88a564da6478bbf26b65108bf8fac9cd8b0b24aa F ext/session/changesetfuzz1.test 15b629004e58d5ffcc852e6842a603775bb64b1ce51254831f3d12b113b616cd -F ext/session/session1.test cc7e58976c2cc6263fb7ef0c5125a98eafc2f213c75929f986768d2dbc224725 +F ext/session/session1.test a9cf4280a01ccee85c9be3d5b76047a05bea2dfbb2891e7775acbec227d9c823 F ext/session/session2.test ee83bb973b9ce17ccce4db931cdcdae65eb40bbb22089b2fe6aa4f6be3b9303f F ext/session/session3.test 2cc1629cfb880243aec1a7251145e07b78411d851b39b2aa1390704550db8e6a F ext/session/session4.test 823f6f018fcbb8dacf61e2960f8b3b848d492b094f8b495eae1d9407d9ab7219 @@ -2215,8 +2215,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 c9c5a15d4d8141aae68d6643869f74879ae053cb86538b805058099af2cec16b -R cede8298428fc3b5753dc7441a438a62 -U stephan -Z aaca6f130a80cd53a17483fde3862546 +P 172f4e4772d90f4737eddb43d97a566a6e3b92702c61e23391e43134737cc838 +R a200b3e63d995804ba9cb2f6183e529f +U dan +Z 9e23138503c61e5d6f72d80a5d70588a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 7821fd6fad..b29703cd99 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -172f4e4772d90f4737eddb43d97a566a6e3b92702c61e23391e43134737cc838 +dda9d7cf319e74de7703bda1eb77e3e7aa7459d6fa1508cc1d62cdfc7985c368 From e6e453def6fc09432a734c82c96f185ed0924bae Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 24 Mar 2025 19:58:13 +0000 Subject: [PATCH 21/23] Test that the sqlite3changeset_apply() function is properly appling indirect changes. FossilOrigin-Name: 1dadea3a79c3edd110b0b32b07287744300958fed31f2da11901a42b16f86669 --- ext/session/session1.test | 62 ++++++++++++++++++++++++++++++++++----- manifest | 12 ++++---- manifest.uuid | 2 +- 3 files changed, 62 insertions(+), 14 deletions(-) diff --git a/ext/session/session1.test b/ext/session/session1.test index 3262c9bc41..27ac0a194b 100644 --- a/ext/session/session1.test +++ b/ext/session/session1.test @@ -741,16 +741,64 @@ do_execsql_test $tn.15.0 { END; } -do_iterator_test $tn.15.1 * { +do_test $tn.15.1 { + set C [changeset_from_sql { INSERT INTO data_view (tbl, pk, value) VALUES ('data', '1', 'First'), ('data', '2', 'Second'); -} { - {INSERT changes 1 X..... {} {i 1 t data t 1 n {} n {} t First}} - {INSERT changes 1 X..... {} {i 2 t data t 2 n {} n {} t Second}} - {INSERT records 1 X... {} {i 1 t data t 1 t First}} - {INSERT records 1 X... {} {i 2 t data t 2 t Second}} -} + }] + changeset_to_list $C +} [list \ + {INSERT changes 1 X..... {} {i 1 t data t 1 n {} n {} t First}} \ + {INSERT changes 1 X..... {} {i 2 t data t 2 n {} n {} t Second}} \ + {INSERT records 1 X... {} {i 1 t data t 1 t First}} \ + {INSERT records 1 X... {} {i 2 t data t 2 t Second}} \ +] + +forcedelete test.db2 +sqlite3 db2 test.db2 + +do_test $tn.15.2 { + db2 eval { + CREATE TABLE records( + idx INTEGER PRIMARY KEY AUTOINCREMENT, + tbl TEXT NOT NULL, + pk TEXT NOT NULL, + value TEXT, + UNIQUE(tbl, pk) + ); + CREATE TABLE changes( + idx INTEGER PRIMARY KEY AUTOINCREMENT, + tbl TEXT NOT NULL, + pk TEXT NOT NULL, + op TEXT DEFAULT ('='), + path TEXT DEFAULT ('$'), + value TEXT, + UNIQUE(tbl, pk) + ); + + CREATE TRIGGER changes_after_insert + AFTER INSERT ON changes + FOR EACH ROW + BEGIN + INSERT INTO records(tbl, pk, value) + VALUES (NEW.tbl, NEW.pk, NEW.value) + ON CONFLICT(tbl, pk) DO UPDATE SET value = NEW.value; + END; + } + + sqlite3changeset_apply db2 $C "" + + db2 eval { + SELECT * FROM records; + } +} [list 1 data 1 First 2 data 2 Second] + +do_test $tn.15.3 { + db2 eval { + SELECT * FROM changes; + } +} {1 data 1 {} {} First 2 data 2 {} {} Second} }] } diff --git a/manifest b/manifest index 14172eb3e7..ccb8614c96 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\stest\scases\sto\ssession1.test. -D 2025-03-24T11:13:18.510 +C Test\sthat\sthe\ssqlite3changeset_apply()\sfunction\sis\sproperly\sappling\sindirect\schanges. +D 2025-03-24T19:58:13.162 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -577,7 +577,7 @@ F ext/rtree/visual01.txt e9c2564083bcd30ec51b07f881bffbf0e12b50a3f6fced0c222c5c1 F ext/session/changeset.c 7a1e6a14c7e92d36ca177e92e88b5281acd709f3b726298dc34ec0fb58869cb5 F ext/session/changesetfuzz.c 227076ab0ae4447d742c01ee88a564da6478bbf26b65108bf8fac9cd8b0b24aa F ext/session/changesetfuzz1.test 15b629004e58d5ffcc852e6842a603775bb64b1ce51254831f3d12b113b616cd -F ext/session/session1.test a9cf4280a01ccee85c9be3d5b76047a05bea2dfbb2891e7775acbec227d9c823 +F ext/session/session1.test 57cb77a816af7760bf4e321d315603ab517e46abd853e75620cfb07eb409c6f8 F ext/session/session2.test ee83bb973b9ce17ccce4db931cdcdae65eb40bbb22089b2fe6aa4f6be3b9303f F ext/session/session3.test 2cc1629cfb880243aec1a7251145e07b78411d851b39b2aa1390704550db8e6a F ext/session/session4.test 823f6f018fcbb8dacf61e2960f8b3b848d492b094f8b495eae1d9407d9ab7219 @@ -2215,8 +2215,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 172f4e4772d90f4737eddb43d97a566a6e3b92702c61e23391e43134737cc838 -R a200b3e63d995804ba9cb2f6183e529f +P dda9d7cf319e74de7703bda1eb77e3e7aa7459d6fa1508cc1d62cdfc7985c368 +R 59f8eb65053a8c37b81b1cc130461378 U dan -Z 9e23138503c61e5d6f72d80a5d70588a +Z 3ffcb094ab9fb9973d19c727d478cf37 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index b29703cd99..bebd8505b3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -dda9d7cf319e74de7703bda1eb77e3e7aa7459d6fa1508cc1d62cdfc7985c368 +1dadea3a79c3edd110b0b32b07287744300958fed31f2da11901a42b16f86669 From b0c3118cad42832cf08b3b6fdc2f9b736d73d6ec Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 24 Mar 2025 23:08:40 +0000 Subject: [PATCH 22/23] Clarify and reduce redundancy in an assert() in walChecksumBytes(). FossilOrigin-Name: 3c53abf5e6df446d569040042363265737aa10fc8aaa20b31c587100c557c5e7 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/wal.c | 6 ++---- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index ccb8614c96..dbe512c36e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Test\sthat\sthe\ssqlite3changeset_apply()\sfunction\sis\sproperly\sappling\sindirect\schanges. -D 2025-03-24T19:58:13.162 +C Clarify\sand\sreduce\sredundancy\sin\san\sassert()\sin\swalChecksumBytes(). +D 2025-03-24T23:08:40.014 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -865,7 +865,7 @@ F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf8 F src/vdbevtab.c fc46b9cbd759dc013f0b3724549cc0d71379183c667df3a5988f7e2f1bd485f3 F src/vtab.c 828221bdbeaaa6d62126ee6d07fd4ec0d09dcaea846f87ad01944d8b7e548859 F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 -F src/wal.c 554a6b1afaaecb98cb47bb598bccf1374c9d3b624e5c4c3c4eb2ad364cc579f8 +F src/wal.c bcf40795a09b699ad7e42624dd6282b13335164fbabcd5a98a717758cebef451 F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452 F src/walker.c d5006d6b005e4ea7302ad390957a8d41ed83faa177e412f89bc5600a7462a014 F src/where.c e80177e452b4e436abc6ece0cb0249631000434f2a7425cc1df709015fce74ad @@ -2215,8 +2215,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 dda9d7cf319e74de7703bda1eb77e3e7aa7459d6fa1508cc1d62cdfc7985c368 -R 59f8eb65053a8c37b81b1cc130461378 -U dan -Z 3ffcb094ab9fb9973d19c727d478cf37 +P 1dadea3a79c3edd110b0b32b07287744300958fed31f2da11901a42b16f86669 +R c08c05d83169d801717107adbed59c20 +U drh +Z 6fb51dc820f4b9af99017fdaa2038941 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index bebd8505b3..36359607da 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1dadea3a79c3edd110b0b32b07287744300958fed31f2da11901a42b16f86669 +3c53abf5e6df446d569040042363265737aa10fc8aaa20b31c587100c557c5e7 diff --git a/src/wal.c b/src/wal.c index 7f091a48cf..5fe2296d6c 100644 --- a/src/wal.c +++ b/src/wal.c @@ -871,10 +871,8 @@ static void walChecksumBytes( s1 = s2 = 0; } - assert( nByte>=8 ); - assert( (nByte&0x00000007)==0 ); - assert( nByte<=65536 ); - assert( nByte%4==0 ); + /* nByte is a multiple of 8 between 8 and 65536 */ + assert( nByte>=8 && (nByte&7)==0 && nByte<=65536 ); if( !nativeCksum ){ do { From 6de1c9d55985dc1540deb4ccd4aa8e3a94f129c1 Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 25 Mar 2025 01:32:16 +0000 Subject: [PATCH 23/23] Configure script internal cleanups. Factor out the superfluous proj-lshift_ and use lassign instead. Add -ro flag to proj-file-write. FossilOrigin-Name: 1f98fc07fdf06d699ffbf1521b0b5e937a582017e4325bd994b488e06becbecc --- autosetup/proj.tcl | 63 ++++++++++++++++++++++++---------------------- manifest | 14 +++++------ manifest.uuid | 2 +- 3 files changed, 41 insertions(+), 38 deletions(-) diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index ae61ee3a91..fdd5d5e346 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -64,6 +64,7 @@ proc proj-warn {msg} { show-notices puts stderr "WARNING: $msg" } + ######################################################################## # @proj-error msg # @@ -111,6 +112,7 @@ proc proj-bold {str} { # @proj-indented-notice ?-error? ?-notice? msg # # Takes a multi-line message and emits it with consistent indentation. +# It does not perform any line-wrapping of its own. # # If the -notice flag it used then it emits using [user-notice], which # means its rendering will (A) go to stderr and (B) be delayed until @@ -162,26 +164,6 @@ proc proj-is-cross-compiling {} { return [expr {[get-define host] ne [get-define build]}] } -######################################################################## -# proj-lshift_ shifts $count elements from the list named $listVar -# and returns them as a new list. On empty input, returns "". -# -# Modified slightly from: https://wiki.tcl-lang.org/page/lshift -proc proj-lshift_ {listVar {count 1}} { - upvar 1 $listVar l - if {![info exists l]} { - # make the error message show the real variable name - error "can't read \"$listVar\": no such variable" - } - if {![llength $l]} { - # error Empty - return "" - } - set r [lrange $l 0 [incr count -1]] - set l [lreplace $l [set l 0] $count] - return $r -} - ######################################################################## # @proj-strip-hash-comments value # @@ -479,16 +461,16 @@ proc proj-opt-define-bool {args} { set invert 0 if {[lindex $args 0] eq "-v"} { set invert 1 - set args [lrange $args 1 end] + lassign $args - optName defName descr + } else { + lassign $args optName defName descr } - set optName [proj-lshift_ args] - set defName [proj-lshift_ args] - set descr [proj-lshift_ args] if {"" eq $descr} { set descr $defName } + puts "optName=$optName defName=$defName descr=$descr" set rc 0 - msg-checking "$descr ... " + msg-checking "[join $descr] ... " if {[proj-opt-truthy $optName]} { if {0 eq $invert} { set rc 1 @@ -617,14 +599,28 @@ proc proj-file-content-list {fname} { } ######################################################################## -# @proj-file-write fname content +# @proj-file-write ?-ro? fname content # # Works like autosetup's [writefile] but explicitly uses binary mode -# to avoid EOL translation on Windows. -proc proj-file-write {fname content} { +# to avoid EOL translation on Windows. If $fname already exists, it is +# overwritten, even if it's flagged as read-only. +proc proj-file-write {args} { + if {"-ro" eq [lindex $args 0]} { + lassign $args ro fname content + } else { + set ro "" + lassign $args fname content + } + file delete -force -- $fname; # in case it's read-only set f [open $fname wb] puts -nonewline $f $content close $f + if {"" ne $ro} { + catch { + exec chmod -w $fname + #file attributes -w $fname; #jimtcl has no 'attributes' + } + } } ######################################################################## @@ -693,12 +689,17 @@ proc proj-make-from-dot-in {args} { } foreach f $filename { set f [string trim $f] - catch { exec chmod u+w $f } + if {[file exists $f]} { + catch { exec chmod u+w $f } + } make-template $f.in $f if {$touch} { proj-touch $f } - catch { exec chmod -w $f } + catch { + exec chmod -w $f + #file attributes -w $f; #jimtcl has no 'attributes' + } } } @@ -1407,6 +1408,8 @@ proc proj-tclConfig-sh-to-autosetup {tclConfigSh} { TCL_PREFIX TCL_VERSION } + # Build a small shell script which proxies the $tclVars from + # $tclConfigSh into autosetup code... lappend shBody "if test x = \"x${tclConfigSh}\"; then" foreach v $tclVars { lappend shBody "$v= ;" diff --git a/manifest b/manifest index dbe512c36e..fd16d584a0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Clarify\sand\sreduce\sredundancy\sin\san\sassert()\sin\swalChecksumBytes(). -D 2025-03-24T23:08:40.014 +C Configure\sscript\sinternal\scleanups.\sFactor\sout\sthe\ssuperfluous\sproj-lshift_\sand\suse\slassign\sinstead.\sAdd\s-ro\sflag\sto\sproj-file-write. +D 2025-03-25T01:32:16.183 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/find_tclconfig.tcl e64886ffe3b982d4df42cd28ed91fe0b5940c2c5785e126c1821baf61bc86a7e F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl 4706741184076b3056356324727b7691e3b6877c84224fa05bbf7d804e895e55 +F autosetup/proj.tcl 8bf99398c20a440d197182f85aaa60a41f07248af779fea68c41df30e6da8546 F autosetup/sqlite-config.tcl 85490e59fb374cf091765308eae96bb96cc85169af46d78e034f3766bdbd0523 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x @@ -2215,8 +2215,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 1dadea3a79c3edd110b0b32b07287744300958fed31f2da11901a42b16f86669 -R c08c05d83169d801717107adbed59c20 -U drh -Z 6fb51dc820f4b9af99017fdaa2038941 +P 3c53abf5e6df446d569040042363265737aa10fc8aaa20b31c587100c557c5e7 +R 1bbb3c025ec1b46650981e453b29c862 +U stephan +Z c139b7624e642b2a32a6648b4ac4392b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 36359607da..ce13eb13ea 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3c53abf5e6df446d569040042363265737aa10fc8aaa20b31c587100c557c5e7 +1f98fc07fdf06d699ffbf1521b0b5e937a582017e4325bd994b488e06becbecc