Subject: Re: bug#38243: Zsh does not load /etc/profile values by default

From: "Danny O'Brien" <[email-masked]>
Date: Sat, 7 Dec 2019 22:15:53 -0800

On Sun, Nov 17, 2019 at 5:22 AM Leo Prikler <[email-masked]>
wrote:

> > Not sure what the correct approach should be here. We could symlink
> > /etc/zprofile to /etc/profile , but that would require knowing that
> > /etc/profile was always available. Or we could include a source'ing
> > of
> > /etc/profile in /etc/zprofile.
>

I took a closer look at this, and currently Zsh users have /etc/profile
included in their environment by virtue of a default $HOME/.zprofile, which
is created in their home directory when they are created (via `useradd` and
/etc/skel ).

I'm a little stuck to know what to do here -- if we source /etc/profile in
/etc/zprofile, then we risk sourcing it twice for users who have the
current default ~/.zprofile already in their home directories`. OTOH, if
users come to Guix System with their own pre-existing home directory, then
they may well struggle --- as I did -- because important environment
variables aren't set by their established ~/.zshrc, ~/.zprofile or
~/.zlogin setups.

I *think* the right thing to do is to drop the current /etc/skel/.zprofile
and establish that /etc/zprofile (and other shells) should source
/etc/profile . Guix System does a lot of setup in /etc/profile including
including $GUIX_PROFILE/etc/profile.  It would be best if this
automatically happened, whatever is going on in individual home
directories. I'm a Guix newbie though, so I'm happy to take advice!
Archlinux has a one-line /etc/zprofile which sources /etc/profile ; Debian
does not; I have not checked other distributions, but I could.

A couple of Guix commits where the current behavior was established:

commit 2f4d43584cb26315c028dfbd2197da0d175933a2
Author: Chris Marusich <[email-masked]>
Date:   Sat Oct 13 22:50:36 2018 -0700

    system: Rename .zlogin to .zprofile.

    Reported by Meiyo Peng <[email-masked]>.

    * gnu/system/shadow.scm (default-skeletons): Rename zlogin to zprofile.

commit 02f707c590fa3c5bbd74168468bf561b47317f71
Author: Sou Bunnbu (宋文武) <[email-masked]>
Date:   Fri Dec 5 21:17:49 2014 +0800

    system: Add skeleton '.zlogin'.

    * gnu/system/shadow.scm (default-skeletons): Add .zlogin.

Best,

d.