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
-- 
Klaus Ethgen                            http://www.ethgen.de/
pub  2048R/D1A4EDE5 2000-02-26 Klaus Ethgen <[EMAIL PROTECTED]>
Fingerprint: D7 67 71 C4 99 A6 D4 FE  EA 40 30 57 3C 88 26 2B
diff -Nur gimp-2.4.2.orig/gimptool-win32.c.in gimp-2.4.2/gimptool-win32.c.in
--- gimp-2.4.2.orig/gimptool-win32.c.in	2007-11-20 10:33:50.000000000 +0100
+++ gimp-2.4.2/gimptool-win32.c.in	2007-12-01 18:17:44.000000000 +0100
@@ -529,7 +529,11 @@
   const gchar slash = '/';
 #endif
 
-  return g_strdup_printf ("[EMAIL PROTECTED]@%cplug-ins",
+  if (g_getenv("HOME"))
+     return g_strdup_printf ("[EMAIL PROTECTED]@%cplug-ins",
+			  g_getenv ("HOME"), slash, slash);
+  else
+     return g_strdup_printf ("[EMAIL PROTECTED]@%cplug-ins",
 			  g_get_home_dir (), slash, slash);
 }
 
@@ -643,7 +647,11 @@
   const gchar slash = '/';
 #endif
 
-  return g_strdup_printf ("[EMAIL PROTECTED]@%cscripts",
+  if (g_getenv("HOME"))
+     return g_strdup_printf ("[EMAIL PROTECTED]@%cscripts",
+			  g_getenv ("HOME"), slash, slash);
+  else
+     return g_strdup_printf ("[EMAIL PROTECTED]@%cscripts",
 			  g_get_home_dir (), slash, slash);
 }
 
diff -Nur gimp-2.4.2.orig/libgimpbase/gimpenv.c gimp-2.4.2/libgimpbase/gimpenv.c
--- gimp-2.4.2.orig/libgimpbase/gimpenv.c	2007-11-20 10:33:50.000000000 +0100
+++ gimp-2.4.2/libgimpbase/gimpenv.c	2007-12-01 18:15:59.000000000 +0100
@@ -170,7 +170,9 @@
     return gimp_dir;
 
   env_gimp_dir = g_getenv ("GIMP2_DIRECTORY");
-  home_dir     = g_get_home_dir ();
+  home_dir = g_getenv ("HOME");
+  if (!home_dir)
+     home_dir = g_get_home_dir ();
 
   if (env_gimp_dir)
     {
@@ -571,8 +573,12 @@
       /* Special-case desktop for historical compatibility */
       if (gimp_user_directories[GIMP_USER_DIRECTORY_DESKTOP] == NULL)
         {
-          gimp_user_directories[GIMP_USER_DIRECTORY_DESKTOP] =
-            g_build_filename (g_get_home_dir (), "Desktop", NULL);
+	   if (g_getenv("HOME"))
+	      gimp_user_directories[GIMP_USER_DIRECTORY_DESKTOP] =
+		 g_build_filename (g_getenv ("HOME"), "Desktop", NULL);
+	   else
+	      gimp_user_directories[GIMP_USER_DIRECTORY_DESKTOP] =
+		 g_build_filename (g_get_home_dir (), "Desktop", NULL);
         }
     }
 
@@ -751,7 +757,9 @@
   if (!path || !*path || max_paths < 1 || max_paths > 256)
     return NULL;
 
-  home = g_get_home_dir ();
+  home = g_getenv ("HOME");
+  if (!home)
+     home = g_get_home_dir ();
 
   patharray = g_strsplit (path, G_SEARCHPATH_SEPARATOR_S, max_paths);
 
diff -Nur gimp-2.4.2.orig/libgimpbase/xdg-user-dir.c gimp-2.4.2/libgimpbase/xdg-user-dir.c
--- gimp-2.4.2.orig/libgimpbase/xdg-user-dir.c	2007-11-20 10:33:49.000000000 +0100
+++ gimp-2.4.2/libgimpbase/xdg-user-dir.c	2007-12-01 18:12:00.000000000 +0100
@@ -66,7 +66,9 @@
   gint         len;
   gint         relative;
 
-  home_dir = g_get_home_dir ();
+  home_dir = g_getenv ("HOME");
+  if (!home_dir)
+     home_dir = g_get_home_dir ();
 
   if (! home_dir)
     return NULL;
diff -Nur gimp-2.4.2.orig/libgimpconfig/gimpconfig-path.c gimp-2.4.2/libgimpconfig/gimpconfig-path.c
--- gimp-2.4.2.orig/libgimpconfig/gimpconfig-path.c	2007-11-20 10:33:43.000000000 +0100
+++ gimp-2.4.2/libgimpconfig/gimpconfig-path.c	2007-12-01 18:09:59.000000000 +0100
@@ -321,7 +321,10 @@
   gint         length   = 0;
   gint         i;
 
-  home = g_get_home_dir ();
+  home = g_getenv ("HOME");
+  if (!home)
+     home = g_get_home_dir ();
+
   if (home)
     home = gimp_filename_to_utf8 (home);
 
diff -Nur gimp-2.4.2.orig/libgimpthumb/gimp-thumbnail-list.c gimp-2.4.2/libgimpthumb/gimp-thumbnail-list.c
--- gimp-2.4.2.orig/libgimpthumb/gimp-thumbnail-list.c	2007-11-20 10:31:20.000000000 +0100
+++ gimp-2.4.2/libgimpthumb/gimp-thumbnail-list.c	2007-12-01 18:11:32.000000000 +0100
@@ -74,7 +74,9 @@
       return -1;
     }
 
-  home = g_get_home_dir ();
+  home = g_getenv ("HOME");
+  if (!home)
+     home = g_get_home_dir ();
 
   thumb_folder = g_build_filename (home, ".thumbnails", NULL);
   dir = g_dir_open (thumb_folder, 0, &error);
diff -Nur gimp-2.4.2.orig/libgimpthumb/gimpthumb-utils.c gimp-2.4.2/libgimpthumb/gimpthumb-utils.c
--- gimp-2.4.2.orig/libgimpthumb/gimpthumb-utils.c	2007-11-20 10:31:20.000000000 +0100
+++ gimp-2.4.2/libgimpthumb/gimpthumb-utils.c	2007-12-01 18:11:07.000000000 +0100
@@ -112,7 +112,9 @@
     }
   else
     {
-      const gchar *home_dir = g_get_home_dir ();
+      const gchar *home_dir = g_getenv ("HOME");
+      if (!home_dir)
+	 home_dir = g_get_home_dir ();
 
       if (home_dir && g_file_test (home_dir, G_FILE_TEST_IS_DIR))
         {

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Reply via email to