diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-03-02 18:12:12 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-03-02 18:12:12 +0100 |
commit | 55f8133a4fb207d6fecd02f43c36809d3c2f6672 (patch) | |
tree | 5f57cd305d494a914980022bb6767b2e8faaf676 /shell/ash_test | |
parent | 744a20d8f9b1baf7c8cc1ed33ec744a52c89768f (diff) | |
download | busybox-w32-55f8133a4fb207d6fecd02f43c36809d3c2f6672.tar.gz busybox-w32-55f8133a4fb207d6fecd02f43c36809d3c2f6672.tar.bz2 busybox-w32-55f8133a4fb207d6fecd02f43c36809d3c2f6672.zip |
shell: tweak bkslash_in_varexp.tests, add bkslash_in_varexp1.tests
It turns out bkslash_in_varexp.tests was a bash bug :]
ash and hush fail "corrected" bkslash_in_varexp.tests as well,
just not as badly as I thought (hush gets half of the cases right).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/ash_test')
-rwxr-xr-x | shell/ash_test/ash-quoting/bkslash_in_varexp.tests | 12 | ||||
-rw-r--r-- | shell/ash_test/ash-quoting/bkslash_in_varexp1.right | 5 | ||||
-rwxr-xr-x | shell/ash_test/ash-quoting/bkslash_in_varexp1.tests | 6 |
3 files changed, 22 insertions, 1 deletions
diff --git a/shell/ash_test/ash-quoting/bkslash_in_varexp.tests b/shell/ash_test/ash-quoting/bkslash_in_varexp.tests index 41b31ab54..6c7b4b0cc 100755 --- a/shell/ash_test/ash-quoting/bkslash_in_varexp.tests +++ b/shell/ash_test/ash-quoting/bkslash_in_varexp.tests | |||
@@ -1,4 +1,14 @@ | |||
1 | x=a | 1 | x='a]' |
2 | # | ||
3 | # \] is not a valid escape for ] in set glob expression. | ||
4 | # Glob sets have no escaping at all: | ||
5 | # ] can be in a set if it is the first char: []abc], | ||
6 | # dash can be in a set if it is first or last: [abc-], | ||
7 | # [ and \ need no protections at all: [a[b\c] is a valid set of 5 chars. | ||
8 | # | ||
9 | # bash-4.3.43 misinterprets [a\]] as "set of 'a' or ']'". | ||
10 | # Correct interpretation is "set of 'a' or '\', followed by ']'". | ||
11 | # | ||
2 | echo Nothing:${x#[a\]]} | 12 | echo Nothing:${x#[a\]]} |
3 | echo Nothing:"${x#[a\]]}" | 13 | echo Nothing:"${x#[a\]]}" |
4 | echo Nothing:${x%[a\]]} | 14 | echo Nothing:${x%[a\]]} |
diff --git a/shell/ash_test/ash-quoting/bkslash_in_varexp1.right b/shell/ash_test/ash-quoting/bkslash_in_varexp1.right new file mode 100644 index 000000000..d03047024 --- /dev/null +++ b/shell/ash_test/ash-quoting/bkslash_in_varexp1.right | |||
@@ -0,0 +1,5 @@ | |||
1 | Nothing: | ||
2 | Nothing: | ||
3 | Nothing: | ||
4 | Nothing: | ||
5 | Ok:0 | ||
diff --git a/shell/ash_test/ash-quoting/bkslash_in_varexp1.tests b/shell/ash_test/ash-quoting/bkslash_in_varexp1.tests new file mode 100755 index 000000000..3c817eae1 --- /dev/null +++ b/shell/ash_test/ash-quoting/bkslash_in_varexp1.tests | |||
@@ -0,0 +1,6 @@ | |||
1 | x=a | ||
2 | echo Nothing:${x#[]a]} | ||
3 | echo Nothing:"${x#[]a]}" | ||
4 | echo Nothing:${x%[]a]} | ||
5 | echo Nothing:"${x%[]a]}" | ||
6 | echo Ok:$? | ||