about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2012-11-08 12:28:11 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2012-11-08 12:28:11 +0000
commit64e925bd65888856f365de45542b0c0eea25af2e (patch)
tree7f29e29f1b6549f53c4fea889881edf639b55411
parent7f767568a6490b0a34d35d8db7bb0fcd3da797b6 (diff)
downloadzsh-64e925bd65888856f365de45542b0c0eea25af2e.tar.gz
zsh-64e925bd65888856f365de45542b0c0eea25af2e.tar.xz
zsh-64e925bd65888856f365de45542b0c0eea25af2e.zip
30783: We don't want leading "="s to be active when
tokenising strings that aren't going to be treated as command line
arguments
-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();