Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 412301

Summary: app-shells/zsh[static] - $USERNAME is not available
Product: Gentoo Linux Reporter: Lars Wendler (Polynomial-C) <polynomial-c>
Component: Current packagesAssignee: Lars Wendler (Polynomial-C) <polynomial-c>
Status: CONFIRMED ---    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Lars Wendler (Polynomial-C) gentoo-dev 2012-04-17 07:51:00 UTC
Hi,

when zsh was compiled with static USE flag being enabled the $USERNAME variable is not available:

@cobalt:~> echo $SHELL $ZSH_VERSION 
/bin/zsh 4.3.17
@cobalt:~> echo $USERNAME

@cobalt:~> export USERNAME="$(whoami)"
@cobalt:~> echo $USERNAME             

@cobalt:~> echo $PS1
%n@%m:%~> 
@cobalt:~>


As you can see, %n in my prompt doesn't get expanded as well as it's using the USERNAME variable.

I've tested this with zsh-4.3.15 and zsh-4.3.17 both on a stable x86 and amd64 machine.
Comment 1 Lars Wendler (Polynomial-C) gentoo-dev 2012-04-17 08:10:27 UTC
I just got told that one cannot assign a value to the USERNAME variable. So the test case can be reduced to this:


@cobalt:~> echo $SHELL $ZSH_VERSION 
/bin/zsh 4.3.17
@cobalt:~> echo $USERNAME

@cobalt:~> echo $PS1
%n@%m:%~> 
@cobalt:~>


On a dynamically linked zsh USERNAME is not empty:

lars@shanghai:~> echo $SHELL $ZSH_VERSION
/bin/zsh 4.3.17
lars@shanghai:~> echo $USERNAME
lars
lars@shanghai:~> echo $PS1     
%n@%m:%~> 
lars@shanghai:~>

and thus %n gets expanded in the prompt.
Comment 2 SpanKY gentoo-dev 2014-12-31 08:03:00 UTC
might be a bug in glibc ...