zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@zsh.org>
Cc: zsh-workers@sunsite.auc.dk
Subject: Some comments on Mandrake zsh RPMs
Date: Mon, 7 Feb 2000 00:35:47 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.20.0002062143030.32697-100000@aztec.zanshin.com> (raw)

Actually, this can all be summed up in one comment:

Just because zsh provides for /etc/z{shenv,profile,shrc,login,logout}
doesn't mean they should all be non-empty.  In fact, they shouldn't be
there at all unless there's a *very* good reason for them to be.

Let's talk about a few of the things that are present in Mandrake's
/etc/z* files.

In /etc/zshenv, which at least has some reason to exist:

 if [ `id -u` -eq 0 ]; then
   path=(/sbin /usr/sbin)
 fi

This is something copied from RedHat.  The best thing about it is that it
helped me find a race condition in backtick evaluation, about a year ago.
It would be much better written:

 if (( EUID == 0 )); then

Following that, there's:

 echo $PATH | /bin/grep -q "\W$X11HOME/bin:" || path=($path $X11HOME/bin)
 echo $PATH | /bin/grep -q "\W/bin:" || path=($path /bin)

And so on.  All those pipes and greps are just cruft.  All that's needed:

 typeset -U path
 path=($path $X11HOME/bin /bin /usr/bin /usr/local/bin)

In /etc/zprofile is this:

 if [[ $(id -gn) = $(id -un) && $(id -u) -gt 14 ]]; then
         umask 002
 else
         umask 022
 fi

This is actually repeated verbatim in /etc/zshrc, which is the better
place for it; all interactive shells read zshrc, but only login shells
read zprofile.  Wherever it's put, only one of those $(id ...) is
necessary:

 if [[ $(id -gn) = $USERNAME && $EUID -gt 14 ]]; then

Next is /etc/zshrc, which is pretty bad.

If it's really necessary to source /etc/profile.d/*.sh, of which I am not
convinced, at least it might be wise to do it in /etc/zprofile rather than
in /etc/zshrc.  RedHat has it in zprofile, but thankfully commented out.

Then there's this:

 export USER=$(id -un)
 export LOGNAME=$USER
 export HOSTNAME=$(/bin/hostname)

LOGNAME is set automatically by zsh.  So are USERNAME and HOST.  If it's
really necessary to have USER and HOSTNAME, use:

 export USER=$USERNAME
 export HOSTNAME=$HOST

Next is:

 path=($path $HOME/bin)
 export PATH=$PATH:$HOME/bin

After all that extra work in zshenv to avoid adding the same directory to
the path multiple times, here $HOME/bin is added twice!  $PATH is
automatically kept in sync when $path is assigned, and is exported by
default.  Drop the "export" line.

One last specific suggestion:

 zmodload | grep -q complist || zmodload complist

is better expressed as

 zmodload -ui complist

where the -i option for "ignore" causes it to be silent if the module
is already loaded.  In -dev-16 and later, it's more correct to use

 zmodload -ui zsh/complist

because the naming convention has changed.

Now some general griping:

I won't comment specifically on all the aliases except to say that I don't
think they should be there.  Particularly "alias -g" can badly confuse an
unsuspecting user; how do YOU know that I never create a file named "G" or
"L" or "O"?

The bindkey for magic-space is another RedHat gratuity.  It's not strictly
wrong for it to be there, but the behavior can be annoying to a fast
typist.  It's particularly bad if you're attempting to embed a space in
a history reference.

I also find the large collection of setopts to be gratuitous.  Why turn
off completeinword?  (It's off by default, so the only possible reason is
to override a user setting; ick.)  Isn't interactivecomments potentially
confusing?  And the best reasons I can think of for setting kshglob,
posixbuiltins, and rcexpandparam are to parse /etc/profile.d/* correctly
(in which case ksharrays might also be needed); but the setopts come much
too late for that.  I'd prefer they weren't there at all.

I'm curious, what users did you have in mind when making these choices?

OK, enough griping.  You have a chance here to take yet another thing that
RedHat botched and improve on it; please do, rather than making it worse.
Thanks for listening.

-- 
Bart Schaefer
Maintainer, zsh 3.0 series


             reply	other threads:[~2000-02-07  8:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-07  8:35 Bart Schaefer [this message]
2000-02-07  9:41 ` Bart Schaefer
2000-02-09 16:09 ` Chmouel Boudjnah
2000-02-10  2:25   ` Bart Schaefer
2000-02-10  9:09     ` Chmouel Boudjnah
2000-02-09 21:49 ` Adam Spiers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.20.0002062143030.32697-100000@aztec.zanshin.com \
    --to=schaefer@zsh.org \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).