ash: perform tilde expansion in all parameter expansion words

Previously tilde expansion was not carried out for =?#% expansion words.

Test case:
   a=~root:~root
   echo ${a#~root}
Old result:
   /root:/root
New result:
   :/root

Based on commit dd721f71 from git://git.kernel.org/pub/scm/utils/dash/dash.git
by Herbert Xu

function                                             old     new   delta
subevalvar                                          1152    1153      +1

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Ron Yorston 2015-05-18 09:51:35 +02:00 committed by Denys Vlasenko
parent d68d1fbd6c
commit eb6b48ba74
3 changed files with 5 additions and 2 deletions

View File

@ -6361,8 +6361,8 @@ subevalvar(char *p, char *varname, int strloc, int subtype,
// p, varname, strloc, subtype, startloc, varflags, quotes); // p, varname, strloc, subtype, startloc, varflags, quotes);
herefd = -1; herefd = -1;
argstr(p, (subtype != VSASSIGN && subtype != VSQUESTION) ? EXP_CASE : 0, argstr(p, EXP_TILDE | (subtype != VSASSIGN && subtype != VSQUESTION ?
var_str_list); EXP_CASE : 0), var_str_list);
STPUTC('\0', expdest); STPUTC('\0', expdest);
herefd = saveherefd; herefd = saveherefd;
argbackq = saveargbackq; argbackq = saveargbackq;

View File

@ -0,0 +1 @@
:/root

View File

@ -0,0 +1,2 @@
a=~root:~root
echo ${a#~root}