* Globbing for directory names with two '='-s fail after 4.2.2.
@ 2005-03-16 7:57 Kobayashi Noritada
2005-03-16 11:13 ` Peter Stephenson
0 siblings, 1 reply; 3+ messages in thread
From: Kobayashi Noritada @ 2005-03-16 7:57 UTC (permalink / raw)
To: zsh-workers
Hi,
Globbing for directory names with two '='-s sometimes fails
(i.e. wildcards '*' and '?' don't work) with Zsh after 4.2.2.
It seems to be related to changes in Src/{glob.c,pattern.c} on 2004-10-18.
Since it is a little bit inconvenient for me, I'd like to create a patch
but cannot do so at present.
Is this a known issue?
Detailed reports are in the lower part of this mail.
If I need to offer more information or to do more tests, I'll do so.
Thanks,
--
== Example
noritada[13:15]% zsh --version golbeza:~/tmp
zsh 4.2.4 (i686-pc-linux-gnu)
noritada[13:16]% ls * golbeza:~/tmp
a=b.c_d=e.f:
hoge
a=b_c=d:
hoge
bar:
hoge
foo:
hoge hoge2
foo+bar:
hoge
foo=bar:
hoge
foo_bar:
hoge
ra=1.0e7_et=3.5:
hogebar
noritada[13:20]% ls foo/* bar/* foo+bar/* foo=bar/* foo_bar/* a=b.c_d=e.f/* a=b_c=d/*
a=b.c_d=e.f/hoge bar/hoge foo/hoge foo=bar/hoge
a=b_c=d/hoge foo+bar/hoge foo/hoge2 foo_bar/hoge
noritada[13:20]% ls foo/* bar/* foo+bar/* foo=bar/* foo_bar/* a=b.c_d=e.f/* a=b_c=d/* ra=1.0e7_et=3.5/*
zsh: no matches found: ra=1.0e7_et=3.5/*
noritada[13:20]% ls foo/* bar/* foo+bar/* foo=bar/* foo_bar/* a=b.c_d=e.f/* a=b_c=d/* ra=1.0e7_et=3.5/???????
zsh: no matches found: ra=1.0e7_et=3.5/???????
== Occurrence condition
=== Directory name patterns
I tested with various directory names, but couldn't find a rule:
* Success in globbing
* "ra=1_et=3"
* "r=.r=."
* "ra=1.0"
* "r=1.r=1"
* "r=1r=1."
* "r=..=r"
* ".=."
* Failure in globbing
* "ra=1.0_et=3.5"
* "ra=1.0et=3.5"
* "r=1.r=1."
* "r=1..r=1"
* ".=r=."
* ".==."
* ".=.="
=== Version info
* Success in globbing
* 4.2.1
* CVS release branch "zsh-4_2-patches" on 2004-09-01
* CVS release branch "zsh-4_2-patches" on 2004-10-01
* CVS release branch "zsh-4_2-patches" on 2004-10-18
* Failure in globbing
* 4.2.2
* 4.2.3
* 4.2.4
* CVS release branch "zsh-4_2-patches" on 2004-10-19
* CVS release branch "zsh-4_2-patches" on 2004-11-01
--
|: Noritada KOBAYASHI
|: Dept. of General Systems Studies,
|: Graduate School of Arts and Sciences, Univ. of Tokyo
|: E-mail: nori1@dolphin.c.u-tokyo.ac.jp (preferable)
|: nori@esa.c.u-tokyo.ac.jp
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Globbing for directory names with two '='-s fail after 4.2.2.
2005-03-16 7:57 Globbing for directory names with two '='-s fail after 4.2.2 Kobayashi Noritada
@ 2005-03-16 11:13 ` Peter Stephenson
2005-03-17 6:13 ` Kobayashi Noritada
0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2005-03-16 11:13 UTC (permalink / raw)
To: Kobayashi Noritada, zsh-workers
Kobayashi Noritada wrote:
> Hi,
>
> Globbing for directory names with two '='-s sometimes fails
> (i.e. wildcards '*' and '?' don't work) with Zsh after 4.2.2.
> It seems to be related to changes in Src/{glob.c,pattern.c} on 2004-10-18.
Thanks for noticing. Could you try the following patch and see if it
fixes all the problems you are seeing?
The problem was that a string was no longer null-terminated in the case
that it was examined by the pattern matcher, but found to contain no
patterns.
I will commit this on both branches and some time around (western-style)
Easter we should probably produce 4.2.5. There may be other patches to
transfer.
Index: Src/glob.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/glob.c,v
retrieving revision 1.38
diff -u -r1.38 glob.c
--- Src/glob.c 10 Jan 2005 17:31:19 -0000 1.38
+++ Src/glob.c 16 Mar 2005 11:12:12 -0000
@@ -223,13 +223,14 @@
/**/
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 @@
}
}
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 @@
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 */
Index: Test/D02glob.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/D02glob.ztst,v
retrieving revision 1.8
diff -u -r1.8 D02glob.ztst
--- Test/D02glob.ztst 26 Oct 2004 17:20:29 -0000 1.8
+++ Test/D02glob.ztst 16 Mar 2005 11:12:12 -0000
@@ -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
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Globbing for directory names with two '='-s fail after 4.2.2.
2005-03-16 11:13 ` Peter Stephenson
@ 2005-03-17 6:13 ` Kobayashi Noritada
0 siblings, 0 replies; 3+ messages in thread
From: Kobayashi Noritada @ 2005-03-17 6:13 UTC (permalink / raw)
To: pws; +Cc: zsh-workers
Hi,
> > Globbing for directory names with two '='-s sometimes fails
> > (i.e. wildcards '*' and '?' don't work) with Zsh after 4.2.2.
> > It seems to be related to changes in Src/{glob.c,pattern.c} on 2004-10-18.
>
> Thanks for noticing. Could you try the following patch and see if it
> fixes all the problems you are seeing?
Thank you for quick work.
I checked all of the problems I reported are now fixed, and 'make check'
works successfully in the 4.2 branch.
> I will commit this on both branches and some time around (western-style)
> Easter we should probably produce 4.2.5. There may be other patches to
> transfer.
OK. I'm looking forward to that new stable release.
Thanks,
--
|: Noritada KOBAYASHI
|: Dept. of General Systems Studies,
|: Graduate School of Arts and Sciences, Univ. of Tokyo
|: E-mail: nori1@dolphin.c.u-tokyo.ac.jp (preferable)
|: nori@esa.c.u-tokyo.ac.jp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-03-17 6:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-16 7:57 Globbing for directory names with two '='-s fail after 4.2.2 Kobayashi Noritada
2005-03-16 11:13 ` Peter Stephenson
2005-03-17 6:13 ` Kobayashi Noritada
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).