about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2000-06-22 20:57:14 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2000-06-22 20:57:14 +0000
commit12fd5d0065f64f0fae54d335624b4cb10e2832b9 (patch)
tree6155027ed5a36edf973d5baed42c87acc2ca0dbd
parent122e46b406f57712158651d8f559f52bbd3227e1 (diff)
downloadzsh-12fd5d0065f64f0fae54d335624b4cb10e2832b9.tar.gz
zsh-12fd5d0065f64f0fae54d335624b4cb10e2832b9.tar.xz
zsh-12fd5d0065f64f0fae54d335624b4cb10e2832b9.zip
12040: typeset -r bug
-rw-r--r--ChangeLog6
-rw-r--r--Src/builtin.c3
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 7847ef33c..068779055 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2000-06-22  Peter Stephenson  <pws@pwstephenson.fsnet.co.uk>
+
+	* 12040: Src/builtin.c: typeset -r on existing parameter set
+	the readonly flag before assigning any value on the same command
+	line.
+
 2000-06-22  Bart Schaefer  <schaefer@zsh.org>
 
 	* 12039: Test/comptest: Use "compinit -u" to avoid a possible
diff --git a/Src/builtin.c b/Src/builtin.c
index 8ea88862f..90c82c06e 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -1622,7 +1622,7 @@ typeset_single(char *cname, char *pname, Param pm, int func,
 		    arrfixenv(pm->nam, x);
 	    }
 	}
-	pm->flags = (pm->flags | on) & ~(off | PM_UNSET);
+	pm->flags = (pm->flags | (on & ~PM_READONLY)) & ~(off | PM_UNSET);
 	/* This auxlen/pm->ct stuff is a nasty hack. */
 	if ((on & (PM_LEFT | PM_RIGHT_B | PM_RIGHT_Z | PM_INTEGER |
 		   PM_EFLOAT | PM_FFLOAT)) &&
@@ -1643,6 +1643,7 @@ typeset_single(char *cname, char *pname, Param pm, int func,
 	    zwarnnam(cname, "can't assign new value for array %s", pname, 0);
 	    return NULL;
 	}
+	pm->flags |= (on & PM_READONLY);
 	return pm;
     }