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

Merging bookmarks in Firefox behaves like pulling, present bookmarks are deleted #1426

Closed
1 task
ungive opened this issue Nov 10, 2023 · 4 comments
Closed
1 task
Labels

Comments

@ungive
Copy link

ungive commented Nov 10, 2023

Which version of floccus are you using?

4.19.1

Sync method

WebDAV

Which browser are you using? In case you are using the phone App, specify the Android or iOS version and device please.

Firefox 119.0b9 (64-Bit)

Which version of Nextcloud Bookmarks are you using? (if relevant)

No response

Which version of Nextcloud? (if relevant)

No response

What kind of WebDAV server are you using? (if relevant)

I have set up my own, very basic WebDAV server with apache2, by following this quick guide:
https://linuxconfig.org/webdav-server-setup-on-ubuntu-linux

My site config /etc/apache2/sites-available/000-webdav.conf contains:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        # Servername webdav.local

        DocumentRoot /var/www/webdav
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/webdav>
                Options Indexes FollowSymLinks
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        Alias /webdav /var/www/webdav/shared
        <Location /webdav>
                DAV On
                AuthType Basic
                AuthName "webdav"
                AuthUserFile /media/shared/.webdav/passwords/webdav.passwords
                Require valid-user
                AllowOverride None
#               <Limit PUT POST DELETE PROPFIND PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
#                       AuthType Basic
#                       AuthName "webdav"
#                       AuthUserFile /media/shared/.webdav/passwords/webdav.passwords
#                       Require user jonas
#               </Limit>
        </Location>

        Alias /webdav-local /var/www/webdav/local
        <Location /webdav-local>
                DAV On
                AuthType Basic
                AuthName "webdav"
                AuthUserFile /media/shared/.webdav/passwords/webdav.passwords
                Require valid-user
                AllowOverride None
        </Location>
</VirtualHost>

Explanation for the first Location: I am using Floccus to sync bookmarks between my dual-boot Linux and Windows partition and by using a shared NTFS-drive as backend for my WebDAV server (apache2 for WebDAV on Linux, IIS for WebDAV on Windows). This issue can be reproduced with both, but I made instructions for the apache2 instance. Since it's a shared NTFS drive I had to create a symlink and I figured that might cause some issues, so to be safe I also tested it with another Location, which is just /var/www/webdav/local/ with permissions for www-data:www-data.

Describe the Bug

Merging two different sets of bookmarks (those on the server in the bookmarks.xbel file with the ones currently present in the bookmarks bar) causes the local bookmarks to be deleted and replaced with the remote bookmarks, as if the "pull" operation was chosen (but "merge" was used).

Expected Behavior

The sets of bookmarks should be merged, but more importantly, the local bookmarks should never be deleted. Good thing I made a backup first.

To Reproduce

Steps to reproduce:

  • Open Firefox
  • Create a new, clean profile in about:profiles, start it and use it for all the following steps
  • Go to https://addons.mozilla.org/en-US/firefox/addon/floccus/ and install the Floccus add-on
  • Delete all default bookmarks and make the following bookmarks in this order (although the order might not even matter here):
    • Bookmark to site A
    • Create a folder called "test"
    • Save a bookmark to a different site B in that created folder
  • Add an account in Floccus for your WebDAV server, do not use encryption, use the XBEL format, sync your bookmarks bar ("Lesezeichen-Symbolleiste" in German), disable auto-sync
  • Choose "push-up operation" and click "sync now"
  • Save the contents of the created xbel file, my file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xbel PUBLIC "+//IDN python.org//DTD XML Bookmark Exchange Language 1.0//EN//XML" "http://pyxml.sourceforge.net/topics/dtds/xbel.dtd">
<xbel version="1.0">
<!--- highestId :3: for Floccus bookmark sync browser extension -->
<bookmark href="https://github.com/floccusaddon/floccus" id="1"><title>GitHub - floccusaddon/floccus: :cloud: Sync your bookmarks privately across browsers and devices</title></bookmark>
<folder id="2"><title>test</title><bookmark href="https://github.com/floccusaddon/floccus/issues" id="3"><title>Issues · floccusaddon/floccus · GitHub</title></bookmark></folder>
</xbel>
  • Save the current "bookmarks.xbel" file as "bookmarks-first.xbel"
  • Delete all your bookmarks
  • Create new bookmarks in this order:
    • Create a folder called "test"
    • Save a bookmark C in that created folder (not A or B from before, so you can tell the difference)
    • Bookmark another site D in your bookmarks bar
    • Create another empty folder "another-folder"
  • Choose "push-up operation" and click "sync now" (overwriting the other one)
  • Save the current "bookmarks.xbel" file as "bookmarks-second.xbel"
  • Save the contents of the new xbel file, my file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xbel PUBLIC "+//IDN python.org//DTD XML Bookmark Exchange Language 1.0//EN//XML" "http://pyxml.sourceforge.net/topics/dtds/xbel.dtd">
<xbel version="1.0">
<!--- highestId :6: for Floccus bookmark sync browser extension -->
<folder id="2"><title>test</title><bookmark href="https://www.youtube.com/?themeRefresh=1" id="4"><title>YouTube</title></bookmark></folder>
<bookmark href="https://www.youtube.com/@firefox" id="5"><title>Firefox - YouTube</title></bookmark>
<folder id="6"><title>another-folder</title></folder>
</xbel>
  • You now have two sets of xbel files, containing the respective sets of bookmarks we created
  • Now rename the "bookmarks-first.xbel" to "bookmarks.xbel", possibly overwriting the existing "bookmarks.xbel" file (which is ok)
  • Choose "merge operation" and click "sync now" which should merge the first set of bookmarks (on the server) with the second set of bookmarks (locally in the bookmarks bar)
  • Observe that the bookmarks we created first are restored, but the ones we created now are deleted. Not even the ones in the "test" folder were merged. They are all gone.

I didn't attach any logs, since I already deleted my temporary Firefox profile and I'd have to follow all the steps again (I'm lazy) and in case you can reproduce it you could get the logs yourself anyway.

Debug log provided

  • I have provided a debug log file
@ungive ungive added the bug label Nov 10, 2023
Copy link

Hello 👋

Thank you for taking the time to open this issue with floccus. I know it's frustrating when software
causes problems. You have made the right choice to come here and open an issue to make sure your problem gets looked at
and if possible solved.
I'm Marcel and I created floccus and have been maintaining it ever since.
I currently work for Nextcloud which leaves me with less time for side projects like this one
than I used to have.
I still try to answer all issues and if possible fix all bugs here, but it sometimes takes a while until I get to it.
Until then, please be patient.
Note also that GitHub is a place where people meet to make software better together. Nobody here is under any obligation
to help you, solve your problems or deliver on any expectations or demands you may have, but if enough people come together we can
collaborate to make this software better. For everyone.
Thus, if you can, you could also have a look at other issues to see whether you can help other people with your knowledge
and experience. If you have coding experience it would also be awesome if you could step up to dive into the code and
try to fix the odd bug yourself. Everyone will be thankful for extra helping hands!
One last word: If you feel, at any point, like you need to vent, this is not the place for it; you can go to the forum,
to twitter or somewhere else. But this is a technical issue tracker, so please make sure to
focus on the tech and keep your opinions to yourself.

I look forward to working with you on this issue
Cheers 💙

@ungive
Copy link
Author

ungive commented Nov 10, 2023

I quickly redid it with fewer bookmarks.

bookmarks-first.xbel:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xbel PUBLIC "+//IDN python.org//DTD XML Bookmark Exchange Language 1.0//EN//XML" "http://pyxml.sourceforge.net/topics/dtds/xbel.dtd">
<xbel version="1.0">
<!--- highestId :1: for Floccus bookmark sync browser extension -->
<bookmark href="https://www.mozilla.org/firefox/?utm_medium=firefox-desktop&amp;utm_source=bookmarks-toolbar&amp;utm_campaign=new-users&amp;utm_content=-global" id="1"><title>Erste Schritte</title></bookmark>
</xbel>

bookmarks-second.xbel

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xbel PUBLIC "+//IDN python.org//DTD XML Bookmark Exchange Language 1.0//EN//XML" "http://pyxml.sourceforge.net/topics/dtds/xbel.dtd">
<xbel version="1.0">
<!--- highestId :2: for Floccus bookmark sync browser extension -->
<bookmark href="https://www.mozilla.org/de/privacy/firefox/" id="2"><title>Firefox Datenschutzhinweis — Mozilla</title></bookmark>
</xbel>

Merge result:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xbel PUBLIC "+//IDN python.org//DTD XML Bookmark Exchange Language 1.0//EN//XML" "http://pyxml.sourceforge.net/topics/dtds/xbel.dtd">
<xbel version="1.0">
<!--- highestId :1: for Floccus bookmark sync browser extension -->
<bookmark href="https://www.mozilla.org/firefox/?utm_medium=firefox-desktop&amp;utm_source=bookmarks-toolbar&amp;utm_campaign=new-users&amp;utm_content=-global" id="1"><title>Erste Schritte</title></bookmark>
</xbel>

Full logs:

2023-11-10T15:29:42.737Z Starting sync process for account jonas@localhost
2023-11-10T15:29:42.740Z onSyncStart: begin
2023-11-10T15:29:42.740Z http://localhost:80/webdav-local/bookmarks.xbel.lock
2023-11-10T15:29:42.742Z http://localhost:80/webdav-local/bookmarks.xbel.lock
2023-11-10T15:29:42.748Z onSyncStart: completed
2023-11-10T15:29:42.751Z Using "default" strategy
2023-11-10T15:29:42.753Z Overriding title of built-in node toolbar_____ Lesezeichen-Symbolleiste => Bookmarks Bar
2023-11-10T15:29:42.754Z { localTreeRoot: 
     + #toolbar_____[undefined] parentId: undefined, hash: undefined
       - #H8oSoJinzDUn[Firefox Datenschutzhinweis — Mozilla](https://www.mozilla.org/de/privacy/firefox/) parentId: toolbar_____,
  serverTreeRoot: 
     + #0[root] parentId: undefined, hash: undefined
       - #1[Erste Schritte](https://www.mozilla.org/firefox/?utm_medium=firefox-desktop&utm_source=bookmarks-toolbar&utm_campaign=new-users&utm_content=-global) parentId: 0,
  cacheTreeRoot: 
     + #toolbar_____[undefined] parentId: undefined, hash: undefined
       - #H8oSoJinzDUn[Firefox Datenschutzhinweis — Mozilla](https://www.mozilla.org/de/privacy/firefox/) parentId: toolbar_____ }
2023-11-10T15:29:42.758Z { localDiff: [],
  serverDiff: 
   [ { type: 'CREATE',
       payload: - #1[Erste Schritte](https://www.mozilla.org/firefox/?utm_medium=firefox-desktop&utm_source=bookmarks-toolbar&utm_campaign=new-users&utm_content=-global) parentId: 0,
       index: 0 },
     { type: 'REMOVE',
       payload: - #H8oSoJinzDUn[Firefox Datenschutzhinweis — Mozilla](https://www.mozilla.org/de/privacy/firefox/) parentId: toolbar_____,
       index: 0 },
     { type: 'REORDER',
       payload: 
        + #0[root] parentId: undefined, hash: 12155261d336b364d55ffcacd9cf926f653ab6789f43086e018b0591700d5219
        - #1[Erste Schritte](https://www.mozilla.org/firefox/?utm_medium=firefox-desktop&utm_source=bookmarks-toolbar&utm_campaign=new-users&utm_content=-global) parentId: 0,
       order: [Object] } ] }
2023-11-10T15:29:42.759Z Mapping server plan
2023-11-10T15:29:42.759Z Mapping local plan
2023-11-10T15:29:42.759Z { localPlan: 
   [ { type: 'CREATE',
       payload: - #undefined[Erste Schritte](https://www.mozilla.org/firefox/?utm_medium=firefox-desktop&utm_source=bookmarks-toolbar&utm_campaign=new-users&utm_content=-global) parentId: toolbar_____,
       index: 0,
       oldItem: - #1[Erste Schritte](https://www.mozilla.org/firefox/?utm_medium=firefox-desktop&utm_source=bookmarks-toolbar&utm_campaign=new-users&utm_content=-global) parentId: 0 },
     { type: 'REMOVE',
       payload: - #H8oSoJinzDUn[Firefox Datenschutzhinweis — Mozilla](https://www.mozilla.org/de/privacy/firefox/) parentId: toolbar_____,
       index: 0,
       oldItem: - #H8oSoJinzDUn[Firefox Datenschutzhinweis — Mozilla](https://www.mozilla.org/de/privacy/firefox/) parentId: toolbar_____ },
     { type: 'REORDER',
       payload: 
        + #0[root] parentId: undefined, hash: 12155261d336b364d55ffcacd9cf926f653ab6789f43086e018b0591700d5219
        - #1[Erste Schritte](https://www.mozilla.org/firefox/?utm_medium=firefox-desktop&utm_source=bookmarks-toolbar&utm_campaign=new-users&utm_content=-global) parentId: 0,
       order: [Object] } ],
  serverPlan: [] }
2023-11-10T15:29:42.759Z Checking failsafe: 1/1=1
2023-11-10T15:29:42.759Z Executing server plan
2023-11-10T15:29:42.760Z Server: executing CREATEs and UPDATEs
2023-11-10T15:29:42.760Z Server: mapping MOVEs
2023-11-10T15:29:42.760Z Server: executing MOVEs
2023-11-10T15:29:42.760Z Server: executing REMOVEs
2023-11-10T15:29:42.760Z Executing local plan
2023-11-10T15:29:42.760Z Local: executing CREATEs and UPDATEs
2023-11-10T15:29:42.760Z (local)CREATE     - #undefined[Erste Schritte](https://www.mozilla.org/firefox/?utm_medium=firefox-desktop&utm_source=bookmarks-toolbar&utm_campaign=new-users&utm_content=-global) parentId: toolbar_____
2023-11-10T15:29:42.787Z Local: mapping MOVEs
2023-11-10T15:29:42.787Z Local: executing MOVEs
2023-11-10T15:29:42.787Z Local: executing REMOVEs
2023-11-10T15:29:42.787Z (local)REMOVE     - #H8oSoJinzDUn[Firefox Datenschutzhinweis — Mozilla](https://www.mozilla.org/de/privacy/firefox/) parentId: toolbar_____
2023-11-10T15:29:42.799Z Executing reorderings
2023-11-10T15:29:42.800Z { reorderings: [] }
2023-11-10T15:29:42.800Z { reorderings: 
   [ { type: 'REORDER',
       payload: 
        + #toolbar_____[root] parentId: undefined, hash: undefined
        - #1[Erste Schritte](https://www.mozilla.org/firefox/?utm_medium=firefox-desktop&utm_source=bookmarks-toolbar&utm_campaign=new-users&utm_content=-global) parentId: 0,
       order: [Object],
       oldItem: 
        + #0[root] parentId: undefined, hash: undefined
        - #1[Erste Schritte](https://www.mozilla.org/firefox/?utm_medium=firefox-desktop&utm_source=bookmarks-toolbar&utm_campaign=new-users&utm_content=-global) parentId: 0,
       oldOrder: [Object] } ] }
2023-11-10T15:29:42.802Z Overriding title of built-in node toolbar_____ Lesezeichen-Symbolleiste => Bookmarks Bar
2023-11-10T15:29:42.806Z onSyncComplete
2023-11-10T15:29:42.806Z No changes to the server version necessary
2023-11-10T15:29:42.811Z Successfully ended sync process for account jonas@localhost

@marcelklehr
Copy link
Member

marcelklehr commented Nov 14, 2023

Hello @jonasberge

Thank you for opening this issue. However, I have to tell you that I believe your assumptions are wrong. The "Merge" strategy is not stateless. It may be stateless initially, but it is not stateless on consecutive runs, for the following reasons:
Floccus keeps track of bookmarks IDs in order to account for movements of bookmarks between folders. Unless you clear floccus' cache in your account settings, floccus will assume that all local bookmarks have been removed if it cannot find their IDs in the XBEL file anymore. You cannot simply switch out the XBEL file and expect things to just work. At the very least you will have to clear the local cache, but even then I don't recommend switching out the XBEL file.
Floccus should have a failsafe to avoid deleting more than 50% of local bookmarks, though.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
Status: Done
Development

No branches or pull requests

2 participants