Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Make $options re-settable.
- X-seq: zsh-workers 40626
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] Make $options re-settable.
- Date: Fri, 24 Feb 2017 05:17:04 +0000
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=tHY 3GPaT4PAQWRS31QQrKUsFw/c=; b=mgoN3LBILnGp5D00ErLl5tlIMUpR2nPfgmG CGojwlz+5g+nnsQcpf4Cy9rhdUKwK1KqguJHZsEnMTuYRY6M2nN674e0mpmrq/j7 /MVsm/O0Kz4r6/WFjfOlTS7xbWhj9P7i+6N02CrjNhcr+n5e8j8Q/59scxv903qt /zk9AT44=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=smtpout; bh=tH Y3GPaT4PAQWRS31QQrKUsFw/c=; b=beQKNr4XGgglhc7XAO0+scKlQO9GzOCOMQ rYhQ57KV+XG9lR76DjcelZR8mx6Cj9hrh/d3YH+UrNPr2VKK8h0Va0S5qz6z59g1 DvyVfU3HhVJVpLXAdenN37e/Zosh54QXfoqgHeag8ZJs3ARUOH35VUHUvXls5g0x H4b664C4E=
- 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
Follow-up to 40508.
Reported-by: James McGlashan
---
Received via IRC.
James also suggests adding fuzzing/codegen-based testing, e.g.,
for v in functions options ...; do
$v+=() $v=() $v=(one_element)
eval "$v+=() $v=() $v=(one_element)"
done
We should indeed check the other parameter.c special hashes for other
occurrences of this bug. I haven't done so yet...
Cheers,
Daniel
Src/Modules/parameter.c | 4 ++--
Test/V06parameter.ztst | 3 +++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c
index c251e4f..c7aac88 100644
--- a/Src/Modules/parameter.c
+++ b/Src/Modules/parameter.c
@@ -937,7 +937,7 @@ unsetpmoption(Param pm, UNUSED(int exp))
/**/
static void
-setpmoptions(UNUSED(Param pm), HashTable ht)
+setpmoptions(Param pm, HashTable ht)
{
int i;
HashNode hn;
@@ -962,7 +962,7 @@ setpmoptions(UNUSED(Param pm), HashTable ht)
(val && strcmp(val, "off")), 0, opts))
zwarn("can't change option: %s", hn->nam);
}
- deleteparamtable(ht);
+ hashsetfn(pm, ht);
}
static const struct gsu_scalar pmoption_gsu =
diff --git a/Test/V06parameter.ztst b/Test/V06parameter.ztst
index 27d5878..2b66713 100644
--- a/Test/V06parameter.ztst
+++ b/Test/V06parameter.ztst
@@ -92,6 +92,9 @@
>foo
>bar
+ options+=(); options+=()
+0:$options can be appended to twice
+
%clean
rm -f autofn functrace.zsh rocky3.zsh sourcedfile myfunc
Messages sorted by:
Reverse Date,
Date,
Thread,
Author