Skip to content

ctrl+c sends SIGINT to bubblwrap instead of child process #369

@valentindavid

Description

@valentindavid

Here is a dumb python program where the issue happens:

import signal
import asyncio

loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)

def interrupt():
    s = input("test")
    print(s)
    loop.stop()

loop.add_signal_handler(signal.SIGINT, interrupt)

loop.run_forever()

loop.remove_signal_handler(signal.SIGINT)

loop.close()

On host, running this program, then pressing ctrl+c, a prompt shows up, then I can type some text and enter. The text is printed again and the program exits.

Now, if I run through bwrap --ro-bind / / -- /usr/bin/python3 test.py, I get the error:

handle: <Handle interrupt() at test-interrupt.py:7>
Traceback (most recent call last):
  File "/usr/lib/python3.8/asyncio/events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "test-interrupt.py", line 8, in interrupt
    s = input("test")
EOFError

This is because is bwrap is part of foreground process group. Instead it should be the child process as to be the foreground process group.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions