Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Jan 2013 14:22:21 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r245690 - in stable/9: bin/sh tools/regression/bin/sh/parser
Message-ID:  <201301201422.r0KEMLLe097063@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Sun Jan 20 14:22:21 2013
New Revision: 245690
URL: http://svnweb.freebsd.org/changeset/base/245690

Log:
  MFC r245382: sh: Fix crash when parsing '{ } &'.

Added:
  stable/9/tools/regression/bin/sh/parser/empty-braces1.0
     - copied unchanged from r245382, head/tools/regression/bin/sh/parser/empty-braces1.0
Modified:
  stable/9/bin/sh/parser.c
Directory Properties:
  stable/9/bin/sh/   (props changed)
  stable/9/tools/regression/bin/sh/   (props changed)

Modified: stable/9/bin/sh/parser.c
==============================================================================
--- stable/9/bin/sh/parser.c	Sun Jan 20 12:44:50 2013	(r245689)
+++ stable/9/bin/sh/parser.c	Sun Jan 20 14:22:21 2013	(r245690)
@@ -240,9 +240,9 @@ list(int nlflag, int erflag)
 		n2 = andor();
 		tok = readtoken();
 		if (tok == TBACKGND) {
-			if (n2->type == NPIPE) {
+			if (n2 != NULL && n2->type == NPIPE) {
 				n2->npipe.backgnd = 1;
-			} else if (n2->type == NREDIR) {
+			} else if (n2 != NULL && n2->type == NREDIR) {
 				n2->type = NBACKGND;
 			} else {
 				n3 = (union node *)stalloc(sizeof (struct nredir));

Copied: stable/9/tools/regression/bin/sh/parser/empty-braces1.0 (from r245382, head/tools/regression/bin/sh/parser/empty-braces1.0)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/tools/regression/bin/sh/parser/empty-braces1.0	Sun Jan 20 14:22:21 2013	(r245690, copy of r245382, head/tools/regression/bin/sh/parser/empty-braces1.0)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+# Unfortunately, some scripts depend on the extension of allowing an empty
+# pair of braces.
+
+{ } &
+wait $!



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