From 8af749224fd69daee5b67295186c77becb1a4479 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 13 Jul 2022 17:14:20 +0200 Subject: home: services: shells: Double-quote environment variable values. Fixes . Until now, environment variable values were emitted unquoted, producing invalid shell code if the value contains spaces for example. * gnu/home/services/shells.scm (serialize-posix-env-vars): Define 'shell-quote' procedure in staged code and use it for #$value. * tests/guix-home.sh: Add test for PS1 variable with a value containing spaces. --- tests/guix-home.sh | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests') diff --git a/tests/guix-home.sh b/tests/guix-home.sh index 8a7048a9ca..a3c979530d 100644 --- a/tests/guix-home.sh +++ b/tests/guix-home.sh @@ -82,6 +82,8 @@ trap 'chmod -Rf +w "$test_directory"; rm -rf "$test_directory"' EXIT (simple-service 'home-bash-service-extension-test home-bash-service-type (home-bash-extension + (environment-variables + '(("PS1" . "$GUIX_ENVIRONMENT λ "))) (bashrc (list (plain-file @@ -138,6 +140,7 @@ EOF # dot-bashrc test file for guix home # the content of bashrc-test-config.sh" grep -q "the content of ~/.config/test.conf" "${HOME}/.config/test.conf" + grep '^export PS1="\$GUIX_ENVIRONMENT λ "$' "${HOME}/.bash_profile" # This one should still be here. grep "stay around" "$HOME/.config/random-file" -- cgit v1.2.3