Hello,

I just installed zsh recently and was working on making the switch
over from bash for my daily user, provided I can get a few things
worked out.

The biggest problem that I can't find useful results googling is zsh
interaction with sudo.

I'm noticing some strange behavior with the PATH and also the
interpretation of '='.

d...@flux log % sudo which useradd
which: no useradd in
(/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/4.4.3:/opt/sun-jdk-1.4.2.17/bin:/opt/sun-jdk-1.4.2.17/jre/bin:/opt/sun-jdk-1.4.2.17/jre/javaws:/usr/kde/3.5/bin:/usr/qt/3/bin:/usr/games/bin)
d...@flux log % sudo echo $PATH
/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/4.4.3:/opt/sun-jdk-1.4.2.17/bin:/opt/sun-jdk-1.4.2.17/jre/bin:/opt/sun-jdk-1.4.2.17/jre/javaws:/usr/kde/3.5/bin:/usr/qt/3/bin:/usr/games/bin:/home/daid/scripts:/sbin:/home/daid/.gentoo/java-config-2/current-user-vm/bin:/usr/sbin:/usr/local/warlock2:/usr/local/sbin:/home/daid/physics/transport_for_crib/transport1.6/bin
d...@flux log % which useradd
/usr/sbin/useradd

So sudo has the PATH set correctly, but it doesn't actually use the
correct path.  Fishy!

It gets more confusing.  Any new zsh opened within a first instance of
zsh things work as expected:

d...@flux log % zsh
d...@flux log % sudo which useradd
/usr/sbin/useradd

This happens in X and at console login.  One can assume that either
ghosts are haunting my machine, there was a solar flare flipping bits
on my hdd, or I've done something silly.  If I make root set my user's
path, then sudo is fine.  So basically the problem is that it's
defaulting to checking root's path and not the user path, which is not
the documented behavior on Gentoo (nor consistent with sudo in other
shells.

As for interpretation of '=' I really don't understand what's
happening.  It seems indiscriminate of the case in terms of mucking
about, but the exact result it not always the same.  Consider the
monstrous output in the following simple case of making a new
environment variable:

d...@flux log % sudo TEST="testing"
LESSOPEN=|lesspipe.sh %s
XDG_DATA_DIRS=/usr/local/share:/usr/kde/3.5/share:/usr/share:/usr/share
GLADE_CATALOG_PATH=:
GTK_PATH=:/usr/lib/gtk-2.0
PATH=/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/4.4.3:/opt/sun-jdk-1.4.2.17/bin:/opt/sun-jdk-1.4.2.17/jre/bin:/opt/sun-jdk-1.4.2.17/jre/javaws:/usr/kde/3.5/bin:/usr/qt/3/bin:/usr/games/bin
GDK_USE_XFT=1
SSH_AUTH_SOCK=/tmp/ssh-mCuWxp2532/agent.2532
USER=root
QTDIR=/usr/qt/3
PRELINK_PATH_MASK=/usr/lib/klibc
SHELL=/bin/zsh
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-HBS914aGoB,guid=109c64af5b65dda3804f8d4d4b7de295
LESS=-R -M --shift 5
JAVACC_HOME=/usr/share/javacc/
GCC_SPECS=
CONFIG_PROTECT_MASK=/etc/gentoo-release /etc/sandbox.d
/etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/terminfo
/etc/ca-certificates.conf /etc/texmf/web2c /etc/texmf/language.dat.d
/etc/texmf/language.def.d /etc/texmf/updmap.d /etc/revdep-rebuild
/etc/splash
LIBGLADE_MODULE_PATH=:/usr/lib/libglade/2.0
OPENGL_PROFILE=xorg-x11
GENERATION=2
MAIL=/var/mail/daid
JAVAC=/home/daid/.gentoo/java-config-2/current-user-vm/bin/javac
ANT_HOME=/usr/share/ant
XAUTHORITY=/home/daid/.Xauthority
PAGER=/usr/bin/less
SHLVL=2
_=/usr/bin/sudo
QMAKESPEC=linux-g++
WINDOWID=25165872
GLADE_MODULE_PATH=:
TERM=xterm
PWD=/home/daid/log
COLORTERM=Terminal
CONFIG_PROTECT=/usr/share/X11/xkb /var/lib/hsqldb
/usr/kde/3.5/share/config /usr/kde/3.5/env /usr/kde/3.5/shutdown
/usr/share/config
CVS_RSH=ssh
GLADE_PIXMAP_PATH=:
JDK_HOME=/home/daid/.gentoo/java-config-2/current-user-vm
VMHANDLE=sun-jdk-1.4
INFOPATH=/usr/share/info:/usr/share/binutils-data/i686-pc-linux-gnu/2.20/info:/usr/share/gcc-data/i686-pc-linux-gnu/4.4.3/info
SESSION_MANAGER=local/flux:@/tmp/.ICE-unix/2541,unix/flux:/tmp/.ICE-unix/2541
DISPLAY=:0.0
LOGNAME=root
JAVA_HOME=/home/daid/.gentoo/java-config-2/current-user-vm
SSH_AGENT_PID=2533
MANPATH=/home/daid/.gentoo/java-config-2/current-user-vm/man:/usr/local/share/man:/usr/share/man:/usr/share/binutils-data/i686-pc-linux-gnu/2.20/man:/usr/share/gcc-data/i686-pc-linux-gnu/4.4.3/man:/opt/sun-jdk-1.4.2.17/man:/etc/java-config/system-vm/man/:/usr/kde/3.5/share/man:/usr/qt/3/doc/man
XDG_CONFIG_DIRS=/etc/xdg
SGML_CATALOG_FILES=/etc/sgml/sgml-ent.cat:/etc/sgml/openjade-1.3.2.cat:/etc/sgml/sgml-docbook.cat:/etc/sgml/sgml-docbook-3.1.cat:/etc/sgml/dsssl-docbook-stylesheets.cat:/etc/sgml/sgml-lite.cat:/etc/sgml/xml-docbook-4.4.cat:/etc/sgml/xml-docbook-4.1.2.cat
HOME=/home/daid
EDITOR=/usr/bin/vi
OLDPWD=/home/daid/log
MOCADI_DIR=/home/daid/physics/rib_model/mocadi
MOCADI_DATA=/home/daid/physics/rib_model/mocadi/data
MOCADI_SPLINES_GZ=/home/daid/physics/rib_model/mocadi/splines_gz
ROOTSYS=/usr
ROOT_LIBRARIES=/usr/lib/root
MYSQL=/usr/include/mysql:/usr/lib/mysql
MYSQL_TCP_PORT=3306
JAVADIR=/usr/lib/jvm/sun-jdk-1.6
USERNAME=root
SUDO_COMMAND=/bin/env
PATH=/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/4.4.3:/opt/sun-jdk-1.4.2.17/bin:/opt/sun-jdk-1.4.2.17/jre/bin:/opt/sun-jdk-1.4.2.17/jre/javaws:/usr/kde/3.5/bin:/usr/qt/3/bin:/usr/games/bin
TEST=testing
SUDO_USER=daid
SUDO_UID=1000
SUDO_GID=1009
TEST=testing

Or if I want to emerge a specific package, instead I get:

d...@flux log % sudo emerge =sudo-1.7.2_p2-r2
zsh: sudo-1.7.2_p2-r2 not found

Unlike the PATH problems, the equal problems do not go away with a new
instance of zsh overtop of the first one.

I'm experiencing some other problems with zsh as well, but being able
to use sudo is reasonably more pressing, and basic googling on the
other errors (problems sourcing /etc/profile and getting a bash
prompt, trying to set zsh as my slim login shell fails to login).

As always, I'm suspicious that I've done something stupid, but I don't
see anything obvious.  I can use tcsh and bash both just fine.  This
occurred for both x86 builds on an x86 arch and ~x86 builds on an ~x86
arch with the most recent versions of sudo and zsh for those
respective arch settings (recent ~x86 upgrade).  revdep-rebuild still
has a couple things to take care of that need babysitting and/or bug
reports, but I would be extremely surprised if those packages are at
all related here (things for tex and also libjpeg).

I'll happily take any advice, even if it's "go back to bash" (although
some tips on auto-completion and command correction would be welcome,
since I didn't get any reasonable results for these features with
bash).

If it's useful I'll post my working .zshrc and such, but honestly I
can't see much reason to do so now since I don't see it as relevant to
the problems I see.

Toodles,
daid

Reply via email to