Bugzilla – Attachment 739 Details for
Bug 5696
Terminating a unity session on ubuntu 15.10 times out.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to replace HUP with TERM
5696_term_instead_of_hup.patch (text/plain), 5.08 KB, created by
Henrik Andersson
on 2016-09-08 13:30:26 CEST
(
hide
)
Description:
Patch to replace HUP with TERM
Filename:
MIME Type:
Creator:
Henrik Andersson
Created:
2016-09-08 13:30:26 CEST
Size:
5.08 KB
patch
obsolete
>Index: tlmisc/xstartup/xstartup.default >=================================================================== >--- tlmisc/xstartup/xstartup.default (revision 31648) >+++ tlmisc/xstartup/xstartup.default (working copy) >@@ -4,14 +4,24 @@ > # Copyright 2002-2016 Cendio AB. > # For more information, see http://www.cendio.com > >-# Ignore SIGHUP, in case Xserver/xinit terminates >-trap "" SIGHUP >+# Propagate TERM signal to tl-run-profile if available >+function on_term { >+ if [ -n "$pid" ]; then >+ kill -TERM $pid >+ else >+ exit >+ fi >+} > >+trap on_term SIGTERM >+ > # Run all scripts in xstartup.d > source "${TLPREFIX}/libexec/tl-run-xstartup.d" > > # Start the profile >-"${TLPREFIX}/libexec/tl-run-profile" >+"${TLPREFIX}/libexec/tl-run-profile" & >+pid=$! >+wait $pid > echo "Profile command exited with exit code $?" >&2 > > # Run all scripts in xlogout.d >Index: vsm/tl-xinit.c >=================================================================== >--- vsm/tl-xinit.c (revision 31673) >+++ vsm/tl-xinit.c (working copy) >@@ -59,6 +59,7 @@ > #define PROGNAME "tl-xinit" > #define XAUTH_TIMEOUT 15 > #define XSERVER_KILL_TIMEOUT 10 >+#define XCLIENT_KILL_TIMEOUT XSERVER_KILL_TIMEOUT > #define SSO_HELPER_TIMEOUT 10 > #define TLCONFIG_TIMEOUT 10 > >@@ -67,7 +68,7 @@ > static volatile short got_signal = 0; > > >-/* Wait for process to exit. Returns 0 if process exited, -1 if still >+/* Wait for process to exit. Returns 0 if process exited or if pid does not exists, -1 if still > around */ > static int > wait_for_exit(pid_t pid, int timeout) >@@ -78,6 +79,9 @@ > for (int i = 0; i <= timeout; i++) { > gotpid = waitpid(pid, &status, WNOHANG); > if (gotpid < 0) { >+ if (errno == ECHILD) { >+ return 0; >+ } > perror(PROGNAME ": waitpid"); > return -1; > } >@@ -726,31 +730,41 @@ > /* xinit calls XCloseDisplay, but this call will hang, say, if > Xvnc is STOPped. Avoid that. */ > >- if (client > 0) { >- /* Send HUP to process group */ >- if (killpg(client, SIGHUP) < 0 && errno != ESRCH) { >- perror(PROGNAME ": Cannot send HUP to client process group"); >- } >+ /* Send TERM to client and server processes */ >+ if (kill(client, SIGTERM) < 0) { >+ if (errno != ESRCH) >+ perror(PROGNAME ": Cannot terminate X client"); > } > >- if (xserver > 0) { >- if (killpg(xserver, SIGTERM) < 0) { >- if (errno == ESRCH) { >- return; >- } >- perror(PROGNAME ": Cannot terminate X server"); >+ if (killpg(server, SIGTERM) < 0) { >+ if (errno != ESRCH) >+ perror(PROGNAME ": Cannot terminate X server"); >+ } >+ >+ /* Wait for server termination */ >+ if (wait_for_exit(xserver, XSERVER_KILL_TIMEOUT) < 0) { >+ fprintf(stderr, >+ PROGNAME ": Xserver is slow to shutdown, forcing\n"); >+ >+ if (killpg(xserver, SIGKILL) < 0) { >+ if (errno != ESRCH) { >+ perror(PROGNAME ": X server refuses to terminate"); >+ } > } >- if (wait_for_exit(xserver, XSERVER_KILL_TIMEOUT) < 0) { >- fprintf(stderr, >- PROGNAME ": Xserver is slow to shutdown, forcing\n"); >- } >- if (killpg(xserver, SIGKILL) < 0) { >- if (errno == ESRCH) { >- return; >- } >- perror(PROGNAME ": X server refuses to terminate"); >- } > } >+ >+ /* Wait for client termination */ >+ if (wait_for_exit(client, XCLIENT_KILL_TIMEOUT) < 0) { >+ fprintf(stderr, >+ PROGNAME ": X client is slow to shutdown, forcing\n"); >+ >+ /* best effort to cleanup session processes */ >+ if (killpg(client, SIGKILL) < 0) { >+ if (errno != ESRCH) { >+ perror(PROGNAME ": X client refuses to terminate"); >+ } >+ } >+ } > } > > >Index: vsm/xsession >=================================================================== >--- vsm/xsession (revision 31673) >+++ vsm/xsession (working copy) >@@ -4,9 +4,6 @@ > # Copyright 2002-2014 Cendio AB. > # For more information, see http://www.cendio.com > >-# Ignore SIGHUP, in case Xserver/xinit terminates >-trap "" SIGHUP >- > # Set language on Debian based systems > if [ -r /etc/default/locale ]; then > source /etc/default/locale >Index: tlmisc/profiles/profiles.hconf.in >=================================================================== >--- tlmisc/profiles/profiles.hconf.in (revision 31648) >+++ tlmisc/profiles/profiles.hconf.in (working copy) >@@ -97,7 +97,7 @@ > description=A complete Microsoft® Windows® desktop provided by a separate server with Remote Desktop Services. Extra features such as load balancing and added security is provided by accessing it through this ThinLinc system. > icon=windows.png > screenshot=windows-ss.png >-cmdline=${TLPREFIX}/bin/tl-run-windesk >+cmdline=exec ${TLPREFIX}/bin/tl-run-windesk > testcmd=${TLPREFIX}/bin/tl-config /appservergroups/rdp/default/servers | grep -v wts1.example.com > description_from_testcmd=false > >@@ -107,7 +107,7 @@ > description=A bare bone environment with just a single graphical terminal started. Only meant to be used for debugging and testing. > icon=terminal.png > screenshot=terminal-ss.png >-cmdline=xterm || rxvt >+cmdline=exec xterm || exec rxvt > testcmd=type xterm || type rxvt > description_from_testcmd=false >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 5696
:
656
|
739
|
740