From 6695b1d477246e30a3f14a7084c82775b30c09c1 Mon Sep 17 00:00:00 2001 From: alois31 <36605164+alois31@users.noreply.github.com> Date: Mon, 21 Apr 2025 17:20:07 +0200 Subject: [PATCH] kconfig: escape arguments properly (#6867) Previously shell arguments were not escaped properly, leading to breakage on group names containing characters with special meaning to the shell (in particular spaces); theoretically keys containing single quotes would be affected too. Escape all arguments passed to the shell properly instead. --- modules/misc/qt/kconfig.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/misc/qt/kconfig.nix b/modules/misc/qt/kconfig.nix index 9c8260d85..58b776749 100644 --- a/modules/misc/qt/kconfig.nix +++ b/modules/misc/qt/kconfig.nix @@ -74,8 +74,8 @@ in lib.mapAttrsToList (group: value: toLine file (path ++ [ group ]) value) value else "run ${pkgs.kdePackages.kconfig}/bin/kwriteconfig6 --file '${configHome}/${file}' ${ - lib.concatMapStringsSep " " (x: "--group ${x}") (lib.lists.init path) - } --key '${lib.lists.last path}' ${toValue value}"; + lib.concatMapStringsSep " " (x: "--group ${lib.escapeShellArg x}") (lib.lists.init path) + } --key ${lib.escapeShellArg (lib.lists.last path)} ${toValue value}"; lines = lib.flatten (lib.mapAttrsToList (file: attrs: toLine file [ ] attrs) cfg); in builtins.concatStringsSep "\n" lines