sh: Treat unexpected newlines in substitutions as a syntax error.
The old approach was wrong because PS2 was not used and seems unlikely to parse extensions (ksh93's ${ COMMAND} may well fail to parse). Exp-run done by: erwin (with some other sh(1) changes)
This commit is contained in:
parent
11ba493dd7
commit
840173ec99
@ -1401,6 +1401,8 @@ parsesub: {
|
||||
subtype = VSERROR;
|
||||
if (c == '}')
|
||||
pungetc();
|
||||
else if (c == '\n' || c == PEOF)
|
||||
synerror("Unexpected end of line in substitution");
|
||||
else
|
||||
USTPUTC(c, out);
|
||||
} else {
|
||||
@ -1417,6 +1419,8 @@ parsesub: {
|
||||
default:
|
||||
p = strchr(types, c);
|
||||
if (p == NULL) {
|
||||
if (c == '\n' || c == PEOF)
|
||||
synerror("Unexpected end of line in substitution");
|
||||
if (flags == VSNUL)
|
||||
STPUTC(':', out);
|
||||
STPUTC(c, out);
|
||||
|
Loading…
x
Reference in New Issue
Block a user