* [PATCH] Make $options re-settable.
@ 2017-02-24 5:17 Daniel Shahaf
0 siblings, 0 replies; only message in thread
From: Daniel Shahaf @ 2017-02-24 5:17 UTC (permalink / raw)
To: zsh-workers
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-02-24 5:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-24 5:17 [PATCH] Make $options re-settable Daniel Shahaf
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).