From patchwork Thu Nov 11 23:46:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thiago Jung Bauermann X-Patchwork-Id: 34405 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 6380A27BBE3; Thu, 11 Nov 2021 23:57:09 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id F045527BBE1 for ; Thu, 11 Nov 2021 23:57:08 +0000 (GMT) Received: from localhost ([::1]:43106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mlJwK-0007AD-19 for patchwork@mira.cbaines.net; Thu, 11 Nov 2021 18:57:08 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34422) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mlJwE-0007A4-RC for guix-patches@gnu.org; Thu, 11 Nov 2021 18:57:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:59231) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mlJwE-00068y-If for guix-patches@gnu.org; Thu, 11 Nov 2021 18:57:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mlJwE-00007t-Do for guix-patches@gnu.org; Thu, 11 Nov 2021 18:57:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51780] [PATCH] environment: Fix =?utf-8?b?4oCYLS1jaGVja+KAmQ==?= with exported PS1 variable. Resent-From: Thiago Jung Bauermann Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 11 Nov 2021 23:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 51780 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51780@debbugs.gnu.org Cc: Thiago Jung Bauermann X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.1636675018473 (code B ref -1); Thu, 11 Nov 2021 23:57:02 +0000 Received: (at submit) by debbugs.gnu.org; 11 Nov 2021 23:56:58 +0000 Received: from localhost ([127.0.0.1]:42544 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mlJwA-00007Z-91 for submit@debbugs.gnu.org; Thu, 11 Nov 2021 18:56:58 -0500 Received: from lists.gnu.org ([209.51.188.17]:44762) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mlJw8-00007R-Dx for submit@debbugs.gnu.org; Thu, 11 Nov 2021 18:56:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34420) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mlJw8-00079v-65 for guix-patches@gnu.org; Thu, 11 Nov 2021 18:56:56 -0500 Received: from mx.kolabnow.com ([212.103.80.154]:33798) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mlJw6-00068L-0w for guix-patches@gnu.org; Thu, 11 Nov 2021 18:56:55 -0500 Received: from localhost (unknown [127.0.0.1]) by mx.kolabnow.com (Postfix) with ESMTP id A5638709 for ; Fri, 12 Nov 2021 00:56:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h= content-transfer-encoding:content-type:content-type:mime-version :message-id:date:date:subject:subject:from:from:received :received:received; s=dkim20160331; t=1636675010; x=1638489411; bh=L+36DT02j+6dBoaNJt5S9t+2YBVTDvk4kKW0EEmXXDo=; b=wQpTLcRE7638 T9NJjruPGp/J+q+yD0+PvVTA7oys/h9fg98/98/vC4ytn+ump5yNB8XlzZwy/XYc uH+lFVSD+0Sz1emWNMYmWOyrcqPLsqvOCh3Dy9XQaWbyF6ffbaUhbKIJYinUacBj o92n9vwIYIGdEizopcwn6gGqNZOWAiKlZ8lse8x0vC8W3ixvOOgixvTfIa243cF3 1EP4jicxqhlR4I/hM8RqQK1y4DYxHuxch1vXdwhm0tqMPNlWEShlLQszWituVeIu 2M2/26tJIjfx7O4UsZ2sEE3meNSF/okKfkzKb/hW+zkw73/rXfkT3X+Vmiy0Pozb qKcdQvPIb1N6k7etiDmzG+oty8K+xswPM7CZrKLf8TeBR4IF8HxI9SvfkS4rEW3I wDKgtVWAPRC/bLObzEuhb8VMg/JvGUGr2UKEgC6v5VP1OemaTrIwi3Hf3JWR1bIw RNNi4FEV5CYSqlQY4kgwQfBK6yhXslp8vemAT5r/24EH00vpHFUFABbeytIs+K0i mi1XvZ1aBX/8illPRw+s9csKUopiGlPXQlkK3U2GaFG6iud4GswXvosa0fyuy5Zi hums0kr3frVWP55J5SXObZDDp/0cmPCftdMVnf/e7Kj5/AcQvOVNz5OplKPGrp1L Ire1CfhyNwvEG/QW6D6zPz8irXJcwY0= X-Virus-Scanned: amavisd-new at mykolab.com Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out002.mykolab.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZkA8AJ0B5rS9 for ; Fri, 12 Nov 2021 00:56:50 +0100 (CET) Received: from int-mx001.mykolab.com (unknown [10.9.13.1]) by mx.kolabnow.com (Postfix) with ESMTPS id F1F7E5C1 for ; Fri, 12 Nov 2021 00:56:49 +0100 (CET) Received: from ext-subm003.mykolab.com (unknown [10.9.6.3]) by int-mx001.mykolab.com (Postfix) with ESMTPS id E8CDF901; Fri, 12 Nov 2021 00:47:05 +0100 (CET) Date: Thu, 11 Nov 2021 20:46:48 -0300 Message-Id: <20211111234648.672963-1-bauermann@kolabnow.com> MIME-Version: 1.0 Received-SPF: pass client-ip=212.103.80.154; envelope-from=bauermann@kolabnow.com; helo=mx.kolabnow.com 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: Thiago Jung Bauermann X-ACL-Warn: , Thiago Jung Bauermann via Guix-patches X-Patchwork-Original-From: Thiago Jung Bauermann via Guix-patches via From: Thiago Jung Bauermann X-getmail-retrieved-from-mailbox: Patches If your .bashrc (unnecessarily) exports PS1 and you’re in a non-login shell, Guix crashes: --8<---------------cut here---------------start------------->8--- user@popigai:~$ guix shell --check coreutils guix shell: checking the environment variables visible from shell '/bin/bash'... Backtrace: 14 (primitive-load "/home/user/.config/guix/current/bin/g…") In guix/ui.scm: 2206:7 13 (run-guix . _) 2169:10 12 (run-guix-command _ . _) In ice-9/boot-9.scm: 1752:10 11 (with-exception-handler _ _ #:unwind? _ # _) 1752:10 10 (with-exception-handler _ _ #:unwind? _ # _) In guix/store.scm: 658:37 9 (thunk) 1320:8 8 (call-with-build-handler _ _) 1320:8 7 (call-with-build-handler # …) In guix/status.scm: 800:4 6 (call-with-status-report _ _) In guix/scripts/environment.scm: 951:12 5 (_) In guix/store.scm: 2119:24 4 (run-with-store # …) In guix/scripts/environment.scm: 521:35 3 (_ _) In unknown file: 2 (string=? ("PS1" . "${debian_chroot:+($debian_chroot)…") …) In ice-9/boot-9.scm: 1685:16 1 (raise-exception _ #:continuable? _) 1685:16 0 (raise-exception _ #:continuable? _) ice-9/boot-9.scm:1685:16: In procedure raise-exception: In procedure string=: Wrong type argument in position 1 (expecting string): ("PS1" . "${debian_chroot:+($debian_chroot)}\\[\\033[01;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]${EXTRA}\\$ ") user@popigai:~$ --8<---------------cut here---------------end--------------->8--- This is because the match pattern doesn’t expect `(vhash-assoc "PS1" actual)` to return a pair. * guix/scripts/environment.scm (validate-child-shell-environment): Change match pattern to expect a pair. --- guix/scripts/environment.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: 893a31ec20f47b979c1be9fb8b942809228ba4c9 diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index 8176de4a5e8c..821f20e2f223 100644 --- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm @@ -517,7 +517,7 @@ (define-syntax-rule (warn exp ...) (unless warned? (match (vhash-assoc "PS1" actual) (#f #f) - (str + ((_ . str) (when (and (getenv "PS1") (string=? str (getenv "PS1"))) (warning (G_ "'PS1' is the same in sub-shell~%")) (display-hint (G_ "Consider setting a different prompt for