mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-06-01 12:56:04 +02:00
20983: failed glob from fixed strings segments in globbed paths
This commit is contained in:
parent
31aaabe1bc
commit
51ec0b8079
|
@ -1,3 +1,8 @@
|
|||
2005-03-16 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 20983: Test/D02glob.ztst, Src/glob.c: fixed string segments
|
||||
in globbed paths could be copied wrongly, resulting in failed globs.
|
||||
|
||||
2005-03-15 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 20978: Src/zle_main.c: don't propagate EOFs from recursive
|
||||
|
|
21
Src/glob.c
21
Src/glob.c
|
@ -223,13 +223,14 @@ struct complist {
|
|||
|
||||
/**/
|
||||
static void
|
||||
addpath(char *s)
|
||||
addpath(char *s, int l)
|
||||
{
|
||||
DPUTS(!pathbuf, "BUG: pathbuf not initialised");
|
||||
while (pathpos + (int) strlen(s) + 1 >= pathbufsz)
|
||||
while (pathpos + l + 1 >= pathbufsz)
|
||||
pathbuf = realloc(pathbuf, pathbufsz *= 2);
|
||||
while ((pathbuf[pathpos++] = *s++));
|
||||
pathbuf[pathpos - 1] = '/';
|
||||
while (l--)
|
||||
pathbuf[pathpos++] = *s++;
|
||||
pathbuf[pathpos++] = '/';
|
||||
pathbuf[pathpos] = '\0';
|
||||
}
|
||||
|
||||
|
@ -504,14 +505,17 @@ scanner(Complist q)
|
|||
}
|
||||
}
|
||||
if (add) {
|
||||
addpath(str);
|
||||
addpath(str, l);
|
||||
if (!closure || !statfullpath("", NULL, 1))
|
||||
scanner((q->closure) ? q : q->next);
|
||||
pathbuf[pathpos = oppos] = '\0';
|
||||
}
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
if (str[l])
|
||||
str = dupstrpfx(str, l);
|
||||
insert(str, 0);
|
||||
}
|
||||
} else {
|
||||
/* Do pattern matching on current path section. */
|
||||
char *fn = pathbuf[pathbufcwd] ? unmeta(pathbuf + pathbufcwd) : ".";
|
||||
|
@ -608,8 +612,9 @@ scanner(Complist q)
|
|||
int oppos = pathpos;
|
||||
|
||||
for (fn = subdirs; fn < subdirs+subdirlen; ) {
|
||||
addpath(fn);
|
||||
fn += strlen(fn) + 1;
|
||||
int l = strlen(fn);
|
||||
addpath(fn, l);
|
||||
fn += l + 1;
|
||||
memcpy((char *)&errsfound, fn, sizeof(int));
|
||||
fn += sizeof(int);
|
||||
scanner((q->closure) ? q : q->next); /* scan next level */
|
||||
|
|
|
@ -317,3 +317,9 @@
|
|||
print ${foo%% #:*}
|
||||
0:Must-match arguments in complex patterns
|
||||
>this string has a
|
||||
|
||||
mkdir glob.tmp/ra=1.0_et=3.5
|
||||
touch glob.tmp/ra=1.0_et=3.5/foo
|
||||
print glob.tmp/ra=1.0_et=3.5/???
|
||||
0:Bug with intermediate paths with plain strings but tokenized characters
|
||||
>glob.tmp/ra=1.0_et=3.5/foo
|
||||
|
|
Loading…
Reference in New Issue