]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Add --die-with-parent when invoking bubblewrap
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 11 Apr 2023 12:49:19 +0000 (14:49 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 11 Apr 2023 18:58:45 +0000 (20:58 +0200)
rpm blocks most signals when doing a transaction. dnf doesn't block
anything. The end result is that when we do ctrl+c when dnf is running
the rpm transaction, dnf gets interrupted and exits, which means mkosi
exits and tries to remove the workspace directory on which rpm is still
operating, causing all kinds of nastiness.

Because we don't care about transaction safety since we're operating on
a chroot, let's add --die-with-parent when running bubblewrap. This makes
bubblewrap ensure cleanup of all child processes underneath it, and
because rpm can't ignore SIGKILL, it also cleans up rpm properly, fixing
the issue.

mkosi/run.py

index 248e3e3273553ddf7e7be15eb57d983e52c3303e..ade636ffeadabd3e7e9dca7c161decb40d5a417b 100644 (file)
@@ -265,6 +265,7 @@ def run_with_apivfs(
         "--dev", state.root / "dev",
         "--ro-bind", "/sys", state.root / "sys",
         "--bind", state.var_tmp, state.root / "var/tmp",
+        "--die-with-parent",
         *bwrap_params,
         "sh", "-c",
     ]
@@ -302,6 +303,7 @@ def run_workspace_command(
         "--proc", "/proc",
         "--ro-bind", "/sys", "/sys",
         "--bind", state.var_tmp, "/var/tmp",
+        "--die-with-parent",
         *bwrap_params,
     ]