parser: Save and restore heredoclist in expandstr
commitec7fc7c7e33b06f31d21bbc03bf81290fd0c7742
authorHerbert Xu <herbert@gondor.apana.org.au>
Sun, 17 May 2020 13:36:25 +0000 (17 23:36 +1000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 28 May 2020 11:34:15 +0000 (28 21:34 +1000)
tree7fce7501dee69b82e1a8412dfa0b7d3ba002ad75
parent3e3e7af1a49273a5e49d50565b3b079a2ab19142
parser: Save and restore heredoclist in expandstr

On Sun, May 17, 2020 at 01:19:28PM +0100, Harald van Dijk wrote:
>
> This still does not restore the state completely. It does not clean up any
> pending heredocs. I see:
>
>   $ PS1='$(<<EOF "'
>   src/dash: 1: Syntax error: Unterminated quoted string
>   $(<<EOF ":
>   >
>
> That is, after entering the ':' command, the shell is still trying to read
> the heredoc from the prompt.

This patch saves and restores the heredoclist in expandstr.

It also removes a bunch of unnecessary volatiles as those variables
are only referenced in case of a longjmp other than one started by
a signal like SIGINT.

Reported-by: Harald van Dijk <harald@gigawatt.nl>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
src/parser.c