From af4c103595a725194318f40fc5aba110772ff417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 14 Jul 2022 00:54:40 +0200 Subject: home: services: environment-variables: Double-quote values. Fixes . Reported by Maxime Devos . * gnu/home/services.scm (environment-variable-shell-definitions): New procedure, with code formerly in 'serialize-posix-env-vars'. (environment-variables->setup-environment-script): Change "setup-environment" from 'mixed-text-file' to 'computed-file', and use 'environment-variable-shell-definitions'. * tests/guix-home.sh: Test it. * gnu/home/services/shells.scm (serialize-posix-env-vars): Delegate to 'environment-variable-shell-definitions'. --- gnu/home/services/shells.scm | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) (limited to 'gnu/home/services') diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm index 28d717f03d..172e58a9ff 100644 --- a/gnu/home/services/shells.scm +++ b/gnu/home/services/shells.scm @@ -111,30 +111,7 @@ service type can be extended with a list of file-like objects."))) (define (serialize-boolean field-name val) "") (define (serialize-posix-env-vars field-name val) - #~(let ((shell-quote - (lambda (value) - ;; Double-quote VALUE, leaving dollar sign as is. - (let ((quoted (list->string - (string-fold-right - (lambda (chr lst) - (case chr - ((#\" #\\) - (append (list chr #\\) lst)) - (else (cons chr lst)))) - '() - value)))) - (string-append "\"" quoted "\""))))) - (string-append - #$@(map - (match-lambda - ((key . #f) - "") - ((key . #t) - #~(string-append "export " #$key "\n")) - ((key . value) - #~(string-append "export " #$key "=" - (shell-quote #$value) "\n"))) - val)))) + (environment-variable-shell-definitions val)) ;;; -- cgit v1.2.3