From: Daan De Meyer Date: Mon, 8 Jan 2024 14:54:26 +0000 (+0100) Subject: Always use /var/tmp in apivfs_cmd() X-Git-Tag: v20~6^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=671a26dceba50efede810101ade3b76deffaacb9;p=thirdparty%2Fmkosi.git Always use /var/tmp in apivfs_cmd() apivfs_cmd() is always executed from within a sandbox so we can just reuse the sandboxes /var/tmp. --- diff --git a/mkosi/qemu.py b/mkosi/qemu.py index 40d8b56cb..267df7f22 100644 --- a/mkosi/qemu.py +++ b/mkosi/qemu.py @@ -746,7 +746,7 @@ def run_qemu(args: Args, config: Config) -> None: scratch = stack.enter_context(tempfile.NamedTemporaryFile(dir="/var/tmp", prefix="mkosi-scratch")) scratch.truncate(1024**4) run([f"mkfs.{config.distribution.filesystem()}", "-L", "scratch", scratch.name], - stdout=subprocess.DEVNULL, stderr=None, sandbox=config.sandbox()) + stdout=subprocess.DEVNULL, sandbox=config.sandbox(options=["--bind", scratch.name, scratch.name])) cmdline += [ "-drive", f"if=none,id=scratch,file={scratch.name},format=raw", "-device", "scsi-hd,drive=scratch", diff --git a/mkosi/sandbox.py b/mkosi/sandbox.py index 0e5da6e45..1e730fdae 100644 --- a/mkosi/sandbox.py +++ b/mkosi/sandbox.py @@ -173,7 +173,7 @@ def apivfs_cmd(root: Path, *, tools: Path = Path("/")) -> list[PathString]: "--dev-bind", "/", "/", "--tmpfs", root / "run", "--tmpfs", root / "tmp", - "--bind", os.getenv("TMPDIR", "/var/tmp"), root / "var/tmp", + "--bind", "/var/tmp", root / "var/tmp", "--proc", root / "proc", "--dev", root / "dev", # APIVFS generally means chrooting is going to happen so unset TMPDIR just to be safe.