svn commit: r253271 - in head: bin/sh tools/regression/bin/sh/execution

Jilles Tjoelker jilles at FreeBSD.org
Fri Jul 12 15:29:42 UTC 2013


Author: jilles
Date: Fri Jul 12 15:29:41 2013
New Revision: 253271
URL: http://svnweb.freebsd.org/changeset/base/253271

Log:
  sh: Do not read from stdin if an error occurs during -i -c cmd.
  
  Although using -i with -c does not seem very useful, it seems inappropriate
  to read commands from the terminal in this case.
  
  Side effect: if the -s -c extension is used and the -s option is turned off
  using 'set +s' during the interactive part, the shell now exits after an
  error or interrupt. Note that POSIX only specifies -s as option to sh, not
  to set.
  
  See also Austin Group issue #718.

Added:
  head/tools/regression/bin/sh/execution/int-cmd1.0   (contents, props changed)
Modified:
  head/bin/sh/main.c

Modified: head/bin/sh/main.c
==============================================================================
--- head/bin/sh/main.c	Fri Jul 12 15:08:37 2013	(r253270)
+++ head/bin/sh/main.c	Fri Jul 12 15:29:41 2013	(r253271)
@@ -170,8 +170,8 @@ state3:
 	if (minusc) {
 		evalstring(minusc, sflag ? 0 : EV_EXIT);
 	}
+state4:
 	if (sflag || minusc == NULL) {
-state4:	/* XXX ??? - why isn't this before the "if" statement */
 		cmdloop(1);
 	}
 	exitshell(exitstatus);

Added: head/tools/regression/bin/sh/execution/int-cmd1.0
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/regression/bin/sh/execution/int-cmd1.0	Fri Jul 12 15:29:41 2013	(r253271)
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+! echo echo bad | $SH -ic 'fi' 2>/dev/null


More information about the svn-src-all mailing list