diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-07-20 17:36:06 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-07-20 17:36:06 +0200 |
commit | 83e434d5b56baccf617ebcc8a752959f7c4aacfc (patch) | |
tree | 46a311ce40ba3f2e444d6cbf0c306351393498bf /shell/ash_test | |
parent | 294eb4612cd668521faa48711297196f00af61d9 (diff) | |
download | busybox-w32-83e434d5b56baccf617ebcc8a752959f7c4aacfc.tar.gz busybox-w32-83e434d5b56baccf617ebcc8a752959f7c4aacfc.tar.bz2 busybox-w32-83e434d5b56baccf617ebcc8a752959f7c4aacfc.zip |
hush: fix handling of '' in ${var:+ARG}
This wasn't an ash bug in dollar_altvalue9, it was hush bug (and bash!)
function old new delta
expand_one_var 2236 2254 +18
expand_vars_to_list 1097 1103 +6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 24/0) Total: 24 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/ash_test')
-rw-r--r-- | shell/ash_test/ash-quoting/dollar_altvalue2.right | 69 | ||||
-rwxr-xr-x | shell/ash_test/ash-quoting/dollar_altvalue2.tests | 33 | ||||
-rw-r--r-- | shell/ash_test/ash-quoting/dollar_altvalue9.right | 2 |
3 files changed, 104 insertions, 0 deletions
diff --git a/shell/ash_test/ash-quoting/dollar_altvalue2.right b/shell/ash_test/ash-quoting/dollar_altvalue2.right new file mode 100644 index 000000000..7cf37e379 --- /dev/null +++ b/shell/ash_test/ash-quoting/dollar_altvalue2.right | |||
@@ -0,0 +1,69 @@ | |||
1 | Unquoted '': | ||
2 | start: | ||
3 | || | ||
4 | end | ||
5 | start: | ||
6 | || | ||
7 | end | ||
8 | start: | ||
9 | || | ||
10 | end | ||
11 | start: | ||
12 | || | ||
13 | end | ||
14 | start: | ||
15 | || | ||
16 | || | ||
17 | end | ||
18 | |||
19 | Unquoted "": | ||
20 | start: | ||
21 | || | ||
22 | end | ||
23 | start: | ||
24 | || | ||
25 | end | ||
26 | start: | ||
27 | || | ||
28 | end | ||
29 | start: | ||
30 | || | ||
31 | end | ||
32 | start: | ||
33 | || | ||
34 | || | ||
35 | end | ||
36 | |||
37 | Quoted '': | ||
38 | start: | ||
39 | |''| | ||
40 | end | ||
41 | start: | ||
42 | |'' | | ||
43 | end | ||
44 | start: | ||
45 | | ''| | ||
46 | end | ||
47 | start: | ||
48 | | '' | | ||
49 | end | ||
50 | start: | ||
51 | |'' ''| | ||
52 | end | ||
53 | |||
54 | Quoted "": | ||
55 | start: | ||
56 | || | ||
57 | end | ||
58 | start: | ||
59 | | | | ||
60 | end | ||
61 | start: | ||
62 | | | | ||
63 | end | ||
64 | start: | ||
65 | | | | ||
66 | end | ||
67 | start: | ||
68 | | | | ||
69 | end | ||
diff --git a/shell/ash_test/ash-quoting/dollar_altvalue2.tests b/shell/ash_test/ash-quoting/dollar_altvalue2.tests new file mode 100755 index 000000000..3377eb27f --- /dev/null +++ b/shell/ash_test/ash-quoting/dollar_altvalue2.tests | |||
@@ -0,0 +1,33 @@ | |||
1 | f() { echo start:; for i; do echo "|$i|"; done; echo end; } | ||
2 | x=a | ||
3 | |||
4 | echo "Unquoted '':" | ||
5 | f ${x:+''} | ||
6 | f ${x:+'' } | ||
7 | f ${x:+ ''} | ||
8 | f ${x:+ '' } | ||
9 | f ${x:+'' ''} | ||
10 | |||
11 | echo | ||
12 | echo 'Unquoted "":' | ||
13 | f ${x:+""} | ||
14 | f ${x:+"" } | ||
15 | f ${x:+ ""} | ||
16 | f ${x:+ "" } | ||
17 | f ${x:+"" ""} | ||
18 | |||
19 | echo | ||
20 | echo "Quoted '':" | ||
21 | f "${x:+''}" | ||
22 | f "${x:+'' }" | ||
23 | f "${x:+ ''}" | ||
24 | f "${x:+ '' }" | ||
25 | f "${x:+'' ''}" | ||
26 | |||
27 | echo | ||
28 | echo 'Quoted "":' | ||
29 | f "${x:+""}" | ||
30 | f "${x:+"" }" | ||
31 | f "${x:+ ""}" | ||
32 | f "${x:+ "" }" | ||
33 | f "${x:+"" ""}" | ||
diff --git a/shell/ash_test/ash-quoting/dollar_altvalue9.right b/shell/ash_test/ash-quoting/dollar_altvalue9.right index fc6c2697c..39342fe7c 100644 --- a/shell/ash_test/ash-quoting/dollar_altvalue9.right +++ b/shell/ash_test/ash-quoting/dollar_altvalue9.right | |||
@@ -3,6 +3,7 @@ Unquoted 1: | |||
3 | |x y| | 3 | |x y| |
4 | |1| | 4 | |1| |
5 | |2| | 5 | |2| |
6 | || | ||
6 | |1 2| | 7 | |1 2| |
7 | |A| | 8 | |A| |
8 | |B| | 9 | |B| |
@@ -14,6 +15,7 @@ Unquoted 2: | |||
14 | |ax y| | 15 | |ax y| |
15 | |1| | 16 | |1| |
16 | |2| | 17 | |2| |
18 | || | ||
17 | |1 2| | 19 | |1 2| |
18 | |A| | 20 | |A| |
19 | |B| | 21 | |B| |