← Commit list

459293b1c

Denys Vlasenko
Denys Vlasenko
2016-09-29
SUCCESS Duration: 217s

Subject

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

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

shell/ash.c+2 -1
@@ -11437,7 +11437,7 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
if (parenlevel > 0) {
parenlevel--;
} else {
- if (pgetc() == ')') {
+ if (pgetc_eatbnl() == ')') {
c = CTLENDARI;
if (--arinest == 0) {
syntax = prevsyntax;
@@ -11464,6 +11464,7 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
if (varnest == 0) {
#if ENABLE_ASH_BASH_COMPAT
if (c == '&') {
+//Can't call pgetc_eatbnl() here, this requires three-deep pungetc()
if (pgetc() == '>')
c = 0x100 + '>'; /* flag &> */
pungetc();
shell/ash_test/ash-vars/var_unbackslash1.right+4 -0
@@ -1,3 +1,7 @@
Ok
Ba d
Ok
+Ok
+Ok
+Forty two:42
+Forty two:42
shell/ash_test/ash-vars/var_unbackslash1.tests+20 -0
@@ -13,3 +13,23 @@ d'
eval $e
# "Ok"
eval "$e"
+
+echo $\
+(echo Ok\
+)
+echo "$\
+(echo Ok\
+)"
+
+echo Forty two:$\
+(\
+(\
+42\
+)\
+)
+echo "Forty two:$\
+(\
+(\
+42\
+)\
+)"
shell/hush_test/hush-vars/var_unbackslash1.right+4 -0
@@ -1,3 +1,7 @@
Ok
Ba d
Ok
+Ok
+Ok
+Forty two:42
+Forty two:42
shell/hush_test/hush-vars/var_unbackslash1.tests+20 -0
@@ -13,3 +13,23 @@ d'
eval $e
# "Ok"
eval "$e"
+
+echo $\
+(echo Ok\
+)
+echo "$\
+(echo Ok\
+)"
+
+echo Forty two:$\
+(\
+(\
+42\
+)\
+)
+echo "Forty two:$\
+(\
+(\
+42\
+)\
+)"