Re: Bug when parsing redirection syntax error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Matt Whitlock <dash@xxxxxxxxxxxxxxxxx> 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 <dash@xxxxxxxxxxxxxxxxx>
Fixes: 17db43b58415 ("input: Allow two consecutive calls to pungetc")
Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

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 <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux