| zsh and pid namespaces don't play very well together. Specifically, when zsh is |
| launched inside a new pid namespace, it doesn't take ownership of the process |
| group, causing things like SIGINT to be sent to the parent process. Upstream |
| bug report here: http://www.zsh.org/mla/workers/2014/msg01769.html. |
| |
| The first chunk of this diff fixes this problem and has already been applied |
| upstream: |
| http://sourceforge.net/p/zsh/code/ci/0c4cb0cc1b527f4341f1a39a10f4120aa7c7d594/. |
| |
| The second chunk is a suggested fix for the warning that zsh prints when |
| exiting: http://www.zsh.org/mla/workers/2014/msg01779.html. |
| |
| diff --git a/Src/jobs.c b/Src/jobs.c |
| index a668b07..c6e1bce 100644 |
| --- a/Src/jobs.c |
| +++ b/Src/jobs.c |
| @@ -2734,7 +2734,7 @@ acquire_pgrp(void) |
| long ttpgrp; |
| sigset_t blockset, oldset; |
| |
| - if ((mypgrp = GETPGRP()) > 0) { |
| + if ((mypgrp = GETPGRP()) >= 0) { |
| long lastpgrp = mypgrp; |
| sigemptyset(&blockset); |
| sigaddset(&blockset, SIGTTIN); |
| @@ -2779,8 +2779,11 @@ void |
| release_pgrp(void) |
| { |
| if (origpgrp != mypgrp) { |
| - attachtty(origpgrp); |
| - setpgrp(0, origpgrp); |
| + /* in linux pid namespaces, origpgrp may never have been set */ |
| + if (origpgrp) { |
| + attachtty(origpgrp); |
| + setpgrp(0, origpgrp); |
| + } |
| mypgrp = origpgrp; |
| } |
| } |