about summary refs log tree commit diff
path: root/Src/glob.c
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-02-17 14:12:35 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-02-17 14:12:35 +0000
commit9aa1735b63b733f062f4061975d8fa65252dee18 (patch)
treed3120e71bd1bf5f68859a0097074e73339410bd4 /Src/glob.c
parent465430918a193aef1448e6161725f644957491d0 (diff)
downloadzsh-9aa1735b63b733f062f4061975d8fa65252dee18.tar.gz
zsh-9aa1735b63b733f062f4061975d8fa65252dee18.tar.xz
zsh-9aa1735b63b733f062f4061975d8fa65252dee18.zip
zsh-workers/9776
Diffstat (limited to 'Src/glob.c')
-rw-r--r--Src/glob.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/Src/glob.c b/Src/glob.c
index 73a752536..f7c67a00f 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -1936,7 +1936,14 @@ compgetmatch(char *pat, int *flp, char **replstrp)
      * have one pattern at a time; we will try the must-match test ourselves,
      * so tell the pattern compiler we are scanning.
      */
-    int patflags = PAT_STATIC|PAT_SCAN|PAT_NOANCH;
+
+    /* int patflags = PAT_STATIC|PAT_SCAN|PAT_NOANCH;*/
+
+    /* Unfortunately, PAT_STATIC doesn't work if we have a replstr with
+     * something like ${x#...} in it which will be singsub()ed below because
+     * that would overwrite the pattern buffer. */
+
+    int patflags = PAT_SCAN|PAT_NOANCH | (*replstrp ? 0 : PAT_STATIC);
 
     /*
      * Search is anchored to the end of the string if we want to match