Package: ldm
Version: 0.58debian4
Tags: patch

When using LTSP in Debian/Sarge, we discovered that the login take a
very long time.  It would get stuck for 20 secunds doing nothing.  We
traced this down to the lack of X authority information and problem
with NFS locking.

I also changed the code to only set DISPLAY once.

--- client/ldm
+++ client/ldm
@@ -25,6 +25,7 @@
         if self.use_xfs:
             xfs_server = get_config('XFS_SERVER') or self.server
             self.fontpath = "tcp/%s:7100" % xfs_server
+        self.authfile = '/tmp/Xauthority'

     def run(self):
         null = open('/dev/null', 'w')
@@ -40,15 +41,21 @@
             if self.use_xfs:
                 server_opts += ['-fp', self.fontpath]

-            server_command = ['X'] + server_opts + [self.vt, self.display]
+            server_command = ['X', '-auth', self.authfile] + server_opts + 
[self.vt, self.display]
             server = subprocess.Popen(server_command, stdout=sys.stdout, 
stderr=sys.stderr)

-            env = os.environ.copy()
-            env['DISPLAY'] = self.display
+            os.environ['DISPLAY'] = self.display
+           os.environ['XAUTHORITY'] = self.authfile

             time.sleep(5)
+
+            # Generate an X authority key in ~/.Xauthority
+            xauth_command = ['xauth', '-f', self.authfile, 'generate', 
self.display]
+            xauth = subprocess.Popen(xauth_command, stdout=sys.stdout, 
stderr=sys.stderr)
+            os.waitpid(xauth.pid, 0)
+
             greeter = subprocess.Popen(['/usr/lib/ltsp/greeters/gtk'],
-                                       stdout=subprocess.PIPE, 
stderr=sys.stderr, env=env)
+                                       stdout=subprocess.PIPE, 
stderr=sys.stderr)
             greeter_output = greeter.stdout.readlines()
             if len(greeter_output) == 2:
                 username = greeter_output[0][:-1]
@@ -69,7 +76,6 @@
             os.close(pipe_write)
             sys.stdin.close()
             os.setsid()
-            os.environ['DISPLAY'] = self.display
             os.environ['LDM_ASKPASS_FD'] = str(pipe_read)
             os.environ['SSH_ASKPASS'] = '/usr/lib/ltsp/ldm-askpass'




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to