From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10973 invoked from network); 2 Mar 2006 17:53:01 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.0 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 2 Mar 2006 17:53:01 -0000 Received: (qmail 72692 invoked from network); 2 Mar 2006 17:52:54 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 2 Mar 2006 17:52:54 -0000 Received: (qmail 26026 invoked by alias); 2 Mar 2006 17:52:47 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9979 Received: (qmail 26016 invoked from network); 2 Mar 2006 17:52:46 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 2 Mar 2006 17:52:46 -0000 Received: (qmail 71498 invoked from network); 2 Mar 2006 17:52:46 -0000 Received: from dep.let.rug.nl (129.125.8.60) by a.mx.sunsite.dk with SMTP; 2 Mar 2006 17:52:44 -0000 Received: from dep.let.rug.nl ([129.125.8.60]) by dep.let.rug.nl (SMSSMTP 4.1.11.41) with SMTP id M2006030218524303627 for ; Thu, 02 Mar 2006 18:52:43 +0100 Received: from loki (postfix@loki.let.rug.nl [129.125.8.86]) by dep.let.rug.nl (8.12.10/8.12.10) with ESMTP id k22HqgFT004777 for ; Thu, 2 Mar 2006 18:52:42 +0100 (MET) Received: by loki (Postfix, from userid 7006) id 1D054E75E; Thu, 2 Mar 2006 18:52:54 +0100 (CET) Date: Thu, 2 Mar 2006 18:52:52 +0100 From: Francisco Borges To: Zsh User Subject: dirstack history: loving zsh, crashing zsh... Message-ID: <20060302175252.GA31734@let.rug.nl> Mail-Followup-To: Zsh User Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Operating-System: Linux/2.6.13.4 (i686) X-Editor: GNU Emacs 22.0.50.1 Organization: Alfa Informatica - Rijksuniversiteit Groningen User-Agent: Mutt/1.5.9i X-Whitelist: OK X-Scanned-By: milter-spamc/0.25.321 (dep.let.rug.nl [129.125.8.60]); Thu, 02 Mar 2006 18:52:43 +0100 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]: 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.