hush: fix a backslash-removal bug in case
function old new delta run_list 1270 1053 -217 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
9a95df9046
commit
abf755615e
3
shell/ash_test/ash-quoting/bkslash_case2.right
Normal file
3
shell/ash_test/ash-quoting/bkslash_case2.right
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
ok1
|
||||||
|
ok2
|
||||||
|
Ok:0
|
13
shell/ash_test/ash-quoting/bkslash_case2.tests
Executable file
13
shell/ash_test/ash-quoting/bkslash_case2.tests
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
x='\abc'
|
||||||
|
|
||||||
|
case "$x" in
|
||||||
|
\\*) echo ok1;;
|
||||||
|
*) echo BUG1;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case $x in
|
||||||
|
\\*) echo ok2;;
|
||||||
|
*) echo BUG2;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo Ok:$?
|
@ -6347,7 +6347,7 @@ static char *expand_string_to_string(const char *str, int do_unbackslash)
|
|||||||
return (char*)list;
|
return (char*)list;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_HUSH_CASE
|
#if 0
|
||||||
static char* expand_strvec_to_string(char **argv)
|
static char* expand_strvec_to_string(char **argv)
|
||||||
{
|
{
|
||||||
char **list;
|
char **list;
|
||||||
@ -8731,8 +8731,10 @@ static int run_list(struct pipe *pi)
|
|||||||
#if ENABLE_HUSH_CASE
|
#if ENABLE_HUSH_CASE
|
||||||
if (rword == RES_CASE) {
|
if (rword == RES_CASE) {
|
||||||
debug_printf_exec("CASE cond_code:%d\n", cond_code);
|
debug_printf_exec("CASE cond_code:%d\n", cond_code);
|
||||||
case_word = expand_strvec_to_string(pi->cmds->argv);
|
case_word = expand_string_to_string(pi->cmds->argv[0], 1);
|
||||||
unbackslash(case_word);
|
debug_printf_exec("CASE word1:'%s'\n", case_word);
|
||||||
|
//unbackslash(case_word);
|
||||||
|
//debug_printf_exec("CASE word2:'%s'\n", case_word);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (rword == RES_MATCH) {
|
if (rword == RES_MATCH) {
|
||||||
|
3
shell/hush_test/hush-quoting/bkslash_case2.right
Normal file
3
shell/hush_test/hush-quoting/bkslash_case2.right
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
ok1
|
||||||
|
ok2
|
||||||
|
Ok:0
|
13
shell/hush_test/hush-quoting/bkslash_case2.tests
Executable file
13
shell/hush_test/hush-quoting/bkslash_case2.tests
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
x='\abc'
|
||||||
|
|
||||||
|
case "$x" in
|
||||||
|
\\*) echo ok1;;
|
||||||
|
*) echo BUG1;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case $x in
|
||||||
|
\\*) echo ok2;;
|
||||||
|
*) echo BUG2;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo Ok:$?
|
Loading…
Reference in New Issue
Block a user