Matt Whitlock <d...@mattwhitlock.name> wrote:
> $ cat <<<EOF
> dash: 4: Syntax error: redirection unexpected
> $ true
> dash: 4: Etrue: not found
> 
> This is with Dash 0.5.11.
> 
> It looks like the first character after the unexpected redirection operator 
> mistakenly gets retained in a buffer somewhere and interferes with the next 
> command to be read.

This is because dash needs to clear the unget buffer on reset.

Reported-by: Matt Whitlock <d...@mattwhitlock.name>
Fixes: 17db43b58415 ("input: Allow two consecutive calls to pungetc")
Signed-off-by: Herbert Xu <herb...@gondor.apana.org.au>

diff --git a/src/input.c b/src/input.c
index 4987732..d7c101b 100644
--- a/src/input.c
+++ b/src/input.c
@@ -87,6 +87,7 @@ INIT {
 RESET {
        /* clear input buffer */
        basepf.lleft = basepf.nleft = 0;
+       basepf.unget = 0;
        popallfiles();
 }
 
-- 
Email: Herbert Xu <herb...@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Reply via email to