Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Jul 2013 15:29:41 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r253271 - in head: bin/sh tools/regression/bin/sh/execution
Message-ID:  <201307121529.r6CFTftp048983@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307121529.r6CFTftp048983>