From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19681 invoked from network); 13 Mar 2000 09:29:15 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 13 Mar 2000 09:29:15 -0000 Received: (qmail 8097 invoked by alias); 13 Mar 2000 09:29:10 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10103 Received: (qmail 8085 invoked from network); 13 Mar 2000 09:29:09 -0000 Date: Mon, 13 Mar 2000 10:29:08 +0100 (MET) Message-Id: <200003130929.KAA15692@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: "Bart Schaefer"'s message of Tue, 7 Mar 2000 17:46:28 +0000 Subject: Re: some directory changing tools to share Bart Schaefer wrote (on zsh-users): > ... > > By the way, in 3.0.7 this works: > > zagzig% setopt extendedglob > zagzig% cd /usr/src/local/zsh/zsh-3.1.6 > zagzig% echo (../)# > ../ ../../ ../../../ ../../../../ ../../../../../ > > But in 3.1.6 it crashes the shell: > > zagzig% setopt extendedglob > zagzig% cd /usr/src/local/zsh/zsh-3.1.6 > zagzig% echo (../)# > BUG: statfullpath(): pathname too long > zsh: segmentation fault (core dumped) $ZSH_NAME -f Here is my attempt. Peter should have the last word, I think. The place where I put that already had a test for `./', though. And I've also changed that, a bit: (./)# gave me `no match' and I thought it would be better to make it give `./'. If everyone disagrees, I can change it back. Bye Sven diff -ru ../z.old/Src/glob.c Src/glob.c --- ../z.old/Src/glob.c Mon Mar 13 10:18:26 2000 +++ Src/glob.c Mon Mar 13 10:25:31 2000 @@ -479,11 +479,26 @@ /* Not the last path section. Just add it to the path. */ int oppos = pathpos; - if (!errflag && !(q->closure && !strcmp(str, "."))) { - addpath(str); - if (!closure || !statfullpath("", NULL, 1)) - scanner((q->closure) ? q : q->next); - pathbuf[pathpos = oppos] = '\0'; + if (!errflag) { + int add = 1; + + if (q->closure && *pathbuf) { + if (!strcmp(str, ".")) + add = 0; + else if (!strcmp(str, "..")) { + struct stat sc, sr; + + add = (stat("/", &sr) || stat(pathbuf, &sc) || + sr.st_ino != sc.st_ino || + sr.st_dev != sc.st_dev); + } + } + if (add) { + addpath(str); + if (!closure || !statfullpath("", NULL, 1)) + scanner((q->closure) ? q : q->next); + pathbuf[pathpos = oppos] = '\0'; + } } } else insert(str, 0); -- Sven Wischnowsky wischnow@informatik.hu-berlin.de