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

Importing data from other computer corrupts the container extension somehow #3

Open
mcepl opened this issue Apr 2, 2019 · 11 comments

Comments

@mcepl
Copy link
Contributor

mcepl commented Apr 2, 2019

Both computers use MozillaFirefox-66.0-1.1.x86_64 from the openSUSE/Tumbleweed repository. On one computer I export my containers to ffcontainers-eguebw4d.default-1548008691899-20190402.zip
On other computer I switch off Firefox and import the data. The result is something which looks very much like mozilla/multi-account-containers#1321 (non-functional container tab). Can reproduce with:

$ rm -rf  /home/matej/.mozilla/firefox//r7f7tog2.default/storage/default/moz-extension+++5f45d77e-be24-4875-92f5-c6dcce28fc7d\^userContextId\=4294967295/
$ # BTW, Note the double slash in the profile name ... isn't it wrong?
$ ./firefox # let it run for a moment to be sure that empty databases and data structures
$ # are created
$ pkill -f firefox
$ ./ffcontainer.sh import ~/ffcontainers-eguebw4d.default-1548008691899-20190402.zip

Restart Firefox and the menu is messed up.

@pierlauro
Copy link
Owner

The result is something which looks very much like mozilla/multi-account-containers#1321 (non-functional container tab)

I had the same issue when synchronizing from an updated Firefox installation with the containers addon version 4 to another updated Firefox BUT whose containers addon was still at version 3.

Could you check the addon's version on the importing machine?

# BTW, Note the double slash in the profile name ... isn't it wrong?

Not totally wrong since the path is valid anyway (// is expanded as ././ so it is equivalent to /).
But thanks, I will fix it. It could potentially introduce indexing errors when using cut -d /.

@pierlauro
Copy link
Owner

Not totally wrong since the path is valid anyway (// is expanded as ././ so it is equivalent to /).
But thanks, I will fix it. It could potentially introduce indexing errors when using cut -d /.

Just merged your pull request, thank you.

@mcepl
Copy link
Contributor Author

mcepl commented Apr 2, 2019

I had the same issue when synchronizing from an updated Firefox installation with the containers addon version 4 to another updated Firefox BUT whose containers addon was still at version 3.

Could you check the addon's version on the importing machine?

??? I have multi-account-containers version 6.1.0 from https://github.com/mozilla/multi-account-containers

@pierlauro
Copy link
Owner

You should check the version in containers.js, your version on the first machine is 4 as you can see in your archive's file. What about the other machine?

@mcepl
Copy link
Contributor Author

mcepl commented Apr 2, 2019

I believe it is the same containers.json.

@pierlauro
Copy link
Owner

pierlauro commented Apr 3, 2019

I tried to reproduce the error but I did not succeed.

Would you mind attaching both your prefs.js?

@mcepl
Copy link
Contributor Author

mcepl commented Apr 3, 2019

@joaopsys
Copy link

Same happening to me unfortunately. The containers.json is copied just fine, but overwriting the sqlite file makes the extension stop working.

@pierlauro
Copy link
Owner

pierlauro commented Apr 10, 2019

A couple of days ago I figured out which is the error: as you can see in prefs.js, every addon installation has a different ramdom ID. The problem could intuitively be solved in 2 ways:

1 - Replace the addon id.
2 - Make a SQL dump of the addon's settings table from the source machine and restore it on the destination one.

Regarding the first solution, it seems that replacing an addon id is not as trivial as expected because it is somewhere stored in a binary form (I replaced all plain-text ids and still didn't succeed to fix the problem).

The second alternative is also presenting a problem as the sqlite database is set to call some triggers on items INSERT/DELETE that, unfortunately, are not enclosed in the file itself but are programmatically declared as custom functions directly in C++ in Firefox.

Given the context, my objective is to develop a generic solution to export/import every addon's settings (at least all the ones using IndexedDB) and use it also in this script.

This will require some time, it is in my TODO list for next weekend so I will update you soon.

Feel free to give suggestions if you have any.

@joaopsys
Copy link

joaopsys commented Apr 10, 2019

Thank you for the technical details! So in theory, if I apply all the INSERTs directly from one DB to the other, while Firefox is running, would that accomplish anything?

EDIT: Nope, the database is obviously locked :)

@pierlauro
Copy link
Owner

pierlauro commented Apr 10, 2019

EDIT: Nope, the database is obviously locked :)

That's not the only problem: even if the DB would not be locked, the SQLite client would still not be able to locate the functions (loaded in memory by Firefox and not saved in the file - so not shared with other clients).

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

No branches or pull requests

3 participants