bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash support for XDG Base Directory spec (~/.config/bash/)


From: Siteshwar Vashisht
Subject: Re: bash support for XDG Base Directory spec (~/.config/bash/)
Date: Tue, 2 Nov 2021 14:53:17 +0100

On Fri, May 7, 2021 at 11:48 AM Allison Karlitskaya <
allison.karlitskaya@redhat.com> wrote:

> hello,
>
> Please consider these two patches for inclusion in bash to support
> storing shell initialisation files (profile, bashrc) in a subdirectory
> of ~/.config/ as most programs do these days.
>
> I'm happy to make changes to address any feedback.
>
> Even if you'd prefer not to apply the second patch, applying the first
> patch is a nice cleanup and would make it easier for distributions
> such as Fedora to apply the second patch for themselves.
>
> Thank you very much for your consideration,
>

This issue is also discussed in Red Hat bug[1]. I will leave few notes
about it here.

>From the XDG specification[2]:

- $XDG_CONFIG_HOME defines the base directory relative to which
user-specific configuration files should be stored. If $XDG_CONFIG_HOME is
either not set or empty, a default equal to $HOME/.config should be used.

- $XDG_CONFIG_DIRS defines the preference-ordered set of base directories
to search for configuration files in addition to the $XDG_CONFIG_HOME base
directory. The directories in $XDG_CONFIG_DIRS should be seperated with a
colon ':'. If $XDG_CONFIG_DIRS is either not set or empty, a value equal to
/etc/xdg should be used.

- The order of base directories denotes their importance; the first
directory listed is the most important. When the same information is
defined in multiple places the information defined relative to the more
important base directory takes precedent. The base directory defined by
$XDG_DATA_HOME is considered more important than any of the base
directories defined by $XDG_DATA_DIRS. The base directory defined by
$XDG_CONFIG_HOME is considered more important than any of the base
directories defined by $XDG_CONFIG_DIRS.

- Default configuration files should be installed to
$sysconfdir/xdg/subdir/filename with $sysconfdir defaulting to /etc.

Proposed patch doesn't fully implement this specification:

- It doesn't cover the case when `$XDG_CONFIG_HOME` is defined.
`$HOME/.config` should be only used if `$XDG_CONFIG_HOME` is not defined.
(It's actually mentioned in the patch commit).

- It doesn't cover the case when `$XDG_CONFIG_DIRS` environment variable is
not defined.

- It doesn't cover the case when `$XDG_CONFIG_DIRS` environment variable is
defined.

So even if we want to follow XDG specification, proposed patch has only
partial implementation of it. Also, if it gets merged, it may require a
change from package maintainers side to provide default configuration files
under `$sysconfdir/xdg/subdir/filename`.

On a side note, I believe bash startup configurations are already confusing
for an average user and following XDG specification will just make it more
complicated.


> Allison
>

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1959284
[2]
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html


reply via email to

[Prev in Thread] Current Thread [Next in Thread]