mirror of
https://github.com/sheumann/hush.git
synced 2024-12-28 07:30:23 +00:00
hush: fix escaping of \[*?; add testsuites for these and for globbing
This commit is contained in:
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");
|
||||
return 1;
|
||||
}
|
||||
o_addqchr(dest, '\\', dest->o_quote);
|
||||
o_addqchr(dest, i_getch(input), dest->o_quote);
|
||||
break;
|
||||
case '$':
|
||||
@ -3653,7 +3652,7 @@ static int parse_stream(o_string *dest, struct p_context *ctx,
|
||||
ch = i_getch(input);
|
||||
if (ch == EOF || ch == '\'')
|
||||
break;
|
||||
o_addchr(dest, ch);
|
||||
o_addqchr(dest, ch, 1);
|
||||
}
|
||||
if (ch == EOF) {
|
||||
syntax("unterminated '");
|
||||
|
2
shell/hush_test/hush-glob/glob1.right
Normal file
2
shell/hush_test/hush-glob/glob1.right
Normal file
@ -0,0 +1,2 @@
|
||||
glob1.tests
|
||||
glob1.tests
|
2
shell/hush_test/hush-glob/glob1.tests
Executable file
2
shell/hush_test/hush-glob/glob1.tests
Executable file
@ -0,0 +1,2 @@
|
||||
echo *glob1?t[e]sts*
|
||||
echo "glob1"?'t'[e]s*
|
4
shell/hush_test/hush-parsing/escape1.right
Normal file
4
shell/hush_test/hush-parsing/escape1.right
Normal file
@ -0,0 +1,4 @@
|
||||
\
|
||||
a\b
|
||||
\\
|
||||
c\\d
|
4
shell/hush_test/hush-parsing/escape1.tests
Executable file
4
shell/hush_test/hush-parsing/escape1.tests
Executable file
@ -0,0 +1,4 @@
|
||||
echo "\\"
|
||||
echo a"\\"b
|
||||
echo '\\'
|
||||
echo c'\\'d
|
4
shell/hush_test/hush-parsing/escape2.right
Normal file
4
shell/hush_test/hush-parsing/escape2.right
Normal file
@ -0,0 +1,4 @@
|
||||
*?[a]*
|
||||
a*?[a]*b
|
||||
*?[a]*
|
||||
c*?[a]*d
|
4
shell/hush_test/hush-parsing/escape2.tests
Executable file
4
shell/hush_test/hush-parsing/escape2.tests
Executable file
@ -0,0 +1,4 @@
|
||||
echo "*?[a]*"
|
||||
echo a"*?[a]*"b
|
||||
echo '*?[a]*'
|
||||
echo c'*?[a]*'d
|
Loading…
Reference in New Issue
Block a user