diff --git a/ext/qrf/qrf.c b/ext/qrf/qrf.c index 7329983231..5f01f7953d 100644 --- a/ext/qrf/qrf.c +++ b/ext/qrf/qrf.c @@ -2932,7 +2932,7 @@ qrf_reinit: case QRF_STYLE_Json: { p->spec.eText = QRF_TEXT_Json; p->spec.zNull = "null"; - if( p->spec.zFpFmt==0 ) p->spec.zFpFmt = "%0.16g"; + if( p->spec.zFpFmt==0 ) p->spec.zFpFmt = "%!0.17g"; break; } case QRF_STYLE_Html: { @@ -2946,7 +2946,7 @@ qrf_reinit: if( p->spec.zTableName==0 || p->spec.zTableName[0]==0 ){ p->spec.zTableName = "tab"; } - if( p->spec.zFpFmt==0 ) p->spec.zFpFmt = "%0.16g"; + if( p->spec.zFpFmt==0 ) p->spec.zFpFmt = "%!0.17g"; p->u.nIns = 0; break; } diff --git a/ext/rbu/rbu3.test b/ext/rbu/rbu3.test index 4ea6adbcda..e579f3f979 100644 --- a/ext/rbu/rbu3.test +++ b/ext/rbu/rbu3.test @@ -163,6 +163,13 @@ do_test 4.1 { do_test 4.2 { list [catch { rbu close } msg] $msg } {1 {SQLITE_ERROR - rbu vfs not found}} +do_test 4.3 { + sqlite3rbu_vacuum rbu file:test.db?vfs=tvfs + list [catch { rbu step } msg] $msg +} {0 SQLITE_ERROR} +do_test 4.4 { + list [catch { rbu close } msg] $msg +} {1 {SQLITE_ERROR - rbu vfs not found}} tvfs delete #------------------------------------------------------------------------- diff --git a/ext/rbu/sqlite3rbu.c b/ext/rbu/sqlite3rbu.c index 1e9756d136..caeb55456f 100644 --- a/ext/rbu/sqlite3rbu.c +++ b/ext/rbu/sqlite3rbu.c @@ -2891,7 +2891,7 @@ static void rbuOpenDatabase(sqlite3rbu *p, sqlite3 *dbMain, int *pbRetry){ p->nRbu = 0; p->pRbuFd = 0; rc = sqlite3_file_control(p->dbRbu, "main", SQLITE_FCNTL_RBUCNT, (void*)p); - if( rc!=SQLITE_NOTFOUND ) p->rc = rc; + if( rc!=SQLITE_NOTFOUND || p->pRbuFd==0 ) p->rc = rc; if( p->eStage>=RBU_STAGE_MOVE ){ bOpen = 1; }else{ diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index 78abf83445..2822484f58 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -757,7 +757,9 @@ emcc.jsflags = -fPIC #emcc.jsflags += -Wno-gcc-install-dir-libstdcxx #emcc is not passing ^^^ this on to clang emcc.jsflags += --no-entry -emcc.jsflags += -sWASM_BIGINT=$(emcc.WASM_BIGINT) +# emcc 6.0.12+ emits ugly warnings if we turn on BIGINT, +# despite the value being the same one it will use by +# default: emcc.jsflags += -sWASM_BIGINT=$(emcc.WASM_BIGINT) emcc.jsflags += -sMODULARIZE emcc.jsflags += -sDYNAMIC_EXECUTION=0 emcc.jsflags += -sNO_POLYFILL @@ -1084,7 +1086,6 @@ $(EXPORTED_FUNCTIONS.fiddle): $(EXPORTED_FUNCTIONS.api.in) \ emcc.flags.fiddle = \ $(emcc.cflags) $(emcc_opt_full) \ - $(emcc.MEMORY64) \ --minify 0 \ -sALLOW_TABLE_GROWTH \ -sALLOW_MEMORY_GROWTH \ diff --git a/ext/wasm/api/extern-post-js.c-pp.js b/ext/wasm/api/extern-post-js.c-pp.js index a3a02c8019..43a2a24907 100644 --- a/ext/wasm/api/extern-post-js.c-pp.js +++ b/ext/wasm/api/extern-post-js.c-pp.js @@ -65,9 +65,40 @@ const toExportForESM = ? (...args)=>console.warn('sqlite3.debugModule:',...args) : ()=>{}; - if(sIMS.urlParams.has('sqlite3.dir')){ - sIMS.sqlite3Dir = sIMS.urlParams.get('sqlite3.dir') +'/'; - }else if(sIMS.moduleScript){ + /** + Fetchs sIMS.urlParams.get(key). If that looks like it might + be a remote path value then null is returned and a console + warning may be emitted. If it looks like it's a local path, + it is returned. + + [bugs:74f052d3d2]: do not allow URL arguments which are used for + determining file locations to be anything other than what appears + to be a local file reference. That is the only documented use for + these args and allowing URLs as values leads to chaos. This is + believed to resolve that report but is also considered a stopgap + measure. TODO is only allow query parameters from the same origin + as this script. + */ + sIMS.getPathArgument = (key)=>{ + const s = sIMS.urlParams.get(key); + //console.warn("sIMS.getPathArgument(",key,")",s); + if( !s ) return s; + if( s.indexOf(':')>=0 || s.indexOf('//')>=0 ){ + console.warn( + "Rejecting path string",key," because it does not look", + "like a local path:",s + ); + return null; + } + return s; + }; + + if( sIMS.urlParams.has('sqlite3.dir') ){ + const s = sIMS.getPathArgument('sqlite3.dir'); + if( s ){ + sIMS.sqlite3Dir = s + (s[s.length-1]==='/' ? '' : '/'); + } + }else if( sIMS.moduleScript ){ const li = sIMS.moduleScript.src.split('/'); li.pop(); sIMS.sqlite3Dir = li.join('/') + '/'; diff --git a/ext/wasm/api/pre-js.c-pp.js b/ext/wasm/api/pre-js.c-pp.js index 1a3d46f1d9..4e9bc4e659 100644 --- a/ext/wasm/api/pre-js.c-pp.js +++ b/ext/wasm/api/pre-js.c-pp.js @@ -56,7 +56,8 @@ Worker constructor or importScripts() to be able to resolve foo/bar/X.wasm (in the latter case, with some help): - 1) If URL param named the same as `path` is set, it is returned. + 1) If URL param named the same as `path` is set and it looks like + a local path reference, it is returned. 2) If sqlite3InitModuleState.sqlite3Dir is set, then (thatName + path) is returned (it's assumed to end with '/'). @@ -84,21 +85,20 @@ return new URL(path, import.meta.url).href; //#else 'use strict'; - let theFile; - const up = this.urlParams; - if(up?.has(path)){ - theFile = up.get(path); - }else if(this.sqlite3Dir){ - theFile = this.sqlite3Dir + path; - }else if(this.scriptDir){ - theFile = this.scriptDir + path; - }else{ - theFile = prefix + path; + let theFile = this.getPathArgument(path); + if( !theFile ){ + if(this.sqlite3Dir){ + theFile = this.sqlite3Dir + path; + }else if(this.scriptDir){ + theFile = this.scriptDir + path; + }else{ + theFile = prefix + path; + } } this.debugModule( "locateFile(",arguments[0], ',', arguments[1],")", 'sqlite3InitModuleState.scriptDir =',this.scriptDir, - 'up.entries() =',Array.from(up.entries()), + 'urlParams.entries() =',Array.from(this.urlParams.entries()), "result =", theFile ); return theFile; diff --git a/ext/wasm/api/sqlite3-worker1-promiser.c-pp.js b/ext/wasm/api/sqlite3-worker1-promiser.c-pp.js index bcbf3fa9f8..b21f8a3a28 100644 --- a/ext/wasm/api/sqlite3-worker1-promiser.c-pp.js +++ b/ext/wasm/api/sqlite3-worker1-promiser.c-pp.js @@ -272,7 +272,14 @@ globalThis.sqlite3Worker1Promiser.defaultConfig = { //sqlite3.config.warn("promiser currentScript, theJs =",this.currentScript,theJs); }else if(globalThis.location){ //sqlite3.config.warn("promiser globalThis.location =",globalThis.location); - const urlParams = new URL(globalThis.location.href).searchParams; + const s = urlParams.get('sqlite3.dir'); + if( s ){ + if( s.indexOf(':')<0 && s.indexOf('//')<0 ){ + theJs = s + '/' + theJs; + }else{ + console.warn("Invalid sqlite3.dir value:",s); + } + } if(urlParams.has('sqlite3.dir')){ theJs = urlParams.get('sqlite3.dir') + '/' + theJs; } diff --git a/ext/wasm/api/sqlite3-worker1.c-pp.js b/ext/wasm/api/sqlite3-worker1.c-pp.js index 046243baa5..0e560c9789 100644 --- a/ext/wasm/api/sqlite3-worker1.c-pp.js +++ b/ext/wasm/api/sqlite3-worker1.c-pp.js @@ -44,7 +44,12 @@ import sqlite3InitModule from './sqlite3.mjs'; : new URLSearchParams(); let theJs = 'sqlite3.js'; if(urlParams.has('sqlite3.dir')){ - theJs = urlParams.get('sqlite3.dir') + '/' + theJs; + const s = urlParams.get('sqlite3.dir'); + if( s && s.indexOf(':')<0 && s.indexOf('//')<0 ){ + theJs = s + '/' + theJs; + }else{ + console.warn("Invalid sqlite3.dir value:",s); + } } //console.warn("worker1 theJs =",theJs); importScripts(theJs); diff --git a/ext/wasm/mkwasmbuilds.c b/ext/wasm/mkwasmbuilds.c index 81f2cae3a7..b883ff1733 100644 --- a/ext/wasm/mkwasmbuilds.c +++ b/ext/wasm/mkwasmbuilds.c @@ -498,6 +498,9 @@ static void mk_prologue(void){ */ "--enable-bulk-memory-opt " /* required */ "--all-features " /* required */ + "--disable-compact-imports " /* + https://github.com/emscripten-core/emscripten/issues/28016 + */ "--post-emscripten " /* Saves roughly 12kb */ "--strip-debug " /* We already wasm-strip, but in ** case this environment has no diff --git a/ext/wasm/tester1-worker.c-pp.html b/ext/wasm/tester1-worker.c-pp.html index fb6421cfdf..2b61f92e39 100644 --- a/ext/wasm/tester1-worker.c-pp.html +++ b/ext/wasm/tester1-worker.c-pp.html @@ -76,8 +76,15 @@ "sqlite3 tester #1: ES6 Worker Module (@bitness@-bit WASM)"; }); }else{ - workerArgs.push(baseName+'.js?sqlite3.dir=jswasm'); + const l = globalThis.location; + workerArgs.push(baseName+'.js?sqlite3.dir='+( + 0/*set to 1 only for testing*/ + ? (l.protocol+'//'+l.host+'/jswasm') + /* ^^^ must be rejected/ignored by module init */ + : 'jswasm' + )); } + console.warn("workerArgs =",workerArgs); const w = new Worker(...workerArgs); w.onmessage = function({data}){ switch(data.type){ diff --git a/ext/wasm/tester1.c-pp.js b/ext/wasm/tester1.c-pp.js index 5c6e1fe959..4307c7930b 100644 --- a/ext/wasm/tester1.c-pp.js +++ b/ext/wasm/tester1.c-pp.js @@ -4642,8 +4642,13 @@ if(!globalThis.sqlite3InitModule && !isUIThread()){ support for locating the wasm, so remove that dir part. */; const urlParams = new URL(globalThis.location.href).searchParams; - if(urlParams.has('sqlite3.dir')){ - sqlite3Js = urlParams.get('sqlite3.dir') + '/' + sqlite3Js; + const s3d = urlParams.get('sqlite3.dir'); + if( s3d ){ + if( s3d.indexOf(':')<0 && s3d.indexOf('//')<0 ){ + sqlite3Js = s3d + '/' + sqlite3Js; + }else{ + throw new Error("Invalid sqlite3.dir value: "+s3d); + } } importScripts(sqlite3Js); } diff --git a/manifest b/manifest index 9da6f989ac..92530335fd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\svec1\sproblem\swith\squerying\sa\stable\swithin\sthe\ssame\stransaction\sas\swriting\sit\sin\ssome\sconfigurations. -D 2026-10-19T11:06:06.382 +C Merge\sthe\slatest\sbranch-3.54\sfixes\sonto\strunk +D 2026-10-19T18:26:06.211 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -427,7 +427,7 @@ F ext/misc/zipfile.c 54bd61f1d80a170dde6c15e6eee790ff89a0acbe3bf57e9d63eba6e3414 F ext/misc/zorder.c bddff2e1b9661a90c95c2a9a9c7ecd8908afab5763256294dd12d609d4664eee F ext/qrf/README.md c5c47a8b82ee870557ec9c6734bf93c296ae4821d33cf60253b36f2fcee09601 F ext/qrf/dev-notes.md e68a6d91ce4c7eb296ef2daadc2bb79c95c317ad15b9fafe40850c67b29c2430 -F ext/qrf/qrf.c 395f16f676c3254b83b0b540ca91c891bfc88290df80930f6a7d9e52c340c34f +F ext/qrf/qrf.c 13d6c899814afe61fb0213be3bdcd23732251e185c820d80fee12badb89a4f43 F ext/qrf/qrf.h b04e50048695aa4a5a41577fb4a56c1feed0bef816354995713116780a4bdacb F ext/rbu/rbu.c 801450b24eaf14440d8fd20385aacc751d5c9d6123398df41b1b5aa804bf4ce8 F ext/rbu/rbu1.test 25870dd7db7eb5597e2b4d6e29e7a7e095abf332660f67d89959552ce8f8f255 @@ -436,7 +436,7 @@ F ext/rbu/rbu11.test 3b71377c018b05dd39c30ea2feb272a087eb0faeff1b7b4511144f87219 F ext/rbu/rbu12.test ec63aa7bfc3c65c1d774bf4357ed731723827d211d9d7cb0efa171bbaeeebaf4 F ext/rbu/rbu13.test 658edbc3325d79252a98b761fde95460e439f80e820ff29e10261e25f870b3b6 F ext/rbu/rbu14.test 05dac607a62f62102f4db92135979a8a4501143638060019aca08c753822cf39 -F ext/rbu/rbu3.test 4a81517af618c3bf8c72e2d0b81c7c06acb8d176036d63d8e6669b73342306ae +F ext/rbu/rbu3.test b84d4e74c1a1beef5c31fce6ecba0147dab946220c4c7dced8e852f0d41e160f F ext/rbu/rbu5.test e21820b83822ae4c12afc2078a7b6c0523fb0cefe69c8b23c044cea91359e81c F ext/rbu/rbu6.test db2ff1f832dfc9e34c7910b17e157c2fe0e36024a3fe1119dd6437640dc07c82 F ext/rbu/rbu7.test 5fa41734613a3ae1bb93d280eb3c341cff5dcc72652ff9ec7fbaa12425eda9c2 @@ -475,7 +475,7 @@ F ext/rbu/rbuvacuum.test 6ded47e692b89c5c31f0bef31d899eecfaa3f0df7e1e969746ea507 F ext/rbu/rbuvacuum2.test 1a9bd41f127be2826de2a65204df9118525a8af8d16e61e6bc63ba3ac0010a23 F ext/rbu/rbuvacuum3.test 3ce42695fdf21aaa3499e857d7d4253bc499ad759bcd6c9362042c13cd37d8de F ext/rbu/rbuvacuum4.test ffccd22f67e2d0b380d2889685742159dfe0d19a3880ca3d2d1d69eefaebb205 -F ext/rbu/sqlite3rbu.c d1bb89154707af558b48d92f3c4d81a9d9ea1a2a13e6f46c445945f66398310e +F ext/rbu/sqlite3rbu.c 29be4d2e7a7fbc8124545d2833570bdefef8724239c6cdd81a8d1e6dd07889f2 F ext/rbu/sqlite3rbu.h e3a5bf21e09ca93ce4e8740e00d6a853e90a697968ec0ea98f40826938bdb68e F ext/rbu/test_rbu.c 8b6e64e486c28c41ef29f6f4ea6be7b3091958987812784904f5e903f6b56418 F ext/recover/dbdata.c 10d3c56968a9af6853722a47280805ad1564714d79ea45ac6f7da14bb57fd137 @@ -648,7 +648,7 @@ F ext/vec1/tool/vec1bench.tcl a117caee3cb99712f0477fe2fa85c94c260866951d3a9d667b F ext/vec1/tool/vec1bench_addcols.tcl 8c509253d07b179928f2ee32e3591a2c70d13c914217e1328c01afa148717051 F ext/vec1/tool/vec1bench_vibe2db.py 84ddb0236bc3d02a0393abce41986a1b7dad7f0d83884576f8318c2883e3aed3 F ext/vec1/vec1.c 7c930e6b5577622326dcf32569318f06d5f73fcc81912e43fb258f3ce396b00e -F ext/wasm/GNUmakefile d93df7101619ae363f431704bb77c0e683240e4d9e7edfb32a0e96e31c23f214 +F ext/wasm/GNUmakefile 390cf98771f3c99e9e6a4a34c506d911f49016d7ed0d4913f78a41a63cda69f1 F ext/wasm/README-dist.txt f01081a850ce38a56706af6b481e3a7878e24e42b314cfcd4b129f0f8427066a F ext/wasm/README.md 6d820c98468ebcee1dbf547467a03f65d256a2be48a9dcbeb5637d3da569c6fe F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff @@ -658,13 +658,13 @@ F ext/wasm/SQLTester/index.html 64f3435084c7d6139b08d1f2a713828a73f68de2ae6a3112 F ext/wasm/SQLTester/touint8array.c 2d5ece04ec1393a6a60c4bf96385bda5e1a10ad49f3038b96460fc5e5aa7e536 F ext/wasm/api/EXPORTED_FUNCTIONS.c-pp 0b0eee602791286ab18e07eadd38a531389285681bd3dbe92c5520ff81ca769a F ext/wasm/api/README.md a905d5c6bfc3e2df875bd391d6d6b7b48d41b43bdee02ad115b47244781a7e81 -F ext/wasm/api/extern-post-js.c-pp.js cba0f9735f741ce266aa0c52e6e1224f9fb027f20253292d3e71480787675a05 +F ext/wasm/api/extern-post-js.c-pp.js 22f9437272a44c385bac4ef66f632ab63ee662e31cbf7053a8961f276a28b6a4 F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41 F ext/wasm/api/opfs-common-inline.c-pp.js f84640e2b1e9c5903deb55ef3d7bf537587e31eb6f4f257b4a75827146d2b5a9 F ext/wasm/api/opfs-common-shared.c-pp.js 51d86e01ec20438552d09d233dfad97e681364b3e432fc083e2b8cd88fdcc865 F ext/wasm/api/post-js-footer.js a50c1a2c4d008aede7b2aa1f18891a7ee71437c2f415b8aeb3db237ddce2935b F ext/wasm/api/post-js-header.js f35d2dcf1ab7f22a93d565f8e0b622a2934fc4e743edf3b708e4dd8140eeff55 -F ext/wasm/api/pre-js.c-pp.js 2d12b65e1caefda202edc67ccbe248918ed1aee7fd4907527bffb3e6bca599c0 +F ext/wasm/api/pre-js.c-pp.js 145da76085bd31bbe9c9b2d52bc56106116745576699d03b8bd6eaaf78e1e537 F ext/wasm/api/sqlite3-api-glue.c-pp.js 0e41b7b571219eaf91a66d8cdbcbcab2b16db537046c0a35af8e0e48a72f99ca F ext/wasm/api/sqlite3-api-oo1.c-pp.js d41c122250a213002adf294487156ed46f146760a4d904e13996dcc425d7c15e F ext/wasm/api/sqlite3-api-prologue.js 0084e15d66fbcd75cacbaa58e3b473d5e57082c30f3122be7fdadff5589cf6b6 @@ -678,8 +678,8 @@ F ext/wasm/api/sqlite3-vfs-opfs-wl.c-pp.js 60fa106fc11d31adb1773ac16dd60fc9335a3 F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 5dd8410121acf623ce53005a4aab2c7b2b7f5d1ad072f69ebc208882bc7b7236 F ext/wasm/api/sqlite3-vtab-helper.c-pp.js 3218318194b11fa625ebda9f7900280c5c26cf257ab5b2b66709ce58e9531624 F ext/wasm/api/sqlite3-wasm.c 5ac22d03231318615112fdea462ea6abbee6cadf964f22b6dfcc813dd6b37b85 -F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js 46919740f8176c10f691431a81c769c35657e3b537e2ed2bde691f9017b0ee8a -F ext/wasm/api/sqlite3-worker1.c-pp.js 21b20d3b8d43471d1647123616a7e5435b1e4b6fa447714f91ffc7f950ea01e8 +F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js 3b551b4c4434d96c5daa21fe849c2f3f9ed1356d931b231975c32828efaa3c86 +F ext/wasm/api/sqlite3-worker1.c-pp.js d274d5eb7f43f4f3b35a4d1f9213a1e34aa5ae27df7af9e74df9f89a50ee7bda F ext/wasm/common/SqliteTestUtil.js dae753b95e72248c4395d8de8359e0d055cd9928488e8dd84aef89e46d23b32e F ext/wasm/common/emscripten.css 11bd104b6c0d597c67d40cc8ecc0a60dae2b965151e3b6a37fa5708bac3acd15 F ext/wasm/common/testing.css e97549bab24126c24e0daabfe2de9bb478fb0a69fdb2ddd0a73a992c091aad6f @@ -704,7 +704,7 @@ F ext/wasm/jaccwabyt/jaccwabyt.js 99039632cd8fa6f82acdb01e213850d2efe220388441fa F ext/wasm/jaccwabyt/jaccwabyt.md 6aa90fa1a973d0ad10d077088bea163b241d8470c75eafdef87620a1de1dea41 F ext/wasm/libcmpp.c a5bec47a754206aac2ffb45ba4adaec6af3b4fcc24c705c61a6f47893b72aef5 F ext/wasm/mkdist.sh f8883b077a2ca47cf92e6f0ce305fbf72ca648c3501810125056c4b09c2d5554 x -F ext/wasm/mkwasmbuilds.c d2cd19cf2e373ae4cc7b08baf6520c0c125b24f30311fcfcd91e69606213a5ec +F ext/wasm/mkwasmbuilds.c 0ec4b858fe04921d88de98216a65fd6d885eb98170e9c2d27a81cb2295eef811 F ext/wasm/module-symbols.html e54f42112e0aac2a31f850ab33e7f2630a2ea4f63496f484a12469a2501e07e2 F ext/wasm/scratchpad-wasmfs.html a3d7388f3c4b263676b58b526846e9d02dfcb4014ff29d3a5040935286af5b96 F ext/wasm/scratchpad-wasmfs.mjs 66034b9256b218de59248aad796760a1584c1dd842231505895eff00dbd57c63 @@ -717,9 +717,9 @@ F ext/wasm/split-speedtest1-script.sh a3e271938d4d14ee49105eb05567c6a69ba4c1f129 F ext/wasm/sql/000-mandelbrot.sql 775337a4b80938ac8146aedf88808282f04d02d983d82675bd63d9c2d97a15f0 F ext/wasm/sql/001-sudoku.sql 35b7cb7239ba5d5f193bc05ec379bcf66891bce6f2a5b3879f2f78d0917299b5 F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555e685bce3da8c3f -F ext/wasm/tester1-worker.c-pp.html 441b8b12769670a6bf03be205e6f20ec05827348a565ddcee94219c44ec313e3 +F ext/wasm/tester1-worker.c-pp.html e81f5a74c045499262b47beaef39cd36963f67021c6575f920ee3f11d0501420 F ext/wasm/tester1.c-pp.html 69403505b2c0b6cd76c8a210e3a09e80a8eb84a47c3eae591ab0e81c3934af61 -F ext/wasm/tester1.c-pp.js de7cdfee3b1dace334698be34a36945f2476be265f20d8c84d6b2408d5d8f8fd +F ext/wasm/tester1.c-pp.js 84c86fbdd6b2867fae245e0c1fa87ab885f1feed018b48eeb1ba3a3ae18f755b F ext/wasm/tests/opfs/concurrency/index.html 706eab6308343c04ac2360aba6001af4ffaf46d8f33a0ccd02c64d93e3216a43 F ext/wasm/tests/opfs/concurrency/test.js 6919778fceaac1b7cc78caf41d796f545d2c4433b31188aa9689f05b5ad28828 F ext/wasm/tests/opfs/concurrency/worker.js 704d82c5e287e47f612349e027765943a58ad967dcf178fb5a1c3a8eaafb09af @@ -768,7 +768,7 @@ F src/hash.h 46b92795a95bfefb210f52f0c316e9d7cdbcdd7e7fcfb0d8be796d3a5767cddf F src/hwtime.h 5cb15147c8583d0fc4748e1c12ea6f38c9deaeefa147a4d8d379fd9bc81fee9a F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 F src/insert.c 482d853c980f4765f045bbea3ab095067a52cd57f47e357f9f17aa7c7fff793f -F src/json.c 7d28da4a3740941eab5fa3361276160bb7698bf87218c9d30be7c10b894b6115 +F src/json.c 11548a00ddd10ecadf90407ce48720486c8aafd613676b972e592398c0f4446b F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 5cd4cd7ec6e1a46416806899086363fbf95eecd3bfb9a388b436c9a77243c902 F src/main.c 43912e1fae97d827e2c2345661336bdf36c31d01efd1f3bf9b5900406849b778 @@ -807,8 +807,8 @@ F src/printf.c 4bd228ed9e9346d558362be562757ee5eef6f9bf483b7f02751ca42cf95174d3 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 0e0990f60c93db38c735d85e5d1741130e72dd0670aec204b5a39118b53c8044 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 -F src/select.c 25ca7908bab21aefd6bf8b5424992ebd3b74cb5ac74735beddd889c31c9c1706 -F src/shell.c.in e474c0820422fb3a34d45151785a606d1e1a42ba468d9580cc92b09a905f7f8e +F src/select.c 71d639113349e0bcaab097629297e3b6bd6ca9d5ae3a842f9c77ab45e4ae1751 +F src/shell.c.in 163279dc63d58ff501ccea12112885d2e19c1e97182ac64ab2484c6ccf35e10b F src/sqlite.h.in d73bee6ea0612260b5edf72e3e58de7bd2a50cff000e0f4b3c3549d3e4c35171 F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479 F src/sqlite3ext.h 5e113c4c0442f2f1b3345d44cbe4b82fad45f2fc0c35f0ed4eef27fb8f1cb394 @@ -869,7 +869,7 @@ F src/threads.c 85d8b9f05f78211c61e3739ab5db761d7118766d1916ae7f2764735106bc4e13 F src/tokenize.c e9d52d9f7374d82dadcd11726bea8a597d43709d6672704f3f0375bf1d726912 F src/treeview.c 3a9e59b0d2b9e54e403fa65056ba90716eb91b5cc6e3fe0cda0edea060ddd281 F src/trigger.c d6d8991ca346eb6f56e50a3c5df486176b67a9179336798a75bb05e622c72cac -F src/update.c 2c5ea3803c19e5726960df9416a50759322d750b820db7d2b623b4f122e25bf9 +F src/update.c a38e0fa71f66a0c1eec564f08c20ec0935db8e3e558f0b9e305549972b91e4f4 F src/upsert.c dd9f0fcccbfb4f20e1026a21a7254ba3f2c08e9cfa92affaff5b5ec3b00ea549 F src/utf.c c5bec56770b71fe75e12f1f7b0a512032e1fd3d1f83c50c4ab4474ced20347a4 F src/util.c 5cda82abda6cc880f67749af782ebd79ac1fad75edf9ab8cdb568482a71e9cd4 @@ -1448,7 +1448,7 @@ F test/json106.test 4aed3afd16549045d198a8d9cea00deea96e1f2ecf55864dce96cac558b8 F test/json107.test 59054e815c8f6b67d634d44ace421cf975828fb5651c4460aa66015c8e19d562 F test/json108.test eab1859b19138ee03acd4415751308fc3849943c669a06b515bba658b96b55c3 F test/json109.test 441cea5d73c24a1a34d284101740dfae5a082237c048c8a66b03aeebe5e3643e -F test/json501.test 25e3ffd0e1e70efb3328e823dbad304687f1340e5b337bebef6e9a3e641d12de +F test/json501.test 37889447b2f0a774711ad7a0a653fa3f59ba5c61e4d7a5a2bd92ecf4ba7579f5 F test/json502.test 4ef68e4f272dfb083d4cbceb4e9e51d67ec1186a185e0c13637c50a4dc2f9796 F test/jsonb01.test 42419c8080af5660cdfd3fddec322d28bdbc244d9800ee9569091d455f1c0dea F test/keyword1.test 37ef6bba5d2ed5b07ecdd6810571de2956599dff @@ -1535,7 +1535,7 @@ F test/mmapcorrupt.test 470fb44fe92e99c1d23701d156f8c17865f5b027063c9119dcfdb842 F test/mmapfault.test d4c9eff9cd8c2dc14bc43e71e042f175b0a26fe3 F test/mmapleak.test 7542cafa4771abba531d072ea905f474a2875a153337a04f327f0a9319cdb72c F test/mmapwarm.test 2272005969cd17a910077bd5082f70bc1fefad9a875afec7fc9af483898ecaf3 -F test/modeA.sql 85875b8d676a3f4f7cb320f1a3d2b87e739dd9f3958902689a37a675affa125c +F test/modeA.sql 555cc4724b59fb9e437efbdbcf6b64cadf7f46d42d1dbb51b7dbf85bf2696403 F test/multiplex.test d74c034e52805f6de8cc5432cef8c9eb774bb64ec29b83a22effc8ca4dac1f08 F test/multiplex2.test 580ca5817c7edbe4cc68fa150609c9473393003a F test/multiplex3.test fac575e0b1b852025575a6a8357701d80933e98b5d2fe6d35ddaa68f92f6a1f7 @@ -1691,7 +1691,7 @@ F test/selectA.test 1da8ce3884c326e11d2855baffb76436b0d7e044404af8a2a70d1399a4ff F test/selectB.test 954e4e49cf1f896d61794e440669e03a27ceea25 F test/selectC.test 38c530b0cc5728b793c3c11f52b52c70290d39822224acd39011c89c1853bd31 F test/selectD.test 6d1909b49970bf92f45ce657505befcef5fc7cbc13544e18103a316d32189bfb -F test/selectE.test a8730ca330fcf40ace158f134f4fe0eb00c7edbf +F test/selectE.test eb48c5abc126d5e17c8de2db509d0669762beafd1b074b016b8619fab8495d3c F test/selectF.test 21c94e6438f76537b72532fa9fd4710cdd455fc3 F test/selectG.test 089f7d3d7e6db91566f00b036cb353107a2cca6220eb1cb264085a836dae8840 F test/selectH.test 0b54599f1917d99568c9b929df22ec6261ed7b6d2f02a46b5945ef81b7871aac @@ -1763,7 +1763,7 @@ F test/spellfix.test 09c4b3aecb6754dd9fd4a01ae3a712935c3a8456bc70d81480926f55d1e F test/spellfix2.test dfc8f519a3fc204cb2dfa8b4f29821ae90f6f8c3 F test/spellfix3.test 0f9efaaa502a0e0a09848028518a6fb096c8ad33 F test/spellfix4.test 7c56a09de68b95051ef0627fe235e514efbba2aa816dc2a9c5c670d98877e632 -F test/sqldiff1.test 1b7ab4f312442c5cc6b3a5f299fa8ca051416d1dd173cb1126fd51bf64f2c3fb +F test/sqldiff1.test b2486da15013e4a54be82067893e49052082be9c72a1410d1ebce66c17967a43 F test/sqllimits1.test 95dcc54332b5fdb00036876d1d98e91d22f4ea0f3b6c076ee8106bd157390977 F test/sqllog.test 6af6cb0b09f4e44e1917e06ce85be7670302517a F test/starschema1.test f5388cd32527ab18d3f98f9e3402ec780f6a186e04e0d9c8531d7568ee734e11 @@ -2273,7 +2273,7 @@ F tool/soak1.tcl a3892082ed1079671565c044e93b55c3c7f38829aedf53cc597c65d23ffdadd F tool/spaceanal.tcl cf693cae76f88cf4e378ccb9de1a6c84dcb9762b336ade56cd3206d10a446db1 F tool/spellsift.tcl 52b4b04dc4333c7ab024f09d9d66ed6b6f7c6eb00b38497a09f338fa55d40618 x F tool/split-sqlite3c.tcl fca49ffd65f54b2d219200ed6b199433a9e6a0a397835045e478601c4c0ea89c -F tool/sqldiff.c c038c3a058f8d8c992eefee6f7e173b1361b81d7f3e3bd871b9808f7d0e96a9a +F tool/sqldiff.c b3d5f5d970a5339d880f7630c9d0481b24c718697204d5df9dd20f80e743d476 F tool/sqlite3_analyzer.c.in 14f02cb5ec3c264cd6107d1f1dad77092b1cf440fc196c30b69ae87b56a1a43b F tool/sqlite3_rsync.c a342f9762653f968e12993bb2dc9083c52ad755c23f6005c575d8a376f970422 F tool/sqltclsh.c.in c103c6fc7d42bce611f9d4596774d60b7ef3d0b291a1f58c9e6184e458b89296 @@ -2294,8 +2294,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c -P 2448fc46cae2149c5d1777b9fe574a48e21d5e16dd64997d2343bb6e160840e3 -R 09d3e97e7e8cbf0049f0f65dd688ee61 -U dan -Z adafb80534c463cf81e26d72578b22d5 +P e2af533c281989c751fa4a15e8a5ebafa9cad5efadfd37a2407c89e397b3ddf2 606005419f60bd14eec71ee87a770051c8c551273c9a7567d830283eeb1058e8 +R b3c969998688fe748072288abe8a1319 +U drh +Z 34b918f9a0d1d3776adc9d5e49f72fce # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 2ecd3935e1..b393032bc4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e2af533c281989c751fa4a15e8a5ebafa9cad5efadfd37a2407c89e397b3ddf2 +79ba7ba1a75c998c68dd2cc60de7fbe133a563e803a536efea94eff657603965 diff --git a/src/json.c b/src/json.c index 98a4167c85..686a6734c8 100644 --- a/src/json.c +++ b/src/json.c @@ -3503,7 +3503,12 @@ static void jsonReturnFromBlob( if( c=='\\' ){ u32 v; u32 szEscape = jsonUnescapeOneChar(&z[iIn], sz-iIn, &v); - if( v<=0x7f ){ + if( v==0 && iIn+szEscape==sz + && (z[iIn+1]=='\n' || z[iIn+1]=='\r' || (u8)z[iIn+1]==0xe2) + ){ + /* A JSON5 line continuation at the end of the string + ** contributes no characters */ + }else if( v<=0x7f ){ zOut[iOut++] = (char)v; }else if( v<=0x7ff ){ assert( szEscape>=2 ); diff --git a/src/select.c b/src/select.c index 38406e2012..c64153c737 100644 --- a/src/select.c +++ b/src/select.c @@ -5763,6 +5763,8 @@ With *sqlite3WithPush(Parse *pParse, With *pWith, u8 bFree){ return pWith; } +static int selectExpanderWalk(Walker*, Select*); + /* ** This function checks to see if argument pFrom refers to a CTE declared by ** a WITH clause on the stack currently maintained by the parser (on the @@ -5927,7 +5929,7 @@ static int resolveFromTermToCte( return 2; } }else{ - if( sqlite3WalkSelect(pWalker, pSel) ){ + if( selectExpanderWalk(pWalker, pSel) ){ pParse->pWith = pSavedWith; return 2; } @@ -6189,7 +6191,10 @@ static int selectExpander(Walker *pWalker, Select *p){ pTab->nCol = -1; pWalker->eCode = 1; /* Turn on Select.selId renumbering */ if( pFrom->fg.isSubquery ){ - sqlite3WalkSelect(pWalker, pFrom->u4.pSubq->pSelect); + bft hasCompound = pParse->hasCompound; + pParse->hasCompound = 1; + selectExpanderWalk(pWalker, pFrom->u4.pSubq->pSelect); + pParse->hasCompound = hasCompound; } pWalker->eCode = eCodeOrig; pTab->nCol = nCol; @@ -6479,6 +6484,27 @@ void sqlite3SelectWalkAssert2(Walker *NotUsed, Select *NotUsed2){ assert( 0 ); } #endif + +/* +** The first argument is a Walker object created by sqlite3SelectExpand(). +** This function uses the walker to expand the SELECT statement passed +** as the second argument. If necessary, it also converts any compound +** SELECT statements that have COLLATE clauses on ORDER BY expressions +** to sub-queries. Return the return value of sqlite3WalkSelect(). +*/ +static int selectExpanderWalk(Walker *pWalker, Select *pSelect){ + assert( pWalker->xExprCallback==sqlite3ExprWalkNoop ); + assert( pWalker->pParse!=0 ); + if( OK_IF_ALWAYS_TRUE(pWalker->pParse->hasCompound) ){ + pWalker->xSelectCallback = convertCompoundSelectToSubquery; + pWalker->xSelectCallback2 = 0; + sqlite3WalkSelect(pWalker, pSelect); + } + pWalker->xSelectCallback = selectExpander; + pWalker->xSelectCallback2 = sqlite3SelectPopWith; + return sqlite3WalkSelect(pWalker, pSelect); +} + /* ** This routine "expands" a SELECT statement and all of its subqueries. ** For additional information on what it means to "expand" a SELECT @@ -6496,15 +6522,8 @@ static void sqlite3SelectExpand(Parse *pParse, Select *pSelect){ Walker w; w.xExprCallback = sqlite3ExprWalkNoop; w.pParse = pParse; - if( OK_IF_ALWAYS_TRUE(pParse->hasCompound) ){ - w.xSelectCallback = convertCompoundSelectToSubquery; - w.xSelectCallback2 = 0; - sqlite3WalkSelect(&w, pSelect); - } - w.xSelectCallback = selectExpander; - w.xSelectCallback2 = sqlite3SelectPopWith; w.eCode = 0; - sqlite3WalkSelect(&w, pSelect); + selectExpanderWalk(&w, pSelect); } diff --git a/src/shell.c.in b/src/shell.c.in index d4c7a382db..78fe3fbff5 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -4300,6 +4300,9 @@ static int dump_callback(void *pArg, int nArg, char **azArg, char **azNotUsed){ p->mode.spec.eBlob = QRF_BLOB_Sql; p->mode.spec.bTitles = QRF_No; p->mode.spec.nCharLimit = 0; + p->mode.spec.bTextJsonb = QRF_No; + p->mode.spec.zIFmt = 0; + p->mode.spec.zFpFmt = 0; rc = shell_exec(p, sSelect.zTxt, 0); if( (rc&0xff)==SQLITE_CORRUPT ){ cli_puts("/****** CORRUPTION ERROR *******/\n", p->out); @@ -10622,6 +10625,8 @@ static int do_meta_command(const char *zLine, ShellState *p){ p->shellFlgs = savedShellFlags; modeFree(&p->mode); p->mode = saved_mode; + if( p->mode.spec.zFpFmt ) p->mode.spec.zFpFmt = p->mode.zFpFmt; + if( p->mode.spec.zIFmt ) p->mode.spec.zIFmt = p->mode.zIFmt; rc = p->nErr>0; }else @@ -14471,7 +14476,7 @@ int SQLITE_CDECL main(int argc, char **argv){ || cli_strcmp(z,"-unsafe")==0 ){ ShellSetFlag(&data,SHFLG_TestingMode); }else if( cli_strcmp(z,"-safe")==0 ){ - /* no-op - catch this on the second pass */ + noInit = 1; /* --safe implies --noinit */ }else if( cli_strcmp(z,"-escape")==0 && i+1zName, j<0 ? "ROWID" : pTab->aCol[j].zCnName, db->aDb[iDb].zDbSName); - if( rc==SQLITE_DENY ){ - goto update_cleanup; - }else if( rc==SQLITE_IGNORE ){ - aXRef[j] = -1; + if( rc!=SQLITE_OK ){ + if( rc==SQLITE_DENY ){ + goto update_cleanup; + }else if( j<0 || j==pTab->iPKey ){ + chngRowid = 0; + }else{ + aXRef[j] = -1; + } } } #endif diff --git a/test/json501.test b/test/json501.test index 0a523d2201..eef1b5635e 100644 --- a/test/json501.test +++ b/test/json501.test @@ -344,4 +344,28 @@ do_execsql_test 15.0 { ORDER BY jid, pid; } {4 integer c text bb text 2 integer} +# Bug 2026-10-18T04:42:37Z +# +do_execsql_test 14.1 { + SELECT hex(('"ab\' || char(10) || '"') ->> '$'); +} {6162} +do_execsql_test 14.2 { + SELECT hex(('"ab\' || char(13,10) || '"') ->> '$'); +} {6162} +do_execsql_test 14.3 { + SELECT hex(('"ab\' || char(8232) || '"') ->> '$'); +} {6162} +do_execsql_test 14.4 { + SELECT hex(('"\' || char(10) || '"') ->> '$'); +} {{}} +do_execsql_test 14.5 { + SELECT hex(jsonb('"ab\' || char(10) || '"') ->> '$'); +} {6162} +do_execsql_test 14.6 { + SELECT hex(('"ab\' || char(10) || 'c"') ->> '$'); +} {616263} +do_execsql_test 14.7 { + SELECT hex('"ab\u0000"' ->> '$'); +} {616200} + finish_test diff --git a/test/modeA.sql b/test/modeA.sql index ddadabe49e..b7767fb65e 100644 --- a/test/modeA.sql +++ b/test/modeA.sql @@ -640,7 +640,7 @@ SELECT 1.25e+12, 0x1234; .testcase 1200 .mode jobject --fpfmt auto SELECT 1 AS a, +9.0e+999 AS b, -9.0e+999 AS c, 0.0 AS d; -.check {"a":1,"b":9e+999,"c":-9e+999,"d":0} +.check {"a":1,"b":9.0e+999,"c":-9.0e+999,"d":0.0} .open :memory: .testcase 1210 CREATE TABLE t1(a); @@ -651,9 +651,9 @@ PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; CREATE TABLE t1(a); INSERT INTO t1 VALUES(123); -INSERT INTO t1 VALUES(9e+999); +INSERT INTO t1 VALUES(9.0e+999); INSERT INTO t1 VALUES('hello'); -INSERT INTO t1 VALUES(-9e+999); +INSERT INTO t1 VALUES(-9.0e+999); INSERT INTO t1 VALUES(x'313233'); COMMIT; END @@ -670,3 +670,63 @@ SELECT '' AS ''; │ │ ╰──╯ END + +# Bug 2026-10-18T20:39:22Z +# +# .dump should not be affected by the --fpfmt, --ifmt, and --textjsonb +# settings of .mode +# +.open :memory: +.testcase 1400 +CREATE TABLE t1(a,b,c); +INSERT INTO t1 VALUES(1234.5678, 16, jsonb('{"a":1}')); +INSERT INTO t1 VALUES(0.5, 1234567, x'0102'); +.mode list --fpfmt %.2f --ifmt %x --textjsonb on +.dump +.check <1e308, b<-1e308 FROM t1 ORDER BY a; +} {1 1 0 2 0 1} +db close + +# The following test cases demonstrate that if the source table contains +# an AUTOINCREMENT table but there is no corresponding entry in the +# sqlite_sequence table, then the sqlite_sequence table is not updated +# correctly. This is a long-standing deficiency in sqldiff, though the +# issue is contrived and does not appear in practice. If the issue is +# ever fixed, then simply uncomment the following test sequence to verify +# the fix. +# +if 0 { + forcedelete test.db test2.db + sqlite3 db test.db + do_execsql_test sqldiff-5.0 { + CREATE TABLE a1(id INTEGER PRIMARY KEY AUTOINCREMENT, x); + } + db backup test2.db + db close + sqlite3 db test2.db + do_execsql_test sqldiff-5.1 { + INSERT INTO a1(x) VALUES('one'),('two'),('three'); + DELETE FROM a1 WHERE id=3; + SELECT seq FROM sqlite_sequence WHERE name='a1'; + } {3} + db close + sqldiff_apply_test sqldiff-5.2 + sqlite3 db test.db + do_execsql_test sqldiff-5.3 { + SELECT seq FROM sqlite_sequence WHERE name='a1'; + } {3} + do_execsql_test sqldiff-5.4 { + INSERT INTO a1(x) VALUES('four'); + SELECT id FROM a1 WHERE x='four'; + } {4} +} + finish_test diff --git a/tool/sqldiff.c b/tool/sqldiff.c index 0f8778e38f..a6c1cfd2f5 100644 --- a/tool/sqldiff.c +++ b/tool/sqldiff.c @@ -341,7 +341,7 @@ static void printQuoted(FILE *out, sqlite3_value *X){ double r1; char zBuf[50]; r1 = sqlite3_value_double(X); - sqlite3_snprintf(sizeof(zBuf), zBuf, "%!.15g", r1); + sqlite3_snprintf(sizeof(zBuf), zBuf, "%!0.17g", r1); sqlite3_fprintf(out, "%s", zBuf); break; }