[klibc] [klibc:update-dash] dash: expand: Fix skipping of command substitution when trimming in evalvar

klibc-bot for Herbert Xu herbert at gondor.apana.org.au
Sat Mar 28 14:49:27 PDT 2020


Commit-ID:  603b0dd1f1e08e9184661251513d281c89a42fac
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=603b0dd1f1e08e9184661251513d281c89a42fac
Author:     Herbert Xu <herbert at gondor.apana.org.au>
AuthorDate: Mon, 28 May 2018 17:09:48 +0800
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Sat, 28 Mar 2020 21:42:55 +0000

[klibc] dash: expand: Fix skipping of command substitution when trimming in evalvar

[ dash commit c5819fdd6e587aeb0bceaf60e86999a484541a19 ]

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 at gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>

---
 usr/dash/expand.c | 2 ++
 1 file changed, 2 insertions(+)

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


More information about the klibc mailing list