Bug 146426

Summary: kdeinit_shutdown should wait for kdeinit to actually exit
Product: [Frameworks and Libraries] kdelibs Reporter: Sune Vuorela <debian>
Component: generalAssignee: Stephan Kulow <coolo>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:

Description Sune Vuorela 2007-06-05 22:00:34 UTC
Version:            (using KDE KDE 3.5.7)
Installed from:    Debian testing/unstable Packages

All details can be found in a debian bug report:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=425314 - but I try to draw out the important issues here.

kdeinit keeps .xsession-errors open until kdeinit exits. The startkde script does return before kdeinit is exited completely. Then .xsession-errors is still open.
This is a problem for users using pam and encrypted home - because pam tries to unmount home before kdeinit is completely finished - so .xsession-errors is still open - and umount of course fails.

adding a sleep 2; or a sleep 5; after kdeinit_shutdown works around the issue, but is kind of hackish. But it shows that it is a timing issue between startkde ending and kdeinit ending.

/Sune
Comment 1 Thiago Macieira 2007-06-05 23:40:39 UTC
SVN commit 671951 by thiago:

Make kdeinit4_shutdown wait for kdeinit4's exit.

Since kdeinit4 doesn't explicitly close the socket, it gets closed
when the program exits. So, this read_socket call returns when
kdeinit4 has finished.

BUG:146426


 M  +1 -0      wrapper.c  


--- trunk/KDE/kdelibs/kinit/wrapper.c #671950:671951
@@ -359,6 +359,7 @@
       header.cmd = LAUNCHER_TERMINATE_KDE;
       header.arg_length = 0;
       write_socket(sock, (char *) &header, sizeof(header));
+      read_socket(sock, (char *) &header, 1); /* wait for the socket to close */
       return 0;
    }