1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-02 10:01:11 +02:00

30783: We don't want leading "="s to be active when

tokenising strings that aren't going to be treated as command line
arguments
This commit is contained in:
Peter Stephenson 2012-11-08 12:28:11 +00:00
parent 7f767568a6
commit 64e925bd65
2 changed files with 48 additions and 42 deletions

View file

@ -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 $
*****************************************************

View file

@ -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);
} else {
*bptr = sav;
}
}
if (*t == '+')
t++;
if (t == bptr) {
if (!sub) {
if (intpos) {
e = hgetc();
if (e == '(' && incmdpos) {
*bptr = '\0';
return ENVARRAY;
if (e != '(') {
hungetc(e);
lexstop = 0;
c = Equals;
} else {
add(Equals);
if (skipcomm()) {
peek = LEXERR;
goto brk;
}
c = Outpar;
}
hungetc(e);
lexstop = 0;
peek = ENVSTRING;
intpos = 2;
} else if (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);
} else {
*bptr = sav;
}
}
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();