diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-10-07 16:08:00 -0400 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-10-07 16:08:00 -0400 |
commit | 8cce4095d3465863fcb26b7264371d97db31990a (patch) | |
tree | 2a98580947ff400dc70161f00b9f77497af92d15 /src/chroot-tools/hooks-distcc.sh | |
parent | c366cd83bb86440dcc15a2203df57be75ff3f11f (diff) |
revert last commit, it makes systemd-nspawn not handle signals correctly.
I'm a fan of systemd-nspawn. I really am. It handles a lot of things the
"right" way, so you don't have to.
However, it handles PTYs and signals in an incredibly stupid way. Working
around one is f---ed up by the other being wrong.
Before I implemented the change that this reverts, this is what happens:
systemd-nspawn> I need to create a PTY and proxy between it and stdio.
I can specify a terminal size when doing this--I should
set it to reflect the terminal I am connected to.
systemd-nspawn> /dev/stdout: Are you a TTY?
/dev/stdout> systemd-nspawn: No.
---- The correct thing to do here would be to either not set the size,
---- or set it to 80×24
systemd-nspawn> /dev/stdin: Are you a TTY?
/dev/stdin> systemd-nspawn: Yes.
systemd-nspawn> /dev/stdin: Great, what size are you?
/dev/stdin> systemd-nspawn: I am X×Y.
systemd-nspawn: libc: Please give me a PTY that is X×Y.
---- Why the f--- would you do this? The size only effects *output*.
---- If you don't know the characteristics of the output, set
---- reasonable defaults! Don't base it on the characteristics of the
---- input!
My solution was to make /dev/stdin not be a TTY by closing it. This had
the desired effect, but tripped up the signal handling.
Here is how signals were handled before:
systemd-nspawn> /dev/stdin: Are you a TTY?
/dev/stdin> systemd-nspawn: Yes.
systemd-nspawn> /dev/stdin: Great, please don't send SIGINT on C-c.
I will handle it myself.
*user presses C-c, systemd reads it*
systemd-nspawn> child processes: here's a SIGINT.
Here's what happens when I close, or do other things to make stdin not be a
TTY:
systemd-nspawn> /dev/stdin: Are you a TTY?
/dev/stdin> systemd-nspawn: No.
systemd-nspawn> /dev/stdin: Oh, OK.
*user presses C-c, /dev/stdin interprets it*
/dev/stdin> systemd-nspawn: Here's a SIGINT.
systemd-nspawn> *dies, abandoning child processes*
The clear correct thing to do would have been to *handle* SIGINT, and pass
it along to the children.
Diffstat (limited to 'src/chroot-tools/hooks-distcc.sh')
0 files changed, 0 insertions, 0 deletions