From 1b655c26ef83543fb0a0c9d62855b6a65b9dd0cd Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 12 Jan 2024 23:02:20 +0100 Subject: [PATCH] [libcalamares] Remove TMP-related environment variables When running a command in the chroot, don't set TMP (and similar) variables because those directories might nog make sense in the target (yet). FIXES #2269 --- CHANGES-3.3 | 2 ++ src/libcalamares/utils/Runner.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGES-3.3 b/CHANGES-3.3 index ce290d8a5..d5ae80112 100644 --- a/CHANGES-3.3 +++ b/CHANGES-3.3 @@ -29,6 +29,8 @@ This release contains contributions from (alphabetically by first name): - In CMake, "view" is no longer accepted as an alias of the module type "viewmodule" in function `calamares_add_plugin()`. - Plain Ubuntu builds have been added to the CI roster. (thanks Simon) + - Commands that run in the target system (in the chroot) no longer + use the TMP-related environment variables from the host. #2269 ## Modules ## - The *displaymanager* module configuration for `greetd` has some more diff --git a/src/libcalamares/utils/Runner.cpp b/src/libcalamares/utils/Runner.cpp index 632f32028..6a1eb85f8 100644 --- a/src/libcalamares/utils/Runner.cpp +++ b/src/libcalamares/utils/Runner.cpp @@ -128,6 +128,14 @@ Calamares::Utils::Runner::run() { auto env = QProcessEnvironment::systemEnvironment(); env.insert( "LC_ALL", "C" ); + // No guarantees that host settings for /tmp/ make sense in target + if ( m_location == RunLocation::RunInTarget ) + { + env.remove( "TEMP" ); + env.remove( "TEMPDIR" ); + env.remove( "TMP" ); + env.remove( "TMPDIR" ); + } process.setProcessEnvironment( env ); } process.setProcessChannelMode( QProcess::MergedChannels );