ash: do not expand tilde in parameter expansion within quotes
authorRon Yorston <rmy@pobox.com>
Mon, 18 May 2015 07:53:26 +0000 (09:53 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 18 May 2015 07:53:26 +0000 (09:53 +0200)
commit3df47f9cbbb7f16608cbc642026625cdf7f06aa9
treea2bc999e17bcf10c29bceeb1403cbc7ef658aa84
parenteb6b48ba743d510ad9e6f9c3a8b3899d1eb9b5f3
ash: do not expand tilde in parameter expansion within quotes

Test case:
   unset a
   echo "${a:-~root}"
Old result:
   /root
New result:
   ~root

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

function                                             old     new   delta
evalvar                                              598     604      +6
parse_command                                       1440    1443      +3
localcmd                                             325     327      +2
readtoken1                                          3199    3200      +1
argstr                                              1180    1164     -16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/1 up/down: 12/-16)             Total: -4 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash.c
shell/ash_test/ash-vars/var-do-not-expand-tilde-in-parameter-expansion-in-quotes.right [new file with mode: 0644]
shell/ash_test/ash-vars/var-do-not-expand-tilde-in-parameter-expansion-in-quotes.tests [new file with mode: 0755]