XDG_CONFIG_DIRS an /usr/local/etc/xdg

Peter White peter.white at posteo.net
Thu Sep 16 16:48:41 UTC 2021


On Thu, Sep 16, 2021 at 04:15:07PM +0000, Bollinger, John C wrote:
> The value of XDG_CONFIG_DIRS, if set, is expected to be a string
> designating one or more directories to search for config files, in
> priority order. If multiple directories are specified then they are
> separated by colon characters (:).  This represents a search path,
> similar to the executable search path conveyed via $PATH.
> 
> HOWEVER, Base Directory does not specify a first match wins rule.  It
> attributes more importance (the spec's terminology) to files located
> in earlier directories in the list, but that does not imply that only
> one can be used.

Fair point, I was talking about "information" as opposed to files. Then
the first match wins is exactly the same as your description. ;)

But, /etc should be off limits for software in /usr/local, right? So
XDG_CONFIG_DIRS has a hole in the spec, because one cannot set it up so
that distro software _and_ software in /usr/local do the right thing,
because whatever is set as "more important" wins for both. Or, as I
said, maybe it should not be used like this to begin with? But then,
what is its *intended* use?

> At least a limited ability to merge multiple configs is suggested by
> the provision for XDG_CONFIG_HOME, which designates a user-specific
> search directory of even higher importance that, alone among all
> these, is assumed to be writable by the user.  This latter is where a
> user would record their personal config customizations, and a
> user-friendly application with many configuration options will not
> insist that users provide a complete configuration just to customize a
> few items.

That is a very good point. The software in question currently does the
latter, but I think this is out of scope for my initial question. I can
live with a first match wins rule on file basis, for the time being.


Best,
PW


More information about the xdg mailing list