summaryrefslogtreecommitdiff
path: root/lib/glob/sm_loop.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/glob/sm_loop.c')
-rw-r--r--lib/glob/sm_loop.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/glob/sm_loop.c b/lib/glob/sm_loop.c
index 2de5acd3..cc14fb16 100644
--- a/lib/glob/sm_loop.c
+++ b/lib/glob/sm_loop.c
@@ -384,7 +384,7 @@ BRACKMATCH (p, test, flags)
{
register CHAR cstart, cend, c;
register int not; /* Nonzero if the sense of the character class is inverted. */
- int brcnt, brchr, forcecoll;
+ int brcnt, brchr, forcecoll, isrange;
INT pc;
CHAR *savep;
U_CHAR orig_test;
@@ -519,6 +519,7 @@ BRACKMATCH (p, test, flags)
}
cstart = cend = FOLD (cstart);
+ isrange = 0;
/* POSIX.2 2.8.3.1.2 says: `An expression containing a `[' that
is not preceded by a backslash and is not part of a bracket
@@ -573,10 +574,18 @@ BRACKMATCH (p, test, flags)
c = FOLD (c);
continue;
}
+ isrange = 1;
}
+#if 0 /* TAG: bash-5.1 */
+ if (isrange == 0 && test == cstart)
+ goto matched;
+ if (isrange && RANGECMP (test, cstart, forcecoll) >= 0 && RANGECMP (test, cend, forcecoll) <= 0)
+ goto matched;
+#else
if (RANGECMP (test, cstart, forcecoll) >= 0 && RANGECMP (test, cend, forcecoll) <= 0)
goto matched;
+#endif
if (c == L(']'))
break;