Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixes minor strange errors with X launching and SIGINT #11

Merged
merged 2 commits into from

2 participants

@fennekki

Using nohup in cdm-xlaunch for some reason kills the X process after the timeout when launched from tty1, replaced with setsid. No side effects observed, apart from X launching now working.

cdm traps SIGINT for rather obvious reasons. This trap, however, propagates to child processes and cannot be removed by them. Unsetting any traps before calling child processes is a good idea.

I've used these fixes for a while on my own system and figured I might just as well push them here as well.

I mean, I can't be the only one with these issues, can I?

fennekki added some commits
@fennekki fennekki Update src/cdm-xlaunch
Replaced nohup with setsid: If using nohup, launching X from the first terminal will succeed but cdm will then shortly proceed to kill the process afterward. This problem is completely fixed by using setsid.
0404623
@fennekki fennekki Untrap before calling console programs
At least bash refuses to let you untrap signals that have been trapped by a parent process. Not untrapping it here means effectively and unrevokably disabling ^C in any child process of any child bash shell. It's irritating and confusing and probably not intended to happen.
06a8406
@ghost1227
Owner

Probably not!

@ghost1227 ghost1227 merged commit ced5b02 into ghost1227:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 18, 2012
  1. @fennekki

    Update src/cdm-xlaunch

    fennekki authored
    Replaced nohup with setsid: If using nohup, launching X from the first terminal will succeed but cdm will then shortly proceed to kill the process afterward. This problem is completely fixed by using setsid.
  2. @fennekki

    Untrap before calling console programs

    fennekki authored
    At least bash refuses to let you untrap signals that have been trapped by a parent process. Not untrapping it here means effectively and unrevokably disabling ^C in any child process of any child bash shell. It's irritating and confusing and probably not intended to happen.
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 1 deletion.
  1. +6 −0 src/cdm
  2. +1 −1  src/cdm-xlaunch
View
6 src/cdm
@@ -125,6 +125,12 @@ case ${flaglist[$binindex]} in
# loop. To solve this problem, export $CDM_SPAWN when `exec'ing $bin and
# only let the shell automatically `exec' cdm when $CDM_SPAWN is not set.
# See also the example shell profile file shipped with the cdm package.
+
+ # Also untrap SIGINT and SIGTSTP before spawning process: If this is not
+ # done, *ANY* child process of *ANY* child (bash) shell will completely
+ # ignore SIGINT, which is rather confusing, and cannot be undone.
+
+ trap - SIGINT SIGTSTP
CDM_SPAWN=$$ exec $bin
;;
View
2  src/cdm-xlaunch
@@ -77,7 +77,7 @@ if $consolekit; then
fi
# Conform to POSIX and do not use `>&' here.
-nohup startx $* > /dev/null 2>&1 &
+setsid startx $* > /dev/null 2>&1 &
# If wait(1) returns with a value >128, it was interrupted by kill(1),
# so registration was sucessful.
Something went wrong with that request. Please try again.