Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 412301 - app-shells/zsh[static] - $USERNAME is not available
Summary: app-shells/zsh[static] - $USERNAME is not available
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Piotr Karbowski (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-17 07:51 UTC by Lars Wendler (Polynomial-C) (RETIRED)
Modified: 2022-11-26 21:57 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Wendler (Polynomial-C) (RETIRED) 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) (RETIRED) 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 ...
Comment 3 Piotr Karbowski (RETIRED) gentoo-dev 2022-11-26 21:57:40 UTC
This is no longer issue with current zsh in tree.