Skip to content

Sync loop path to diff files in .mergin folder exceeds 260 characters #932

Description

@raherin

User encountered an issue where they synced their project and the plugin entered a sync loop that created 100s of versions of the project within a few minutes without the user realising what had happened.

This appears to have been triggered by the project being stored in a directory with a long file path. Though the project directory and files were within the 260 character limit for Windows, some of the diff files in the .mergin folder exceeded this limit. The missing diff file causes the plugin to fail to create a changeset and the plugin continues to re-sync, creating new project versions, until the user kills the app.

This is related to ticket (Lutra internal use only): https://odoo.lutraconsulting.co.uk/odoo/helpdesk.ticket/helpdesk.ticket/16516

Activity

  1. MarcelGeo commented on Aug 28, 2026

    @MarcelGeo
    Contributor

    @wonder-sk let's discuss fix approach.

  2. MarcelGeo commented on Sep 2, 2026

    @MarcelGeo
    Contributor

    @wonder-sk will check the geodiff implementation. Python looks like it's safe to handle longer paths from 3.6 version - s we do not need any proxy fs.py in py-client code itself.

    @harminius - would you like double check if everyting in py client is fine with longer paths when you revert fs.py in PR implementation?

  3. wonder-sk commented on Sep 4, 2026

    @wonder-sk
    Contributor

    Pending geodiff ticket: MerginMaps/geodiff#264

  4. harminius commented on Sep 4, 2026

    @harminius
    Contributor

    @wonder-sk will check the geodiff implementation. Python looks like it's safe to handle longer paths from 3.6 version - s we do not need any proxy fs.py in py-client code itself.

    @harminius - would you like double check if everyting in py client is fine with longer paths when you revert fs.py in PR implementation?

    @MarcelGeo I tested long path files manipulation in python console and qgis bundled python (3.12) failed to access unprefixed paths

    QGIS embedded Python long-path test
    Python: 3.12.11 (main, Jun 17 2025, 13:41:12) [MSC v.1943 64 bit (AMD64)]
    Host executable: C:\OSGeo4W\bin\qgis-ltr-qt6-bin.exe
    RtlAreLongPathsEnabled() for this process: True
    LongPathsEnabled registry value: 1
    
    Target directory length: 284
    Target directory: C:\Users\ACER\qgis_longpath_test\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa3\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa5
    
    --- os.makedirs WITHOUT prefix ---
    [FAIL] makedirs(deep) : FileNotFoundError [WinError 3] Systém nemůže nalézt uvedenou cestu: 'C:\\Users\\ACER\\qgis_longpath_test\\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0\\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1\\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2\\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa3\\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4\\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa5'
    
    --- os.makedirs WITH prefix ---
    [OK]   makedirs(lp(deep)) 
    
    Target file path length: 318
    
    --- open() WITHOUT prefix ---
    [FAIL] open(target, 'w') : FileNotFoundError [Errno 2] No such file or directory: 'C:\\Users\\ACER\\qgis_longpath_test\\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0\\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1\\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2\\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa3\\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4\\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa5\\test_file_data.gpkg-diff-someuuid'
    
    --- open() WITH prefix ---
    [OK]   open(lp(target), 'w') -> 17
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions