Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: LOGNAME not properly set on FreeBSD



On Tue, 01 Apr 2014 16:22:39 -0500
Erik Johnson <palehose@xxxxxxxxx> wrote:
> When using "su - username" to change users, zsh is not properly setting
> the LOGNAME environment variable on FreeBSD. Example below.
> 
> erik@virtubsd:~% zsh --version
> zsh 5.0.2 (amd64-portbld-freebsd9.1)
> erik@virtubsd:~% su - root
> Password:
> virtubsd# echo $LOGNAME
> erik

From the code, it looks like this would only happen if getlogin() is
returning the wrong thing, i.e. "erik", or it's not returning anything
and the shell is having to guess and doing so wrongly.  Although that
doesn't seem very likely it's hard to see another way this can happen
within the shell.  Presumably

python -c 'import os; print os.getlogin()'

prints "root"?

It might also be useful to start the shell with the "-x" option to check
all the initialisation scripts.  I'm not sure you can do that with su
without some fiddling but you could put "set -x" temporarily at the top
of /etc/zshenv.

pws



Messages sorted by: Reverse Date, Date, Thread, Author