summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpdpennock <pdpennock>2010-10-10 00:05:24 +0000
committerpdpennock <pdpennock>2010-10-10 00:05:24 +0000
commitd234059b1c6493e5eefb6c28aa2b8a021d894d51 (patch)
tree2056dc91918a8f55be34a0506fd129116f0243e0
parentf58f9caf6f69bc5c6477307e949679532cb278ac (diff)
downloadzsh-d234059b1c6493e5eefb6c28aa2b8a021d894d51.tar.gz
zsh-d234059b1c6493e5eefb6c28aa2b8a021d894d51.zip
28338: keep =~ from inverting sense of subsequent tests (after &&/||)
-rw-r--r--Src/parse.c3
-rw-r--r--Test/C02cond.ztst13
2 files changed, 15 insertions, 1 deletions
diff --git a/Src/parse.c b/Src/parse.c
index edf87bdbf..2953f00aa 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -2172,10 +2172,11 @@ par_cond_triple(char *a, char *b, char *c)
ecadd(ecnpats++);
} else if ((b[0] == Equals || b[0] == '=') &&
(b[1] == '~' || b[1] == Tilde) && !b[2]) {
+ /* We become an implicit COND_MODI but do not provide the first
+ * item, it's skipped */
ecadd(WCB_COND(COND_REGEX, 0));
ecstr(a);
ecstr(c);
- ecadd(ecnpats++);
} else if (b[0] == '-') {
if ((t0 = get_cond_num(b + 1)) > -1) {
ecadd(WCB_COND(t0 + COND_NT, 0));
diff --git a/Test/C02cond.ztst b/Test/C02cond.ztst
index 2d4204038..00e22c182 100644
--- a/Test/C02cond.ztst
+++ b/Test/C02cond.ztst
@@ -285,6 +285,19 @@ F:Failures in these cases do not indicate a problem in the shell.
0:MATCH, MBEGIN, MEND, match, mbegin, mend
>OK
+ (if zmodload -i zsh/regex 2>/dev/null; then
+ if [[ a =~ a && b == b ]]; then
+ print OK
+ else
+ print "regex =~ inverted following test"
+ fi
+ else
+ # not a test error
+ print OK
+ fi)
+0:regex infix operator should not invert following conditions
+>OK
+
[[ -fail badly ]]
2:Error message for unknown prefix condition
?(eval):1: unknown condition: -fail