Zsh startup file execution order problem

Zsh startup file execution order problem

Post by Steve Ba » Wed, 03 Jun 1992 05:45:52



I guess these are really documentation bugs.
Here is what TFM says:
      Commands are first read from /etc/zshenv.  Then, if the NO_RCS option
      is unset, commands are read from $ZDOTDIR/.zshenv.  (If ZDOTDIR is
      unset, HOME is used instead).  Then, if the shell is interactive and
      the NO_RCS option is unset, commands are read from /etc/zshrc and
      $ZDOTDIR/.zshrc, in that order, if either file exists.  If the first
      character of argument zero passed to the shell is -, then the shell is
      assumed to be a login shell, and commands are read from /etc/zprofile
      and $ZDOTDIR/.zprofile before .zshrc is read, then /etc/zlogin and

      $ZDOTDIR/.zlogin after .zshrc is read.  If the NO_RCS option is set,
      only /etc/zshrc /etc/zlogin, and /etc/zprofile may be read.

From building the recently posted zsh 2.2 ...
GLOBALZSHENV by default is not set, so /etc/zshenv does not really get
read in.

The comment about reading /etc/zprofile and $ZDOTDIR/.zprofile is
vague about stating which one is executed first.  In fact, .zprofile
is read in first.  I think this is a bug since both .zshrc and .zlogin
are read in after their global counterparts, and ksh doesn't do it
that way.

Another minor problem is the case of trap.  In ksh, one could do
trap "" 1 2 3
and then
trap 1 2 3
around a script to ignore SIGHUP, SIGINT, and SIGQUIT.  HP does in
fact do that with their supplied /etc/profile.  Zsh, however, dies on
the latter statement[*], because its syntax is a little different.
Sigh.
ksh(1):
      - trap [arg] [sig ...]
                     If arg is omitted or is -, all traps for sig are reset
                     to their original values.  If arg is the null string,
zsh(1):
      trap [ arg ] [ sig ] ...
                    If arg is -, then all traps sig are reset to their
           default values.  If arg is the null string, then this signal is

I do like zsh, and it is very nearly a plug in replacement for ksh.

[*]  O.K. it doesn't die, it binds the command ``1'' to SIGINT and SIGQUIT.
--

 
 
 

Zsh startup file execution order problem

Post by Steve Rums » Thu, 04 Jun 1992 01:26:30



> The comment about reading /etc/zprofile and $ZDOTDIR/.zprofile is
> vague about stating which one is executed first.  In fact, .zprofile
> is read in first.  I think this is a bug since both .zshrc and .zlogin
> are read in after their global counterparts, and ksh doesn't do it
> that way.

I've already reported this to Paul, along with the following fairly
trivial patch. Hopefully this will be incorporated into an "official"
patch sometime.

*** /tmp/,RCSt1a05536   Tue Jun  2 17:21:41 1992
--- init.c      Thu May 21 14:53:47 1992
***************
*** 488,497 ****
                        return;
                if (interact) {
                        if (islogin) {
-                               sourcehome(".zprofile");
  #ifdef GLOBALZPROFILE
                                source(GLOBALZPROFILE);
  #endif
                        }
  #ifdef GLOBALZSHRC
                        source(GLOBALZSHRC);
--- 488,497 ----
                        return;
                if (interact) {
                        if (islogin) {
  #ifdef GLOBALZPROFILE
                                source(GLOBALZPROFILE);
  #endif
+                               sourcehome(".zprofile");
                        }
  #ifdef GLOBALZSHRC
                        source(GLOBALZSHRC);

Quote:> [ Various stuff about trap incompatibilities ]

Yes, zsh's trap handling is annoyingly different from the more "usual"
Bourne-like shells. It makes writing portable .profiles quite tricky
(not that it isn't already - you should see mine:-) I also believe
that it is broken in various ways. Again I've mailed Paul about this,
but I don't have any patches as yet, since I'm not sure where the
problems lie.

Steve.
--



 
 
 

1. Ordered execution Vs. Random execution



Do you mean "crash"?

I have been using computers for almost 25 years, and I have seen many
applications crash.

Object-oriented programming doesn't change the order of subroutine
execution.  I don't think you know what you're talking about.

Also, what does this have to do with Unix?  If you want to discuss
programming methodologies, go to comp.programming.

--

Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

2. Problems with 4.5.8 libs and Ghostscript 2.6.1

3. Execution order of files for csh/ksh/sh/bash

4. setup apache proxy with eudora

5. ZSH: How to setup startup files on windows NT

6. ipfw accounting features.

7. zsh startup files

8. Non-root accounts can't find X library????

9. Order rc files are loaded during startup

10. Help needed with job scheduling/queueing - execution in fifo order (hp-ux 11.00)

11. Apache handler execution order?

12. Order of execution