GNU bug report logs - #76082
[PATCH 0/9] Improve profile initialization on foreign distros plus misc improvements

Previous Next

Package: guix-patches;

Reported by: Liam Hupfer <liam <at> hpfr.net>

Date: Thu, 6 Feb 2025 04:09: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


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

From: Liam Hupfer <liam <at> hpfr.net>
To: 76082 <at> debbugs.gnu.org
Cc: Liam Hupfer <liam <at> hpfr.net>
Subject: [PATCH 2/9] home: services: Unset variables after profile init.
Date: Wed,  5 Feb 2025 22:24:58 -0600
While they aren’t exported, these temporary variables show up in the
resulting shell, cluttering tab completion and declare -p.

* gnu/home/services.scm (environment-variables->setup-environment-script):
Unset shell variables.
* gnu/home/services/shells.scm (add-shell-profile-file): Likewise.

Change-Id: Ibb634849d9f38c1a9a44c0d493e92231364de958
---
 gnu/home/services.scm        | 6 +++++-
 gnu/home/services/shells.scm | 3 ++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gnu/home/services.scm b/gnu/home/services.scm
index bbf2ba2404..165bc33b05 100644
--- a/gnu/home/services.scm
+++ b/gnu/home/services.scm
@@ -275,7 +275,8 @@ (define (environment-variables->setup-environment-script vars)
                            (lambda (port)
                              (set-port-encoding! port "UTF-8")
                              (display "\
-HOME_ENVIRONMENT=$HOME/.guix-home
+# NOTE: Set HOME_ENVIRONMENT before sourcing (home-shell-profile-service-type ensures
+# ~/.profile does)
 GUIX_PROFILE=\"$HOME_ENVIRONMENT/profile\"
 PROFILE_FILE=\"$GUIX_PROFILE/etc/profile\"
 [ -f $PROFILE_FILE ] && . $PROFILE_FILE
@@ -301,6 +302,9 @@ (define (environment-variables->setup-environment-script vars)
   *) export XCURSOR_PATH=$GUIX_PROFILE/share/icons:$XCURSOR_PATH ;;
 esac
 
+# Keep the shell environment clean.
+unset GUIX_PROFILE PROFILE_FILE
+
 " port)
                              (display
                               #$(environment-variable-shell-definitions vars)
diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm
index ee6b09f17c..bab5730c3d 100644
--- a/gnu/home/services/shells.scm
+++ b/gnu/home/services/shells.scm
@@ -89,7 +89,8 @@ (define (add-shell-profile-file config)
        "\
 HOME_ENVIRONMENT=$HOME/.guix-home
 . $HOME_ENVIRONMENT/setup-environment
-$HOME_ENVIRONMENT/on-first-login\n"
+$HOME_ENVIRONMENT/on-first-login
+unset HOME_ENVIRONMENT\n"
        (serialize-configuration
         config
         (filter-configuration-fields
-- 
2.47.1





This bug report was last modified 84 days ago.

Previous Next


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