From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: [PATCH] Make $options re-settable.
Date: Fri, 24 Feb 2017 05:17:04 +0000 [thread overview]
Message-ID: <1487913424-22247-1-git-send-email-danielsh@fujitsu.shahaf.local2> (raw)
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
reply other threads:[~2017-02-24 5:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1487913424-22247-1-git-send-email-danielsh@fujitsu.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).