Skip to content

Advertise shared memory only when the underlying VFS provides it - #623

Open
LucaCappelletti94 wants to merge 1 commit into
sqlcipher:betafrom
LucaCappelletti94:upstream/beta-vfs-shm-without-base-shm
Open

LucaCappelletti94 wants to merge 1 commit into
sqlcipher:betafrom
LucaCappelletti94:upstream/beta-vfs-shm-without-base-shm

Conversation

@LucaCappelletti94

@LucaCappelletti94 LucaCappelletti94 commented Sep 29, 2026 •

Copy link
Copy Markdown

On 5.0.0-beta the VFS shim gives every file sqlcipher_io_methods, whose shared memory entries are always set, whatever the underlying file offers. SQLite decides whether WAL is possible from those entries alone in sqlite3PagerWalSupported, so over a base VFS without shared memory PRAGMA journal_mode = WAL answers wal and every later write fails with SQLITE_IOERR_SHMMAP, on plaintext and keyed databases alike.

That covers unix-dotfile, unix-none, and any SQLITE_OS_OTHER build whose own VFS lacks shared memory, since sqlite3_initialize runs sqlite3OsInit before SQLITE_EXTRA_INIT and the shim wraps that VFS. We hit it in CI with SQLCipher built for WebAssembly on the sqlite-wasm-rs platform layer, whose sqlite3_os_init installs an in-memory VFS with version 1 io methods. 4.19 over the same VFS keeps the rollback journal, as SQLite documents for WAL without shared memory.

The shim now offers shared memory only when the file under it has it, with a second table shaped like SQLite's own memdb_io_methods, so WAL availability matches the base VFS. WAL over unix is unchanged.

The test uses a new SQLCIPHER_TEST pragma to place the shim over unix-dotfile and unix-none, and sqlcipher.test passes in full.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant