dhruvmanila / browser-bookmarks.nvim

A Neovim plugin to open your browser bookmarks right from the editor!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Firefox: database is locked

JanValiska opened this issue · comments

Hello,

extension doesn't work with my firefox.
When I try to run Telescope bookmarks it will end up with:

E5108: Error executing lua ...nvim/site/pack/packer/opt/sqlite.lua/lua/sqlite/stmt.lua:35: sqlite.lua: sq
l statement parse, , stmt: `select name from sqlite_master where name= ?`, err: `(`database is locked`)` 

The same error is here when I try to use places.sqlite database using sqlite3 utility:

➜  hbo9xv4w.default sqlite3 places.sqlite
SQLite version 3.37.0 2021-11-27 14:13:22
Enter ".help" for usage hints.
sqlite> .tables
Error: database is locked

NOTE: The error is present only when the Firefox is running. When I close FF the database is locked error is not present anymore.

POSSIBLE SOLUTION:
I tried to open sqlite database using immutable flag and it works:

sqlite3 'file:places.sqlite?immutable=1'

I just contacted developer of sqlite.lua: kkharji/sqlite.lua#131

The problem can be solved after the PR feat: support sqlite open v2 #132 of sqlite.lua repo will be merged.
After that the connection to firefoxs places.sqlite file should be changed to something like(firefox.lua:L72):

local uri = "file:" .. utils.join_path(profile_dir, "places.sqlite") .. "?immutable=1"
local db = sqlite.new(uri, { open_mode = "ro" }):open()

Ah, right. I completely forgot about Firefox locking the database when it's opened. This is on me, sorry for the trouble.

The problem can be solved after the PR feat: support sqlite open v2 #132 of sqlite.lua repo will be merged.
After that the connection to firefoxs places.sqlite file should be changed to something like(firefox.lua:L72):

That sounds good. Thanks for taking a look at it. I will open a PR with the change and merge it as soon as the mentioned PR is merged.

For anyone facing this issue, you can pin this plugin to the commit: eef8e53. Sorry for the inconvenience.