about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--Src/glob.c2
-rw-r--r--Src/params.c18
-rw-r--r--Test/E01options.ztst9
4 files changed, 35 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index f76633ac6..6cb83facb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-01-10  Peter Stephenson  <pws@csr.com>
+
+	* 28617: Src/glob.c, Src/params.c, Test/E01options.ztst: NO_EXEC
+	option was doing to much work with parameter subscripting,
+	parameter assignments, and globbing.
+
 2011-01-09  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
 	* 28544: Src/Makefile.in, Makemod.in.in: another way of handling
@@ -14088,5 +14094,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5177 $
+* $Revision: 1.5178 $
 *****************************************************
diff --git a/Src/glob.c b/Src/glob.c
index 5f6813589..b788ff38a 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -1111,7 +1111,7 @@ zglob(LinkList list, LinkNode np, int nountok)
     struct globdata saved;		/* saved glob state              */
     int nobareglob = !isset(BAREGLOBQUAL);
 
-    if (unset(GLOBOPT) || !haswilds(ostr)) {
+    if (unset(GLOBOPT) || !haswilds(ostr) || unset(EXECOPT)) {
 	if (!nountok)
 	    untokenize(ostr);
 	return;
diff --git a/Src/params.c b/Src/params.c
index 3eb83eab2..246b0c1e1 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -1055,6 +1055,14 @@ getarg(char **str, int *inv, Value v, int a2, zlong *w,
     zlong num = 1, beg = 0, r = 0, quote_arg = 0;
     Patprog pprog = NULL;
 
+    /*
+     * If in NO_EXEC mode, the parameters won't be set up
+     * properly, so there's no point even doing any sanity checking.
+     * Just return 0 now.
+     */
+    if (unset(EXECOPT))
+	return 0;
+
     ishash = (v->pm && PM_TYPE(v->pm->node.flags) == PM_HASHED);
     if (prevcharlen)
 	*prevcharlen = 1;
@@ -2230,6 +2238,8 @@ export_param(Param pm)
 mod_export void
 setstrvalue(Value v, char *val)
 {
+    if (unset(EXECOPT))
+	return;
     if (v->pm->node.flags & PM_READONLY) {
 	zerr("read-only variable: %s", v->pm->node.nam);
 	zsfree(val);
@@ -2361,6 +2371,8 @@ setnumvalue(Value v, mnumber val)
 {
     char buf[BDIGBUFSIZE], *p;
 
+    if (unset(EXECOPT))
+	return;
     if (v->pm->node.flags & PM_READONLY) {
 	zerr("read-only variable: %s", v->pm->node.nam);
 	return;
@@ -2398,6 +2410,8 @@ setnumvalue(Value v, mnumber val)
 mod_export void
 setarrvalue(Value v, char **val)
 {
+    if (unset(EXECOPT))
+	return;
     if (v->pm->node.flags & PM_READONLY) {
 	zerr("read-only variable: %s", v->pm->node.nam);
 	freearray(val);
@@ -2808,6 +2822,8 @@ sethparam(char *s, char **val)
 	errflag = 1;
 	return NULL;
     }
+    if (unset(EXECOPT))
+	return;
     queue_signals();
     if (!(v = fetchvalue(&vbuf, &s, 1, SCANPM_ASSIGNING)))
 	createparam(t, PM_HASHED);
@@ -2846,6 +2862,8 @@ setnparam(char *s, mnumber val)
 	errflag = 1;
 	return NULL;
     }
+    if (unset(EXECOPT))
+	return;
     queue_signals();
     ss = strchr(s, '[');
     v = getvalue(&vbuf, &s, 1);
diff --git a/Test/E01options.ztst b/Test/E01options.ztst
index be83ceccd..4b53840c6 100644
--- a/Test/E01options.ztst
+++ b/Test/E01options.ztst
@@ -344,6 +344,15 @@
 0:NO_EXEC option
 >before
 
+  (setopt noexec
+  typeset -A hash
+  hash['this is a string'])
+0:NO_EXEC option should not attempt to parse subscripts
+
+  (setopt noexec nomatch
+  echo *NonExistentFile*)
+0:NO_EXEC option should not do globbing
+
   setopt NO_eval_lineno
   eval 'print $LINENO'
   setopt eval_lineno