Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Aug 2010 17:18:09 +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: r211399 - in head/tools/regression/bin/sh: builtins execution set-e
Message-ID:  <201008161718.o7GHI9ne004674@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Mon Aug 16 17:18:08 2010
New Revision: 211399
URL: http://svn.freebsd.org/changeset/base/211399

Log:
  sh: Get rid of unnecessary non-standard empty lists.
  
  POSIX does not allow constructs like:
    if cmd; then fi
    { }
  Add a colon dummy command, except in a test that verifies that such empty
  lists do not cause crashes when used as a function definition.

Modified:
  head/tools/regression/bin/sh/builtins/command3.0
  head/tools/regression/bin/sh/builtins/command5.0
  head/tools/regression/bin/sh/builtins/command6.0
  head/tools/regression/bin/sh/execution/func2.0
  head/tools/regression/bin/sh/set-e/elif1.0
  head/tools/regression/bin/sh/set-e/elif2.0
  head/tools/regression/bin/sh/set-e/if1.0
  head/tools/regression/bin/sh/set-e/if3.0
  head/tools/regression/bin/sh/set-e/while1.0
  head/tools/regression/bin/sh/set-e/while2.0

Modified: head/tools/regression/bin/sh/builtins/command3.0
==============================================================================
--- head/tools/regression/bin/sh/builtins/command3.0	Mon Aug 16 15:51:41 2010	(r211398)
+++ head/tools/regression/bin/sh/builtins/command3.0	Mon Aug 16 17:18:08 2010	(r211399)
@@ -4,6 +4,7 @@ command -v true
 command -v /bin/ls
 
 fun() {
+	:
 }
 command -v fun
 command -v break

Modified: head/tools/regression/bin/sh/builtins/command5.0
==============================================================================
--- head/tools/regression/bin/sh/builtins/command5.0	Mon Aug 16 15:51:41 2010	(r211398)
+++ head/tools/regression/bin/sh/builtins/command5.0	Mon Aug 16 17:18:08 2010	(r211399)
@@ -4,6 +4,7 @@ command -V true
 command -V /bin/ls
 
 fun() {
+	:
 }
 command -V fun
 command -V break

Modified: head/tools/regression/bin/sh/builtins/command6.0
==============================================================================
--- head/tools/regression/bin/sh/builtins/command6.0	Mon Aug 16 15:51:41 2010	(r211398)
+++ head/tools/regression/bin/sh/builtins/command6.0	Mon Aug 16 17:18:08 2010	(r211399)
@@ -5,6 +5,7 @@ command -pV true
 command -pV /bin/ls
 
 fun() {
+	:
 }
 command -pV fun
 command -pV break

Modified: head/tools/regression/bin/sh/execution/func2.0
==============================================================================
--- head/tools/regression/bin/sh/execution/func2.0	Mon Aug 16 15:51:41 2010	(r211398)
+++ head/tools/regression/bin/sh/execution/func2.0	Mon Aug 16 17:18:08 2010	(r211399)
@@ -1,4 +1,5 @@
 # $FreeBSD$
+# The empty pairs of braces here are to test that this does not cause a crash.
 
 f() { }
 f

Modified: head/tools/regression/bin/sh/set-e/elif1.0
==============================================================================
--- head/tools/regression/bin/sh/set-e/elif1.0	Mon Aug 16 15:51:41 2010	(r211398)
+++ head/tools/regression/bin/sh/set-e/elif1.0	Mon Aug 16 17:18:08 2010	(r211399)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 set -e
 if false; then
+	:
 elif false; then
+	:
 fi

Modified: head/tools/regression/bin/sh/set-e/elif2.0
==============================================================================
--- head/tools/regression/bin/sh/set-e/elif2.0	Mon Aug 16 15:51:41 2010	(r211398)
+++ head/tools/regression/bin/sh/set-e/elif2.0	Mon Aug 16 17:18:08 2010	(r211399)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 set -e
 if false; then
+	:
 elif false; false; then
+	:
 fi

Modified: head/tools/regression/bin/sh/set-e/if1.0
==============================================================================
--- head/tools/regression/bin/sh/set-e/if1.0	Mon Aug 16 15:51:41 2010	(r211398)
+++ head/tools/regression/bin/sh/set-e/if1.0	Mon Aug 16 17:18:08 2010	(r211399)
@@ -1,4 +1,5 @@
 # $FreeBSD$
 set -e
 if false; then
+	:
 fi

Modified: head/tools/regression/bin/sh/set-e/if3.0
==============================================================================
--- head/tools/regression/bin/sh/set-e/if3.0	Mon Aug 16 15:51:41 2010	(r211398)
+++ head/tools/regression/bin/sh/set-e/if3.0	Mon Aug 16 17:18:08 2010	(r211399)
@@ -1,4 +1,5 @@
 # $FreeBSD$
 set -e
 if false; false; then
+	:
 fi

Modified: head/tools/regression/bin/sh/set-e/while1.0
==============================================================================
--- head/tools/regression/bin/sh/set-e/while1.0	Mon Aug 16 15:51:41 2010	(r211398)
+++ head/tools/regression/bin/sh/set-e/while1.0	Mon Aug 16 17:18:08 2010	(r211399)
@@ -1,4 +1,5 @@
 # $FreeBSD$
 set -e
 while false; do
+	:
 done

Modified: head/tools/regression/bin/sh/set-e/while2.0
==============================================================================
--- head/tools/regression/bin/sh/set-e/while2.0	Mon Aug 16 15:51:41 2010	(r211398)
+++ head/tools/regression/bin/sh/set-e/while2.0	Mon Aug 16 17:18:08 2010	(r211399)
@@ -1,4 +1,5 @@
 # $FreeBSD$
 set -e
 while false; false; do
+	:
 done



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