ash: fix arithmetic closing )) split by backslash-newline

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2016-09-29 17:58:58 +02:00
parent 73c3e074df
commit 459293b1c5
5 changed files with 50 additions and 1 deletions

View File

@ -11437,7 +11437,7 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
if (parenlevel > 0) { if (parenlevel > 0) {
parenlevel--; parenlevel--;
} else { } else {
if (pgetc() == ')') { if (pgetc_eatbnl() == ')') {
c = CTLENDARI; c = CTLENDARI;
if (--arinest == 0) { if (--arinest == 0) {
syntax = prevsyntax; syntax = prevsyntax;
@ -11464,6 +11464,7 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
if (varnest == 0) { if (varnest == 0) {
#if ENABLE_ASH_BASH_COMPAT #if ENABLE_ASH_BASH_COMPAT
if (c == '&') { if (c == '&') {
//Can't call pgetc_eatbnl() here, this requires three-deep pungetc()
if (pgetc() == '>') if (pgetc() == '>')
c = 0x100 + '>'; /* flag &> */ c = 0x100 + '>'; /* flag &> */
pungetc(); pungetc();

View File

@ -1,3 +1,7 @@
Ok Ok
Ba d Ba d
Ok Ok
Ok
Ok
Forty two:42
Forty two:42

View File

@ -13,3 +13,23 @@ d'
eval $e eval $e
# "Ok" # "Ok"
eval "$e" eval "$e"
echo $\
(echo Ok\
)
echo "$\
(echo Ok\
)"
echo Forty two:$\
(\
(\
42\
)\
)
echo "Forty two:$\
(\
(\
42\
)\
)"

View File

@ -1,3 +1,7 @@
Ok Ok
Ba d Ba d
Ok Ok
Ok
Ok
Forty two:42
Forty two:42

View File

@ -13,3 +13,23 @@ d'
eval $e eval $e
# "Ok" # "Ok"
eval "$e" eval "$e"
echo $\
(echo Ok\
)
echo "$\
(echo Ok\
)"
echo Forty two:$\
(\
(\
42\
)\
)
echo "Forty two:$\
(\
(\
42\
)\
)"