[OE-core] [PATCH 09/61] bitbake: bitbake-worker: Use setsid() rather than setpgid()
Armin Kuster
akuster808 at gmail.com
Thu Feb 5 16:03:17 UTC 2015
From: Richard Purdie <richard.purdie at linuxfoundation.org>
The bug has a long discussion of this. Basically, in some environments,
the exact details of which aren't understood, a Ctrl+C signal to the
UI is being transmitted to all the process children. Looking at the output
of "ps ax -O tpgid", its clear the main process is still the terminal
owner of these processes.
stty -a on a problematic system shows: "-ignbrk brkint"
and on a working system shows: "-ignbrk -brkint"
The description of brkint would suggest this is the problem, setting up
that terminal environment wasn't able to reproduce the problem though.
It was confirmed that using setsid() caused the problem to be resolved
and is probably the right thing to be doing anyway, so lets do it.
[YOCTO #6949]
(Bitbake rev: 461aa73fff0ab616032d28c4fd0322eb88838be6)
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808 at gmail.com>
---
bitbake/bin/bitbake-worker | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker
index 371c99a..8a24161 100755
--- a/bitbake/bin/bitbake-worker
+++ b/bitbake/bin/bitbake-worker
@@ -156,8 +156,11 @@ def fork_off_task(cfg, data, workerdata, fn, task, taskname, appends, taskdepdat
bb.event.worker_fire = worker_child_fire
worker_pipe = pipeout
- # Make the child the process group leader
- os.setpgid(0, 0)
+ # Make the child the process group leader and ensure no
+ # child process will be controlled by the current terminal
+ # This ensures signals sent to the controlling terminal like Ctrl+C
+ # don't stop the child processes.
+ os.setsid()
# No stdin
newsi = os.open(os.devnull, os.O_RDWR)
os.dup2(newsi, sys.stdin.fileno())
--
1.9.1
More information about the Openembedded-core
mailing list