Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Moderately unhelpful error message
- X-seq: zsh-workers 28384
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Moderately unhelpful error message
- Date: Mon, 01 Nov 2010 08:51:30 -0700
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
schaefer<565> history[12]="Bwahahahaha#"
zsh: read-only variable: 12
The following isn't an ideal patch. For one thing, even in the case
where a member of an associative array is read-only, assignsparam()
returns v->pm which may not be NULL (but it seems as though perhaps a
NULL return ought to be what happens). For another, this duplicates
the read-only test in a fifth location.
Index: Src/params.c
--- ../zsh-forge/current/Src/params.c 2010-10-10 17:11:35.000000000 -0700
+++ Src/params.c 2010-11-01 08:49:43.000000000 -0700
@@ -2591,8 +2591,15 @@
*ss = '\0';
if (!(v = getvalue(&vbuf, &s, 1)))
createparam(t, PM_ARRAY);
- else
+ else {
+ if (v->pm->node.flags & PM_READONLY) {
+ zerr("read-only variable: %s", v->pm->node.nam);
+ *ss = '[';
+ zsfree(val);
+ return NULL;
+ }
flags &= ~ASSPM_WARN_CREATE;
+ }
*ss = '[';
v = NULL;
} else {
Messages sorted by:
Reverse Date,
Date,
Thread,
Author