hush: document bugs in [[ =~ ]] comparison
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
a7c065354f
commit
64981b4c8e
2
shell/hush_test/hush-bugs/strops5_bug.right
Normal file
2
shell/hush_test/hush-bugs/strops5_bug.right
Normal file
@ -0,0 +1,2 @@
|
||||
4:no:1
|
||||
5:YES:0
|
10
shell/hush_test/hush-bugs/strops5_bug.tests
Executable file
10
shell/hush_test/hush-bugs/strops5_bug.tests
Executable file
@ -0,0 +1,10 @@
|
||||
v='*.z'
|
||||
|
||||
# Buggy:
|
||||
# the problem is that expansion rules of LHS and RHS of ~=
|
||||
# should not be the same: in RHS, "$v" and "*" should escape metas
|
||||
# (currently "$v" does not),
|
||||
# but in LHS, they should _not_ do that
|
||||
# (currently "*" does). Thus these cases fail:
|
||||
[[ a.z == "$v" ]]; echo 4:no:$? # BUG: "$v" expands to *.z
|
||||
[[ "*".z == ?.z ]]; echo 5:YES:$? # BUG: "*" expands to \*
|
3
shell/hush_test/hush-test2/strops5.right
Normal file
3
shell/hush_test/hush-test2/strops5.right
Normal file
@ -0,0 +1,3 @@
|
||||
1:YES:0
|
||||
2:no:1
|
||||
3:YES:0
|
13
shell/hush_test/hush-test2/strops5.tests
Executable file
13
shell/hush_test/hush-test2/strops5.tests
Executable file
@ -0,0 +1,13 @@
|
||||
v='*.z'
|
||||
[[ a.z = *.z ]]; echo 1:YES:$?
|
||||
[[ a.z = "*".z ]]; echo 2:no:$?
|
||||
[[ a.z == $v ]]; echo 3:YES:$?
|
||||
|
||||
# Buggy:
|
||||
# the problem is that expansion rules of LHS and RHS of ~=
|
||||
# should not be the same: in RHS, "$v" and "*" should escape metas
|
||||
# (currently "$v" does not),
|
||||
# but in LHS, they should _not_ do that
|
||||
# (currently "*" does). Thus these cases fail:
|
||||
#[[ a.z == "$v" ]]; echo 4:no:$? # BUG: "$v" expands to *.z
|
||||
#[[ "*".z == ?.z ]]; echo 5:YES:$? # BUG: "*" expands to \*
|
Loading…
Reference in New Issue
Block a user