1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 11:36:05 +01:00

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.
This commit is contained in:
alois31 2025-04-21 17:20:07 +02:00 committed by GitHub
parent 3fbe9a2b76
commit 6695b1d477
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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