about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/builtin.c7
2 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 4f2d49301..7ad21af73 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2002-09-19  Bart Schaefer  <schaefer@zsh.org>
+
+	* 17692: Src/builtin.c: Prevent typeset of a positional parameter
+	before it can do damage, and improve the error message about it.
+
 2002-09-19  Clint Adams  <clint@zsh.org>
 
         * 17252: Sven: Completion/Unix/Type/_path_files: fix for use of (z)
diff --git a/Src/builtin.c b/Src/builtin.c
index c43751711..dd553cf1c 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -1825,7 +1825,7 @@ typeset_single(char *cname, char *pname, Param pm, int func,
 		    "%s: array elements must be scalar", pname, 0);
 	    return NULL;
 	}
-    } else if (isident(pname)) {
+    } else if (isident(pname) && !idigit(*pname)) {
 	/*
 	 * Create a new node for a parameter with the flags in `on' minus the
 	 * readonly flag
@@ -1834,7 +1834,10 @@ typeset_single(char *cname, char *pname, Param pm, int func,
 	DPUTS(!pm, "BUG: parameter not created");
 	pm->ct = auxlen;
     } else {
-	zerr("not an identifier: %s", pname, 0);
+	if (isident(pname))
+	    zerrnam(cname, "not valid in this context: %s", pname, 0);
+	else
+	    zerrnam(cname, "not an identifier: %s", pname, 0);
 	return NULL;
     }