From d703c693845a3ecaf804bc11c339d3fddeb1b54a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Guzm=C3=A1n?= Date: Mon, 2 Jun 2025 19:14:08 -0600 Subject: [PATCH] debconf-kde: fix TPH #212, pass home to prevent requests. --- .../000-fix_TPH_212_LP_1851573.patch | 33 +++++++++++++++++++ helpers/make-debconf-kde | 28 ++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 helpers/DATA/debconf-kde/patch_changes/000-fix_TPH_212_LP_1851573.patch create mode 100644 helpers/make-debconf-kde diff --git a/helpers/DATA/debconf-kde/patch_changes/000-fix_TPH_212_LP_1851573.patch b/helpers/DATA/debconf-kde/patch_changes/000-fix_TPH_212_LP_1851573.patch new file mode 100644 index 0000000..0727b46 --- /dev/null +++ b/helpers/DATA/debconf-kde/patch_changes/000-fix_TPH_212_LP_1851573.patch @@ -0,0 +1,33 @@ +diff --git a/tools/main.cpp b/tools/main.cpp +index 813aba5a..5f91e057 100644 +--- a/tools/main.cpp ++++ b/tools/main.cpp +@@ -37,6 +37,8 @@ + + #include + ++#include ++ + using namespace DebconfKde; + + // Handle SIGQUIT. Clients (e.g. packagekit) may use QUIT which would otherwise +@@ -73,6 +76,19 @@ static void setupQuitHandler() { + + int main(int argc, char **argv) + { ++ /* TPH: #212 | LP: #1851573 — When the helper is started through pkexec/aptdaemon ++ * the environment may arrive without $HOME. Without HOME, KConfig writes ++ * to "//.config/..." and shows a "not writable" dialog for every debconf ++ * question. Substitute the passwd entry’s home directory. ++ */ ++ const char *homeEnv = getenv("HOME"); ++ if (!homeEnv || homeEnv[0] == '\0') { ++ struct passwd *pw = getpwuid(getuid()); ++ if (pw && pw->pw_dir) { ++ setenv("HOME", pw->pw_dir, /* overwrite = */ 1); ++ } ++ } ++ + QApplication app(argc, argv); + setupQuitHandler(); + diff --git a/helpers/make-debconf-kde b/helpers/make-debconf-kde new file mode 100644 index 0000000..be8021e --- /dev/null +++ b/helpers/make-debconf-kde @@ -0,0 +1,28 @@ +#!/bin/sh +# +# Copyright (C) 2025 Luis Guzmán +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +VERSION=1 + +. ./config + +apply_patch_changes + +changelog "Patch package to pass HOME to prevent dialog for every request." + +package