summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--Src/builtin.c8
-rw-r--r--Test/C02cond.ztst12
3 files changed, 18 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index fc371399b..673fd9f26 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
+2016-01-21  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 37722: Src/builtin.c, Test/C02cond.zts: test builtin should
+	return status 2 on syntax error.
+
 2016-01-20  Peter Stephenson  <p.stephenson@samsung.com>
 
+	* 37705: Src/lex.c, Test/D04parameter.ztst: don't turn - to
+	Dash after start of brace parameter.
+
 	* unspoted: Config/version.mk: incremented version to 5.2-dev-1
 	because of parsing change.
 
diff --git a/Src/builtin.c b/Src/builtin.c
index dd20f9eab..98ecb09e8 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -6531,7 +6531,7 @@ bin_test(char *name, char **argv, UNUSED(Options ops), int func)
 	for (s = argv; *s; s++);
 	if (s == argv || strcmp(s[-1], "]")) {
 	    zwarnnam(name, "']' expected");
-	    return 1;
+	    return 2;
 	}
 	s[-1] = NULL;
     }
@@ -6574,19 +6574,19 @@ bin_test(char *name, char **argv, UNUSED(Options ops), int func)
     if (errflag) {
 	errflag &= ~ERRFLAG_ERROR;
 	zcontext_restore();
-	return 1;
+	return 2;
     }
 
     if (!prog || tok == LEXERR) {
 	zwarnnam(name, tokstr ? "parse error" : "argument expected");
 	zcontext_restore();
-	return 1;
+	return 2;
     }
     zcontext_restore();
 
     if (*curtestarg) {
 	zwarnnam(name, "too many arguments");
-	return 1;
+	return 2;
     }
 
     /* syntax is OK, so evaluate */
diff --git a/Test/C02cond.ztst b/Test/C02cond.ztst
index 0b4608a21..88cad0d64 100644
--- a/Test/C02cond.ztst
+++ b/Test/C02cond.ztst
@@ -223,27 +223,27 @@ F:Failures in these cases do not indicate a problem in the shell.
 0:substitution in `[' builtin
 
   [ -n foo scrimble ]
-1:argument checking for [ builtin
+2:argument checking for [ builtin
 ?(eval):[:1: too many arguments
 
   test -n foo scramble
-1:argument checking for test builtin
+2:argument checking for test builtin
 ?(eval):test:1: too many arguments
 
   [ -n foo scrimble scromble ]
-1:argument checking for [ builtin
+2:argument checking for [ builtin
 ?(eval):[:1: too many arguments
 
   test -n foo scramble scrumble
-1:argument checking for test builtin
+2:argument checking for test builtin
 ?(eval):test:1: too many arguments
 
   [ -n foo -a -n bar scrimble ]
-1:argument checking for [ builtin
+2:argument checking for [ builtin
 ?(eval):[:1: too many arguments
 
   test -n foo -a -z "" scramble
-1:argument checking for test builtin
+2:argument checking for test builtin
 ?(eval):test:1: too many arguments
 
   fn() {