Random sort order of bus_alias entries when loading (and later saving) leads to pseudo VCS changes
Description
When loading a schematic file with bus_alias definitions, the order of bus alias definitions is random. This can be verified with "Tools -> Bus Definitions..." (order changes after each file load operation). This behavior leads to pseudo-changes when committing saved .kicad_sch files to a VCS (e.g. Git) repo. N.b.: The save order is the same as the listing order under "Tools -> Bus Definitions...".
Steps to reproduce
- Open a .kicad_sch that includes bus_aliases (nine entries in my case) and some hierarchical sub-sheets (don't know if the latter matters)
- Check the sort order of bus alias definitions under "Tools -> Bus Definitions..."
- Save the unchanged schematic file
- Close the schematic editor
- See changed sort order of bus_alias entries in the .kicad_sch file (leads to VCS changes)
- Repeat the above steps as often as you want - the sort order after loading will change randomly
Suggestion
I would suggest to alphabetically sort bus_alias definitions upon file loading and after each modification (e.g. after editing via the Bus Definitions dialog).
This would lead to no regression, as the bus_alias order does not seem to matter anyway.
KiCad Version
Application: KiCad
Version: 6.0.6-3a73a75311~116~ubuntu20.04.1, release build
Libraries:
wxWidgets 3.0.4
Platform: Linux 5.4.0-120-generic x86_64, 64 bit, Little endian, wxGTK, xfce, x11
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
Boost: 1.71.0
OCC: 7.5.2
Curl: 7.83.1
ngspice: 36
Compiler: GCC 9.4.0 with C++ ABI 1013
Build settings:
KICAD_USE_OCC=ON
KICAD_SPICE=ON