Subject: bug#63048: closed (Re: bug#63048: [Home] Shell alias values are not properly quoted)

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 11 Jul 2023 15:03:02 +0000

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 [email-masked].

-- 
63048: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63048
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#63048: [Home] Shell alias values are not properly quoted
From: Ludovic Courtès <[email-masked]>
To: [email-masked]
Cc: [email-masked], Ekaitz Zarraga <[email-masked]>, Andrew Tropin <[email-masked]>
Date: Tue, 11 Jul 2023 17:02:34 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Ludovic Courtès <[email-masked]> skribis:

> From: Ludovic Courtès <[email-masked]>
>
> Fixes <https://issues.guix.gnu.org/63048>.
> Reported by Ekaitz Zarraga <[email-masked]>.
>
> * 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'.

Subject: [Home] Shell alias values are not properly quoted
From: Ludovic Courtès <[email-masked]>
To: [email-masked]
Date: Mon, 24 Apr 2023 09:57:14 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

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 "=\"" #$value "\"\n")))
         val)))
--8<---------------cut here---------------end--------------->8---

The solution is to borrow and factorize the code of
‘environment-variable-shell-definitions’, which does it right.

Ludo’.