mirror of https://github.com/mirror/busybox.git
hush: fix escaping of \[*?; add testsuites for these and for globbing
parent
2e76c3f901
commit
43360e5178
|
@ -3638,7 +3638,6 @@ static int parse_stream(o_string *dest, struct p_context *ctx,
|
||||||
debug_printf_parse("parse_stream return 1: \\<eof>\n");
|
debug_printf_parse("parse_stream return 1: \\<eof>\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
o_addqchr(dest, '\\', dest->o_quote);
|
|
||||||
o_addqchr(dest, i_getch(input), dest->o_quote);
|
o_addqchr(dest, i_getch(input), dest->o_quote);
|
||||||
break;
|
break;
|
||||||
case '$':
|
case '$':
|
||||||
|
@ -3653,7 +3652,7 @@ static int parse_stream(o_string *dest, struct p_context *ctx,
|
||||||
ch = i_getch(input);
|
ch = i_getch(input);
|
||||||
if (ch == EOF || ch == '\'')
|
if (ch == EOF || ch == '\'')
|
||||||
break;
|
break;
|
||||||
o_addchr(dest, ch);
|
o_addqchr(dest, ch, 1);
|
||||||
}
|
}
|
||||||
if (ch == EOF) {
|
if (ch == EOF) {
|
||||||
syntax("unterminated '");
|
syntax("unterminated '");
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
glob1.tests
|
||||||
|
glob1.tests
|
|
@ -0,0 +1,2 @@
|
||||||
|
echo *glob1?t[e]sts*
|
||||||
|
echo "glob1"?'t'[e]s*
|
|
@ -0,0 +1,4 @@
|
||||||
|
\
|
||||||
|
a\b
|
||||||
|
\\
|
||||||
|
c\\d
|
|
@ -0,0 +1,4 @@
|
||||||
|
echo "\\"
|
||||||
|
echo a"\\"b
|
||||||
|
echo '\\'
|
||||||
|
echo c'\\'d
|
|
@ -0,0 +1,4 @@
|
||||||
|
*?[a]*
|
||||||
|
a*?[a]*b
|
||||||
|
*?[a]*
|
||||||
|
c*?[a]*d
|
|
@ -0,0 +1,4 @@
|
||||||
|
echo "*?[a]*"
|
||||||
|
echo a"*?[a]*"b
|
||||||
|
echo '*?[a]*'
|
||||||
|
echo c'*?[a]*'d
|
Loading…
Reference in New Issue