From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 27 16:24:03 2022 Received: (at submit) by debbugs.gnu.org; 27 Dec 2022 21:24:03 +0000 Received: from localhost ([127.0.0.1]:56586 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pAHQZ-0007nU-Bo for submit@debbugs.gnu.org; Tue, 27 Dec 2022 16:24:03 -0500 Received: from lists.gnu.org ([209.51.188.17]:46492) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pAHQY-0007nA-1D for submit@debbugs.gnu.org; Tue, 27 Dec 2022 16:24:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pAHQX-0000kQ-Qe for guix-patches@gnu.org; Tue, 27 Dec 2022 16:24:01 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pAHQX-0003D1-AM; Tue, 27 Dec 2022 16:24:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=sZwX1fJ+dcPpPRPn6A81TuwIlDXxI8I6IXofP1f55ZI=; b=iay6vTRpEsYy/8 nWIgVfiHh0MY/REwFRIr0qnom1iyDVol3j+LEEfJrIolE2N+B2h4Lx1cKfB5oDs9OohNZyIy/3hva 7adGfEuj6oGSEBm8jEjmt7JRnsAPjLwu8D+1YzjFgONk1hCMD96t5gJArKa6NipxcZUNfUcyXrk6i CyqCrnmngzBAh2QC9Vatyy+3K2MkP91AmYf2T0PXSBsZakqiQjSCImxkU8XiFcEYguojpJ0BKA4HK C5FeMeaK+fLzG3y4aPDf6JPTJZp1Lu9kNuJ6ZGqUxWRD+mnCuveQqscXNlZM3puor6hx7LDyJgbt8 zpBx/XSY8IGnwX7JiBxA==; Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pAHQW-0006gW-U0; Tue, 27 Dec 2022 16:24:01 -0500 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: guix-patches@gnu.org Subject: [PATCH 0/4] Rationalize 'PS1' handling in home, system, and shell Date: Tue, 27 Dec 2022 22:23:42 +0100 Message-Id: <20221227212342.17939-1-ludo@gnu.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) 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 From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 27 16:26:35 2022 Received: (at 60365) by debbugs.gnu.org; 27 Dec 2022 21:26:35 +0000 Received: from localhost ([127.0.0.1]:56601 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pAHT0-0007rv-77 for submit@debbugs.gnu.org; Tue, 27 Dec 2022 16:26:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52330) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pAHSy-0007rb-U1 for 60365@debbugs.gnu.org; Tue, 27 Dec 2022 16:26:33 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pAHSt-0003wx-I0; Tue, 27 Dec 2022 16:26:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=yzRijfcOpOS3yxSmBXg9a+6cJjQVJGLS+CDH/FpIX4c=; b=Omon+9Qeph2F4K y3b/Ij70aVFyjVY3YVPVGwG+3nT7slUbz8rf637DNRjhLiiOHeTbbgvvv8OMWNqQB3NbCDyuzF7ue hmvmuExEqHD/L71wGyhORWKtN+krB69bbpRRXYIjOPcVCxajVoMs4wQfQjOn1fpX0ix2D7DP81GRB 02c627uNgrRCGUNxDn6V/hyrSo2z5ppI4fGoRE3Mh0s+TSH1ge5pmO12S/0gd4W2/wi0qijNM/rxV SONWj5YhwaeyuZwD2Ulx3JBtLHTF9PWpJQdgwmUlv7fbL16QUhGFlnAyeb994g/ws70HG2tgUlp82 UieeLTu2KalxXaFgUnCg==; Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pAHSt-0007DL-6G; Tue, 27 Dec 2022 16:26:27 -0500 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 60365@debbugs.gnu.org Subject: [PATCH 1/4] system, home: Factorize default '.bashrc'. Date: Tue, 27 Dec 2022 22:26:15 +0100 Message-Id: <20221227212618.18063-1-ludo@gnu.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60365 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * gnu/system/shadow.scm (%default-bashrc): New variable. Source /etc/bashrc only if it exists. (default-skeletons): Use it. * gnu/home/services/shells.scm (guix-bashrc): Remove. (add-bash-configuration): Refer to '%default-bashrc' instead. --- gnu/home/services/shells.scm | 41 +++--------------------------------- gnu/system/shadow.scm | 26 +++++++++++++---------- 2 files changed, 18 insertions(+), 49 deletions(-) diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm index b529c8e798..d7dd579293 100644 --- a/gnu/home/services/shells.scm +++ b/gnu/home/services/shells.scm @@ -19,6 +19,7 @@ (define-module (gnu home services shells) #:use-module (gnu services configuration) + #:autoload (gnu system shadow) (%default-bashrc) #:use-module (gnu home services utils) #:use-module (gnu home services) #:use-module (gnu packages shells) @@ -370,43 +371,6 @@ (define-configuration home-bash-configuration won't be read in some cases (if the shell terminates by exec'ing another process for example).")) -;; TODO: Use value from (gnu system shadow) -(define guix-bashrc - "\ -# Bash initialization for interactive non-login shells and -# for remote shells (info \"(bash) Bash Startup Files\"). - -# Export 'SHELL' to child processes. Programs such as 'screen' -# honor it and otherwise use /bin/sh. -export SHELL - -if [[ $- != *i* ]] -then - # We are being invoked from a non-interactive shell. If this - # is an SSH session (as in \"ssh host command\"), source - # /etc/profile so we get PATH and other essential variables. - [[ -n \"$SSH_CLIENT\" ]] && source /etc/profile - - # Don't do anything else. - return -fi - -# Source the system-wide file. -if [[ -e /etc/bashrc ]]; then - source /etc/bashrc -fi - -# Adjust the prompt depending on whether we're in 'guix environment'. -if [ -n \"$GUIX_ENVIRONMENT\" ] -then - PS1='\\u@\\h \\w [env]\\$ ' -else - PS1='\\u@\\h \\w\\$ ' -fi -alias ls='ls -p --color=auto' -alias ll='ls -l' -alias grep='grep --color=auto'\n") - (define (add-bash-configuration config) (define (filter-fields field) (filter-configuration-fields home-bash-configuration-fields @@ -449,7 +413,8 @@ (define* (file-if-not-empty field #:optional (extra-content #f)) ,@(list (file-if-not-empty 'bashrc (if (home-bash-configuration-guix-defaults? config) - (list (serialize-field 'aliases) guix-bashrc) + (list (serialize-field 'aliases) + (plain-file-content %default-bashrc)) (list (serialize-field 'aliases)))) (file-if-not-empty 'bash-logout))))) diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index 59f0a02c8b..4360a5ebd1 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès +;;; Copyright © 2013-2020, 2022 Ludovic Courtès ;;; Copyright © 2016 Alex Griffin ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; Copyright © 2020 Efraim Flashner @@ -63,7 +63,8 @@ (define-module (gnu system shadow) user-group-id user-group-system?) - #:export (default-skeletons + #:export (%default-bashrc + default-skeletons skeleton-directory %base-groups %base-user-accounts @@ -118,14 +119,8 @@ (define %base-user-accounts (create-home-directory? #f) (system? #t)))) -(define (default-skeletons) - "Return the default skeleton files for /etc/skel. These files are copied by -'useradd' in the home directory of newly created user accounts." - - (let ((profile (plain-file "bash_profile" "\ -# Honor per-interactive-shell startup file -if [ -f ~/.bashrc ]; then . ~/.bashrc; fi\n")) - (bashrc (plain-file "bashrc" "\ +(define %default-bashrc + (plain-file "bashrc" "\ # Bash initialization for interactive non-login shells and # for remote shells (info \"(bash) Bash Startup Files\"). @@ -145,7 +140,7 @@ (define (default-skeletons) fi # Source the system-wide file. -source /etc/bashrc +[ -f /etc/bashrc ] && source /etc/bashrc # Adjust the prompt depending on whether we're in 'guix environment'. if [ -n \"$GUIX_ENVIRONMENT\" ] @@ -157,6 +152,15 @@ (define (default-skeletons) alias ls='ls -p --color=auto' alias ll='ls -l' alias grep='grep --color=auto'\n")) + +(define (default-skeletons) + "Return the default skeleton files for /etc/skel. These files are copied by +'useradd' in the home directory of newly created user accounts." + + (let ((profile (plain-file "bash_profile" "\ +# Honor per-interactive-shell startup file +if [ -f ~/.bashrc ]; then . ~/.bashrc; fi\n")) + (bashrc %default-bashrc) (zprofile (plain-file "zprofile" "\ # Honor system-wide environment variables source /etc/profile\n")) -- 2.38.1 From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 27 16:26:39 2022 Received: (at 60365) by debbugs.gnu.org; 27 Dec 2022 21:26:39 +0000 Received: from localhost ([127.0.0.1]:56605 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pAHT4-0007sI-W2 for submit@debbugs.gnu.org; Tue, 27 Dec 2022 16:26:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52338) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pAHSz-0007rd-Kg for 60365@debbugs.gnu.org; Tue, 27 Dec 2022 16:26:33 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pAHSu-0003x5-EH; Tue, 27 Dec 2022 16:26:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=T9FJTiQCJAUcBzfAWXqDxlNDP/o4zwVmF0cpNlhwJ8Q=; b=QklAT+fXUPixWfOagNMN yIWGT4EeaC5KYTlmJ4ynJ31FQEhL/3xOKTtWg/j87BWMDCnX2bkl5aQPWRmuuHBcxXXk39CJvdDkz JTxevY5K9AQjf5p+fqyez1at2OGKzMeAo4GlIu8N/r7tyTuQgq969qpNkGwf0XIRnf5ACO+bhqcTA 23J8bc7hQNNbpwhl6WydDBl7Gaf4apJImW23RiXAnVLXUFAKLliaNrWcwjfiNqg1J2PCTcjfnZ8nV l6C+Ie/5XAWb+V01fTDxiQdP49oA/1XS1uDtsa5Hc2el6EL8uk7JgBvaMkNdq9gcEaNmrVswxip0n DW8fBqjqcmahAQ==; Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pAHSt-0007DL-Pf; Tue, 27 Dec 2022 16:26:27 -0500 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 60365@debbugs.gnu.org Subject: [PATCH 2/4] system: Define default 'PS1' in /etc/bashrc rather than ~/.bashrc. Date: Tue, 27 Dec 2022 22:26:16 +0100 Message-Id: <20221227212618.18063-2-ludo@gnu.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221227212618.18063-1-ludo@gnu.org> References: <20221227212618.18063-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60365 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Users can override 'PS1' in ~/.bashrc if they wish. Previously, on Guix Home, the "default" 'PS1' would be set in ~/.bashrc when 'home-bash-configuration-guix-defaults?' is true, preventing users from overriding it via the 'environment-variables' field of 'home-bash-extension'. * gnu/system/shadow.scm (%default-bashrc): Remove 'PS1' setting. * gnu/system.scm (operating-system-etc-service): Define PS1 in /etc/bashrc. --- gnu/system.scm | 3 +++ gnu/system/shadow.scm | 7 ------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/gnu/system.scm b/gnu/system.scm index 62c8e0c2b6..d67f9a615b 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -1047,6 +1047,9 @@ (define* (operating-system-etc-service os) (bashrc (plain-file "bashrc" "\ # Bash-specific initialization. +# Provide a default prompt. The user's ~/.bashrc can override it. +PS1='\\u@\\h \\w${GUIX_ENVIRONMENT:+ [env]}\\$ ' + # The 'bash-completion' package. if [ -f /run/current-system/profile/etc/profile.d/bash_completion.sh ] then diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index 4360a5ebd1..2e87928368 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -142,13 +142,6 @@ (define %default-bashrc # Source the system-wide file. [ -f /etc/bashrc ] && source /etc/bashrc -# Adjust the prompt depending on whether we're in 'guix environment'. -if [ -n \"$GUIX_ENVIRONMENT\" ] -then - PS1='\\u@\\h \\w [env]\\$ ' -else - PS1='\\u@\\h \\w\\$ ' -fi alias ls='ls -p --color=auto' alias ll='ls -l' alias grep='grep --color=auto'\n")) -- 2.38.1 From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 27 16:26:39 2022 Received: (at 60365) by debbugs.gnu.org; 27 Dec 2022 21:26:40 +0000 Received: from localhost ([127.0.0.1]:56607 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pAHT5-0007sL-D3 for submit@debbugs.gnu.org; Tue, 27 Dec 2022 16:26:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52352) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pAHT0-0007re-0C for 60365@debbugs.gnu.org; Tue, 27 Dec 2022 16:26:34 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pAHSu-0003xL-Pr; Tue, 27 Dec 2022 16:26:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=8Uc6z+g0WAoQdqJjLWT0uDgMYuY++02kgtRDtvfWg9A=; b=HZbdTSiBN8NDZajBzSCd d5hqywRvA/SGh8kXgL3T29lzWcPbyW2VH7OHF7+HSt2uxSe7i1CW3XKiAr3pyzlVOSKCdFPaT+xas yw4PibDpdiZHG0mTYKrLTAuwfoZeCxqhGTMxhGluRLuJtFyfjYqIRpVjQ/TPirFKwkfDe5uMfHeNa dUj90u0GgHk/NQzwiimKsfvRG0PsV4qMG09Htih9m/DTVLLg7Co7lLVAyA+SXllU6Lfixdn/UpPoH mlpW1KB1h44M5/Mh2xAG+s1/g2UuOZB4rZrehFNeNQDl2MORcQ5YbqfRkHW2FZbkgXSueOAZFaYC4 loFYpbOZ+evLpA==; Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pAHSu-0007DL-Cs; Tue, 27 Dec 2022 16:26:28 -0500 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 60365@debbugs.gnu.org Subject: [PATCH 3/4] environment: Simplify 'PS1' suggestion on '--check'. Date: Tue, 27 Dec 2022 22:26:17 +0100 Message-Id: <20221227212618.18063-3-ludo@gnu.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221227212618.18063-1-ludo@gnu.org> References: <20221227212618.18063-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60365 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * guix/scripts/environment.scm (validate-child-shell-environment): In 'PS1' suggestion, remove 'export' and avoid 'if'. --- guix/scripts/environment.scm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index ab11b35335..bdbfa03fcf 100644 --- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm @@ -610,10 +610,7 @@ (define-syntax-rule (warn exp ...) @file{~/.bashrc}: @example -if [ -n \"$GUIX_ENVIRONMENT\" ] -then - export PS1=\"\\u@@\\h \\w [env]\\$ \" -fi +PS1='\\u@@\\h \\w${GUIX_ENVIRONMENT:+ [env]}\\$ ' @end example ")))))) -- 2.38.1 From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 27 16:26:40 2022 Received: (at 60365) by debbugs.gnu.org; 27 Dec 2022 21:26:40 +0000 Received: from localhost ([127.0.0.1]:56609 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pAHT5-0007sS-RU for submit@debbugs.gnu.org; Tue, 27 Dec 2022 16:26:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52368) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pAHT0-0007rg-Jd for 60365@debbugs.gnu.org; Tue, 27 Dec 2022 16:26:34 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pAHSv-0003xU-Cz; Tue, 27 Dec 2022 16:26:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=mFnGOYrRMxmh7l+dvRYR9J5Hwr/OR0s9vi0mN6SICo0=; b=UtZdI3nlYlHVCiBz3c5b WPM2cHU3TBxVz7ofkp/O/1+z/HLG3T9zlc4gnoJCDrcqLQNfXlpge54XNtgcTtiwCRipytW2t56EY 0vZtBR/rT4jkKVBGAfCJ0KdCQfJERA3dYOUxUr3EKOu/AP6wNg0ij0xhk0LXSZBZxVGbx5x/kbTgN OzXyFVuo4EbUk+SYVBd8cJOpN9IVJNtj6k9wl7+TmltL5NuuDxtaTYCmP0cB3lICGmgbdcCL1Jx80 ex06igMTWRdwfpSlN7WiE4iIbKzcsH/PdUAi8lPL+vwRCFLeTIfJt6/ID2o4i2KnV411MSwfYVecK OBtZSt9h6HG4GQ==; Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pAHSv-0007DL-1C; Tue, 27 Dec 2022 16:26:29 -0500 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 60365@debbugs.gnu.org Subject: [PATCH 4/4] environment: Avoid false positive on 'PS1' check. Date: Tue, 27 Dec 2022 22:26:18 +0100 Message-Id: <20221227212618.18063-4-ludo@gnu.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221227212618.18063-1-ludo@gnu.org> References: <20221227212618.18063-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60365 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * 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 From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 28 02:23:15 2022 Received: (at 60365) by debbugs.gnu.org; 28 Dec 2022 07:23:16 +0000 Received: from localhost ([127.0.0.1]:57024 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pAQmR-0006xz-JG for submit@debbugs.gnu.org; Wed, 28 Dec 2022 02:23:15 -0500 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:34873) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pAQmP-0006xl-R2 for 60365@debbugs.gnu.org; Wed, 28 Dec 2022 02:23:14 -0500 Received: (Authenticated sender: andrew@trop.in) by mail.gandi.net (Postfix) with ESMTPSA id 07477C000B; Wed, 28 Dec 2022 07:23:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=gm1; t=1672212187; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+8uEQcbSe/WxIdeseGdnqtzEwby7B3BNiQsCkz9guTM=; b=FQm6+T4iu1rEfTLjRKN/de/+Dm/uTHCCBkmHAb3VB2WCUsMrPdPxxhpvIkS86LS0NAq3/o M6L/3UF2QWaGBxxfOpnw6VV2OxIcj7NOYqNB15E4aOEJ0+IrUJ4gBcSftiFynNfex85vS0 Xv2f9u6dXfAgMbvaOb51obiBQlD+PleVCNHgEybpsabrkKUh9gvD6g0XNI/DKtD5Cv8uLV IghxRiag2Z561reYS2iPGNWEhH8xncGiXFExTb1DMXn6QsFwF+j17f7mPd3UPTJOjguWG5 XqaJ1no8BpcXmABogdw7u6P6h4zb/g8OJhFq7CC2ZfdJQk2b/IEbx3nlWp1s9A== From: Andrew Tropin To: Ludovic =?utf-8?Q?Court=C3=A8s?= , 60365@debbugs.gnu.org Subject: Re: [bug#60365] [PATCH 0/4] Rationalize 'PS1' handling in home, system, and shell In-Reply-To: <20221227212342.17939-1-ludo@gnu.org> References: <20221227212342.17939-1-ludo@gnu.org> Date: Wed, 28 Dec 2022 11:23:03 +0400 Message-ID: <87v8lwf0vc.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60365 Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2022-12-27 22:23, Ludovic Court=C3=A8s wrote: > Hello! > Hi Ludovic! > I found some things could be improved in how we deal with =E2=80=98PS1=E2= =80=99 in > Guix Home, Guix System, and =E2=80=98guix shell=E2=80=99 (my initial moti= vation was > making it easy to change =E2=80=98PS1=E2=80=99 from a Home configuration). > > These patches fiddle with =E2=80=98PS1=E2=80=99. The most visible effect= is that > Guix Home=E2=80=99s ~/.bashrc will no longer provide a default =E2=80=98P= S1=E2=80=99. > > Thoughts? Factorization of bashrc is great! 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. 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. > > Ludo=E2=80=99. > > Ludovic Court=C3=A8s (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 =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmOr7tcACgkQIgjSCVjB 3rC3DQ/9EbUwBi+Co39BP1nnHczQ/Fj+BxVXAQP/PMRqS/LIBFShTMB+GpHhQpEK gKeUWFt31sWD2vO1Go9Rp7yMm3rZTtzxP8C7Xm/Yzk+UQ5qfHKjIcu7L/pBkAQX8 Que+jKJBCzqo1m2vKf/ojx6vEvCqId5rYe3jpzfuecIhdUOE3PCnWdzYGxK/XqCe Ap7Jk/JRTpNAisbaDZ47KgspbbxWtXbbxpgmZvCY9GF78bSQCJKoLVlkKQCx/ldl qsF+UpOiKxexcY+KDaGkaH+EX3Czby/wfKgF89fhLkDsBcfWc8HV8i3bq04Jd3Uc 3T+bfY3h2oX8VRsTFByey7ED2yyWkpfpQW8aqw8wpYvf3L2rYlN3NqPKWpw0iB/E RcBFpwBaBecxVIpytjGyKWyHZvaJ9nuqiW02/McZPCbdKfvkjhiyhfAo8fjGSPHG CHpUu/FnGaO5qqvQEx+7a0h5Muo4hrcXztqKwErOq1JrB73kpDnJXNFAkoOxZej+ WWCVLa+BfHYcPXUC3gpQf1zXHhp8UA/OvEBMsh+RED8/iXXnVYIamp1yDu61hbs/ FDYSdoXYfkWaTeT3/NkP4EsyDvJ9F0TI95THD29889wanDAytk1IIntQXmMy1vVW h3/0kqhIX3tg8f/yXdYqPUAxx6UMXsztPl1t1QfziuFHq/qPQa4= =kSH8 -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 03 17:47:05 2023 Received: (at 60365) by debbugs.gnu.org; 3 Jan 2023 22:47:05 +0000 Received: from localhost ([127.0.0.1]:47037 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pCq3l-0004c4-Gx for submit@debbugs.gnu.org; Tue, 03 Jan 2023 17:47:05 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35176) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pCq3j-0004b9-05 for 60365@debbugs.gnu.org; Tue, 03 Jan 2023 17:47:04 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pCq3d-0002lC-IC; Tue, 03 Jan 2023 17:46:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=hWlmL8DdtWYtUrdJeGPBS4d00bfXIELki8q5/CdRgiI=; b=ZD6w05YVpkxj9Ugre0IX 0dr+EPcfwcdGGevJ/fC0olDqf1vKjQHRC8SvHkaBpWbMOS/r5Xco67daf7y9mevvjJlgXcYUeJub9 2WBF6Y8cDXQGO+UIW1TI99PLHOJvYtZwO0TmRO4/gHIP7KR1NtOSRPJlk6K0rB59B/7tNTKrK6mvw e2eX148LQPzQWUJjd0EFFNQ909wjopDok74V+1yycc6fMuFf0+Juc4VRVwYzVXh5WKREl/r5qwR1R tkLOyUjAIGlSOKgE4hQol8mF1e7bnhan8+xXY8vi/ryZRzmvBMBgUDWSry4VgCxdfrlFn5wZ24w8l JcNK5QOsX0F0nQ==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pCq3b-0006Xt-SM; Tue, 03 Jan 2023 17:46:57 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Andrew Tropin Subject: Re: bug#60365: [PATCH 0/4] Rationalize 'PS1' handling in home, system, and shell References: <20221227212342.17939-1-ludo@gnu.org> <87v8lwf0vc.fsf@trop.in> Date: Tue, 03 Jan 2023 23:46:53 +0100 In-Reply-To: <87v8lwf0vc.fsf@trop.in> (Andrew Tropin's message of "Wed, 28 Dec 2022 11:23:03 +0400") Message-ID: <878rij6xsy.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60365 Cc: 60365@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Andrew! Andrew Tropin skribis: >> I found some things could be improved in how we deal with =E2=80=98PS1= =E2=80=99 in >> Guix Home, Guix System, and =E2=80=98guix shell=E2=80=99 (my initial mot= ivation was >> making it easy to change =E2=80=98PS1=E2=80=99 from a Home configuration= ). >> >> These patches fiddle with =E2=80=98PS1=E2=80=99. The most visible effec= t is that >> Guix Home=E2=80=99s ~/.bashrc will no longer provide a default =E2=80=98= PS1=E2=80=99. >> >> Thoughts? > > Factorization of bashrc is great! > > 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=E2=80=99re 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: --=-=-= Content-Type: text/x-patch Content-Disposition: inline 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" + "") (serialize-field 'bash-profile) (serialize-field 'environment-variables))) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable That way, if one adds =E2=80=98PS1=E2=80=99 to =E2=80=98environment-variabl= es=E2=80=99, that will override the default. WDYT? Thanks for your feedback! Ludo=E2=80=99. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 04 01:00:35 2023 Received: (at 60365) by debbugs.gnu.org; 4 Jan 2023 06:00:35 +0000 Received: from localhost ([127.0.0.1]:47362 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pCwpH-0001c7-AT for submit@debbugs.gnu.org; Wed, 04 Jan 2023 01:00:35 -0500 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:52865) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pCwpC-0001bi-GG for 60365@debbugs.gnu.org; Wed, 04 Jan 2023 01:00:34 -0500 Received: (Authenticated sender: andrew@trop.in) by mail.gandi.net (Postfix) with ESMTPSA id F380DC0006; Wed, 4 Jan 2023 06:00:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=gm1; t=1672812024; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8xYs+0pnMPpCVxIO85A7DZmP2Q66mgKw1zmrC3nQEtY=; b=nCScbfez0wXfQFxar8ESVxjUNRGBk4ktodeHwwOffcLZZgRjy8DAn+UvBHeD7VnpnjXPlF Z2yUMJSbMCbR41QwplZ9vrW/8FGewZ7rJ6TXLqlOUlfGPA6ElCtM4JO/1/GG6dFYr3AdeY m4qUoCZ1KQOUOmPy0t0DHwOcXuB1qHGwQFZGTNb78WTGyT2BgTw4VUquk2/Ox13rzEkibK +OH0PKEnqWucmLNZ6t9DCf7UcU+V+02CA7BKye4w0eVmhvhBhWvjZusMebw7FiBK3axk2Q 3NYonheWn3hEwNvkffPRBBcvIytZxorNuALEhuczoQxQrTbxM4SMdEubD1WXKg== From: Andrew Tropin To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: bug#60365: [PATCH 0/4] Rationalize 'PS1' handling in home, system, and shell In-Reply-To: <878rij6xsy.fsf_-_@gnu.org> References: <20221227212342.17939-1-ludo@gnu.org> <87v8lwf0vc.fsf@trop.in> <878rij6xsy.fsf_-_@gnu.org> Date: Wed, 04 Jan 2023 10:00:18 +0400 Message-ID: <871qoac00d.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60365 Cc: 60365@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2023-01-03 23:46, Ludovic Court=C3=A8s wrote: > Hi Andrew! > > Andrew Tropin skribis: > >>> I found some things could be improved in how we deal with =E2=80=98PS1= =E2=80=99 in >>> Guix Home, Guix System, and =E2=80=98guix shell=E2=80=99 (my initial mo= tivation was >>> making it easy to change =E2=80=98PS1=E2=80=99 from a Home configuratio= n). >>> >>> These patches fiddle with =E2=80=98PS1=E2=80=99. The most visible effe= ct is that >>> Guix Home=E2=80=99s ~/.bashrc will no longer provide a default =E2=80= =98PS1=E2=80=99. >>> >>> Thoughts? >> >> Factorization of bashrc is great! >> >> 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=E2=80=99re 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-c= ontent #f)) > # Honor per-interactive-shell startup file > if [ -f ~/.bashrc ]; then source ~/.bashrc; fi > " > + (if (home-bash-configuration-guix-defaults? config) > + "export PS1=3D...\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. > + "") > (serialize-field 'bash-profile) > (serialize-field 'environment-variables))) >=20=20 > > That way, if one adds =E2=80=98PS1=E2=80=99 to =E2=80=98environment-varia= bles=E2=80=99, that will > override the default. > > WDYT? > > Thanks for your feedback! > > Ludo=E2=80=99. =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmO1FfIACgkQIgjSCVjB 3rCe/Q//a02e7/c43v864oZlCxfIs/u8NaFhyXjUM/rGR3RcNu99FkhXLDv69MDT vHWqKUTRhF0E79Qfe2JqNMqxvaAP9NfWorX3oRbjRIWaICXHxN6kEjW/0C2gexox XAVaFnPyh2G8UrI5rbMOxr74DYovsCXGv1KbAmTWvXZ53QNbkWR7EDIduf8dhF2W HmdYVqDHP/Xx6BLKEQuj06lQQ8mQxgkKaCGkBDtGTDIQsanaPMad/jIbMh3k3WFR eGkGKHoDQqGtsLyNknqeIFasHKlMQ2ojibtiw0puZMAcc38aRUH2Jf1C/NXnWwOX CmnxxYiv72S9vhnFsyzEONc8/ciILey79iOEwQFqt4llzjW/JISzHm0PRqQxBy7U xd8kkQ6vrOxB8LenAJG3Gl0G95NMXeK/KaKpisy1+2e0c11ALRN8LCvhJzqCIYPv ap1LDfkeujRPKmKeXSevrpPK5wKmdXWR0YOoIcgabu6dUuv4jO2gyPce4+eze45a bXVzcuctebkitadR/QMd5fVXLWXookA300R5SIZ3m8w4UgysqESXVw5yfMp/uSh0 MhZcuUllyFmlR9zhS27++vkF84ZsxKpcbR1nefFDJDxLqTW6cTwo9MOexDLb81Dr mSzNRSvl1iMw6V2CF1vhf48sNDQ0/FS0VbNBVv0BmOaD+nFSnz8= =OWJ6 -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 05 09:20:26 2023 Received: (at 60365-done) by debbugs.gnu.org; 5 Jan 2023 14:20:26 +0000 Received: from localhost ([127.0.0.1]:50559 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pDR6Y-0008G8-4a for submit@debbugs.gnu.org; Thu, 05 Jan 2023 09:20:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60444) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pDR6V-0008Fu-Vb for 60365-done@debbugs.gnu.org; Thu, 05 Jan 2023 09:20:24 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pDR6P-0007qz-5w; Thu, 05 Jan 2023 09:20:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=bdttlHJIB/srG5J8YIcLoRMkSV1HfIi/k00LdUu8Kds=; b=eYCGJo4zKfqK8pZ/cIXQ L0HZUgrksUMcn0MaHFXASK6cOUqJPkeJkXHHUfChXPaBWAecLE9bV4j821HkJ1CWCChoCe/7MiKWH rI/8Bj4hIo0rB7I6vB+aToIn7nx6WNMl5hE3gFof86b1QCkj+ZC9nv45K3Gb09nU7Sk4lHHxr3vtl HlP13Ai3L1pcVWFbYyC3VyCCnoBa/1Jrt8UWZY/qIxSDsepkYfr1l05R244PCnHhF76t+jyGAXgmd tOJIixAthmHVLvNkur+SDm8SiBgr4UeGQ6DVp8MSDlQI00NEsjgSijRUWBXt/QDzRYwQ50r93diW/ VAFixKcWnrTj4g==; Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pDR6N-0005AY-5z; Thu, 05 Jan 2023 09:20:16 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Andrew Tropin Subject: Re: bug#60365: [PATCH 0/4] Rationalize 'PS1' handling in home, system, and shell References: <20221227212342.17939-1-ludo@gnu.org> <87v8lwf0vc.fsf@trop.in> <878rij6xsy.fsf_-_@gnu.org> <871qoac00d.fsf@trop.in> Date: Thu, 05 Jan 2023 15:20:13 +0100 In-Reply-To: <871qoac00d.fsf@trop.in> (Andrew Tropin's message of "Wed, 04 Jan 2023 10:00:18 +0400") Message-ID: <87v8ll2hcy.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60365-done Cc: 60365-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Andrew Tropin skribis: > On 2023-01-03 23:46, Ludovic Court=C3=A8s 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=E2=80=99re 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=3D...\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 ~/.bas= hrc. 2127e56bd8 system, home: Factorize default '.bashrc'. Thanks! Ludo=E2=80=99. From unknown Sun Jun 22 22:44:35 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 03 Feb 2023 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator