Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: some directory changing tools to share
- X-seq: zsh-workers 10103
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: some directory changing tools to share
- Date: Mon, 13 Mar 2000 10:29:08 +0100 (MET)
- In-reply-to: "Bart Schaefer"'s message of Tue, 7 Mar 2000 17:46:28 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
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@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author