Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Jan 2013 19:26:33 +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: r245382 - in head: bin/sh tools/regression/bin/sh/parser
Message-ID:  <201301131926.r0DJQXQS064110@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Sun Jan 13 19:26:33 2013
New Revision: 245382
URL: http://svnweb.freebsd.org/changeset/base/245382

Log:
  sh: Fix crash when parsing '{ } &'.
  
  MFC after:	1 week

Added:
  head/tools/regression/bin/sh/parser/empty-braces1.0   (contents, props changed)
Modified:
  head/bin/sh/parser.c

Modified: head/bin/sh/parser.c
==============================================================================
--- head/bin/sh/parser.c	Sun Jan 13 19:19:40 2013	(r245381)
+++ head/bin/sh/parser.c	Sun Jan 13 19:26:33 2013	(r245382)
@@ -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));

Added: head/tools/regression/bin/sh/parser/empty-braces1.0
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/regression/bin/sh/parser/empty-braces1.0	Sun Jan 13 19:26:33 2013	(r245382)
@@ -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?201301131926.r0DJQXQS064110>