]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake-worker: Use setsid() rather than setpgid()
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 8 Dec 2014 21:31:56 +0000 (21:31 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 8 Jan 2015 09:46:06 +0000 (09:46 +0000)
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]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bin/bitbake-worker

index 371c99a6770d3fa887cc48f747bab65e1a7d72f7..8a241612504dc2d703512ee4f3294aa3be4d66c5 100755 (executable)
@@ -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())