Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when browsers are installed to a custom directory #20

Closed
Yolo390 opened this issue Aug 1, 2022 · 10 comments
Closed

Error when browsers are installed to a custom directory #20

Yolo390 opened this issue Aug 1, 2022 · 10 comments
Labels
bug Something isn't working question Further information is requested

Comments

@Yolo390
Copy link

Yolo390 commented Aug 1, 2022

Hey !

My Brave browser is installed with snap store on Ubuntu 22.04.

Bookmarks folder with snap is a bit different: /home/{user}/snap/brave/current/.config/BraveSofware/Brave-Browser/Default/Bookmarks

So I created a symlink to /home/{user}/.config/BraveSoftware/Brave-Browser/Default/Bookmarks

But I got this error: bad argument #1 to 'decode' (string expected, got nil)

Screenshot from 2022-08-01 22-57-47

Screenshot from 2022-08-01 23-02-20

Click on pictures for better quality xD

Did I miss something ?

Thanks !

@dhruvmanila
Copy link
Owner

related: #16

For now, the simplest solution would be to resolve the symlink to the actual file on disk and read that instead. But, I would rather prefer to implement a long term solution of using XDG based directories along with user provided directories.

@dhruvmanila dhruvmanila added the bug Something isn't working label Aug 2, 2022
@dhruvmanila
Copy link
Owner

@Flo-Slv Hey, can you please update the extension to the latest commit and try again with debug = true config parameter? Provide the output.

@dhruvmanila
Copy link
Owner

Also, the way file is read in lua, it seems that the symlinks are resolved by it, so this problem shouldn't rise. There must be something else which is going on. Can you try this code by substituting the path to any symlink which points to a file containing some content?

local path = '/path/to/symlink'

local file, err = io.open(path, 'r')
if not file then
  return print(err)
end

local content = file:read '*a'
file:close()
print(content)

@dhruvmanila dhruvmanila added the question Further information is requested label Aug 6, 2022
@Yolo390
Copy link
Author

Yolo390 commented Aug 7, 2022

I just updated plugins with :PackerSync and now it's working ! Thanks !

I don't really know what's happened... you are right, with symlinks it's working great.

But I still have an issue but with... firefox now

defs.lua:31: libsqlite3.so cannot open shared object file No such file or directory

Here is the screenshot
Screenshot from 2022-08-07 02-04-12

Do I need to create an symlink too ? since in Ubuntu 22.04, Firefox is installed via snapstore

@dhruvmanila
Copy link
Owner

This would probably be because the dependencies weren't installed correctly, I'm not really sure. Can you look at https://github.com/kkharji/sqlite.lua and install it as mentioned in it's README with all the C dependencies? If not, this issue needs to be reported in that repository.

@Yolo390
Copy link
Author

Yolo390 commented Aug 7, 2022

I thought only tami5/sqlite.lua was required. My bad, sorry !

So I installed kkharji/sqlite.lua too and give me a new error

defs.lua:683: sqlite.lua counldn't connect to sql database. ERR: unable to open database file 

Do I need to configure something else with sqlite3 ? Thanks 🙏🏼

@dhruvmanila
Copy link
Owner

They both are the same repository, the username was changed.

since in Ubuntu 22.04, Firefox is installed via snapstore

Ah, yes. This is the problem. I think the extension should've errored before trying to open the database file as I'm getting the profile information from the profiles.ini file stored in the default Firefox config directory.

Can you check if the config directory is present? Location:

https://github.com/dhruvmanila/telescope-bookmarks.nvim/blob/0368bc390b25329f86b2a1bc83fa621ce921d7c6/lua/telescope/_extensions/bookmarks/firefox.lua#L12-L16

Also, sorry to ask you again, but please update the extension and share the output. I can reproduce the message on my system only if there is a profile directory but the database file is absent.

@dhruvmanila dhruvmanila changed the title bad argument #1 to 'decode' - Brave on snap store (Ubuntu) Error when browsers are installed to a custom directory Aug 7, 2022
@Yolo390
Copy link
Author

Yolo390 commented Aug 7, 2022

Thanks for your fast reply !

Here is the debug output

Firefox bookmarks database file is not present in the profile director: /home/floslv/.mozilla/firefox/06lhu944.default/places.sqlite

So I confirm I have a folder called /home/floslv/.mozilla/firefox/

ls /home/floslv/.mozilla/firefox/

06lhu944.default   0ojxz66h.default-release  'Crash Reports'   installs.ini  'Pending Pings'   profiles.ini

Here is my profiles.ini

[Install4F96D1932A9F858E]
Default=0ojxz66h.default-release
Locked=1

[Profile1]
Name=default
IsRelative=1
Path=06lhu944.default
Default=1

[Profile0]
Name=default-release
IsRelative=1
Path=0ojxz66h.default-release

[General]
StartWithLastProfile=1
Version=2

Inside 06lhu944.default folder, there is only one file times.json.

There is no places.sqlite

Inside 0ojxz66h.default-release, there is places.sqlite but it's not my bookmarks, only default ones.

When I search on my files system for places.sqlite, the only return it's for 0ojxz66h.default-release, nothing for 06lhu944.default....

@Yolo390
Copy link
Author

Yolo390 commented Aug 7, 2022

I found where my Firefox bookmarks are stored
/home/floslv/snap/firefox/common/.mozilla/firefox/0ojxz66h.default-release/places.sqlite

I just did a symlink from here to /home/floslv/.mozilla/firefox/06lhu944.default/

It's working like a charm now !

@dhruvmanila
Copy link
Owner

It's working like a charm now !

Good to know that! I think there should be a better solution to this problem.

Continuing the discussion in #16 (or a new issue?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants