Subject: bug#64765: closed (Re: bug#64765: [PATCH] gnu: home: zsh: Also load enviroment in non-login shells)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 17 Sep 2023 13:11:03 +0000

Your bug report

#64765: [PATCH] gnu: home: zsh: Also load enviroment in non-login shells

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
64765: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64765
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#64765: [PATCH] gnu: home: zsh: Also load enviroment in non-login shells
From: Ludovic Courtès <[email-masked]>
To: Saku Laesvuori <[email-masked]>
Cc: [email-masked], [email-masked], Andrew Tropin <[email-masked]>
Date: Sun, 17 Sep 2023 15:10:30 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

Saku Laesvuori <[email-masked]> skribis:

> * gnu/home/services/shells.scm (zsh-file-zshenv): Add snippet to source
> /etc/profile when running via ssh.
> (zsh-get-configuration-files): Always add .zshenv as it is never empty.

Applied, thanks!

Ludo’.

Subject: [PATCH] gnu: home: zsh: Also load enviroment in non-login shells
From: Saku Laesvuori <[email-masked]>
To: [email-masked]
Cc: Saku Laesvuori <[email-masked]>
Date: Fri, 21 Jul 2023 13:51:19 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

* gnu/home/services/shells.scm (zsh-file-zshenv): Add snippet to source
profiles.
(zsh-file-zprofile): Remove profile sourcing snippet.
(zsh-get-configuration-files): Always add .zshenv as it is never empty.
Check that .zprofile is not empty before adding it.
---
The service incorrectly assumed that shells are either login shells or
started from another shell. For example, ssh with a command argument
starts shells that aren't login shells nor started from another shell.

 gnu/home/services/shells.scm | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm
index 7960590e7c..93a3b38267 100644
--- a/gnu/home/services/shells.scm
+++ b/gnu/home/services/shells.scm
@@ -182,21 +182,18 @@ (define* (zsh-field-not-empty? config field)
 (define (zsh-file-zshenv config)
   (mixed-text-file
    "zshenv"
-   (zsh-serialize-field config 'zshenv)
-   (zsh-serialize-field config 'environment-variables)))
-
-(define (zsh-file-zprofile config)
-  (mixed-text-file
-   "zprofile"
    "\
 # Set up the system, user profile, and related variables.
 source /etc/profile
 # Set up the home environment profile.
 source ~/.profile
-
-# It's only necessary if zsh is a login shell, otherwise profiles will
-# be already sourced by bash
 "
+   (zsh-serialize-field config 'zshenv)
+   (zsh-serialize-field config 'environment-variables)))
+
+(define (zsh-file-zprofile config)
+  (mixed-text-file
+   "zprofile"
    (zsh-serialize-field config 'zprofile)))
 
 (define (zsh-file-by-field config field)
@@ -208,10 +205,9 @@ (define (zsh-file-by-field config field)
         (zsh-serialize-field config field)))))
 
 (define (zsh-get-configuration-files config)
-  `((".zprofile" ,(zsh-file-by-field config 'zprofile)) ;; Always non-empty
-    ,@(if (or (zsh-field-not-empty? config 'zshenv)
-              (zsh-field-not-empty? config 'environment-variables))
-          `((".zshenv" ,(zsh-file-by-field config 'zshenv))) '())
+  `((".zshenv" ,(zsh-file-by-field config 'zshenv)) ;; Always non-empty
+    ,@(if (zsh-field-not-empty? config 'zprofile)
+          `((".zprofile" ,(zsh-file-by-field config 'zprofile))) '())
     ,@(if (zsh-field-not-empty? config 'zshrc)
           `((".zshrc" ,(zsh-file-by-field config 'zshrc))) '())
     ,@(if (zsh-field-not-empty? config 'zlogin)

base-commit: e401eff97706dc6cdaf20b01dd12e291d7d13c2b
-- 
2.41.0