aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJilles Tjoelker <jilles@FreeBSD.org>2018-04-29 17:46:08 +0000
committerJilles Tjoelker <jilles@FreeBSD.org>2018-04-29 17:46:08 +0000
commit4d7f36eea512377761f16ab24054c9b321b8539f (patch)
tree9a78e20c7cf1d75e12998f10cb211eacf5507a54 /bin
parenta7163bb962b66afb768707fa0b5ad6773d755503 (diff)
downloadsrc-4d7f36eea512377761f16ab24054c9b321b8539f.tar.gz
src-4d7f36eea512377761f16ab24054c9b321b8539f.zip
sh: Don't have [ match any [[:class:]]
Submitted by: Robert Elz MFC after: 3 days
Notes
Notes: svn path=/head/; revision=333092
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/expand.c4
-rw-r--r--bin/sh/tests/builtins/Makefile1
-rw-r--r--bin/sh/tests/builtins/case23.05
3 files changed, 9 insertions, 1 deletions
diff --git a/bin/sh/expand.c b/bin/sh/expand.c
index 3b44d5569a66..f2287bea5605 100644
--- a/bin/sh/expand.c
+++ b/bin/sh/expand.c
@@ -1342,8 +1342,10 @@ patmatch(const char *pattern, const char *string)
}
if (c == '[' && *p == ':') {
found |= match_charclass(p, chr, &end);
- if (end != NULL)
+ if (end != NULL) {
p = end;
+ continue;
+ }
}
if (c == CTLESC)
c = *p++;
diff --git a/bin/sh/tests/builtins/Makefile b/bin/sh/tests/builtins/Makefile
index cb69b1358311..e35944c268de 100644
--- a/bin/sh/tests/builtins/Makefile
+++ b/bin/sh/tests/builtins/Makefile
@@ -42,6 +42,7 @@ ${PACKAGE}FILES+= case19.0
${PACKAGE}FILES+= case20.0
${PACKAGE}FILES+= case21.0
${PACKAGE}FILES+= case22.0
+${PACKAGE}FILES+= case23.0
${PACKAGE}FILES+= cd1.0
${PACKAGE}FILES+= cd2.0
${PACKAGE}FILES+= cd3.0
diff --git a/bin/sh/tests/builtins/case23.0 b/bin/sh/tests/builtins/case23.0
new file mode 100644
index 000000000000..ce03cf96d62e
--- /dev/null
+++ b/bin/sh/tests/builtins/case23.0
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+case [ in
+[[:alpha:]]) echo bad
+esac