← Commit list

d73cdbf84

Denys Vlasenko
Denys Vlasenko
2018-07-23
SUCCESS Duration: 148s

Subject

hush: fix handling of heredocs starting with empty lines

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_test/ash-heredoc/heredoc_empty3.right+2 -0
@@ -0,0 +1,2 @@
+
+Ok
shell/ash_test/ash-heredoc/heredoc_empty3.tests+4 -0
@@ -0,0 +1,4 @@
+cat <<EOF
+
+Ok
+EOF
shell/hush.c+8 -0
@@ -4226,6 +4226,14 @@ static char *fetch_till_str(o_string *as_string,
int prev = 0; /* not \ */
int ch;
+ /* Starting with "" is necessary for this case:
+ * cat <<EOF
+ *
+ * xxx
+ * EOF
+ */
+ heredoc.data = xzalloc(1); /* start as "", not as NULL */
+
goto jump_in;
while (1) {
shell/hush_test/hush-heredoc/heredoc_empty3.right+2 -0
@@ -0,0 +1,2 @@
+
+Ok
shell/hush_test/hush-heredoc/heredoc_empty3.tests+4 -0
@@ -0,0 +1,4 @@
+cat <<EOF
+
+Ok
+EOF