I know this has been discussed previously, and both Debian and Gentoo (heh, me), have had issues with GNUstep.sh, it's use of make_services, and assumptions about the user environment.

Problems became apparent to me, using Gentoo's portage sandox, that the installation of the GNUstep libraries, which except for gnustep-make, is dependant on GNUstep.sh, assumes that the use of a user's "proper" $HOME is available, and ignore's the environment's "configured" $HOME.

Being able to configure the $HOME environment variable has made the package management nightmares I was having go away. I've put together a patch that effects NSUser.m in -base and user_home.c in -make.

I've thought a lot about possible consequences, and the only one I can come up with is "Is the getenv() function secure enough on all platforms we support?" For this reason, I ask that anyone please go over this patch for GNUstep-ness, go over for coding correctness and security, and don't flame me too bad 'cause I know this was discussed and supposedly solved already.

Thanks,
__Armando Di Cianno

<base-nsuser-home-fix.patch>

Only in base/Source: .NSUserDefaults.m.swp
diff -ur base-orig/Source/NSUser.m base/Source/NSUser.m
--- base-orig/Source/NSUser.m	2004-06-25 15:30:43.000000000 -0400
+++ base/Source/NSUser.m	2004-07-23 21:47:19.147599472 -0400
@@ -230,13 +230,26 @@
 {
   NSString	*s = nil;
 #if !defined(__MINGW__)
-  struct passwd *pw;
+  const char    *env_list;
 
   [gnustep_global_lock lock];
-  pw = getpwnam ([loginName cString]);
-  if (pw != 0)
+  env_list = getenv("HOME");
+  if (env_list != 0)
+    { 
+      s = [NSString stringWithCString: env_list];
+    }
+  else
     {
-      s = [NSString stringWithCString: pw->pw_dir];
+      struct passwd *pw;
+
+      pw = getpwnam ([loginName cString]);
+      if (pw != 0)
+       {
+         s = [NSString stringWithCString: pw->pw_dir];
+       }
     }
   [gnustep_global_lock unlock];
 #else

Reply via email to