Reverse order for parsing files in `XDG_CONFIG_DIRS`
https://specifications.freedesktop.org/basedir-spec/latest/ says precedence should be
XDG_CONFIG_HOME > 1st entry of XDG_CONFIG_DIRS > 2nd entry ...
EasyBuild had this reversed for XDG_CONFIG_DIRS
Fixes #4582
There's a bit of an order of priority issue here with wildcards:
Presently we have this output for example, with XDG_CONFIG_DIRS=$HOME/hi:$HOME/lo
* user-level: ${XDG_CONFIG_HOME:-$HOME/.config}/easybuild/config.cfg
-> /home/oldeman/.config/easybuild/config.cfg => found
* system-level: ${XDG_CONFIG_DIRS:-/etc}/easybuild.d/*.cfg
-> {/cvmfs/soft.computecanada.ca/gentoo/2023/x86-64-v3/etc/xdg, /home/oldeman/hi, /home/oldeman/lo}/easybuild.d/*.cfg => /home/oldeman/hi/easybuild.d/bla.cfg, /home/oldeman/hi/easybuild.d/foo.cfg, /home/oldeman/lo/easybuild.d/bla.cfg, /home/oldeman/lo/easybuild.d/foo.cfg
Default list of existing configuration files (5): /home/oldeman/hi/easybuild.d/bla.cfg, /home/oldeman/hi/easybuild.d/foo.cfg, /home/oldeman/lo/easybuild.d/bla.cfg, /home/oldeman/lo/easybuild.d/foo.cfg, /home/oldeman/.config/easybuild/config.cfg
In the present PR I've only reversed the XDG_CONFIG_DIRS-derived list but did not reverse the alphabetical order for wildcards; I also did not change the output after ->
so we now have:
Default list of existing configuration files (5): /home/oldeman/lo/easybuild.d/bla.cfg, /home/oldeman/lo/easybuild.d/foo.cfg, /home/oldeman/hi/easybuild.d/bla.cfg, /home/oldeman/hi/easybuild.d/foo.cfg, /home/oldeman/.config/easybuild/config.cfg
This list is fed to configparser, last one has priority.
If I also change the order in the list displayed after -> then that looks confusing since XDG_CONFIG_DIRS would have lo and hi reversed, which is then weird looking syntax, e.g.
* system-level: ${XDG_CONFIG_DIRS:-/etc}/easybuild.d/*.cfg
-> {/cvmfs/soft.computecanada.ca/gentoo/2023/x86-64-v3/etc/xdg, /home/oldeman/hi, /home/oldeman/lo}/easybuild.d/*.cfg => /home/oldeman/lo/easybuild.d/bla.cfg, /home/oldeman/lo/easybuild.d/foo.cfg, /home/oldeman/hi/easybuild.d/bla.cfg, /home/oldeman/hi/easybuild.d/foo.cfg
where the visual expansion flips order, so I decided not to change the output there. If anyone has a better idea how to display, let me know!
@bartoldeman Can we tweak the language used in --show-default-configfiles so it's crystal-clear what the priority is between the configuration files that are present?
I change the language as follows, also moving the list on a separate line:
Default list of existing configuration files (5, most important last):
/home/oldeman/lo/easybuild.d/bla.cfg, /home/oldeman/lo/easybuild.d/foo.cfg, /home/oldeman/hi/easybuild.d/bla.cfg, /home/oldeman/hi/easybuild.d/foo.cfg, /home/oldeman/.config/easybuild/config.cfg
This should be good to go @boegel