about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-09-15 08:57:25 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-09-15 08:57:25 +0000
commit6951a1e0b2ce74ad8f2b30243e721c3890dcdda8 (patch)
treef3bb0eb795da5f0b7b81f64f6db09eb645faf3bd
parent06cc84ce849c2e28286ea68aed02cb8df2fb9ab7 (diff)
downloadzsh-6951a1e0b2ce74ad8f2b30243e721c3890dcdda8.tar.gz
zsh-6951a1e0b2ce74ad8f2b30243e721c3890dcdda8.tar.xz
zsh-6951a1e0b2ce74ad8f2b30243e721c3890dcdda8.zip
25671: non existing variable in typeset -p should cause status 1
-rw-r--r--ChangeLog5
-rw-r--r--Src/builtin.c4
-rw-r--r--Test/B02typeset.ztst2
3 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index d70fb004e..c39b470ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-09-15  Peter Stephenson  <pws@csr.com>
+
+	* 25671: Src/builtin.c, Test/B02typeset.ztst: non-existent
+	variable in typeset -p should cause status 1.
+
 2008-09-14  Clint Adams  <clint@zsh.org>
 
 	* 25667: Src/Zle/complete.c: free mstr before returning from
diff --git a/Src/builtin.c b/Src/builtin.c
index 8246453f4..4772e0a8c 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2479,8 +2479,10 @@ bin_typeset(char *name, char **argv, Options ops, int func)
 	if (OPT_ISSET(ops,'p')) {
 	    if (hn)
 		printparamnode(hn, printflags);
-	    else
+	    else {
 		zwarnnam(name, "no such variable: %s", asg->name);
+		returnval = 1;
+	    }
 	    continue;
 	}
 	if (!typeset_single(name, asg->name, (Param)hn,
diff --git a/Test/B02typeset.ztst b/Test/B02typeset.ztst
index abb549ed6..48a45c15d 100644
--- a/Test/B02typeset.ztst
+++ b/Test/B02typeset.ztst
@@ -449,7 +449,7 @@
  array=(foo bar)
  fn() { typeset -p array nonexistent; }
  fn
-0:declare -p shouldn't create scoped values
+1:declare -p shouldn't create scoped values
 >typeset -a array
 >array=(foo bar)
 ?fn:typeset: no such variable: nonexistent