From 7d9fdfb19d17dc99a4cf2548942c4f8ae7433572 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 6 Jul 2023 16:53:21 +0200 Subject: home: services: bash: Properly quote shell aliases. Fixes . Reported by Ekaitz Zarraga . * gnu/home/services.scm (with-shell-quotation-bindings): New procedure. (environment-variable-shell-definitions): Use it instead of inline copy. * gnu/home/services/shells.scm (bash-serialize-aliases): Use it. Add clause for 'literal-string?'. * tests/guix-home.sh: Add 'aliases' to 'home-bash-extension' and test it. --- tests/guix-home.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/guix-home.sh b/tests/guix-home.sh index e9ef76c862..e6d16d7fab 100644 --- a/tests/guix-home.sh +++ b/tests/guix-home.sh @@ -1,7 +1,7 @@ # GNU Guix --- Functional package management for GNU # Copyright © 2021-2023 Andrew Tropin # Copyright © 2021 Oleg Pykhalov -# Copyright © 2022 Ludovic Courtès +# Copyright © 2022, 2023 Ludovic Courtès # # This file is part of GNU Guix. # @@ -94,6 +94,9 @@ trap 'chmod -Rf +w "$test_directory"; rm -rf "$test_directory"' EXIT (home-bash-extension (environment-variables '(("PS1" . "$GUIX_ENVIRONMENT λ "))) + (aliases + `(("run" . "guix shell") + ("path" . ,(literal-string "echo $PATH")))) (bashrc (list (plain-file @@ -149,6 +152,8 @@ EOF test -d "${HOME}/.guix-home" test -h "${HOME}/.bash_profile" test -h "${HOME}/.bashrc" + grep 'alias run="guix shell"' "$HOME/.bashrc" + grep "alias path='echo \$PATH'" "$HOME/.bashrc" test "$(tail -n 2 "${HOME}/.bashrc")" == "\ # dot-bashrc test file for guix home # the content of bashrc-test-config.sh" -- cgit 1.4.1