← Commit list

350e686f3

Denys Vlasenko
Denys Vlasenko
2016-10-26
SUCCESS Duration: 209s

Subject

ash: [PARSER] Recognise here-doc delimiters terminated by EOF

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+9 -3
@@ -11592,11 +11592,17 @@ checkend: {
if (c == *eofmark) {
if (pfgets(line, sizeof(line)) != NULL) {
char *p, *q;
+ int cc;
p = line;
- for (q = eofmark + 1; *q && *p == *q; p++, q++)
- continue;
- if (*p == '\n' && *q == '\0') {
+ for (q = eofmark + 1;; p++, q++) {
+ cc = *p;
+ if (cc == '\n')
+ cc = 0;
+ if (!*q || cc != *q)
+ break;
+ }
+ if (cc == *q) {
c = PEOF;
nlnoprompt();
} else {
shell/ash_test/ash-heredoc/heredoc6.right+2 -0
@@ -0,0 +1,2 @@
+test
+OK:0
shell/ash_test/ash-heredoc/heredoc6.tests+4 -0
@@ -0,0 +1,4 @@
+eval 'cat <<- NOT
+test
+NOT'
+echo OK:$?
shell/ash_test/ash-heredoc/heredoc7.right+1 -0
@@ -0,0 +1 @@
+_ASBOX
shell/ash_test/ash-heredoc/heredoc7.tests+3 -0
@@ -0,0 +1,3 @@
+cat << _ACEOF
+_ASBOX
+_ACEOF
shell/hush_test/hush-heredoc/heredoc6.right+2 -0
@@ -0,0 +1,2 @@
+test
+OK:0
shell/hush_test/hush-heredoc/heredoc6.tests+4 -0
@@ -0,0 +1,4 @@
+eval 'cat <<- NOT
+test
+NOT'
+echo OK:$?
shell/hush_test/hush-heredoc/heredoc7.right+1 -0
@@ -0,0 +1 @@
+_ASBOX
shell/hush_test/hush-heredoc/heredoc7.tests+3 -0
@@ -0,0 +1,3 @@
+cat << _ACEOF
+_ASBOX
+_ACEOF