Re: move "source /etc/profile" from .zlogin to .zprofile

2018-10-19 Thread Chris Marusich
l...@gnu.org (Ludovic Courtès) writes:

> Alright, so Chris you can probably go ahead and push the patch!

Sounds good!  I've committed this to master as
2f4d43584cb26315c028dfbd2197da0d175933a2.

-- 
Chris


signature.asc
Description: PGP signature


Re: move "source /etc/profile" from .zlogin to .zprofile

2018-10-16 Thread Ludovic Courtès
Leo Famulari  skribis:

> On Mon, Oct 15, 2018 at 11:48:01AM +0200, Ludovic Courtès wrote:
>> Hello,
>> 
>> Chris Marusich  skribis:
>> 
>> > 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 don’t use Zsh either; IMO, if Meiyo and other Zsh users think it’s the
>> right thing, go for it!
>
> I use Zsh as my interactive shell and I use zprofile for everything,
> either in /etc or my home directory. I don't even have a zlogin file.
> So, I think it will work :)

Alright, so Chris you can probably go ahead and push the patch!

Thanks,
Ludo’.



Re: move "source /etc/profile" from .zlogin to .zprofile

2018-10-15 Thread Leo Famulari
On Mon, Oct 15, 2018 at 11:48:01AM +0200, Ludovic Courtès wrote:
> Hello,
> 
> Chris Marusich  skribis:
> 
> > 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 don’t use Zsh either; IMO, if Meiyo and other Zsh users think it’s the
> right thing, go for it!

I use Zsh as my interactive shell and I use zprofile for everything,
either in /etc or my home directory. I don't even have a zlogin file.
So, I think it will work :)


signature.asc
Description: PGP signature


Re: move "source /etc/profile" from .zlogin to .zprofile

2018-10-15 Thread Ludovic Courtès
Hello,

Chris Marusich  skribis:

> 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 don’t use Zsh either; IMO, if Meiyo and other Zsh users think it’s the
right thing, go for it!

Thanks,
Ludo’.



Re: move "source /etc/profile" from .zlogin to .zprofile

2018-10-14 Thread Meiyo Peng
Hi Chris,

On Sun, Oct 14, 2018 at 6:30 AM Chris Marusich wrote:

> I haven't tested it, though.  Would you like to test it and
> let me know if it works for you?

Guix is still new to me, and I don't know how to apply the patch and
build guix. But I moved "source /etc/profile" from my .zlogin to
.zprofile and I have no problem.

> 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?

Usually I prefer to put less dot files in my $HOME directory. But I'm OK
with guix's solution.

> I've always found the relationship between shell start-up scripts to be
> confusing; everyone seems to want to configure them differently.

I agree. So I prefer to use fish shell, which is simpler. But I have to
temporarily switch to zsh until this bug is fixed:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30265


Re: move "source /etc/profile" from .zlogin to .zprofile

2018-10-14 Thread Chris Marusich
Hi Leo and Meiyo,

Leo Famulari  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  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 
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



signature.asc
Description: PGP signature


Re: move "source /etc/profile" from .zlogin to .zprofile

2018-10-13 Thread Meiyo Peng
Hi Chris,

/etc/profile should do the preparation work for users settings in .zshrc.
But
since .zlogin is sourced after .zshrc, it will override users settings in
.zshrc. It resets $PATH and many other environment variables. This is
counterintuitive.

You can find what archlinux did here:
https://wiki.archlinux.org/index.php/Zsh

   - /etc/zsh/zprofile Used for executing commands at start, will be
   sourced when starting as a *login shell*. Please note that on Arch
   Linux, by default it contains one line
   

   which source the /etc/profile.
  - /etc/profile This file should be sourced by all Bourne-compatible
  shells upon login: it sets up $PATH and other environment variables
  and application-specific (/etc/profile.d/*.sh) settings upon login.
   - $ZDOTDIR/.zprofile Used for executing user's commands at start, will
   be sourced when starting as a *login shell*.
   - ...
   - $ZDOTDIR/.zshrc Used for setting user's interactive shell
   configuration and executing commands, will be sourced when starting
as an *interactive
   shell*.
   - ...
   - $ZDOTDIR/.zlogin Used for executing user's commands at ending of
   initial progress, will be sourced when starting as a *login shell*.


On Sun, Oct 14, 2018, 09:34 Chris Marusich  wrote:

>
> Is the intended use of .zprofile any different from the intended use of
> .zlogin?  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.
>
>


Re: move "source /etc/profile" from .zlogin to .zprofile

2018-10-13 Thread Leo Famulari
On Sat, Oct 13, 2018 at 06:33:59PM -0700, Chris Marusich wrote:
> The same documentation you linked says:
> 
> `.zprofile' is meant as an alternative to `.zlogin' for ksh fans;
> the two are not intended to be used together, although this could
> certainly be done if desired.
> 
> Is the intended use of .zprofile any different from the intended use of
> .zlogin?  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.


signature.asc
Description: PGP signature


Re: move "source /etc/profile" from .zlogin to .zprofile

2018-10-13 Thread Chris Marusich
Hi Meiyo,

Meiyo Peng  writes:

> Guix's default skeletons put "source /etc/profile" into ~/.zlogin. But
> /etc/profile resets the PATH environment variable, exports many other
> environment variables, and source /etc/bashrc. According to
> http://zsh.sourceforge.net/Intro/intro_3.html .zlogin is sourced after
> .zshrc and should not be used for alias definitions, options,
> environment variable settings, etc. Especially "as a general rule, it
> should not change the shell environment at all". I think it's better to
> source /etc/profile from ~/.zprofile.

The same documentation you linked says:

`.zprofile' is meant as an alternative to `.zlogin' for ksh fans;
the two are not intended to be used together, although this could
certainly be done if desired.

Is the intended use of .zprofile any different from the intended use of
.zlogin?  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.

-- 
Chris


signature.asc
Description: PGP signature