about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2011-07-01 15:23:01 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2011-07-01 15:23:01 +0000
commitad29258c8c2785796d3149c6c230e55d9debc82b (patch)
tree83b8c7e4028779c51b09f57899dc4c83807305b2
parent47347fc7d7decb08155abbeebdbeed4fc7ace6d9 (diff)
downloadzsh-ad29258c8c2785796d3149c6c230e55d9debc82b.tar.gz
zsh-ad29258c8c2785796d3149c6c230e55d9debc82b.tar.xz
zsh-ad29258c8c2785796d3149c6c230e55d9debc82b.zip
29530: ${...?...} shouldn't cause an error with NO_EXEC option
-rw-r--r--ChangeLog7
-rw-r--r--Src/subst.c28
-rw-r--r--Test/E01options.ztst4
3 files changed, 25 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index e4016aa3a..c2f1fd8a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-07-01  Peter Stephenson  <pws@csr.com>
+
+	* 29530: Src/subst.c, Test/E01options.ztst: ${..?..} shouldn't
+	cause an error with NO_EXEC option.
+
 2011-07-01  Frank Terbeck  <ft@bewatermyfriend.org>
 
 	* 29518: Completion/Unix/Command/_git: Fall back to file
@@ -15077,5 +15082,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5389 $
+* $Revision: 1.5390 $
 *****************************************************
diff --git a/Src/subst.c b/Src/subst.c
index e8a181129..1b0097001 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -2715,19 +2715,21 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
 	case '?':
 	case Quest:
 	    if (vunset) {
-		*idend = '\0';
-		zerr("%s: %s", idbeg, *s ? s : "parameter not set");
-		if (!interact) {
-		    if (mypid == getpid()) {
-			/*
-			 * paranoia: don't check for jobs, but there shouldn't
-			 * be any if not interactive.
-			 */
-			stopmsg = 1;
-			zexit(1, 0);
-		    } else
-			_exit(1);
-		}
+                if (isset(EXECOPT)) {
+                    *idend = '\0';
+                    zerr("%s: %s", idbeg, *s ? s : "parameter not set");
+                    if (!interact) {
+                        if (mypid == getpid()) {
+                            /*
+                             * paranoia: don't check for jobs, but there
+                             * shouldn't be any if not interactive.
+                             */
+                            stopmsg = 1;
+                            zexit(1, 0);
+                        } else
+                            _exit(1);
+                    }
+                }
 		return NULL;
 	    }
 	    break;
diff --git a/Test/E01options.ztst b/Test/E01options.ztst
index 4b53840c6..1bbfdbda1 100644
--- a/Test/E01options.ztst
+++ b/Test/E01options.ztst
@@ -353,6 +353,10 @@
   echo *NonExistentFile*)
 0:NO_EXEC option should not do globbing
 
+  (setopt noexec
+  echo ${unset_var?Not an error})
+0:NO_EXEC should not test for unset variables
+
   setopt NO_eval_lineno
   eval 'print $LINENO'
   setopt eval_lineno