hush/shell/ash_test/ash-vars
Ron Yorston 549deab5ab ash: move parse-time quote flag detection to run-time
Because the parser does not recursively parse parameter expansion
with respect to quotes, we can't accurately determine quote status at
parse time.  This patch works around this by moving the quote detection
to run-time where we do interpret it recursively.

Test case:
   foo=\\ echo "<${foo#[\\]}>"
Old result:
   <\>
New result:
   <>

Do not quote back slashes in parameter expansions outside quotes.

Test case:
   a=/b/c/*
   b=\\
   echo ${a%$b*}
Old result:
   /b/c/*
New result:
   /b/c/

Based on commits 880d952, 7cfd8be, 0d7d660 and a7c21a6 from
git://git.kernel.org/pub/scm/utils/dash/dash.git by Herbert Xu

function                                             old     new   delta
argstr                                              1164    1193     +29
memtodest                                            147     174     +27
subevalvar                                          1153    1177     +24
redirect                                            1279    1282      +3
dolatstr                                               5       7      +2
static.spclchars                                      10       9      -1
expandarg                                            962     960      -2
evalcase                                             273     271      -2
evalcommand                                         1204    1197      -7
rmescapes                                            236     227      -9
preglob                                               27       8     -19
evalvar                                              604     582     -22
cmdputs                                              389     334     -55
readtoken1                                          3163    3061    -102
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/9 up/down: 85/-219)          Total: -134 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-05-18 09:57:51 +02:00
..
var_bash1.right
var_bash1.tests
var_bash2.right
var_bash2.tests
var_bash3.right ash: add a testcase for bug 2281 (currently fails). Small code cleanups. 2010-08-05 17:19:27 +02:00
var_bash3.tests hush: add support for ${var/pattern/repl}, conditional on bash compat 2010-09-05 14:47:58 +02:00
var_bash4.right ash: fix another bit of var_bash4 bug 2010-08-07 22:24:36 +02:00
var_bash4.tests ash: fix another bit of var_bash4 bug 2010-08-07 22:24:36 +02:00
var_bash5.right ash: add another ${v/a/b} test we currently fail 2010-08-30 13:54:12 +02:00
var_bash5.tests hush: fix handling of backslashes in variable assignment 2010-09-04 19:52:44 +02:00
var_leak.right ash: fix var_leak.tests so that it actually catches the NOFORK bug 2010-05-18 16:13:56 +02:00
var_leak.tests ash: fix var_leak.tests so that it actually catches the NOFORK bug 2010-05-18 16:13:56 +02:00
var_posix1.right ash: a bit more complete POSIX subst testsuite entry 2008-04-12 23:02:43 +00:00
var_posix1.tests ash: a bit more complete POSIX subst testsuite entry 2008-04-12 23:02:43 +00:00
var-do-not-collapse-arithmetic-expansion-at-parse-time.right ash: remove arithmetic expansion collapsing at parse time 2015-05-18 09:56:16 +02:00
var-do-not-collapse-arithmetic-expansion-at-parse-time.tests ash: remove arithmetic expansion collapsing at parse time 2015-05-18 09:56:16 +02:00
var-do-not-expand-tilde-in-parameter-expansion-in-quotes.right ash: do not expand tilde in parameter expansion within quotes 2015-05-18 09:53:26 +02:00
var-do-not-expand-tilde-in-parameter-expansion-in-quotes.tests ash: do not expand tilde in parameter expansion within quotes 2015-05-18 09:53:26 +02:00
var-do-not-quote-backslashes-in-parameter-expansions-outside-quotes.right ash: move parse-time quote flag detection to run-time 2015-05-18 09:57:51 +02:00
var-do-not-quote-backslashes-in-parameter-expansions-outside-quotes.tests ash: move parse-time quote flag detection to run-time 2015-05-18 09:57:51 +02:00
var-expand-tilde-in-parameter-expansion.right ash: perform tilde expansion in all parameter expansion words 2015-05-18 09:51:35 +02:00
var-expand-tilde-in-parameter-expansion.tests ash: perform tilde expansion in all parameter expansion words 2015-05-18 09:51:35 +02:00
var-runtime-quote-detection.right ash: move parse-time quote flag detection to run-time 2015-05-18 09:57:51 +02:00
var-runtime-quote-detection.tests ash: move parse-time quote flag detection to run-time 2015-05-18 09:57:51 +02:00
var1.right
var1.tests
var2.right
var2.tests
var3.right ash: fix handling of duplicate "local" 2015-04-18 19:36:38 +02:00
var3.tests ash: fix handling of duplicate "local" 2015-04-18 19:36:38 +02:00