about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <p.stephenson@samsung.com>2021-08-10 09:19:32 +0100
committerPeter Stephenson <p.stephenson@samsung.com>2021-08-10 09:19:32 +0100
commitdaa208e90763d304dc1d554a834d0066e0b9937c (patch)
tree2af47d1d690225eab47f526ba3aced64b1ecc096
parent765bc1470197fa76b74e58b878ed406745234518 (diff)
downloadzsh-daa208e90763d304dc1d554a834d0066e0b9937c.tar.gz
zsh-daa208e90763d304dc1d554a834d0066e0b9937c.tar.xz
zsh-daa208e90763d304dc1d554a834d0066e0b9937c.zip
49269: Fix "[ ! -o ]".
This should detect "-o" as non-empty string; "-a" was alrady working.
Update the test.
-rw-r--r--ChangeLog6
-rw-r--r--Src/parse.c2
-rw-r--r--Test/C02cond.ztst2
3 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 4690121fc..b7ba668f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2021-08-10  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 49269: Src/parse.c, Test/C02cond.ztst: "[ ! -o ]" should
+	detect "-o" as a non-empty string and return status 1.  Update
+	test to reflect this.
+
 2021-07-30  dana  <dana@dana.is>
 
 	* github #77: Stavros Ntentos: Completion/X/Command/_sublimetext:
diff --git a/Src/parse.c b/Src/parse.c
index b09c7989a..be26112a5 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -2509,7 +2509,7 @@ par_cond_2(void)
 	 * In "test" compatibility mode, "! -a ..." and "! -o ..."
 	 * are treated as "[string] [and] ..." and "[string] [or] ...".
 	 */
-	if (!(n_testargs > 1 && (check_cond(*testargs, "a") ||
+	if (!(n_testargs > 2 && (check_cond(*testargs, "a") ||
 				 check_cond(*testargs, "o"))))
 	{
 	    condlex();
diff --git a/Test/C02cond.ztst b/Test/C02cond.ztst
index 5b105b2a0..4366b4142 100644
--- a/Test/C02cond.ztst
+++ b/Test/C02cond.ztst
@@ -380,7 +380,7 @@ F:scenario if you encounter it.
 >0
 >0
 >1
->0
+>1
 >0
 >0
 >1