diff --git a/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js b/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js index 3ba889c393..709d3414c3 100644 --- a/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js +++ b/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js @@ -854,12 +854,18 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ return true; } + //! Documented elsewhere in this file. exportFile(name){ const sah = this.#mapFilenameToSAH.get(name) || toss("File not found:",name); const n = sah.getSize() - HEADER_OFFSET_DATA; - const b = new Uint8Array(n>=0 ? n : 0); - if(n>0) sah.read(b, {at: HEADER_OFFSET_DATA}); + const b = new Uint8Array(n>0 ? n : 0); + if(n>0){ + const nRead = sah.read(b, {at: HEADER_OFFSET_DATA}); + if(nRead != n){ + toss("Expected to read "+n+" bytes but read "+nRead+"."); + } + } return b; } @@ -879,8 +885,13 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ const sah = this.#mapFilenameToSAH.get(name) || this.nextAvailableSAH() || toss("No available handles to import to."); - sah.write(bytes, {at: HEADER_OFFSET_DATA}); - this.setAssociatedPath(sah, name, capi.SQLITE_OPEN_MAIN_DB); + const nWrote = sah.write(bytes, {at: HEADER_OFFSET_DATA}); + if(nWrote != n){ + this.setAssociatedPath(sah, '', 0); + toss("Expected to write "+n+" bytes but wrote "+nWrote+"."); + }else{ + this.setAssociatedPath(sah, name, capi.SQLITE_OPEN_MAIN_DB); + } } }/*class OpfsSAHPool*/; @@ -1087,6 +1098,9 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ automatically clean up any non-database files so importing them is pointless. + On a write error, the handle is removed from the pool and made + available for re-use. + - [async] number reduceCapacity(n) Removes up to `n` entries from the pool, with the caveat that it can diff --git a/manifest b/manifest index 76f5f962e1..8a308da5a1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sbug\sin\sthe\sjsonLookup()\sroutine\sused\sto\ssearch\sJSON.\s\sBug\swas\nintroduced\sby\sthe\srecent\s(unreleased)\sJSON\scaching\senhancements\ncheck-in\s[a4c1af616e672a0d]\smerged\sinto\strunk\sat\s[df099ad713011b67]. -D 2023-08-04T13:19:11.464 +C In\sthe\sopfs-sahpool\sVFS's\simportDb()\sand\sexportFile()\smethods,\sthrow\sif\sthe\sactually-wrote/read\samounts\sdiffer\sfrom\sthe\sexpected-to-write/read\samounts,\sper\sfeedback\sin\s[forum:a4122e986f|forum\spost\sa4122e986f]. +D 2023-08-04T16:01:55.085 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -507,7 +507,7 @@ F ext/wasm/api/sqlite3-api-worker1.js 9f32af64df1a031071912eea7a201557fe39b17386 F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89 F ext/wasm/api/sqlite3-opfs-async-proxy.js 8cf8a897726f14071fae6be6648125162b256dfb4f96555b865dbb7a6b65e379 F ext/wasm/api/sqlite3-v-helper.js 7daa0eab0a513a25b05e9abae7b5beaaa39209b3ed12f86aeae9ef8d2719ed25 -F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 54cee22aacadb9dfaea438d72ac0882249d028c37903208d48c52871290ceff7 +F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js abb69b5e008961026bf5ff433d7116cb046359af92a5daf73208af2e7ac80ae7 F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js e7a690e0e78ff4d563f2eca468f91db69f001ff4b79c6d2304cbb6f62dca437d F ext/wasm/api/sqlite3-wasm.c 8867f1d41c112fb4a2cfe22ff224eccaf309fcdea266cee0ec554f85db72ef0f F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js bc06df0d599e625bde6a10a394e326dc68da9ff07fa5404354580f81566e591f @@ -2049,8 +2049,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b7de399c277394a6a3bbf253d4177aa82753271e5087b98b2c2268f629a7dfdd -R 0023494055da434d093283e3467ed659 -U drh -Z fcef72d2f53678066563a17e3c8f660b +P ba7a66db13b28da0b41f03be825a593608474a5ebda89e12d58d89db709b8f65 +R f2c78f56dfb337758355d58b9337ecba +U stephan +Z 00aafcc21ac118e76e1aadfe455b796f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index e5cb58fc65..17fc756294 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ba7a66db13b28da0b41f03be825a593608474a5ebda89e12d58d89db709b8f65 \ No newline at end of file +a617ebf4e5d1af1b5b15e9782ad111399caaa3ea7b99bb0c8691c8b4283b6d6e \ No newline at end of file