From: Daan De Meyer Date: Thu, 17 Aug 2023 18:54:36 +0000 (+0200) Subject: Unset TMPDIR in apivfs_cmd() X-Git-Tag: v16~52^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7d136f636eeed2b87bd6ccde70cc457f34bb75b5;p=thirdparty%2Fmkosi.git Unset TMPDIR in apivfs_cmd() dnf seems to have issues with this as well so let's unset TMPDIR whenever we set up APIVFS as that's a good indication something is going to chroot and we should unset TMPDIR. --- diff --git a/mkosi/installer/apt.py b/mkosi/installer/apt.py index c8804326c..d84a71a6b 100644 --- a/mkosi/installer/apt.py +++ b/mkosi/installer/apt.py @@ -107,6 +107,5 @@ def invoke_apt( ) -> None: cmd = apivfs_cmd(state.root) if apivfs else [] bwrap(cmd + apt_cmd(state, command) + [operation, *sort_packages(packages)], - # dpkg doesn't seem to unset TMPDIR when chrooting so we unset it for dpkg. - options=["--unsetenv", "TMPDIR"] + flatten(["--bind", d, d] for d in (state.config.workspace_dir, state.config.cache_dir) if d), + options=flatten(["--bind", d, d] for d in (state.config.workspace_dir, state.config.cache_dir) if d), network=True, env=state.config.environment) diff --git a/mkosi/run.py b/mkosi/run.py index 5efa29015..87e8a5a95 100644 --- a/mkosi/run.py +++ b/mkosi/run.py @@ -369,6 +369,8 @@ def apivfs_cmd(root: Path) -> list[PathString]: "--proc", root / "proc", "--dev", root / "dev", "--ro-bind", "/sys", root / "sys", + # APIVFS generally means chrooting is going to happen so unset TMPDIR just to be safe. + "--unsetenv", "TMPDIR", ] if (root / "etc/machine-id").exists(): @@ -394,7 +396,6 @@ def chroot_cmd(root: Path, *, options: Sequence[PathString] = ()) -> list[PathSt "--setenv", "container", "mkosi", "--setenv", "HOME", "/", "--setenv", "PATH", "/usr/bin:/usr/sbin", - "--unsetenv", "TMPDIR", ] resolve = Path("etc/resolv.conf")