From e778155f51e02e0a405fe74d3380e05cef49a2f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 17 Jul 2025 17:33:21 +0200 Subject: [PATCH] =?UTF-8?q?profiles:=20Preserve=20Bash=20=E2=80=98HIST?= =?UTF-8?q?=E2=80=99=20variables.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reduces the risk that, when using Bash, ‘guix shell --pure’ would spawn an instance of Bash that would ignore the user’s history-related settings. It is not bulletproof though: these variables as shell variables that need not be exported as environment variable. When they are not exported, the user’s history-related settings would still be ignored. * guix/profiles.scm (%precious-variables): Add HIST variables from Bash. Change-Id: Id2898d67d2e70c083abbeacad3f0663940fb6789 --- guix/profiles.scm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/guix/profiles.scm b/guix/profiles.scm index a1df7eb683c..8cf4903fb8d 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013-2024 Ludovic Courtès +;;; Copyright © 2013-2025 Ludovic Courtès ;;; Copyright © 2013 Nikita Karetnikov ;;; Copyright © 2014, 2016 Alex Kost ;;; Copyright © 2015 Mark H Weaver @@ -2136,7 +2136,14 @@ already effective." (define %precious-variables ;; Environment variables in the default 'load-profile' white list. - '("HOME" "USER" "LOGNAME" "DISPLAY" "XAUTHORITY" "TERM" "TZ" "PAGER")) + '("HOME" "USER" "LOGNAME" "DISPLAY" "XAUTHORITY" "TERM" "TZ" "PAGER" + + ;; These Bash variables (which can also be environment variables) must be + ;; preserved. Failure to preserve 'HISTSIZE', for instance, would lead + ;; Bash to use its default history size of 500 entries, possibly + ;; truncating the user's ~/.bash_history. + "HISTCONTROL" "HISTFILE" "HISTFILESIZE" "HISTIGNORE" + "HISTSIZE" "HISTTIMEFORMAT")) (define (purify-environment white-list white-list-regexps) "Unset all environment variables except those that match the regexps in