]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Reuse host /tmp in bwrap()
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 18 Sep 2023 11:50:47 +0000 (13:50 +0200)
committerJörg Behrmann <behrmann@physik.fu-berlin.de>
Mon, 18 Sep 2023 12:42:42 +0000 (14:42 +0200)
If we replace /tmp, we'll also make any directories located in /tmp
inaccessible, e.g. the workspace directory. Work around the problem
by reusing the host's /tmp.

Fixes #1894

mkosi/run.py

index a94c944d8af7c8240e56534fd08a5f58926c4137..8f77a25980452d912c03297835678e42fcc890cc 100644 (file)
@@ -294,11 +294,11 @@ def bwrap(
             "--ro-bind", "/var", "/var",
             "--ro-bind", "/run", "/run",
             "--bind", "/var/tmp", "/var/tmp",
+            "--bind", "/tmp", "/tmp",
+            "--bind", Path.cwd(), Path.cwd(),
         ]
 
     cmdline += [
-        "--tmpfs", "/tmp",
-        "--bind", Path.cwd(), Path.cwd(),
         "--chdir", Path.cwd(),
         "--unshare-pid",
         "--unshare-ipc",
@@ -332,7 +332,7 @@ def bwrap(
         cmdline += [
             "--setenv", "PATH", f"{d}:{os.environ['PATH']}",
             *options,
-            "sh", "-c", "chmod 1777 /tmp /dev/shm && exec $0 \"$@\"",
+            "sh", "-c", "chmod 1777 /dev/shm && exec $0 \"$@\"",
         ]
 
         try: