From unknown Fri Aug 15 16:57:58 2025 X-Loop: help-debbugs@gnu.org Subject: bug#63048: [Home] Shell alias values are not properly quoted Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: ekaitz@elenq.tech, bug-guix@gnu.org Resent-Date: Mon, 24 Apr 2023 07:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 63048 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 63048@debbugs.gnu.org Cc: Ekaitz Zarraga X-Debbugs-Original-To: bug-guix@gnu.org X-Debbugs-Original-Xcc: Ekaitz Zarraga Received: via spool by submit@debbugs.gnu.org id=B.168232304413810 (code B ref -1); Mon, 24 Apr 2023 07:58:01 +0000 Received: (at submit) by debbugs.gnu.org; 24 Apr 2023 07:57:24 +0000 Received: from localhost ([127.0.0.1]:47400 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqr4e-0003ag-8o for submit@debbugs.gnu.org; Mon, 24 Apr 2023 03:57:24 -0400 Received: from lists.gnu.org ([209.51.188.17]:39086) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqr4d-0003aZ-3Y for submit@debbugs.gnu.org; Mon, 24 Apr 2023 03:57:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqr4b-0000yB-NB for bug-guix@gnu.org; Mon, 24 Apr 2023 03:57:22 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqr4Z-0008VA-QO for bug-guix@gnu.org; Mon, 24 Apr 2023 03:57:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=FmLic2B3JIy2jVAngh2Mz/7kxXOKpOa2EK9Ls3ZCvvg=; b=f3F73dJpiV+9nJLmmd+RvNvxJbakDKIVrXZFkv+XfDK+yYorWi0/Rj9q 0ldC1of/EbqS/n38t4hDeLNMdWLmHuzvSUfDPkhvhnD+vS65njFBvF01z B5RZTSGT/J8dauMcFaHgkT17fty7swqujUgWeIZOsfoyRPKpwnqjxsyvv 0=; Authentication-Results: mail3-relais-sop.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=ludovic.courtes@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="5.99,222,1677538800"; d="scan'208";a="54149873" Received: from unknown (HELO ribbon) ([193.50.110.118]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2023 09:57:15 +0200 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Quintidi 5 =?UTF-8?Q?Flor=C3=A9al?= an 231 de la =?UTF-8?Q?R=C3=A9volution,?= jour du Rossignol X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Mon, 24 Apr 2023 09:57:14 +0200 Message-ID: <875y9l67c5.fsf@inria.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=192.134.164.104; envelope-from=ludovic.courtes@inria.fr; helo=mail3-relais-sop.national.inria.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Hi! As Ekaitz reported on Mastodon, shell alias values are not properly quoted, which causes problem when an alias value contains double-quotes for instance: --8<---------------cut here---------------start------------->8--- (define (bash-serialize-aliases field-name val) #~(string-append #$@(map (match-lambda ((key . #f) "") ((key . #t) #~(string-append "alias " #$key "\n")) ((key . value) #~(string-append "alias " #$key "=3D\"" #$value "\"\n"))) val))) --8<---------------cut here---------------end--------------->8--- The solution is to borrow and factorize the code of =E2=80=98environment-variable-shell-definitions=E2=80=99, which does it rig= ht. Ludo=E2=80=99. From unknown Fri Aug 15 16:57:58 2025 X-Loop: help-debbugs@gnu.org Subject: bug#63048: [Home] Shell alias values are not properly quoted Resent-From: Ekaitz Zarraga Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Mon, 24 Apr 2023 10:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63048 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 63048@debbugs.gnu.org Received: via spool by 63048-submit@debbugs.gnu.org id=B63048.16823310555228 (code B ref 63048); Mon, 24 Apr 2023 10:11:01 +0000 Received: (at 63048) by debbugs.gnu.org; 24 Apr 2023 10:10:55 +0000 Received: from localhost ([127.0.0.1]:47592 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqt9r-0001MG-9r for submit@debbugs.gnu.org; Mon, 24 Apr 2023 06:10:55 -0400 Received: from mail-4018.proton.ch ([185.70.40.18]:27437) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqt9o-0001M1-0U for 63048@debbugs.gnu.org; Mon, 24 Apr 2023 06:10:54 -0400 Date: Mon, 24 Apr 2023 10:10:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=elenq.tech; s=protonmail; t=1682331045; x=1682590245; bh=uxfal5vS+njUEHJTarCQKrhSGttAsPyXED05E7MFau0=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=oi0I/pJTXnqph40q2u36ONUwM83WMAuQrNNSNcZh8xjs7mBxoXdrOiMPtkOfvYi79 WmXnwfin/JJvRL1NHX5DxLIZM7QuoU8A6d6D94SfMeLIGQ6OVFUottUvxKqiGilQu4 drFRcvjEY1oGLuFANvyPcv0P/dCEKO80GCSVs6pZAs6ihCEidYJGjXXUAFVVtz68Jz 9u/BkJGt46YDd5PuJTh3yAzt79/nl5yg0PfOQTBsGpnI1a5ReC0Mzi1Cn7jJ3W7T2S hL+JpzjHj0Z+fpAuYHlZ28jJhdNU85FcWNsozQ8EGaxmri5vG0h5tg7CyBiA/vGPvY ItHXozg2Ow/Jg== From: Ekaitz Zarraga Message-ID: In-Reply-To: <875y9l67c5.fsf@inria.fr> References: <875y9l67c5.fsf@inria.fr> Feedback-ID: 3263582:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) As an extra note: The problem I encountered was when the alias was defined using single quote= marks: alias ls=3D'ls blabla "problem"' this is parsed to: ("ls" . "blabla \"problem\"") Which is written as: alias ls=3D"blabla "problem"" Which is wrong. So the problem relies on the fact that the quotations marks have been chang= ed from ' to " and the escaping have not been adjusted accordingly. :) From unknown Fri Aug 15 16:57:58 2025 X-Loop: help-debbugs@gnu.org Subject: bug#63048: [Home] Shell alias values are not properly quoted Resent-From: Ekaitz Zarraga Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Mon, 24 Apr 2023 17:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63048 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 63048@debbugs.gnu.org Received: via spool by 63048-submit@debbugs.gnu.org id=B63048.168235809414871 (code B ref 63048); Mon, 24 Apr 2023 17:42:02 +0000 Received: (at 63048) by debbugs.gnu.org; 24 Apr 2023 17:41:34 +0000 Received: from localhost ([127.0.0.1]:50270 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pr0By-0003rl-Ee for submit@debbugs.gnu.org; Mon, 24 Apr 2023 13:41:34 -0400 Received: from mail-40136.proton.ch ([185.70.40.136]:39971) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pr0Bt-0003rL-4D for 63048@debbugs.gnu.org; Mon, 24 Apr 2023 13:41:33 -0400 Date: Mon, 24 Apr 2023 17:41:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=elenq.tech; s=protonmail; t=1682358082; x=1682617282; bh=/XMM5EIfWkrZuh4EJMmIX6otQMzW3jOK0SeYViEGWC0=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=qVyAaRykvk+W6b0PZ5/vb1s2j6EAD0+uKy+99avRC0Enhyn+RD8u0EGmcjIlk2ZRp K+A7+k5i4rjdIxOV1lphtwRKWHTSnqeVAxnj9SsVxwW/lVxKuW1SztxW5YyhVMvSe8 qHYWC5nQq4l5Gka6scDhTCAsI+hvLegdcbU46W1336n7Pq9mFrrplGyvA/vLBjDUcM 8xzwI+7NTdJag92BXrZbobiXFiuSafGyNq9yXmzQVi9Zen1ryThiY5HR+DX39mbNwh 3Pjdyq2NDGhSVWDVovFKUXMYy23FImA/j5CpL3rkixk056nOskA1j8a+28HPU0Y6m5 t8BTnOzVhFIYQ== From: Ekaitz Zarraga Message-ID: In-Reply-To: References: <875y9l67c5.fsf@inria.fr> Feedback-ID: 3263582:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) I made something like this instead of reusing the code you suggested, Ludo. But it doesn't work. I don't really know why: diff --git a/guix/scripts/home/import.scm b/guix/scripts/home/import.scm index fd263c0699..2d7a7abbf2 100644 --- a/guix/scripts/home/import.scm +++ b/guix/scripts/home/import.scm @@ -64,12 +64,23 @@ (define (destination-append path) (define alias-rx (make-regexp "^alias ([^=3D]+)=3D[\"'](.+)[\"']$")) =20 + (define (quote-style line) + (cond + ((string-match "^alias ([^=3D]+)=3D[\"].*$" line) 'double) + ((string-match "^alias ([^=3D]+)=3D['].*$" line) 'single))) + (define (bash-alias->pair line) (match (regexp-exec alias-rx line) (#f #f) (matched `(,(match:substring matched 1) . ,(match:substring matched 2))))) =20 + (define (escape-alias-body quote-style body) + (if (eq? quote-style 'single) + (let* ((escaped-dquotes (string-replace-substring body "\"" "\\\"")= )) + (string-replace-substring escaped-dquotes "\\'" "'")) + body)) + (define (parse-aliases input) (let loop ((result '())) (match (read-line input) @@ -78,7 +89,7 @@ (define (parse-aliases input) (line (match (bash-alias->pair line) (#f (loop result)) - (alias (loop (cons alias result)))))))) + (alias (loop (cons alias (escape-alias-body (quote-style line) = result))))))))) =20 (let ((rc (destination-append ".bashrc")) (profile (destination-append ".bash_profile")) From unknown Fri Aug 15 16:57:58 2025 X-Loop: help-debbugs@gnu.org Subject: bug#63048: [PATCH] home: services: bash: Properly quote shell aliases. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: , bug-guix@gnu.org Resent-Date: Thu, 06 Jul 2023 15:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63048 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 63048@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , Ekaitz Zarraga , ( , Andrew Tropin , Ludovic =?UTF-8?Q?Court=C3=A8s?= X-Debbugs-Original-Xcc: ( , Andrew Tropin , Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 63048-submit@debbugs.gnu.org id=B63048.168865574030242 (code B ref 63048); Thu, 06 Jul 2023 15:03:01 +0000 Received: (at 63048) by debbugs.gnu.org; 6 Jul 2023 15:02:20 +0000 Received: from localhost ([127.0.0.1]:41840 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qHQUt-0007ri-O7 for submit@debbugs.gnu.org; Thu, 06 Jul 2023 11:02:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59498) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qHQUp-0007rQ-Ge for 63048@debbugs.gnu.org; Thu, 06 Jul 2023 11:02:18 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qHQUi-0003xf-C6; Thu, 06 Jul 2023 11:02:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=KNA7O3emHPG7khztgLGFBu7nVJokFEa23Xmi0+F54Vg=; b=K8Ieb6BDn1wRzXnDE+B8 +WKG1Vhl3gEAe16hFTGtMyZywGUXXXHBcb7LafEoKGJo/kjy52P8HQuWxyno75dLYcKQ3xvZ2pY9l E+kHovQV/rG2R3q0YLKRub+Cc3uVufqaKsWTbmE+Nfur88eh2yIrbwyTWM+gK/70FBqas56orEIdB ecQxfNHmx32c5M19A+Ke8KbuYZt7NFBB4CSrC6QhxQI2f/+VuasqsmJDtND4vnKuUnVpy6XRrXMpu RkcKNOetUXnWCkql6tX/xDNFFAkZX4g/FEVb3MJehUBKVesev5B3jRQeo7whZ9m2Rc13oUUGfXWkH hHMmu5bXKlTJaw==; Received: from [193.50.110.205] (helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qHQUh-0001Ku-St; Thu, 06 Jul 2023 11:02:08 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Thu, 6 Jul 2023 17:01:54 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) From: Ludovic Courtès 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. --- gnu/home/services.scm | 53 ++++++++++++++++++++---------------- gnu/home/services/shells.scm | 28 ++++++++++++------- tests/guix-home.sh | 7 ++++- 3 files changed, 54 insertions(+), 34 deletions(-) Hi! Here's a patch that fixes it. AFAICS 'guix home import' does the right thing, so this is really just fixing the way aliases are serialized. Let me know what you think! Ludo'. diff --git a/gnu/home/services.scm b/gnu/home/services.scm index b17a34d19d..042eba4780 100644 --- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -53,6 +53,7 @@ (define-module (gnu home services) literal-string? literal-string-value + with-shell-quotation-bindings environment-variable-shell-definitions home-files-directory xdg-configuration-files-directory @@ -183,11 +184,10 @@ (define-record-type literal-string? (str literal-string-value)) -(define (environment-variable-shell-definitions variables) - "Return a gexp that evaluates to a list of POSIX shell statements defining -VARIABLES, a list of environment variable name/value pairs. The returned code -ensures variable values are properly quoted." - #~(let* ((quote-string +(define (with-shell-quotation-bindings exp) + "Insert EXP, a gexp, in a lexical environment providing the +'shell-single-quote' and 'shell-double-quote' bindings." +#~(let* ((quote-string (lambda (value quoted-chars) (list->string (string-fold-right (lambda (chr lst) @@ -206,24 +206,31 @@ (define (environment-variable-shell-definitions variables) ;; Single-quote VALUE to enter a literal string. (string-append "'" (quote-string value '(#\')) "'")))) - (string-append - #$@(map (match-lambda - ((key . #f) - "") - ((key . #t) - #~(string-append "export " #$key "\n")) - ((key . (or (? string? value) - (? file-like? value) - (? gexp? value))) - #~(string-append "export " #$key "=" - (shell-double-quote #$value) - "\n")) - ((key . (? literal-string? value)) - #~(string-append "export " #$key "=" - (shell-single-quote - #$(literal-string-value value)) - "\n"))) - variables)))) + #$exp)) + +(define (environment-variable-shell-definitions variables) + "Return a gexp that evaluates to a list of POSIX shell statements defining +VARIABLES, a list of environment variable name/value pairs. The returned code +ensures variable values are properly quoted." + (with-shell-quotation-bindings + #~(string-append + #$@(map (match-lambda + ((key . #f) + "") + ((key . #t) + #~(string-append "export " #$key "\n")) + ((key . (or (? string? value) + (? file-like? value) + (? gexp? value))) + #~(string-append "export " #$key "=" + (shell-double-quote #$value) + "\n")) + ((key . (? literal-string? value)) + #~(string-append "export " #$key "=" + (shell-single-quote + #$(literal-string-value value)) + "\n"))) + variables)))) (define (environment-variables->setup-environment-script vars) "Return a file that can be sourced by a POSIX compliant shell which diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm index 415b5470c5..7960590e7c 100644 --- a/gnu/home/services/shells.scm +++ b/gnu/home/services/shells.scm @@ -313,16 +313,24 @@ (define home-zsh-service-type ;;; (define (bash-serialize-aliases field-name val) - #~(string-append - #$@(map - (match-lambda - ((key . #f) - "") - ((key . #t) - #~(string-append "alias " #$key "\n")) - ((key . value) - #~(string-append "alias " #$key "=\"" #$value "\"\n"))) - val))) + (with-shell-quotation-bindings + #~(string-append + #$@(map + (match-lambda + ((key . #f) + "") + ((key . #t) + #~(string-append "alias " #$key "\n")) + ((key . (? literal-string? value)) + #~(string-append "alias " #$key "=" + (shell-single-quote + #$(literal-string-value value)) + "\n")) + ((key . value) + #~(string-append "alias " #$key "=" + (shell-double-quote #$value) + "\n"))) + val)))) (define-configuration home-bash-configuration (package 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" base-commit: 2426e51688d479042ea115a634c6be2d8b9f3b99 -- 2.40.1 From unknown Fri Aug 15 16:57:58 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#63048: closed (Re: bug#63048: [Home] Shell alias values are not properly quoted) Message-ID: References: <87ilaq3305.fsf_-_@gnu.org> <875y9l67c5.fsf@inria.fr> X-Gnu-PR-Message: they-closed 63048 X-Gnu-PR-Package: guix Reply-To: 63048@debbugs.gnu.org Date: Tue, 11 Jul 2023 15:03:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1689087782-29505-1" This is a multi-part message in MIME format... ------------=_1689087782-29505-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #63048: [Home] Shell alias values are not properly quoted which was filed against the guix package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 63048@debbugs.gnu.org. --=20 63048: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D63048 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1689087782-29505-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 63048-done) by debbugs.gnu.org; 11 Jul 2023 15:02:46 +0000 Received: from localhost ([127.0.0.1]:50885 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qJEt4-0007fQ-DN for submit@debbugs.gnu.org; Tue, 11 Jul 2023 11:02:46 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56932) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qJEt1-0007fB-IT for 63048-done@debbugs.gnu.org; Tue, 11 Jul 2023 11:02:44 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qJEsv-0006h4-C9; Tue, 11 Jul 2023 11:02:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=UeTOZDn80YUkHZzhcEimavAVu89gWS2LnAwiHW/PM0w=; b=U7PS1wtorv+FE6qJhdEk AkP5e3/c0tcilnYltMXJDvu007gC3imG6WdP3qeHzga94XaOsYZCafQ3P30lXVkXk8px8dQ8SwLi/ kk7fJAceytiPlqazI1Cm8zhdLpQP8/u/pIanbE2RM7zuC6TNvcmA4gLtuC1plV6oRMk5skd73YCBF DihwsCewzh79eAvHtchER3DxL6b+CUQZri0Y0lzc68nzf9oARKtr8Y2TcIgYNGucqgBSPbK7lNjwA MM/oQhVF/YysIxFDxZLKxVtVQ+whKTFMR0LsIGBJt+xi8UuF826rLSZQDMOJ7bccClXhD+S+0rVlJ GCVs5ycnhVNrEw==; Received: from [193.50.110.205] (helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qJEsu-0003jA-U9; Tue, 11 Jul 2023 11:02:37 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: 63048-done@debbugs.gnu.org Subject: Re: bug#63048: [Home] Shell alias values are not properly quoted References: Date: Tue, 11 Jul 2023 17:02:34 +0200 In-Reply-To: ("Ludovic =?utf-8?Q?Court=C3=A8s=22's?= message of "Thu, 6 Jul 2023 17:01:54 +0200") Message-ID: <87ilaq3305.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 63048-done Cc: paren@disroot.org, Ekaitz Zarraga , Andrew Tropin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Ludovic Court=C3=A8s skribis: > From: Ludovic Court=C3=A8s > > 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. Pushed as 7d9fdfb19d17dc99a4cf2548942c4f8ae7433572! Ludo'. ------------=_1689087782-29505-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 24 Apr 2023 07:57:24 +0000 Received: from localhost ([127.0.0.1]:47400 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqr4e-0003ag-8o for submit@debbugs.gnu.org; Mon, 24 Apr 2023 03:57:24 -0400 Received: from lists.gnu.org ([209.51.188.17]:39086) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqr4d-0003aZ-3Y for submit@debbugs.gnu.org; Mon, 24 Apr 2023 03:57:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqr4b-0000yB-NB for bug-guix@gnu.org; Mon, 24 Apr 2023 03:57:22 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqr4Z-0008VA-QO for bug-guix@gnu.org; Mon, 24 Apr 2023 03:57:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=FmLic2B3JIy2jVAngh2Mz/7kxXOKpOa2EK9Ls3ZCvvg=; b=f3F73dJpiV+9nJLmmd+RvNvxJbakDKIVrXZFkv+XfDK+yYorWi0/Rj9q 0ldC1of/EbqS/n38t4hDeLNMdWLmHuzvSUfDPkhvhnD+vS65njFBvF01z B5RZTSGT/J8dauMcFaHgkT17fty7swqujUgWeIZOsfoyRPKpwnqjxsyvv 0=; Authentication-Results: mail3-relais-sop.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=ludovic.courtes@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="5.99,222,1677538800"; d="scan'208";a="54149873" Received: from unknown (HELO ribbon) ([193.50.110.118]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2023 09:57:15 +0200 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: bug-guix@gnu.org Subject: [Home] Shell alias values are not properly quoted X-Debbugs-Cc: Ekaitz Zarraga X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Quintidi 5 =?utf-8?Q?Flor=C3=A9al?= an 231 de la =?utf-8?Q?R=C3=A9volution=2C?= jour du Rossignol X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Mon, 24 Apr 2023 09:57:14 +0200 Message-ID: <875y9l67c5.fsf@inria.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=192.134.164.104; envelope-from=ludovic.courtes@inria.fr; helo=mail3-relais-sop.national.inria.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Hi! As Ekaitz reported on Mastodon, shell alias values are not properly quoted, which causes problem when an alias value contains double-quotes for instance: --8<---------------cut here---------------start------------->8--- (define (bash-serialize-aliases field-name val) #~(string-append #$@(map (match-lambda ((key . #f) "") ((key . #t) #~(string-append "alias " #$key "\n")) ((key . value) #~(string-append "alias " #$key "=3D\"" #$value "\"\n"))) val))) --8<---------------cut here---------------end--------------->8--- The solution is to borrow and factorize the code of =E2=80=98environment-variable-shell-definitions=E2=80=99, which does it rig= ht. Ludo=E2=80=99. ------------=_1689087782-29505-1--