ash: expand: Fix skipping of command substitution when trimming in evalvar

Upstream commit:

    Date: Mon, 28 May 2018 17:09:48 +0800
    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>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2020-02-16 18:42:50 +01:00
parent 226b8a143d
commit 4ace385809

View File

@ -7506,6 +7506,8 @@ evalvar(char *p, int flag)
goto record;
}
varlen = 0;
end:
if (subtype != VSNORMAL) { /* skip to end of alternative */
int nesting = 1;