Re: g_get_home_dir (), ${HOME}, and getpwuid ()->pw_dir

On Fri, Sep 28, 2012 at 1:38 AM, Stef Walter <stefw gnome org> wrote:
> 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]
> 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]
> 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().
> 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.

Ok... I've been enjoying this read and, just thought I might point out that...

For example in my system which I installed 2 days ago, there is no
$XDG_CONFIG_HOME defined by default in my shell.

The spec seems to clearly state that if $XDG_CONFIG_HOME
is not defined, $HOME/.config/ should be chosen.

g_get_user_config_dir() ... probably getting popular in newer apps...
docs say:
   "On UNIX platforms this is determined using the mechanisms
    described in the XDG Base Directory Specification."

However... upon reading the source... it actually falls back to
the value of g_get_home_dir() and not the $HOME which
was prescribed by the spec.

So, whether glib apps today try to comply with the XDG spec or
whether they store things directly in g_get_home_dir()... for the
grand majority of systems, they are instead... still getting the
password dir instead of the correct directory.


So... maybe we dont want to change the behavior of an api
that dates 10 years back, but we might want to at least correct
g_get_user_config/data_dir() at this point ?

Or, is it a bug in the documentation for g_get_user_*_dir() ?


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