about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--Src/lex.c80
2 files changed, 46 insertions, 40 deletions
diff --git a/ChangeLog b/ChangeLog
index 2742f59cc..be74b5bb8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2012-11-08  Peter Stephenson  <pws@csr.com>
 
+	* 30783: Src/lex.c: we don't want leading "="'s to be active when
+	tokenising strings that aren't going to be treated as command
+	line arguments.
+
 	* 30780: Doc/Zsh/builds.yo: document that set -o failures are
 	hard but setopt failures are soft.
 
@@ -307,5 +311,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5754 $
+* $Revision: 1.5755 $
 *****************************************************
diff --git a/Src/lex.c b/Src/lex.c
index 2c738c005..ac87e5ec8 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -1265,51 +1265,53 @@ gettokstr(int c, int sub)
 		break;
 	    goto brk;
 	case LX2_EQUALS:
-	    if (intpos) {
-		e = hgetc();
-		if (e != '(') {
-		    hungetc(e);
-		    lexstop = 0;
-		    c = Equals;
-		} else {
-		    add(Equals);
-		    if (skipcomm()) {
-			peek = LEXERR;
-			goto brk;
-		    }
-		    c = Outpar;
-		}
-	    } else if (!sub && peek != ENVSTRING &&
-		       incmdpos && !bct && !brct) {
-		char *t = tokstr;
-		if (idigit(*t))
-		    while (++t < bptr && idigit(*t));
-		else {
-		    int sav = *bptr;
-		    *bptr = '\0';
-		    t = itype_end(t, IIDENT, 0);
-		    if (t < bptr) {
-			skipparens(Inbrack, Outbrack, &t);
+	    if (!sub) {
+		if (intpos) {
+		    e = hgetc();
+		    if (e != '(') {
+			hungetc(e);
+			lexstop = 0;
+			c = Equals;
 		    } else {
-			*bptr = sav;
+			add(Equals);
+			if (skipcomm()) {
+			    peek = LEXERR;
+			    goto brk;
+			}
+			c = Outpar;
 		    }
-		}
-		if (*t == '+')
-                    t++;
-		if (t == bptr) {
-		    e = hgetc();
-		    if (e == '(' && incmdpos) {
+		} else if (peek != ENVSTRING &&
+			   incmdpos && !bct && !brct) {
+		    char *t = tokstr;
+		    if (idigit(*t))
+			while (++t < bptr && idigit(*t));
+		    else {
+			int sav = *bptr;
 			*bptr = '\0';
-			return ENVARRAY;
+			t = itype_end(t, IIDENT, 0);
+			if (t < bptr) {
+			    skipparens(Inbrack, Outbrack, &t);
+			} else {
+			    *bptr = sav;
+			}
 		    }
-		    hungetc(e);
-		    lexstop = 0;
-		    peek = ENVSTRING;
-		    intpos = 2;
+		    if (*t == '+')
+			t++;
+		    if (t == bptr) {
+			e = hgetc();
+			if (e == '(' && incmdpos) {
+			    *bptr = '\0';
+			    return ENVARRAY;
+			}
+			hungetc(e);
+			lexstop = 0;
+			peek = ENVSTRING;
+			intpos = 2;
+		    } else
+			c = Equals;
 		} else
 		    c = Equals;
-	    } else
-		c = Equals;
+	    }
 	    break;
 	case LX2_BKSLASH:
 	    c = hgetc();