zsh-users
 help / color / mirror / code / Atom feed
* dirstack history: loving zsh, crashing zsh...
@ 2006-03-02 17:52 Francisco Borges
  2006-03-02 18:07 ` William Scott
  2006-03-05  9:19 ` Bart Schaefer
  0 siblings, 2 replies; 7+ messages in thread
From: Francisco Borges @ 2006-03-02 17:52 UTC (permalink / raw)
  To: Zsh User

Hello!

Having to navigate through lot's of nasty dir names, I googled for "zsh
dirstack history", found some guy using ruby to do it (!) hello?! and a
old email from zsh-users [1] that showed a simple way to do it
[1]: <http://www.zsh.org/mla/users/1999/msg00629.html>

I changed a few things, and ended with

if [[ -f ~/.zdirs ]] && [[ ${#dirstack[*]} -eq 0 ]]; then
    dirstack=( $(< ~/.zdirs) )
    popd > /dev/null
fi
precmd() {
    dirs -l >! ~/.zdirs # added -l
}

So far so good. Except that I didn't want to change automatically to the
last dir, and zsh's popd didn't seem to allow a way out. So I tried

% typeset -U dirstack

and the shell crashed. (I kid you not!)

This will not happen all the time or with any array. But it does happen
(and I can show you how!), all you need is bunch of identical items on
the top of the dirstack (which you'll get if turn that popd off for a
while).

~ % zsh -f
loki% echo $ZSH_VERSION
4.3.1
loki% dirstack=( $(< ~/.zdirs) )
loki% dirs -vp
0       ~
1       ~
2       ~
3       ~
4       ~
5       ~
6       ~/Desktop
7       /home
8       ~/sys/Firefox/firefox
9       ~/sys/Firefox
10      ~/roskva/outros/images
11      ~/roskva/outros/images/o
12      ~/outros/imagens
13      ~/outros/agenda
14      ~/thesis/EXP/newpar
15      ~/thesis/EXP
loki% typeset -U dirstack
zsh: segmentation fault  zsh -f

Sometimes the shell does not crash (for instance if there aren't a lot
of repeated items in the beginning) and sometimes it will just say:
"free(): invalid pointer 0xb7fdf388!"

[...]

OR you guys are now going to say: "Don't you know you're not supposed to
use typeset with dirstack!!"

Cheers!
Francisco.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-03-07  3:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-02 17:52 dirstack history: loving zsh, crashing zsh Francisco Borges
2006-03-02 18:07 ` William Scott
2006-03-05  9:19 ` Bart Schaefer
2006-03-06 13:01   ` [zsh] " Francisco Borges
2006-03-06 16:51     ` Bart Schaefer
2006-03-06 18:26       ` [zsh] " Francisco Borges
2006-03-07  3:54         ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).