Skip to content

Commit

Permalink
Properly flush input after an error in backquotes in interactive mode.
Browse files Browse the repository at this point in the history
For parsing an old-style backquote substitution (`...`),
a string "file" is used to store the contents of the
substitution (with the special backslash processing done).
If an error occurs, the shell cleans up all these files
(returning to the top level) and flush the top level
file. Erroneously, it first flushed the current file and
then cleaned up all extra files, so that the top level
file (i.e. the terminal) was not flushed.

Example (in interactive mode):
  echo `for` echo This should not be printed

Also noticeable in (in interactive mode):
  echo `(`
The old version prints an extraneous prompt.

Approved by:	ed (mentor)
  • Loading branch information
jillest committed Jun 17, 2009
1 parent 31dc96e commit 8f12a6b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bin/sh/input.c
Expand Up @@ -118,9 +118,9 @@ INIT {
}

RESET {
popallfiles();
if (exception != EXSHELLPROC)
parselleft = parsenleft = 0; /* clear input buffer */
popallfiles();
}

SHELLPROC {
Expand Down

0 comments on commit 8f12a6b

Please sign in to comment.