[PATCH] config-parser: Honor the XDG_CONFIG_DIRS environment variable
Othman, Ossama
ossama.othman at intel.com
Tue May 14 14:15:46 PDT 2013
Hi Kristian,
On Tue, May 14, 2013 at 1:57 PM, Kristian Høgsberg <hoegsberg at gmail.com>wrote:
> On Tue, May 14, 2013 at 09:55:19AM -0700, Othman, Ossama wrote:
> > I've attached the patch since the patch I sent through git send-mail was
> > sent through an e-mail account that isn't subscribed to this list
> (waiting
> > for moderator approval), and to make sure the spacing isn't munged again.
> > This patch was generated against weston master as of this morning.
>
> Cool, looks good now, committed. I did catch a corner case in the
> spec that we could handle better. As far as I can see,
> XDG_CONFIG_HOME, if set, overrides ~/.config. That means if it's set
> and we don't find a config file there, we shouldn't fall back and try
> ~/.config/weston.ini.
Good catch!
> Similarly, only if XDG_CONFIG_DIRS is not set
> do we fall back to /etc/xdg, but we do handle correctly with your
> patch. Also the spec says "not set or empty", so we should be
> checking !config_dirs || *config_dirs == '\0'.
>
> Finally, I didn't see a reason for adding weston/ to the path when
> iterating the XDG_CONFIG_DIRS? I guess many applications put their
> config file in a subdirectory of the config dir, but at least for
> ~/.config/weston.ini we don't do that.
>
The part of the XDG base spec that discusses XDG_CONFIG_DIRS wasn't very
clear to me. I was thrown by the mention of "subdirs" on the web page at
http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html#referencing.
Unfortunately "subdirs" doesn't appear to be defined. It states:
Specifications may reference this specification by specifying the
location of a configuration file as $XDG_CONFIG_DIRS/subdir/filename. This
implies that:
-
Default configuration files should be installed to
$sysconfdir/xdg/subdir/filename
with $sysconfdir defaulting to /etc.
-
A user specific version of the configuration file may be created in
$XDG_CONFIG_HOME/subdir/filename, taking into account the default value
for $XDG_CONFIG_HOME if $XDG_CONFIG_HOME is not set.
-
Lookups of the configuration file should search for ./subdir/filename
relative to all base directories indicated by $XDG_CONFIG_HOME and
$XDG_CONFIG_DIRS . If an environment variable is either not set or
empty, its default value as defined by this specification should be used
instead.
I interpreted "subdir" as "weston" in our case. My Linux box (Ubuntu
12.10) also puts config files under various subdirectories in /etc/xdg;
although there are some config file placed directly in /etc/xdg as well. I
don't know which is right so I'm happy with whatever you decide. :)
> I committed a small patch to fix up these issues - let me know if you
> see a problem.
>
Will do!
Thanks Kristian!
-Ossama
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20130514/dee79c7e/attachment.html>
More information about the wayland-devel
mailing list