Skip to content
Snippets Groups Projects
Commit dad1cb18 authored by Herbert Xu's avatar Herbert Xu
Browse files

parser: Allow newlines within parameter substitution


On Fri, Mar 16, 2018 at 11:27:22AM +0800, Herbert Xu wrote:
> On Thu, Mar 15, 2018 at 10:49:15PM +0100, Harald van Dijk wrote:
> >
> > Okay, it can be trivially modified to something that does work in other
> > shells (even if it were actually executed), but gets rejected at parse time
> > by dash:
> >
> >   if false; then
> >     : ${$+
> >   }
> >   fi
>
> That's just a bug in dash's parser with ${} in general, because
> it bombs out without the if clause too:
>
> 	: ${$+
> 	}

This patch fixes the parsing of newlines with parameter substitution.

Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent f8807824
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -924,7 +924,8 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs)
CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */
switch(synstack->syntax[c]) {
case CNL: /* '\n' */
if (synstack->syntax == BASESYNTAX)
if (synstack->syntax == BASESYNTAX &&
!synstack->varnest)
goto endword; /* exit outer loop */
USTPUTC(c, out);
nlprompt();
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment