Re: g_get_home_dir (), ${HOME}, and getpwuid ()->pw_dir
- From: Ivan Shmakov <oneingray gmail com>
- To: gtk-devel-list gnome org
- Subject: Re: g_get_home_dir (), ${HOME}, and getpwuid ()->pw_dir
- Date: Fri, 28 Sep 2012 15:02:49 +0700
>>>>> Stef Walter <stefw gnome org> writes:
>>>>> On 09/27/2012 04:48 PM, Ivan Shmakov wrote:
>> $ HOME=/net/home/jrh emacs
>> Moreover, GNU Bash started under such a Emacs instance will also use
>> /net/home/jrh/.bashrc (instead of /home/jrh/.bashrc), and so will
>> GNU Wget, or Lynx, and a sheer variety of other tools.
>> … But not the bulk of GNOME, which will insist on using
>> /home/jrh/.whatever, perhaps leaving the user no way to choose
>> otherwise (sans of persuading the local passwd(5) — or the site's
>> LDAP — administrator to change his or her account.)
> Nah, you can use XDG Base directories to get the bulk of GNOME to use
> another directory for files, config, settings and so on. [1]
ACK, thanks for the pointer!
> Set $XDG_CONFIG_HOME, $XDG_DATA_HOME and $XDG_CACHE_HOME.
> These are exposed to GLib based software as g_get_user_data_dir(),
> g_get_user_cache_dir() and g_get_user_config_dir(). GNOME is
> actively moving towards using those. [2]
(Actually, [3] mentions also the XDG_RUNTIME_DIR variable,
though it doesn't specify a particular default value, or state
that such a default should be below user's HOME.)
Unfortunately, given the current state of affairs, these
variables have to be set /in addition/ to HOME, since there
seems to be a number of applications developed prior to the
introduction of the XDG conventions, which are still in use.
And setting four environment variables isn't as convenient as
setting just one.
> FWIW, the default values for those are supposed to be derived from
> $HOME according to the XDG Basedir spec. So if the spec is to be
> taken literally it seems like we should be using $HOME instead of
> g_get_home_dir().
Indeed. Consider, e. g. [3]:
--cut--
$XDG_DATA_HOME defines the base directory relative to which user
specific data files should be stored. If $XDG_DATA_HOME is either
not set or empty, a default equal to $HOME/.local/share should be
used.
$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.
--cut--
And that is the behavior I hope the future versions of GLib will
implement. (Aside from the HOME directory ownership check I've
suggested before.)
TIA.
> But anyway, there is a way to use environment variables to change
> where the 'bulk of GNOME' looks for its stuff. And where not, there
> is active progress in fixing this issue.
Also to note is that non-GNOME (and even “non-desktop”)
GLib-based applications were seen in the wild. Consider, e. g.,
the OpenBSD version of the Netcat command-line networking
diagnostic tool (as of the version currently in Debian stable
[4].) And I'm not yet sure that the developers of these
packages will be eager to implement the support for the
aforementioned variables.
> [1] http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
> [2] https://live.gnome.org/GnomeGoals/XDGConfigFolders
[3] http://standards.freedesktop.org/basedir-spec/basedir-spec-0.8.html
[4] http://packages.debian.org/squeeze/netcat-openbsd
--
FSF associate member #7257
- References:
- g_get_home_dir (), ${HOME}, and getpwuid ()->pw_dir
- Re: g_get_home_dir (), ${HOME}, and getpwuid ()->pw_dir
- Re: g_get_home_dir (), ${HOME}, and getpwuid ()->pw_dir
- Re: g_get_home_dir (), ${HOME}, and getpwuid ()->pw_dir
- Re: g_get_home_dir (), ${HOME}, and getpwuid ()->pw_dir
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]