From: "Ludovic Courtès" <ludo@gnu.org>
To: 60365@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#60365] [PATCH 4/4] environment: Avoid false positive on 'PS1' check.
Date: Tue, 27 Dec 2022 22:26:18 +0100 [thread overview]
Message-ID: <20221227212618.18063-4-ludo@gnu.org> (raw)
In-Reply-To: <20221227212618.18063-1-ludo@gnu.org>
* 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
next prev parent reply other threads:[~2022-12-27 21:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-27 21:23 [bug#60365] [PATCH 0/4] Rationalize 'PS1' handling in home, system, and shell Ludovic Courtès
2022-12-27 21:26 ` [bug#60365] [PATCH 1/4] system, home: Factorize default '.bashrc' Ludovic Courtès
2022-12-27 21:26 ` [bug#60365] [PATCH 2/4] system: Define default 'PS1' in /etc/bashrc rather than ~/.bashrc Ludovic Courtès
2022-12-27 21:26 ` [bug#60365] [PATCH 3/4] environment: Simplify 'PS1' suggestion on '--check' Ludovic Courtès
2022-12-27 21:26 ` Ludovic Courtès [this message]
2022-12-28 7:23 ` [bug#60365] [PATCH 0/4] Rationalize 'PS1' handling in home, system, and shell Andrew Tropin
2023-01-03 22:46 ` Ludovic Courtès
2023-01-04 6:00 ` Andrew Tropin
2023-01-05 14:20 ` bug#60365: " Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221227212618.18063-4-ludo@gnu.org \
--to=ludo@gnu.org \
--cc=60365@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).