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

Re: ${HOME} vs. g_get_home_dir ()



* Simon McVittie <smcv@debian.org> [120926 18:50]:
> ... but I don't think this is the right way to make it happen. Please
> research previous discussion to check that you're not missing arguments
> that have happened in the past, then if you still think your proposal is
> the best option, take it upstream.

This was already taken upstream and upstream's opinion was
"if we do this as the unix guys expect then users complain that
changing $HOME changes the home directory.".

> I can see the value in having everything follow the same precedence,
> $HOME > getpwent - predictability is good. However, having Debian's GLib
> contradict behaviour that is specifically documented upstream doesn't
> sound as though it promotes predictability.

It's nice to see this finally documented upstream. (Back in time
it claimed to get the home directory which it obviously almost
but not quite does not at all.)

The documentation for g_get_home_dir[1] also documents what a
proper program can do, it's a simple:

 const char *homedir = g_getenv ("HOME");
   if (!homedir)
      homedir = g_get_home_dir ();

instead of using get_get_home_dir directly.

        Bernhard R. Link

(And tip of the day: If you are working with multiple home directories
regulariy and get tired of badly written programs confusing the initial
home directory with the current one, setting the initial home directory to
the empty string can help in many cases (though you lose having a
default one for programs not getting one set)).

[1] For example
http://developer.gnome.org/glib/2.33/glib-Miscellaneous-Utility-Functions.html#g-get-home-dir


Reply to: