autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Autoconf 2.53: improved fix for problems with CONFIG_SHELL=bash


From: Akim Demaille
Subject: Re: Autoconf 2.53: improved fix for problems with CONFIG_SHELL=bash
Date: 22 Mar 2002 11:29:02 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp)

>>>>> "Paul" == Paul Eggert <address@hidden> writes:

>> From: Akim Demaille <address@hidden> Date: 21 Mar 2002 10:49:17
>> +0100

>> | 2002-03-19 Paul Eggert <address@hidden>
>> | 
>> | * lib/m4sugar/m4sh.m4 (_AS_LINENO_PREPARE): Unset ENV and |
>> BASH_ENV when reinvoking the shell, to work around problems | with
>> installers who put "cd" commands in their environments.
>> 
>> Even if it does not solve the current issue, I'm in favor of it.

Paul> OK, I installed it; we can always uninstall it later, I suppose.

Paul> I noticed that we couldn't do a similar thing for zsh, though,
Paul> as zsh always consults $ZDOTDIR/.zshenv unless /etc/zshenv says
Paul> not to.  At least, that's what the man page says on Solaris 8.

The info page of the latest version include the following.  I'd say
that the bottom line is that with ENV, we've (you've ;) done all that
you (we :) could do.

Compatibility
=============

Zsh tries to emulate `sh' or `ksh' when it is invoked as sh or ksh
respectively; more precisely, it looks at the first letter of the name
by which it was invoked, excluding any initial `r' (assumed to stand
for `restricted'), and if that is `s' or `k' it will emulate `sh' or
`ksh'.  Furthermore, if invoked as su (which happens on certain systems
when the shell is executed by the su command), the shell will try to
find an alternative name from the SHELL environment variable and
perform emulation based on that.

In `sh' and `ksh' compatibility modes the following parameters are not
special and not initialized by the shell: ARGC, argv, cdpath, fignore,
fpath, HISTCHARS, mailpath, MANPATH, manpath, path, prompt, PROMPT,
PROMPT2, PROMPT3, PROMPT4, psvar, status, watch.

The usual zsh startup/shutdown scripts are not executed.  Login shells
source /etc/profile followed by $HOME/.profile.  If the ENV environment
variable is set on invocation, $ENV is sourced after the profile
scripts.  The value of ENV is subjected to parameter expansion, command
substitution, and arithmetic expansion before being interpreted as a
pathname.  Note that the PRIVILEGED option also affects the execution
of startup files.

The following options are set if the shell is invoked as sh or ksh:
NO_BAD_PATTERN, NO_BANG_HIST, NO_BG_NICE, NO_EQUALS,
NO_FUNCTION_ARGZERO, GLOB_SUBST, NO_GLOBAL_EXPORT, NO_HUP,
INTERACTIVE_COMMENTS, KSH_ARRAYS, NO_MULTIOS, NO_NOMATCH, NO_NOTIFY,
POSIX_BUILTINS, NO_PROMPT_PERCENT, RM_STAR_SILENT, SH_FILE_EXPANSION,
SH_GLOB, SH_OPTION_LETTERS, SH_WORD_SPLIT.  Additionally the BSD_ECHO
and IGNORE_BRACES options are set if zsh is invoked as sh.  Also, the
KSH_OPTION_PRINT, LOCAL_OPTIONS, PROMPT_BANG, PROMPT_SUBST and
SINGLE_LINE_ZLE options are set if zsh is invoked as ksh.


Startup/Shutdown Files
======================

Commands are first read from /etc/zshenv; this cannot be overridden.
Subsequent behaviour is modified by the RCS and GLOBAL_RCS options; the
former affects all startup files, while the second only affects those
in the /etc directory.  If one of the options is unset at any point,
any subsequent startup file(s) of the corresponding type will not be
read.  It is also possible for a file in $ZDOTDIR to re-enable
GLOBAL_RCS. Both RCS and GLOBAL_RCS are set by default.

Commands are then read from $ZDOTDIR/.zshenv.  If the shell is a login
shell, commands are read from /etc/zprofile and then $ZDOTDIR/.zprofile.
Then, if the shell is interactive, commands are read from /etc/zshrc
and then $ZDOTDIR/.zshrc.  Finally, if the shell is a login shell,
/etc/zlogin and $ZDOTDIR/.zlogin are read.

When a login shell exits, the files $ZDOTDIR/.zlogout and then
/etc/zlogout are read.  This happens with either an explicit exit via
the exit or logout commands, or an implicit exit by reading end-of-file
from the terminal.  However, if the shell terminates due to exec'ing
another process, the logout files are not read.  These are also
affected by the RCS and GLOBAL_RCS options.  Note also that the RCS
option affects the saving of history files, i.e. if RCS is unset when
the shell exits, no history file will be saved.

If ZDOTDIR is unset, HOME is used instead.  Those files listed above as
being in /etc may be in another directory, depending on the
installation.

As /etc/zshenv is run for all instances of zsh, it is important that it
be kept as small as possible.  In particular, it is a good idea to put
code that does not need to be run for every single shell behind a test
of the form `if [[ -o rcs ]]; then ...' so that it will not be executed
when zsh is invoked with the `-f' option.

Files
=====

$ZDOTDIR/.zshenv

$ZDOTDIR/.zprofile

$ZDOTDIR/.zshrc

$ZDOTDIR/.zlogin

$ZDOTDIR/.zlogout

${TMPPREFIX}*   (default is /tmp/zsh*)

/etc/zshenv

/etc/zprofile

/etc/zshrc

/etc/zlogin

/etc/zlogout    (installation-specific - /etc is the default)

Any of these files may be pre-compiled with the zcompile builtin
command (*Note Shell Builtin Commands::).  If a compiled file exists
(named for the original file plus the .zwc extension) and it is newer
than the original file, the compiled file will be used instead.



With the following additional information:

GLOBAL_RCS (-d) <D>
     If this option is unset, the startup files /etc/zprofile,
     /etc/zshrc, /etc/zlogin and /etc/zlogout will not be run.  It can
     be disabled and re-enabled at any time, including inside local
     startup files (.zshrc, etc.).

RCS (+f) <D>
     After /etc/zshenv is sourced on startup, source the .zshenv,
     /etc/zprofile, .zprofile, /etc/zshrc, .zshrc, /etc/zlogin,
     .zlogin, and .zlogout files, as described in *Note Files::.  If
     this option is unset, the /etc/zshenv file is still sourced, but
     any of the others will not be; it can be set at any time to
     prevent the remaining startup files after the currently executing
     one from being sourced.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]