* Re: some directory changing tools to share
@ 2000-03-13 9:29 Sven Wischnowsky
0 siblings, 0 replies; only message in thread
From: Sven Wischnowsky @ 2000-03-13 9:29 UTC (permalink / raw)
To: zsh-workers
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2000-03-13 9:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-13 9:29 some directory changing tools to share Sven Wischnowsky
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).