Hi Leo and Meiyo,

Leo Famulari <l...@famulari.name> writes:

> On Sat, Oct 13, 2018 at 06:33:59PM -0700, Chris Marusich wrote:
>> [...]  If .zprofile and .zlogin are both meant to serve the same
>> purpose, then I'm not sure why one would be preferable over the
>> other.
>
> The difference is that they are used at different times — zprofile is
> used before zshrc, whereas zlogin is used after zshrc.

Meiyo Peng <meiyo.p...@gmail.com> writes:

> [...] [S]ince .zlogin is sourced after .zshrc, it will override users
> settings in .zshrc. It resets $PATH and many other environment
> variables. This is counterintuitive.

I see.  I'm not a zsh user, but I agree it would make sense to rename
.zlogin to .zprofile.  I've attached a patch that does this in our
/etc/skel.  I haven't tested it, though.  Would you like to test it and
let me know if it works for you?

I see that zsh also sources files like /etc/zprofile when they exist.  I
don't have a strong preference for putting this into /etc/zprofile
vs. putting it into ~/.zprofile (via /etc/skel).  What do you think
about that?

Can anybody think of anything bad that might happen if we apply the
attached patch?  It seems reasonable and safe to me, but you never know!
I've always found the relationship between shell start-up scripts to be
confusing; everyone seems to want to configure them differently.

-- 
Chris
From a80c1f231f0c94a2b2c3780039b3f6fc2957c2be Mon Sep 17 00:00:00 2001
From: Chris Marusich <cmmarus...@gmail.com>
Date: Sat, 13 Oct 2018 22:50:36 -0700
Subject: [PATCH] system: Rename .zlogin to .zprofile.

* gnu/system/shadow.scm (default-skeletons): Rename zlogin to zprofile.
---
 gnu/system/shadow.scm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm
index f800c3b54..63f544cec 100644
--- a/gnu/system/shadow.scm
+++ b/gnu/system/shadow.scm
@@ -181,7 +181,7 @@ fi
 alias ls='ls -p --color=auto'
 alias ll='ls -l'
 alias grep='grep --color=auto'\n"))
-        (zlogin    (plain-file "zlogin" "\
+        (zprofile    (plain-file "zprofile" "\
 # Honor system-wide environment variables
 source /etc/profile\n"))
         (guile-wm  (computed-file "guile-wm" copy-guile-wm))
@@ -197,7 +197,10 @@ set debug-file-directory ~/.guix-profile/lib/debug
 set auto-load safe-path /gnu/store/*/lib\n")))
     `((".bash_profile" ,profile)
       (".bashrc" ,bashrc)
-      (".zlogin" ,zlogin)
+      ;; Zsh sources ~/.zprofile before ~/.zshrc, and it sources ~/.zlogin
+      ;; after ~/.zshrc.  To avoid interfering with any customizations a user
+      ;; may have made in their ~/.zshrc, put this in .zprofile, not .zlogin.
+      (".zprofile" ,zprofile)
       (".nanorc" ,(plain-file "nanorc" "\
 # Include all the syntax highlighting modules.
 include /run/current-system/profile/share/nano/*.nanorc\n"))
-- 
2.18.0

Attachment: signature.asc
Description: PGP signature

Reply via email to