ash: fix ${unset_var/pattern/repl}

function                                             old     new   delta
subevalvar                                          1349    1353      +4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2021-01-09 08:27:37 +01:00
parent cc4303f5e6
commit 883cdb79a4
3 changed files with 5 additions and 1 deletions

View File

@ -7015,7 +7015,8 @@ subevalvar(char *start, char *str, int strloc,
slash_pos = -1;
if (repl) {
slash_pos = expdest - ((char *)stackblock() + strloc);
STPUTC('/', expdest);
if (!(flag & EXP_DISCARD))
STPUTC('/', expdest);
//bb_error_msg("repl+1:'%s'", repl + 1);
p = argstr(repl + 1, (flag & EXP_DISCARD) | EXP_TILDE); /* EXP_TILDE: echo "${v/x/~}" expands ~ ! */
*repl = '/';

View File

@ -1,3 +1,5 @@
unset v
echo ${v/*/w}
v=''
echo ${v/*/w}
echo Ok:$?