svn commit: r194406 - head/bin/sh

Jilles Tjoelker jilles at FreeBSD.org
Wed Jun 17 21:58:33 UTC 2009


Author: jilles
Date: Wed Jun 17 21:58:32 2009
New Revision: 194406
URL: http://svn.freebsd.org/changeset/base/194406

Log:
  Properly flush input after an error in backquotes in interactive mode.
  
  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)

Modified:
  head/bin/sh/input.c

Modified: head/bin/sh/input.c
==============================================================================
--- head/bin/sh/input.c	Wed Jun 17 21:52:39 2009	(r194405)
+++ head/bin/sh/input.c	Wed Jun 17 21:58:32 2009	(r194406)
@@ -118,9 +118,9 @@ INIT {
 }
 
 RESET {
+	popallfiles();
 	if (exception != EXSHELLPROC)
 		parselleft = parsenleft = 0;	/* clear input buffer */
-	popallfiles();
 }
 
 SHELLPROC {


More information about the svn-src-all mailing list