ash: bash-compatible $'...' shouldn't expand in double quotes
Bash doesn't expand its $'...' construct in double quotes: $ echo "$'a\tb'" $'a\tb' Change BusyBox ash to do the same. This also fixes a problem with here documents where BusyBox ash gave an incorrect result for: $ cat <<EOF > '$' > EOF '$' Reported-by: Timo Teras <timo.teras@iki.fi> Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
2b91958dff
commit
84ba50c32f
@ -11500,7 +11500,7 @@ parsesub: {
|
|||||||
|| (c != '(' && c != '{' && !is_name(c) && !is_special(c))
|
|| (c != '(' && c != '{' && !is_name(c) && !is_special(c))
|
||||||
) {
|
) {
|
||||||
#if ENABLE_ASH_BASH_COMPAT
|
#if ENABLE_ASH_BASH_COMPAT
|
||||||
if (c == '\'')
|
if (syntax != DQSYNTAX && c == '\'')
|
||||||
bash_dollar_squote = 1;
|
bash_dollar_squote = 1;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
1
shell/ash_test/ash-heredoc/heredoc4.right
Normal file
1
shell/ash_test/ash-heredoc/heredoc4.right
Normal file
@ -0,0 +1 @@
|
|||||||
|
'$'
|
3
shell/ash_test/ash-heredoc/heredoc4.tests
Executable file
3
shell/ash_test/ash-heredoc/heredoc4.tests
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
cat <<EOF
|
||||||
|
'$'
|
||||||
|
EOF
|
@ -1,4 +1,5 @@
|
|||||||
a b
|
a b
|
||||||
|
$'a\tb'
|
||||||
a
|
a
|
||||||
b c
|
b c
|
||||||
def
|
def
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
echo $'a\tb'
|
echo $'a\tb'
|
||||||
|
echo "$'a\tb'"
|
||||||
echo $'a\nb' $'c\nd''ef'
|
echo $'a\nb' $'c\nd''ef'
|
||||||
echo $'a\'b' $'c\"d' $'e\\f'
|
echo $'a\'b' $'c\"d' $'e\\f'
|
||||||
echo $'a\63b' $'c\063b' $'e\0633f'
|
echo $'a\63b' $'c\063b' $'e\0633f'
|
||||||
|
Loading…
Reference in New Issue
Block a user