[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-solaris
Subject:    Re: [kde-solaris] quickie path question
From:       Torsten Kasch <tk () Genetik ! Uni-Bielefeld ! DE>
Date:       2001-10-10 7:15:11
[Download RAW message or body]

Hi Dan,

On Tue, Oct 09, 2001 at 09:14:22AM -0700, Dan Gorman wrote:
> Torsten,
>   Hi - I am very intersted as KDE can't correctly find my $KDEDIR/libs 
> directory. To me this is a big problem. Why can't X|Kdm use the shell 
> profile? This still seems like a big bug to me.
> 
> Let me know when I can grab those diffs ;)
[...]

Ok, since the diffs are very small, i've attached them to this mail. I've
tested the modified kdm only on my Solaris laptop, but our production
environment here at the university currently relies on an old "xdm"
modified with essentially the same patch.

Use "patch -p0 -s < /path/to/diff" from the toplevel kdebase-2.2.1 src
dir to apply the diff.

In our site-wide Xsession we use the following lines:

--- snip, snip ---
[...]

startup=$HOME/.xsession
resources=$HOME/.Xdefaults
kdestartup=$KDEDIR/bin/startkde

[...]

if [ -x $startup ]; then
    exec $startup
elif [ -x $kdestartup ]; then
    exec $kdestartup
else
    twm &
    exec xterm -geometry 80x24-0-0
fi
--- snip, snip ---

Hope this is useful.

cheers,
	Torsten

-- 
   Torsten Kasch                               tk@Genetik.Uni-Bielefeld.DE
        Biologie VI/Zentrum f. Genomforschung
        Universität Bielefeld                  Phone: +49 521 106-4828
        D-33594 Bielefeld                      Fax:   +49 521 106-5626

["kdebase-2.2.1-kdm.diff" (text/plain)]

--- kdm/backend/client.c.orig	Tue Jul 31 00:12:39 2001
+++ kdm/backend/client.c	Wed Oct 10 08:30:10 2001
@@ -1,5 +1,5 @@
 /* $TOG: verify.c /main/37 1998/02/11 10:00:45 kaleb $ */
-/* $Id: client.c,v 2.15 2001/07/30 02:13:23 ossi Exp $ */
+/* $Id: client.c,v 1.1 2001/07/30 22:12:39 torsten Exp torsten $ */
 /*
 
 Copyright 1988, 1998  The Open Group
@@ -1214,9 +1214,78 @@
 	if (!argv || !argv[0])
 	    argv = addStrArr (argv, "xsession", 8);
 	if (argv) {
+#ifdef OLD
 		Debug ("executing session %s\n", argv[0]);
 		execute (argv, verify->userEnviron);
 		LogError ("Session \"%s\" execution failed (err %d)\n", argv[0], errno);
+#else
+		/*
+		 *  We want to execute the user's login shell. Since the
+		 *  only not-shell-specific way to get a login shell is
+		 *  to execute it with first char of *argv[0] == '-' (cmdline
+		 *  arg wouldn't  work: bash needs -login, other shells -l),
+		 *  we write a temp file containing just
+		 *  "exec /path/to/startup" and execute the user's shell
+		 *  with this file as stdin. In combination with an appropriate
+		 *  site-wide startup file (usually "Xsession"), the user is
+		 *  able to control via mechanisms in his/her shell-specific
+		 *  initialization file what kind of windowing environment will
+		 *  be chosen.
+		 *
+		 *  Thus, the user will get the correct environment form
+		 *  his/her shell's dotfile even if logging in from a
+		 *  text-only console with no windowing environment at all.
+		 *  In a windowing environment it is no longer necessary
+		 *  to start a login shell in a terminal window (e.g. xterm)
+		 *  to get the correct environment there.
+		 */
+		char *shell, *arg[2];
+		char tmp[L_tmpnam];
+		int i, fd;
+
+		shell = getEnv(verify->userEnviron, "SHELL");
+		if( ! shell )
+			shell = "/bin/sh";
+
+		/*
+		 *  setup argv[0] for executing the login shell
+		 */
+		arg[0] = "-xdmlogin";
+		arg[1] = NULL;
+		tmpnam( tmp );
+
+		/*
+		 *  write "exec /path/to/Xsession" to temp file
+		 */
+		if( (fd = open( tmp, O_EXCL | O_CREAT | O_RDWR )) < 0 ) {
+			LogError( "couldn't create temporary launch file\n" );
+			exit( 1 );
+		}
+		unlink( tmp );
+		write( fd, "exec", 4 );
+		for( i = 0; argv[i] != NULL; i++ ) {
+			write( fd, " ", 1 );
+			write( fd, argv[i], strlen( argv[i] ));
+			Debug( "%s: wrote \"%s\"\n", tmp, argv[i] );
+		}
+		write( fd, "\n", 1 );
+		lseek( fd, 0, SEEK_SET );
+
+		/*
+		 *  connect the temp file to stdin
+		 */
+		close( 0 );
+		if( dup2( fd, 0 ) < 0 ) {
+			LogError( "dup2() failed: %s\n", strerror( errno ));
+			exit( 1 );
+		}
+
+		/*
+		 *  finally, execute the user's login shell
+		 */
+		execve( shell, arg, verify->userEnviron );
+
+#endif /* OLD */
 	} else {
 		LogError ("Session has no command/arguments\n");
 	}

___________________________________________________
This message is from the kde-solaris mailing list.
Account management:  http://mail.kde.org/mailman/listinfo/kde-solaris.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic