From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id 4BNqOH6/RmQYEAAASxT56A (envelope-from ) for ; Mon, 24 Apr 2023 19:42:22 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id aGh0OH6/RmTDKwAA9RJhRA (envelope-from ) for ; Mon, 24 Apr 2023 19:42:22 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 986A93B03B for ; Mon, 24 Apr 2023 19:42:22 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pr0CU-0001Wq-Ca; Mon, 24 Apr 2023 13:42:06 -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 1pr0CR-0001Rh-KN for bug-guix@gnu.org; Mon, 24 Apr 2023 13:42:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pr0CQ-0005HQ-LY for bug-guix@gnu.org; Mon, 24 Apr 2023 13:42:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pr0CQ-0003si-HV for bug-guix@gnu.org; Mon, 24 Apr 2023 13:42:02 -0400 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Seal: i=1; s=key1; d=yhetil.org; t=1682358142; a=rsa-sha256; cv=none; b=VvxOXAAK1yAlV+JCRUUVsTYb/ohIoSx5RL9gvDP5kTHtds3/nEegILPAKoIlAJUjlOD/k+ IbaceY/RTI4HeftbU5Xkq6MkSujKhFPTaZOnI0J2K/p+M+RE7UPjd4x9cddvtCD2/EhV7N 0j/PsVB0uGI1ihC1Yyq+DkY7SK63M75pdUmxW03S2Tx86a5/EN1ZcDNtNFtdnCEJrG3IJu 9yQREgv4l5N/5/kiLkWz95ycoy9mETOMlERto9jK+tWP1IX+4J6VijZ4VcHHI5qHi9luZ8 36l0guMsPkPfTtPdZ+Z45++ux3mQPA/lNnRc8BtVSRAqpx0PxrZ3sxjEBobmjQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=elenq.tech header.s=protonmail header.b=qVyAaRyk; dmarc=fail reason="SPF not aligned (relaxed)" header.from=elenq.tech (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1682358142; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=/XMM5EIfWkrZuh4EJMmIX6otQMzW3jOK0SeYViEGWC0=; b=OJ0xMncTG5o3Mnd8k7dPbgWw45MjIHpXMFhEPCCMoI3/ugsRqrfinR/AFp5rvmKuZktgpJ haT+pODKQEPRSrV2lvJB1mKeiLGCjf7yX8xSyFqm8cM56crHDR+rNt0gG2WrCVoXwR7iiL 0OWo3ausjzOl807r96vGQrvvjN3cV8QEcFCNmx+NGtyvnUDtVe8/5Zk4Mxfa4drt+vWWtB 5D010Nbuuk72cP1h8IZ8rSSR81VzT846Cp6f5iTbcWDRg3QPCxALC9L/2txIlXhhUxX0ws hslFfQMpn3M6ZZzo1cnjd0xfP2h5f6aYqHZtuZWxsuKT5Q+tgYncR6C1wPp5dA== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=elenq.tech header.s=protonmail header.b=qVyAaRyk; dmarc=fail reason="SPF not aligned (relaxed)" header.from=elenq.tech (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 7.29 X-Spam-Score: 7.29 X-Migadu-Queue-Id: 986A93B03B X-TUID: IamfiwEPJOrU 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"))