GNU bug report logs - #60365
[PATCH 0/4] Rationalize 'PS1' handling in home, system, and shell

Previous Next

Package: guix-patches;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Tue, 27 Dec 2022 21:25:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: 60365 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>
Subject: [bug#60365] [PATCH 4/4] environment: Avoid false positive on 'PS1' check.
Date: Tue, 27 Dec 2022 22:26:18 +0100
* guix/scripts/environment.scm (validate-child-shell-environment): Do
not warn when 'PS1' refers to 'GUIX_ENVIRONMENT'.
---
 guix/scripts/environment.scm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index bdbfa03fcf..c7fd8fd340 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -601,7 +601,12 @@ (define-syntax-rule (warn exp ...)
       (match (vhash-assoc "PS1" actual)
         (#f #f)
         ((_ . str)
-         (when (and (getenv "PS1") (string=? str (getenv "PS1")))
+         (when (and (getenv "PS1") (string=? str (getenv "PS1"))
+
+                    ;; 'PS1' might be conditional on 'GUIX_ENVIRONMENT', as
+                    ;; shown in the hint below.
+                    (not (or (string-contains str "$GUIX_ENVIRONMENT")
+                             (string-contains str "${GUIX_ENVIRONMENT"))))
            (warning (G_ "'PS1' is the same in sub-shell~%"))
            (display-hint (G_ "Consider setting a different prompt for
 environment shells to make them distinguishable.
-- 
2.38.1





This bug report was last modified 2 years and 140 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.