diff mbox

expand: Fix skipping of command substitution when trimming in evalvar

Message ID 20180528090948.4ootvfsm4qqt3klk@gondor.apana.org.au (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show

Commit Message

Herbert Xu May 28, 2018, 9:09 a.m. UTC
When we are trimming an unset variable in evalvar, any embedded
command substitution that should have been skipped are not.  This
can cause them to be evaluated later should there be other command
substitutions in the same input word.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
diff mbox

Patch

diff --git a/src/expand.c b/src/expand.c
index a8bc142..f9ab160 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -810,6 +810,8 @@  record:
 		goto record;
 	}
 
+	varlen = 0;
+
 end:
 	if (subtype != VSNORMAL) {	/* skip to end of alternative */
 		int nesting = 1;