ash: fix ${unset_var/pattern/repl}

function                                             old     new   delta
subevalvar                                          1349    1353      +4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
1_33_stable
Denys Vlasenko 2021-01-09 08:27:37 +01:00
parent 23dd1c75b7
commit 611bbfc148
3 changed files with 5 additions and 1 deletions

View File

@ -7011,7 +7011,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:$?