Fix opening the DB on network filesystems (e.g., SMB) on macOS/Linux

(Confirmed on macOS, but probably Linux too)

Pass openNotExclusive to avoid acquiring an exclusive lock at the OS level
at open time, which fails with an I/O error on network shares. We still set
locking_mode=EXCLUSIVE, so the connection holds an exclusive SQLite lock for
its lifetime and keeps the WAL index in heap memory (no -shm file).

Regression in Zotero 7 (Fx115)

Fixes #4860
This commit is contained in:
Dan Stillman 2026-06-15 10:52:05 -04:00
parent 39d7835472
commit 22055d92b7

View file

@ -1401,8 +1401,14 @@ Zotero.DBConnection.prototype._getConnectionAsync = async function () {
if (await OS.File.exists(corruptMarker)) {
throw new Error(this.DB_CORRUPTION_STRINGS[0]);
}
// Open without an exclusive lock at the OS level so the database can be opened on network
// filesystems (e.g., SMB shares), where acquiring the exclusive open lock fails with an I/O
// error. We still set locking_mode=EXCLUSIVE below, which gives us a connection-lifetime
// SQLite lock (preventing undetected concurrent writes) and keeps the WAL index in heap
// memory, avoiding the -shm file that can't be created on a network filesystem. See #4860.
this._connection = await Promise.resolve(this.Sqlite.openConnection({
path: file
path: file,
openNotExclusive: true
}));
}
catch (e) {