Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Feb 2011 15:02:19 +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: r218325 - in head: bin/sh tools/regression/bin/sh/execution
Message-ID:  <201102051502.p15F2J3k031417@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Sat Feb  5 15:02:19 2011
New Revision: 218325
URL: http://svn.freebsd.org/changeset/base/218325

Log:
  sh: Fix two things about {(...)} <redir:
  
  * In {(...) <redir1;} <redir2, do not drop redir1.
  * Maintain the difference between (...) <redir and {(...)} <redir:
    In (...) <redir, the redirection is performed in the child, while in
    {(...)} <redir it should be performed in the parent (like {(...); :;}
    <redir)

Added:
  head/tools/regression/bin/sh/execution/redir5.0   (contents, props changed)
Modified:
  head/bin/sh/parser.c

Modified: head/bin/sh/parser.c
==============================================================================
--- head/bin/sh/parser.c	Sat Feb  5 14:08:51 2011	(r218324)
+++ head/bin/sh/parser.c	Sat Feb  5 15:02:19 2011	(r218325)
@@ -389,8 +389,10 @@ command(void)
 	union node *cp, **cpp;
 	union node *redir, **rpp;
 	int t;
+	int is_subshell;
 
 	checkkwd = CHKNL | CHKKWD | CHKALIAS;
+	is_subshell = 0;
 	redir = NULL;
 	n1 = NULL;
 	rpp = &redir;
@@ -558,6 +560,7 @@ TRACE(("expecting DO got %s %s\n", tokna
 		if (readtoken() != TRP)
 			synexpect(TRP);
 		checkkwd = CHKKWD | CHKALIAS;
+		is_subshell = 1;
 		break;
 	case TBEGIN:
 		n1 = list(0, 0);
@@ -596,7 +599,7 @@ TRACE(("expecting DO got %s %s\n", tokna
 	tokpushback++;
 	*rpp = NULL;
 	if (redir) {
-		if (n1->type != NSUBSHELL) {
+		if (!is_subshell) {
 			n2 = (union node *)stalloc(sizeof (struct nredir));
 			n2->type = NREDIR;
 			n2->nredir.n = n1;

Added: head/tools/regression/bin/sh/execution/redir5.0
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/regression/bin/sh/execution/redir5.0	Sat Feb  5 15:02:19 2011	(r218325)
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+{ (echo bad) >/dev/null; } </dev/null



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