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

Bug with named dirs in prompt expansion

Dear all,

is it just me, or is there a bug in the "%~" prompt expansion:

$ export PS1='%~> '
~> zsh -f
~> cd /tmp
/tmp> fooo=$PWD
/tmp> : ~fooo
/tmp> foo=$PWD
/tmp> : ~foo
~foo> hash -d | grep tmp

I would expect that after ": ~fooo" the prompt changes to "~fooo>", but it doesn't.
With one "o" less it's working. But both variant, i.e. "fooo" and "foo", are listed in
the named dir hash, and "cd ~fooo" is working, too.

I seems to depend on the length of the path-string, because in /tmp1 this works:
/tmp1> fooo=$PWD
/tmp1> : ~fooo

But with one character more, i.e. length(namedir) > lentgh(tmp1), it fails again.

Although I use named dirs a lot, I never came about a problem in "real life",
probably because the named dir names are usually shorter than the path;
this issue was originally raised here: http://superuser.com/q/624603/195224
I tried to boil it down to a minimal example.

The behavior above is reproducable with

$ echo $ZSH_VERSION $ZSH_PATCHLEVEL `uname -mo`
4.3.10 Debian x86_64 GNU/Linux
5.0.2-dev-0 zsh-5.0.2-130-gc5d9abc i686 Cygwin


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