zsh-workers
 help / color / mirror / code / Atom feed
* Re: PATCH: Re: adding a toplevel zsh.spec.in file
@ 2000-07-18 15:40 zefram
  2000-07-18 16:37 ` Andrej Borsenkow
  0 siblings, 1 reply; 12+ messages in thread
From: zefram @ 2000-07-18 15:40 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote:
>Besides, sourcing /etc/profile effectively prevents a sysadmin from having
>any zsh-specific code in the global startups.  I think that's going to have
>the exact opposite effect from what you want -- it's going to encourage
>admins to build zsh with the global RC files *enabled*, so that they can
>separate the zsh-specific stuff.

/etc/profile is there to set up bits of the environment that pertain to
the local system.  It's an adjunct to login; it does the new mail check
on systems where login doesn't, it sets MAIL if login doesn't, and it can
set TAPE and stuff if that's really necessary on that system.  My point is
that the things that need to be done are the same regardless of what shell
the user prefers to use, and so there shouldn't be any zsh-specific stuff.

Andrej Borsenkow wrote:
>- wordsplitting :-) (yes, it may happen)
>- some /etc/profile(s) (ours at least) check the the value of $0 for
>being somehing like -sh and do not expect -zsh here.

Yes, I momentarily forgot that sh syntax is sufficiently different from
zsh syntax to make this problematic.  Obviously my scheme needs a little
rethinking.

>I use /etc/zprofile that defines function that sets shwordsplit, fakes
>$0 being -sh (hmm, may there be some security problems in case of su?)
>and sources /etc/profile.

Perhaps we can locally emulate sh when sourcing /etc/profile?  We have
the local emulation logic working for functions, and /etc/profile can't
possibly get confused by that, because it can't contain any setopt
commands.  The $0 issue remains.  What does $0 get examined for?

Hmm, the local emulation has lots of advantages.  It means that one
can simply install zsh on an existing system without having to worry
about global startup files.  There'll be no need to write a zsh-specific
/etc/zprofile.

Bart Schaefer wrote:
>However, I'm curious why you object to (e.g.) setting $PATH in /etc/zshenv.
>On systems where commands are installed in nonstandard places, why should
>every user's own .zshenv have to contain the settings that make rsh (and
>other noninteractive/nonlogin shells) find commands in the right places?

PATH (or anything else) shouldn't be set in /etc/zshenv because then it'd
be set for every shell that starts, whereas shells that are run explicitly
are supposed to inherit the environment from their parent process.
Obviously the user can affect that with .zshenv, but that's their choice;
/etc/zshenv would force these modified semantics on everyone.

/etc/profile is the proper place for local configuration, because then
it's done once, which is all that's desired.

rshd is defective in not providing a way to locally affect the environment
of a new shell that it creates.  Yet another reason to switch to ssh.
Being less flippant, if the user is going to rsh into somewhere, they
simply have to know about this problem and allow for it.  It's well
understood.

>} The only annoying thing left is that the global zprofile is run *after*
>} the user's .zshenv.
>
>Why is that annoying?

Whatever we run as our equivalent of /etc/profile might choose to set
the PATH and other bits of the environment.  The user should have the
possibility of overriding what's set up there, using their .zshenv.
As it is, a PATH setting in .zshenv can be stomped on by /etc/zprofile.

>I predict that every system that currently ships with non-empy /etc/z*
>files will simply compile with these configs enabled, and continue to
>ship non-empty /etc/z* files.  Obviously the maintainers of those
>environments believe that there's value in the settings they place in
>those files.

I think they haven't actually thought much about the issues we're
discussing.  If we ship with /etc/z* disabled by default, then they'll
*have* to think before they can ship non-empty effective /etc/z*.
We should make it non-trivial to do the thing that is almost always wrong.

Peter Stephenson wrote:
>                                            There are perfectly good, if
>specialised, reasons for adding stuff.

Yes.  My point is that the valid reasons are all very specialised
and unusual, so it doesn't seem too much of an imposition to ask that
the administrator handling this specialised situation also install a
specialised version of zsh.

>The way forward is to educate people over the use of startup script.
>They're willing to learn if you explain things to them.

Yes, the documentation should probably explain these issues, regardless
of what default behavior we decide upon.

-zefram


^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: adding a toplevel zsh.spec.in file
@ 2000-07-17 15:09 Adam Spiers
  2000-07-18  1:56 ` PATCH: " Zefram
  0 siblings, 1 reply; 12+ messages in thread
From: Adam Spiers @ 2000-07-17 15:09 UTC (permalink / raw)
  To: zsh workers mailing list

Bart Schaefer (schaefer@candle.brasslantern.com) wrote:
> On Jul 7,  6:44pm, Zefram wrote:
> } Subject: Re: adding a toplevel zsh.spec.in file
> }
> } Is there anything that ought to go in /etc/z* on more machines than,
> } say, those in a single company?
> 
> I've always asserted that there is not, with the possible exception of
> default path settings in /etc/zshenv.

In /etc/zshenv:

What about setting of umask?  In the last discussion about this kind
of stuff you suggested that umask setting was better done in zshrc.
But shouldn't it be set correctly for non-interactive processes too?

These don't do much harm either (quoted mostly straight from Bart
anyway ;-)

  export USER=`id -un`
  export LOGNAME=$USER
  export HOSTNAME=$HOST
  
  # this only on appropriate boxes of course
  export MAIL=/var/spool/mail/$USER
  
  HISTSIZE=1000
  HISTFILE=~/.zshhistory
  SAVEHIST=1000
  
  export INPUTRC=/etc/inputrc
  
Is there any good reason why /sbin and /usr/sbin should not be on
every user's path by default?  They're not under RedHat, which is
infuriating when it comes to using traceroute, lsof etc.

Now here's a candidate for StartupFiles/RedHat/zshrc.  Anything badly
wrong?

--------- 8< --------- 8< --------- 8< --------- 8< --------- 8< ---------
#
# /etc/zshrc is sourced in interactive shells.  It
# should contain commands to set up aliases, functions,
# options, key bindings, etc.
#

# Set up aliases
alias mv='nocorrect mv'       # no spelling correction on mv
alias cp='nocorrect cp'       # no spelling correction on cp
alias mkdir='nocorrect mkdir' # no spelling correction on mkdir

# Where to look for autoloaded function definitions
fpath=(
       ~/{lib/zsh,.zsh}/{functions,scripts}(N)
       ~/.z{sh,}func*(N)
       $fpath
       /usr/doc/zsh*/Functions(N)
      )

typeset -U fpath

# Autoload all shell functions from all directories
# in $fpath that have the executable bit on
# (the executable bit is not necessary, but gives
# you an easy way to stop the autoloading of a
# particular shell function).
for dirname in $fpath
do
  fns=( $dirname/*(N.x:t) )
  (( $#fns )) && autoload $fns
done

# Set prompts
PS1='%n@%m %B%3~%b %# '        # default prompt
#RPS1=' %~'                     # prompt for right side of screen

#bindkey -v               # vi key bindings
#bindkey -e               # emacs key bindings
#bindkey ' ' magic-space  # also do history expansion on space

--------- 8< --------- 8< --------- 8< --------- 8< --------- 8< ---------


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2000-07-18 20:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-18 15:40 PATCH: Re: adding a toplevel zsh.spec.in file zefram
2000-07-18 16:37 ` Andrej Borsenkow
  -- strict thread matches above, loose matches on Subject: below --
2000-07-17 15:09 Adam Spiers
2000-07-18  1:56 ` PATCH: " Zefram
2000-07-18  5:22   ` Bart Schaefer
2000-07-18  6:15     ` Wayne Davison
2000-07-18 16:54     ` Trond Eivind Glomsrød
2000-07-18  6:25   ` Andrej Borsenkow
2000-07-18  9:42   ` Peter Stephenson
2000-07-18 18:22   ` Trond Eivind Glomsrød
2000-07-18 19:57     ` Zefram
2000-07-18 20:07       ` Trond Eivind Glomsrød
2000-07-18 20:37         ` Zefram

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).