Menu ▾ ▴

Very strange bug in Mapsources tree

2026-09-25
2026-09-25
  • Laurent Grenet

    Laurent Grenet - 2026-09-25

    I have found a very strange bug in Mapsources tree management.
    I found it during my 2.4Beta tests, but since actually this bug already exist in last "official" version (2.3.3), I preferred to create a specific thread rather than a post in the 2.4Beta thread

    Please, Robert, be patient, and read until the end, because it's really VERY strange, and VERY difficult to have a workaround.

    What happens ?
    I've incidently discovered that in my custom sources collection, I had two folders with the same name, one directly under MapSources top folder, the other as subfolder of another folders.
    To be more specific,

    • directly under the top level MapSources folder, I have a "Divers" folder, including 5 .bsh files
    • and if a subfolder of Mapsources, named LocalMBTilesGen, there were also a sub-sub-folder named "Divers", including 3 .xml files

    And in the MapSource tree window on GUI, the Divers folder at top level is not shown, while the Divers folder under LocalMBTilesGen is shown, and includes all the 8 (5 + 3) mapsources from BOTH "Divers" folders, altogether mixed !

    The most surprising being that I have several other pairs of folders, present both at top level and as subfolder of another folder, that do NOT have the same "mixture" behaviour.

    In order to understand, I tried
    1) to reproduce the bug
    2) but also (mainly, in a first time) to FIX the issue

    This fix is very difficult to obtain, And I had to struggle a lot before being succesful.
    Of course, I begun with removing the settings.xml file, and the mobac-profile.xml file, thinking that something "wrong" was recorded inside, but this didn't fix. Entering in Mobac after removing them asked me the Atlas format I wanted to create, loaded all the custom source files.... with exactly the same issue. Of course, all parameters were reset to their default value, and I had to restore them (for those I want a specific value)

    (BTW, this led me to a first question : Is there any place other than the settings.xml and the mbac-profile.xml files where Mobac (or maybe directly java ?) records something about what is in the MapSources folder tree ?)

    Then I tried to rename one of the "Divers" folders as "DiversBis". Of course, DiversBis and LocalMBTilesGen/Divers appeared then separately, but when I renamed back DiversBis to Divers, the issue was still there ! And if renamed both of them as DiversBis, they are mixed and the bug is still there.

    I tried also to create a new folder, with a different name than LocalMBTilesGen, beside LocalMBTilesGen, and move all content of LocalMBTilesGen to this new folder.
    No change : the two "Divers" folders are still mixed.

    After a lot and a lot of unsuccesful tests, I eventually found a way to fix the issue.
    1) I completely removed the folder LocalMBTilesGen and its subfolders (I moved it elsewhere, not in MapSources folder)
    2) I launched Mobac
    3) Tools / Settings menu, MapSources tab, select all, deactivate all, select all, activate all, OK button (this force rewriting of settings.xml, especially mapSourcesDisabled and mapSourcesEnabled tags)
    4) Exit Mobac
    4) Restore under MapSources the folder LocalMBTilesGen and its subfolders
    5) Launch again Mobac... and bingo ! this time, it's OK, the two "Divers" folders are at their place, not mixed altogether in one place.

    My second will was to try to REPRODUCE the bug (among other reason to be able to reproduce the fix....)
    And I succeeded.... more or less.

    What I discovered is that if, after closing Mobac, you

    • add in MapSources a new folder (whatever its name)
    • add in Mapsources another new folder, including a sub-folder with the same name than the previous one
    • populate both folders with different source files (either .bsh or .xml)
      when you restart Mobac, in some cases, quite often, but not always, the two new folders are mixed in only one !
      But I've until now definitely not understood what could make the bug appear in some cases, and not in some other cases !

    The only thing I can say being that every time they are mixed (ie. the bug happens), the "fix" described above works fine.

    What I can say also is that, every time I create a completely new and separate Mobac environment, and I put inside my full MapSources arborescence, I have the issue.

    I tried to set the log level to TRACE... but I've not seen anything (at least anything I can understand) in the log.

    But hopefully, I've been able to reduce my collection to a strict minimum, that nevertheless produces the bug.
    Whenever I create a completely new Mobac environment, with this minimum set of map sources, the bug is here. It's 100% (until now...) reproducible.
    So I attach this set of source files, and I hope you'll reproduce the bug.... and then you'll be able to understand, then fix it.

     
    • r_x

      r_x - 2026-09-25

      Thanks for the detailed bug report and the sample mapsources to trigger it. The only question that remains to me is this is a foum post and not a bug ticket.

      Because this is definetly a bug: the map sources tree building algorithm was defect.

      Will be finxed in beta 9 in a few minutes.

       
  • Laurent Grenet

    Laurent Grenet - 2026-09-25

    Thank you for your quick intervention, and sorry to do not have posted that in the right place !
    Your fix is OK

     

Log in to post a comment.