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: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#60365: closed ([PATCH 0/4] Rationalize 'PS1' handling in
 home, system, and shell)
Date: Thu, 05 Jan 2023 14:21:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Thu, 05 Jan 2023 15:20:13 +0100
with message-id <87v8ll2hcy.fsf_-_ <at> gnu.org>
and subject line Re: bug#60365: [PATCH 0/4] Rationalize 'PS1' handling in home, system, and shell
has caused the debbugs.gnu.org bug report #60365,
regarding [PATCH 0/4] Rationalize 'PS1' handling in home, system, and shell
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
60365: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60365
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ludovic Courtès <ludo <at> gnu.org>
To: guix-patches <at> gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>
Subject: [PATCH 0/4] Rationalize 'PS1' handling in home, system, and shell
Date: Tue, 27 Dec 2022 22:23:42 +0100
Hello!

I found some things could be improved in how we deal with ‘PS1’ in
Guix Home, Guix System, and ‘guix shell’ (my initial motivation was
making it easy to change ‘PS1’ from a Home configuration).

These patches fiddle with ‘PS1’.  The most visible effect is that
Guix Home’s ~/.bashrc will no longer provide a default ‘PS1’.

Thoughts?

Ludo’.

Ludovic Courtès (4):
  system, home: Factorize default '.bashrc'.
  system: Define default 'PS1' in /etc/bashrc rather than ~/.bashrc.
  environment: Simplify 'PS1' suggestion on '--check'.
  environment: Avoid false positive on 'PS1' check.

 gnu/home/services/shells.scm | 41 +++---------------------------------
 gnu/system.scm               |  3 +++
 gnu/system/shadow.scm        | 33 +++++++++++++----------------
 guix/scripts/environment.scm | 12 ++++++-----
 4 files changed, 28 insertions(+), 61 deletions(-)


base-commit: 9369c1ccf47d9bf6f2e28a9454c1c329a2044f19
prerequisite-patch-id: aae3af39aa7753dd7ed6d0584587a06d51402386
-- 
2.38.1



[Message part 3 (message/rfc822, inline)]
From: Ludovic Courtès <ludo <at> gnu.org>
To: Andrew Tropin <andrew <at> trop.in>
Cc: 60365-done <at> debbugs.gnu.org
Subject: Re: bug#60365: [PATCH 0/4] Rationalize 'PS1' handling in home,
 system, and shell
Date: Thu, 05 Jan 2023 15:20:13 +0100
Andrew Tropin <andrew <at> trop.in> skribis:

> On 2023-01-03 23:46, Ludovic Courtès wrote:

[...]

>>> Not sure about moving PS1 to /etc/bashrc as it won't work on foreign
>>> distros and guix environment won't be noticable in the prompt.  Warning
>>> is useful, but I would expect prompt work OOB, when guix-defualts? is
>>> #t.
>>
>> Yes, you’re right.
>>
>>> The possible alternative solution is to factorize bash_profile and put
>>> PS1 here, so both skeleton and home provided bashrc have it, after that
>>> setting PS1 with environment-variables field will start working.
>>
>> How about this:
>>
>> diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm
>> index d7dd579293..8d7db6b774 100644
>> --- a/gnu/home/services/shells.scm
>> +++ b/gnu/home/services/shells.scm
>> @@ -407,6 +407,9 @@ (define* (file-if-not-empty field #:optional (extra-content #f))
>>  # Honor per-interactive-shell startup file
>>  if [ -f ~/.bashrc ]; then source ~/.bashrc; fi
>>  "
>> +        (if (home-bash-configuration-guix-defaults? config)
>> +            "export PS1=...\n"
>
> Yep, something like that should work.  Ideally, is to make
> %default-bash-profile or even more generic %default-profile and reuse it
> across system and home, but it may be not that trivial, so we can
> postpone it for now.

I adjusted things as proposed and pushed:

  b5e3701f1a environment: Avoid false positive on 'PS1' check.
  632e2f7ce1 environment: Simplify 'PS1' suggestion on '--check'.
  086df6ef21 system: Define default 'PS1' in /etc/bashrc rather than ~/.bashrc.
  2127e56bd8 system, home: Factorize default '.bashrc'.

Thanks!

Ludo’.


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.