-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bubblewrap] Propagate SIGTERM and SIGINT to child #402
Conversation
Can one of the admins verify this patch?
|
The proposed patch works and it's necessary to be able to use ^C in |
I can confirm that this patch works well! In my case I'm using bubblewrap with |
I think it should certainly be possible to make bubblewrap catch and forward signals, but I'm less sure that it should be catching and forwarding them by default - there's a risk that someone is relying on its current behaviour. On #402, @wansing also wanted to catch and forward Also on #402, @valentindavid thought the CLI use-case would be better handled by putting bubblewrap's child in a new process group, and making that process group the foreground process group for the terminal, so that Ctrl+C and Ctrl+\ deliver SIGINT and SIGQUIT to the child instead of to bwrap. |
I do not think this is the proper way to solve #369. We need to properly set the foreground process group. |
A couple questions.
|
I'm using this to run a valheim server using NixOS' |
How is this not fixed after 2 years? Using this as part of my compile sandbox, but now Ctrl-C is leaving corrupt object files -.- |
Looks like without this patch bwrap is useless for interactive cli tools, which handle SIGINT |
@smcv if somebody made config options for selectively forwarding any signals, would you be willing to help push that forward? |
I'd review a pull request, if that's what you mean. |
@smcv wrote:
That's a fair call given the established user base. Ideas to accommodate this might include:
An implementation could support just one, or both, these strategies. Thinking more broadly, most generally the lifecycle of a process can be controlled by Ideally, I think it is least surprising if the following hold even when there is no controlling terminal:
The consequence of the above is:
If both the parent and child reside in the same process group, then signals sent to the shared process group (whether sent by If the parent and child reside in different process groups, then signals sent to the process group of the parent will not be delivered to the child. This means that job control signals sent via the controlling terminal must be directed to the child otherwise a SIGSTOP will prevent the parent from suspending the child. The requirement for shared fate means the parent must mimic suspension of the child (suspended also perhaps due to SIGTTOU), and later propagate continuation to the child. This means that the parent must use Even when the parent and child reside in different process groups, the parent must block termination signals, propagate delivery to the child because these signals might be sent by other processes independently of the controlling terminal, and mimic the behaviour of the child to meet the expectations of the launching process. Given the above, the only reasons I could think of for placing the child in a new process group are:
|
Signed-off-by: Aaruni Kaushik <[email protected]>
[bubblewrap] Propagate SIGTERM and SIGINT to child Co-authored-by: Earl Chew <[email protected]> Signed-off-by: Aaruni Kaushik <[email protected]>
Superseded by #586, which seems more likely to reach a mergeable state. |
[bubblewrap] Propagate SIGTERM and SIGINT to child Co-authored-by: Earl Chew <[email protected]> Signed-off-by: Aaruni Kaushik <[email protected]>
[bubblewrap] Propagate SIGTERM and SIGINT to child Co-authored-by: Earl Chew <[email protected]> Signed-off-by: Aaruni Kaushik <[email protected]>
[bubblewrap] Propagate SIGTERM and SIGINT to child Co-authored-by: Earl Chew <[email protected]> Signed-off-by: Aaruni Kaushik <[email protected]>
[bubblewrap] Propagate SIGTERM and SIGINT to child Co-authored-by: Earl Chew <[email protected]> Signed-off-by: Aaruni Kaushik <[email protected]>
This fixes, for example, pressing CTRL+C to send a SIGINT during interactive use and also allows for things like passing SIGWINCH to neovim running inside the bubblewrap to resize the window. Extends [bubblewrap] Propagate SIGTERM and SIGINT to child containers#402 Borrows test from q3cpma Co-authored-by: Earl Chew <[email protected]> Co-authored-by: q3cpma <[email protected]> Signed-off-by: Aaruni Kaushik <[email protected]>
I'm proposing this commit to address #369.
Instead of the default termination when receiving SIGINT or SIGTERM, this change propagates SIGINT and SIGTERM from the parent to the child.