containers / bubblewrap

Low-level unprivileged sandboxing tool used by Flatpak and similar projects
Other
3.88k stars 236 forks source link

Feature request: --json-status-fd could provide pid of command? #553

Open teleclimber opened 1 year ago

teleclimber commented 1 year ago

--json-status-fd gives a child-pid value, which is handy. In a lot of situations that is the pid of the COMMAND you're running in the sandbox.

But when run with --unshare-pid (and maybe others) bwrap forks itself and child-pid references the fork. I would like a way of getting the pid of the COMMAND. Could this be added to the JSON output?

Thanks.

smcv commented 1 year ago

If this is achievable, I'd be happy to review a pull request. The easiest way to work out whether this is achievable or not would be to try to implement it and see what happens.

WGH- commented 1 year ago

A use case example: you might want to send SIGTERM to give your program a chance to terminate gracefully. However, child-pid is wrong pid to send signals to when bwrap runs pid 1.

mcatanzaro commented 3 months ago

I think we'll need this to fix this WebKit bug.

If this is achievable, I'd be happy to review a pull request. The easiest way to work out whether this is achievable or not would be to try to implement it and see what happens.

See #576 (and thank you!).