This patch appears to solve the issue. As far as I can tell, this routine
is only used for here-documents.
diff --git a/parse.y b/parse.y
index 8fd24a1c..4d361af7 100644
--- a/parse.y
+++ b/parse.y
@@ -2083,6 +2083,8 @@ read_a_line (remove_quoted_newline)
static char *line_buffer = (char *)NULL;
static int buffer_size = 0;
int indx, c, peekc, pass_next;
+ /* Cannibalize our own input buffer. */
+ int prefetch;
#if defined (READLINE)
if (no_line_editing && SHOULD_PROMPT ())
@@ -2092,12 +2094,21 @@ read_a_line (remove_quoted_newline)
print_prompt ();
pass_next = indx = 0;
+ prefetch = shell_input_line_index < shell_input_line_len;
while (1)
{
/* Allow immediate exit if interrupted during input. */
QUIT;
- c = yy_getc ();
+ if (prefetch)
+{
+ if (c = shell_input_line[shell_input_line_index])
+shell_input_line_index++;
+ else
+c = '\n', prefetch = 0;
+}
+ else
+c = yy_getc ();
/* Ignore null bytes in input. */
if (c == 0)