summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2018-05-28 17:09:48 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2018-08-29 11:15:57 +0800
commitc5819fdd6e587aeb0bceaf60e86999a484541a19 (patch)
tree8a759059349de6ca7e49625416b5801fdc3d3bc2 /src
parentexpand: Merge syntax/quotes in memtodest with flags (diff)
downloaddash-c5819fdd6e587aeb0bceaf60e86999a484541a19.tar.gz
dash-c5819fdd6e587aeb0bceaf60e86999a484541a19.zip
expand: Fix skipping of command substitution when trimming in evalvar
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>
Diffstat (limited to 'src')
-rw-r--r--src/expand.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/expand.c b/src/expand.c
index c565646..7a51766 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -805,6 +805,8 @@ record:
 		goto record;
 	}
 
+	varlen = 0;
+
 end:
 	if (subtype != VSNORMAL) {	/* skip to end of alternative */
 		int nesting = 1;