On Thu, Sep 16, 2021 at 01:10:30AM -0400, Elsie Hupp wrote: > I’m by no means an expert on this, but it may be possible that by not > implementing XDG_CONFIG_DIRS the distros’ intention may be for > applications to use, for example, XDG_CONFIG_HOME instead. It may be > worth asking your distro’s maintainers why the variable is unset.
The reason might very well be the possibly unexpected behaviour I mentioned. XDG_CONFIG_DIRS acts like PATH does: first match wins, which I would not expect to happen with conffiles. As I said I expect local software to pick its conf from the local prefix and distro provided software to use an empty prefix for /etc, exclusively. > By comparison, looking at the Flatpak documentation, for example, they > don’t even mention XDG_CONFIG_DIRS: > > https://docs.flatpak.org/en/latest/conventions.html?#xdg-base-directories > > …though Flatpak is specifically intended to be sandboxed, so their > environmental variables are set internally, and system-level writable > directories are generally discouraged. I think that's why: you cannot write inside such a container, so system- wide configs cannot be changed. XDG_CONFIG_HOME has the problem, that one cannot provide a default for everyone, which is the purpose of a system-wide config and it cannot be installed by make install, unless each user installs the software to $HOME/.local. Now, that can't be right. ;) > If you need to use /usr/local/etc/xdg instead of /etc/xdg specifically > in order to work with a different, pre-existing application, it may be > worth looking at that application’s code and asking its developers > about it, as well. Which is precisely why I am asking. I am in the process of proposing changes to that project, because it has/had rather peculiar install and runtime routines, i.e. installing outside PREFIX, overwriting distro managed files and using /etc (not even /etc/xdg, let alone /usr/local/etc/xdg), despite them facilitating g_get_system_config_dirs() to find configs, which suggests, they want to comply to the spec, but they won't apply my changes yet, since there is disagreement over where in /usr/local (etc or etc/xdg) the config should go and how to actually find it at runtime. So I am asking here for guidance by the folks who should know best, so I can go back there with authoritative information, hopefully. Something needs to change, might as well do it right. ;) I found XDG_CONFIG_DIRS to be unset on Ubuntu and expect that to be the case for all distributions because of the above mentioned PATH-like behaviour of this facility. So, either we find a way to make it work flexibly with XDG_CONFIG_DIRS or it needs to be set an compile time. I would very much prefer the first option and want to know, if that is possible or even intended. > > On Sep 16, 2021, at 12:44 AM, Peter White <[email protected]> wrote: > > > > Dear list, > > > > I am having a hard time finding documentation about the best way to make > > locally installed software recognize its config dir in > > /usr/local/etc/xdg. Of course, the quick and easy answer could be: > > > > $ env XDG_CONFIG_DIRS=/usr/local/etc/xdg foobar > > > > But that is not something one can ask their users if they install > > software from an upstream repository. I believe XDG_CONFIG_DIRS is unset > > on most systems and thus defaults to /etc/xdg, i.e. returned by > > g_get_system_config_dirs(), so most people would have to set it manually > > to make software in /usr/local pick up its config from there, which it > > should IMO. > > > > One might also think: > > > > # echo XDG_CONFIG_DIR=/usr/local/etc/xdg:/etc/xdg >> /etc/environment > > > > could be the solution, but I believe that can lead to some unexpected > > behaviour, when the user also has the distro counterpart of said > > software installed, i.e. when they installed the local version to test > > it against the distro version. If they then only change PATH to either > > prefer the local or the distro version, the latter would also pick the > > config which is only meant for the local one. The distro version might > > be outdated an contain obsolete settings. > > From what other software (i.e. a shell) does, I believe the correct way > > would be to use the /usr/local/etc/xdg when running a local version and > > /etc/xdg when running the distro version, if I am not mistaken. > > > > So I guess, my first question is, if XDG_CONFIG_DIRS is even meant to be > > used by locally installed software, its default seems to suggest > > otherwise? Or is this maybe just an oversight in the spec? I'd find that > > hard to believe, given that it's been around for quite a while now, so > > my thought process may very well be flawed here. > > > > I have pondered this for a while now and could also not find anything > > via search engine or on this list, so I figured I actually ask the ones > > who wrote the spec. ;) > > > > > > Best, > > PW >
