Merge current trunk into the autosetup branch.

FossilOrigin-Name: 352da23b46f13fbb2c38fcdd0b6092bf39a391a0bfed587004c85f7f5b99a58d
This commit is contained in:
stephan 2024-10-17 22:20:27 +00:00
commit d1068f8b73
6 changed files with 64 additions and 13 deletions

View File

@ -506,8 +506,7 @@ const installAsyncProxy = function(){
dirHandle: hDir,
fileHandle: hFile,
sabView: state.sabFileBufView,
readOnly: create
? false : (state.sq3Codes.SQLITE_OPEN_READONLY & flags),
readOnly: !create && !!(state.sq3Codes.SQLITE_OPEN_READONLY & flags),
deleteOnClose: !!(state.sq3Codes.SQLITE_OPEN_DELETEONCLOSE & flags)
});
fh.releaseImplicitLocks =

View File

@ -57,7 +57,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
'use strict';
const toss = sqlite3.util.toss;
const toss3 = sqlite3.util.toss3;
const initPromises = Object.create(null);
const initPromises = Object.create(null) /* cache of (name:result) of VFS init results */;
const capi = sqlite3.capi;
const util = sqlite3.util;
const wasm = sqlite3.wasm;
@ -843,6 +843,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
if(!this.#cVfs.pointer || !this.#dhOpaque) return false;
capi.sqlite3_vfs_unregister(this.#cVfs.pointer);
this.#cVfs.dispose();
delete initPromises[this.vfsName];
try{
this.releaseAccessHandles();
await this.#dhVfsRoot.removeEntry(OPAQUE_DIR_NAME, {recursive: true});

View File

@ -922,6 +922,8 @@ const installOpfsVfs = function callee(options){
fh.filename = zName;
fh.sab = new SharedArrayBuffer(state.fileBufferSize);
fh.flags = flags;
fh.readOnly = !(sqlite3.SQLITE_OPEN_CREATE & flags)
&& !!(flags & capi.SQLITE_OPEN_READONLY);
const rc = opRun('xOpen', pFile, zName, flags, opfsFlags);
if(!rc){
/* Recall that sqlite3_vfs::xClose() will be called, even on

View File

@ -3355,6 +3355,55 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
db.close();
}
})
.t({
name: 'r/o connection recovery from write op error',
predicate: ()=>hasOpfs() || "Requires OPFS to reproduce",
//predicate: ()=>false,
test: async function(sqlite3){
/* https://sqlite.org/forum/forumpost/cf37d5ff1182c31081
The "opfs" VFS (but not SAHPool) was formerly misbehaving
after a write attempt was made on a db opened with
mode=ro. This test ensures that that behavior is fixed and
compares that behavior with other VFSes. */
const tryOne = function(vfsName,descr){
const uri = 'file:///foo.db';
let db = new sqlite3.oo1.DB(uri + (vfsName ? '?vfs='+vfsName : ''));
db.exec([
"drop table if exists t;",
"create table t(a);",
"insert into t(a) values('abc'),('def'),('ghi');"
]);
db.close();
db = new sqlite3.oo1.DB(uri+'?mode=ro'+
(vfsName ? '&vfs='+vfsName : ''));
let err;
try {
db.exec('insert into t(a) values(1)');
}catch(e){
err = e;
}
T.assert(err && (err.message.indexOf('SQLITE_READONLY')===0));
try{
db.exec('select a from t');
}finally{
db.close();
}
};
const poolConfig = JSON.parse(JSON.stringify(sahPoolConfig));
poolConfig.name = 'opfs-sahpool-cf37d5ff11';
let poolUtil;
await sqlite3.installOpfsSAHPoolVfs(poolConfig).then(p=>poolUtil=p);
T.assert(!!sqlite3.capi.sqlite3_vfs_find(poolConfig.name), "Expecting to find just-registered VFS");
try{
tryOne(false, "Emscripten filesystem");
tryOne(poolConfig.name);
tryOne('opfs');
}finally{
await poolUtil.removeVfs();
}
}
})
;/*end of Bug Reports group*/;
////////////////////////////////////////////////////////////////////////

View File

@ -1,5 +1,5 @@
C General\scleanups.\sRename\sBTCL\sto\sBTCLSH\sfor\ssome\sclarity.
D 2024-10-17T22:19:37.426
C Merge\scurrent\strunk\sinto\sthe\sautosetup\sbranch.
D 2024-10-17T22:20:27.470
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -649,10 +649,10 @@ F ext/wasm/api/sqlite3-api-oo1.c-pp.js f3a8e2004c6625d17946c11f2fb32008be78bc520
F ext/wasm/api/sqlite3-api-prologue.js 6f1257e04885632ed9f44d43aba200b86e0bc16709ffdba29abbbeb1bc8e8b76
F ext/wasm/api/sqlite3-api-worker1.c-pp.js 5cc22a3c0d52828cb32aad8691488719f47d27567e63e8bc8b832d74371c352d
F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89
F ext/wasm/api/sqlite3-opfs-async-proxy.js e8f1df56e97a29004a95a2eddd26778f52c33b3e797d32d4b1b668a38e6493dd
F ext/wasm/api/sqlite3-opfs-async-proxy.js 3774befd97cd1a5e2895c8225a894aad946848c6d9b4028acc988b5d123475af
F ext/wasm/api/sqlite3-vfs-helper.c-pp.js 3f828cc66758acb40e9c5b4dcfd87fd478a14c8fb7f0630264e6c7fa0e57515d
F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js e529a99b7d5a088284821e2902b20d3404b561126969876997d5a73a656c9199
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js e99e3d99f736937914527070f00ab13e9391d3f1cef884ab99a64cbcbee8d675
F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js bb5e96cd0fd6e1e54538256433f1c60a4e3095063c4d1a79a8a022fc59be9571
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 9b86ca2d8276cf919fbc9ba2a10e9786033b64f92c2db844d951804dee6c4b4e
F ext/wasm/api/sqlite3-vtab-helper.c-pp.js e809739d71e8b35dfe1b55d24d91f02d04239e6aef7ca1ea92a15a29e704f616
F ext/wasm/api/sqlite3-wasm.c 83f5e9f998e9fa4261eb84e9f092210e3ffe03895119f5ded0429eb34ab9d2be
F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js 46f303ba8ddd1b2f0a391798837beddfa72e8c897038c8047eda49ce7d5ed46b
@ -701,7 +701,7 @@ F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555
F ext/wasm/test-opfs-vfs.js 1618670e466f424aa289859fe0ec8ded223e42e9e69b5c851f809baaaca1a00c
F ext/wasm/tester1-worker.html ebc4b820a128963afce328ecf63ab200bd923309eb939f4110510ab449e9814c
F ext/wasm/tester1.c-pp.html 1c1bc78b858af2019e663b1a31e76657b73dc24bede28ca92fbe917c3a972af2
F ext/wasm/tester1.c-pp.js bb8c41a56ca0eabb945ca2e8f06324a7b63ad91630959d714b071bee88322019
F ext/wasm/tester1.c-pp.js b683e64f776e03dc7cb81cf4737b991c644b0a59e3ca52dcdc606d851a95475e
F ext/wasm/tests/opfs/concurrency/index.html 657578a6e9ce1e9b8be951549ed93a6a471f4520a99e5b545928668f4285fb5e
F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65ad09f510589c779b7cc6a803a88
F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
@ -2238,8 +2238,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 9a7e56a01703fdcb4c83481d33d48bd4c8e6a5586c1315bae36fdff34a1b3bd1
R 30374e42cf396edeeab8be3ba90d92cf
P 83eaef7d62677a85a2c42f98d52ff2e8e5356724ad6d12b2907409d96d4757f1 0a32624015f16fd881a4ecbb56b7833391028d327a95f4c899eee864ed7fe00d
R 5bf6ee4a5edead94a59479d61cb4229f
U stephan
Z 533ef536662a14cac9318bc23f02aeac
Z 0e34f05747acefc37ecfc30a7ac64e71
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
83eaef7d62677a85a2c42f98d52ff2e8e5356724ad6d12b2907409d96d4757f1
352da23b46f13fbb2c38fcdd0b6092bf39a391a0bfed587004c85f7f5b99a58d