GNU bug report logs - #70205
[PATCH] home: services: bash: Move default PS1 prompt to bashrc

Previous Next

Package: guix-patches;

Reported by: Richard Sent <richard <at> freakingpenguin.com>

Date: Thu, 4 Apr 2024 22:56:02 UTC

Severity: normal

Tags: patch

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

To reply to this bug, email your comments to 70205 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to , guix-patches <at> gnu.org:
bug#70205; Package guix-patches. (Thu, 04 Apr 2024 22:56:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Richard Sent <richard <at> freakingpenguin.com>:
New bug report received and forwarded. Copy sent to , guix-patches <at> gnu.org. (Thu, 04 Apr 2024 22:56:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Richard Sent <richard <at> freakingpenguin.com>
To: guix-patches <at> gnu.org
Cc: Richard Sent <richard <at> freakingpenguin.com>
Subject: [PATCH] home: services: bash: Move default PS1 prompt to bashrc
Date: Thu,  4 Apr 2024 18:53:27 -0400
Reported in <https://issues.guix.gnu.org/70164>.

* home/services/shells.scm (add-bash-configuration): Move default PS1 prompt
from .bash_profile to .bashrc.

Change-Id: Ic437458ee362cc4aa803a71c9962af866749f59a
---
Hi Guix!

See the issue mentioned in the commit message for the motivation for
this patch.

 gnu/home/services/shells.scm | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm
index 8fd1668b59..a5b2586dde 100644
--- a/gnu/home/services/shells.scm
+++ b/gnu/home/services/shells.scm
@@ -415,14 +415,6 @@ (define (add-bash-configuration config)
 if [ -f ~/.bashrc ]; then source ~/.bashrc; fi
 "
 
-        ;; The host distro might provide a bad 'PS1' default--e.g., not taking
-        ;; $GUIX_ENVIRONMENT into account.  Provide a good default here when
-        ;; asked to.  The default can be overridden below via
-        ;; 'environment-variables'.
-        (if (home-bash-configuration-guix-defaults? config)
-            "PS1='\\u@\\h \\w${GUIX_ENVIRONMENT:+ [env]}\\$ '\n"
-            "")
-
         (serialize-field 'bash-profile)
         (serialize-field 'environment-variables)))
 
@@ -430,6 +422,10 @@ (define (add-bash-configuration config)
               'bashrc
               (if (home-bash-configuration-guix-defaults? config)
                   (list (plain-file-content %default-bashrc)
+                        ;; The host distro might provide a bad 'PS1'
+                        ;; default--e.g., not taking $GUIX_ENVIRONMENT into
+                        ;; account.  Provide a good default here when asked.
+                        "PS1='\\u@\\h \\w${GUIX_ENVIRONMENT:+ [env]}\\$ '"
                         (serialize-field 'aliases))
                   (list (serialize-field 'aliases))))
              (file-if-not-empty 'bash-logout)))))

base-commit: ade6845da6cec99f3bca46faac9b2bad6877817e
-- 
2.41.0





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Mon, 29 Apr 2024 21:55:02 GMT) Full text and rfc822 format available.

Notification sent to Richard Sent <richard <at> freakingpenguin.com>:
bug acknowledged by developer. (Mon, 29 Apr 2024 21:55:02 GMT) Full text and rfc822 format available.

Message #10 received at 70205-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Richard Sent <richard <at> freakingpenguin.com>
Cc: 70205-done <at> debbugs.gnu.org, paren <at> disroot.org,
 Tanguy Le Carrour <tanguy <at> bioneland.org>, Andrew Tropin <andrew <at> trop.in>,
 70164-done <at> debbugs.gnu.org
Subject: Re: [bug#70205] [PATCH] home: services: bash: Move default PS1
 prompt to bashrc
Date: Mon, 29 Apr 2024 23:53:54 +0200
[Message part 1 (text/plain, inline)]
Hi Richard,

Richard Sent <richard <at> freakingpenguin.com> skribis:

> Reported in <https://issues.guix.gnu.org/70164>.
>
> * home/services/shells.scm (add-bash-configuration): Move default PS1 prompt
> from .bash_profile to .bashrc.
>
> Change-Id: Ic437458ee362cc4aa803a71c9962af866749f59a

Sounds reasonable to me; thanks for the clear explanation in
<https://issues.guix.gnu.org/70164>.

There was one missing newline before aliases so I made the following
change (adding two newlines, for good measure).

Applied, thanks!

Ludo’.

[Message part 2 (text/x-patch, inline)]
diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm
index a5b2586dde..ee6b09f17c 100644
--- a/gnu/home/services/shells.scm
+++ b/gnu/home/services/shells.scm
@@ -421,11 +421,11 @@ (define (add-bash-configuration config)
      ,@(list (file-if-not-empty
               'bashrc
               (if (home-bash-configuration-guix-defaults? config)
-                  (list (plain-file-content %default-bashrc)
+                  (list (plain-file-content %default-bashrc) "\n"
                         ;; The host distro might provide a bad 'PS1'
                         ;; default--e.g., not taking $GUIX_ENVIRONMENT into
                         ;; account.  Provide a good default here when asked.
-                        "PS1='\\u@\\h \\w${GUIX_ENVIRONMENT:+ [env]}\\$ '"
+                        "PS1='\\u@\\h \\w${GUIX_ENVIRONMENT:+ [env]}\\$ '\n"
                         (serialize-field 'aliases))
                   (list (serialize-field 'aliases))))
              (file-if-not-empty 'bash-logout)))))

This bug report was last modified 4 days ago.

Previous Next


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