$HOME
This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.
This is a read-only list on gimpusers.com so this discussion thread is read-only, too.
$HOME | Klaus Ethgen | 16 Feb 14:05 |
$HOME | Klaus Ethgen | 16 Feb 14:08 |
$HOME | Sven Neumann | 16 Feb 16:55 |
$HOME | Klaus Ethgen | 16 Feb 17:25 |
$HOME | Daniel Hornung | 16 Feb 17:42 |
$HOME | Sven Neumann | 16 Feb 17:48 |
$HOME | Bill Skaggs | 16 Feb 18:19 |
$HOME | Klaus Ethgen | 16 Feb 19:17 |
$HOME | Sven Neumann | 16 Feb 20:13 |
$HOME | Klaus Ethgen | 16 Feb 20:37 |
$HOME | Sven Neumann | 16 Feb 21:10 |
$HOME | Klaus Ethgen | 03 Mar 21:05 |
XDG Base Directory Specification | Sven Neumann | 16 Feb 18:09 |
$HOME
Hello,
the first think I always do when a new version of gimp is out I have to fix the $HOME problem. So as this is a little problem in source with a big impact to the usability of gimp (in special environments) I think that should be fixed upstream.
To go in the detail. Gimp is one of nearly the only one application using g_get_home_dir to get the home directory of the user. This directory is not necessary existing. But (on unix, I have no idea about windows or other ill think) the home directory is specified always in the environment variable $HOME and this variable is used in all other applications except gimp. Also the X-windows system ist using this variable. So the description that g_get_home_dir would be more often defined as $HOME is absolutely wrong as without $HOME pointing to a user home directory X would not work and so gimp too.
The special case. If you use pam to tune the $HOME setting to determinate the home directory in runtime it will work in every application except gimp. Also if you are a user logged in (with ssh) without home directory, which can be in seldom circumstances, you can set your $HOME to a temporary path and are able to work locally (except with gimp).
So please use the patch I apply to this mail to fix this issue in gimp. Note that also the description of g_get_home_dir advises this solution.
Regards Klaus Ethgen
$HOME
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Ah, please note that also the man page of gimp is always referring to $HOME and gimp is not working as documented.
Regards
Klaus Ethgen
-
$HOME
Hi,
I am not convinced that your patch is doing the right thing. But it definitely adds too much complexity to the code. It would be better to define gimp_get_home_dir() in libgimpbase/gimpenv.c und use that all over the place.
Sven
$HOME
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi Sven,
Am Sa den 16. Feb 2008 um 16:55 schrieb Sven Neumann:
I am not convinced that your patch is doing the right thing.
What is the thing that is not clear? It is exactly what in the documentation to g_get_home_dir is described. (http://library.gnome.org/devel/glib/unstable/glib-Miscellaneous-Utility-Functions.html#g-get-home-dir)
But it definitely adds too much complexity to the code.
I see no point how to make it more simple. 3 lines vs. one line is not that more complexity.
It would be better to define gimp_get_home_dir() in libgimpbase/gimpenv.c und use that all over the place.
Sure, can be done. And might be more abstract. But in that case please define the stuff inline else the overhead for the function call would be to high.
Regards
Klaus
-
$HOME
On Saturday 16 February 2008, Klaus Ethgen wrote:
I see no point how to make it more simple. 3 lines vs. one line is not that more complexity.
Every dev would have to remember 3 lines instead of only one.
Sure, can be done. And might be more abstract. But in that case please define the stuff inline else the overhead for the function call would be to high.
I doubt that there'd be any measurable difference, considering
a) nowadays' compilers,
b) the amount that function would be called (not within loops, constant times,
at startup or at maybe by a user action) and
c) the time the access to some environment variable (or even /etc/passwd)
needs.
If it works, the patch is accepted and anyone notices that it is speed critical, _then_ is the time for optimizing.
BTW, have you proposed this to the GLIB team/list already?
Greetings, Daniel
$HOME
Hi,
On Sat, 2008-02-16 at 17:25 +0100, Klaus Ethgen wrote:
I see no point how to make it more simple. 3 lines vs. one line is not that more complexity.
It is three times as complex. And we will most likely want to make it even more complex and add a check that the directory pointed to by the HOME environment variable does actually exist.
It would be better to define gimp_get_home_dir() in libgimpbase/gimpenv.c und use that all over the place.
Sure, can be done. And might be more abstract. But in that case please define the stuff inline else the overhead for the function call would be to high.
It is absolutely pointless to worry about function call overhead here. This is not something that is being called from inner loops. Whatever we do here, even if we would make the function run a hundred times slower, it would not have any noticeable impact.
Sven
XDG Base Directory Specification
Hi,
before we accept Klaus patch or anything like that, we should discuss how we can implement the XDG Base Directory Specification in GIMP without breaking backward compatibility:
http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
Sven
$HOME
Let me just add a pointer to bug #394687 (g_get_home_dir documentation confusing) --
http://bugzilla.gnome.org/show_bug.cgi?id=394687
The gist is that apparently g_get_home_dir works as it does in order to get the right behavior when a program is run as a different user. Since this will very rarely happen with Gimp, it may be okay to use a different logic.
$HOME
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Am Sa den 16. Feb 2008 um 17:48 schrieb Sven Neumann:
I see no point how to make it more simple. 3 lines vs. one line is not that more complexity.
It is three times as complex.
True.
And we will most likely want to make it even more complex and add a check that the directory pointed to by the HOME environment variable does actually exist.
Ehem, why didn't you do that before? I agree, that should be checked anyway. But this is independent of the $HOME way. And, if the $HOME doesn't exist the user might have other problems which is prevents gimp running anyway. (.Xauthority for example)
It would be better to define gimp_get_home_dir() in libgimpbase/gimpenv.c und use that all over the place.
Sure, can be done. And might be more abstract. But in that case please define the stuff inline else the overhead for the function call would be to high.
It is absolutely pointless to worry about function call overhead here. This is not something that is being called from inner loops. Whatever we do here, even if we would make the function run a hundred times slower, it would not have any noticeable impact.
Ok. But why wasting resources if there is a easy place to hold it down?
Regards
Klaus
-
$HOME
Hi,
On Sat, 2008-02-16 at 19:17 +0100, Klaus Ethgen wrote:
And we will most likely want to make it even more complex and add a check that the directory pointed to by the HOME environment variable does actually exist.
Ehem, why didn't you do that before?
Because it is very unlikely that the user directory as specified in the passwd is not present. This is different for the value of the HOME environment variable. The user might easily mess this up.
Why are you arguing at all? The problem you pointed out hasn't bothered anyone but you in the last twelve years. The natural response to your request would have been to turn it down. In particular because it is based on the wrong assumption that every other application would behave differently. That is wrong as can be easily seen by doing a code search for g_get_home_dir(). Instead of turning your request down we expressed interest to consider your patch if you can rework it a little. It would help a lot if you could simply do that.
Sven
$HOME
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Am Sa den 16. Feb 2008 um 20:13 schrieb Sven Neumann:
Ehem, why didn't you do that before?
Because it is very unlikely that the user directory as specified in the passwd is not present.
Oh, that is very common. It could be intentional or not but it is very common.
It is intentional if you generate the users $HOME in pam session state where the home directory in passwd is just a dummy.
It might unintentional if the file serve is gone but you want to work either using /tmp/username as $HOME.
This is different for the value of the HOME environment variable. The user might easily mess this up.
The variable can be set by pam or similar thinks or can be fixed by the user to keep working if the normal home is not available. More over it can be set to a other directory if you have need to. Eg. you have no space left in your home or you want to test a new version without poisoning your current gimp settings.
And, by the way, not respecting $HOME was always a bug as it is documented other:
- From "man gimp":
...
Most GIMP configuration is read in from the user's init file, $HOME/.gimp-2.4/gimprc. The system wide
equivalent is in /etc/gimprc. The system wide file is parsed first and the user gimprc can override the
system settings. /etc/gimprc_user is the default gimprc placed in users' home directories the first time
GIMP is run.
$HOME/.gimp-2.4/devicerc - holds settings for input devices together with the tool, colors, brush, pattern and gradient associated to that device.
$HOME/.gimp-2.4/documents - lists all images that have been opened or saved using GIMP. ...
Why are you arguing at all? The problem you pointed out hasn't bothered anyone but you in the last twelve years.
Oh, it has. I know many people who told me that this is completely shit. I just get so bothered that I try to fix the bug.
The natural response to your > request would have been to turn it down.
Ah yes. Sorry, but aren't you able to be open for constructive critic? Maybe you note that I not only told that this is shit. I provide you with a working and tested patch and I gave some reasons why this is a bug. Can you give me just one reason why to use the passwd entry and not accepting user choice? (Except of that it is implemented this way in glib)
In particular because it is based on the wrong assumption that every other application would behave differently. That is wrong as can be easily seen by doing a code search for g_get_home_dir().
Oh, sorry, I just checked the applications I know about. And not all but several. And there are graphical applications and non graphical applications both.
Instead of turning your request down we expressed interest to consider your patch if you can rework it a little.
Oh, I'm open for it. This patch is just how I get around this bug for ages now.
It would help a lot if you could simply do that.
Ok, I will. Since now I just understand that YOU have to chance some to put that patch in. Sorry for the misunderstanding.
Regards Klaus
Ps. I hope not to get away to much from a objective explaining in this
mail.
-
$HOME
Hi,
On Sat, 2008-02-16 at 20:37 +0100, Klaus Ethgen wrote:
And, by the way, not respecting $HOME was always a bug as it is documented other:
Well, it can be handled as a bug in behavior or a bug in documentation. Since the current behavior has worked well for more than a decade and since it works well on a wide range of platforms, we should be very careful about changing the behavior. It would be a lot simpler to change the documentation.
But I am willing to accept that the behavior is wrong and that it should be adjusted. Having the implementation in a single place in libgimpbase will make it easy for us to adjust the behavior if it turns out to cause problems on one platform or another.
Sven
$HOME
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi,
Am Sa den 16. Feb 2008 um 16:55 schrieb Sven Neumann:
It would be better to define gimp_get_home_dir() in libgimpbase/gimpenv.c und use that all over the place.
I redo my patch this way. But there is one small part I stumble. What to do with sources which do not use gimpenv (gimpbase.h) like libgimpthumb/gimp-thumbnail-list.c. It introduce many changes to add there gimpbase.h includings. Many more than just duplicate this function.
Regards
Klaus Ethgen
-