Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
segv on typeset -A; a=(x y) builtin
- X-seq: zsh-workers 42159
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: segv on typeset -A; a=(x y) builtin
- Date: Fri, 22 Dec 2017 22:17:09 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mail-followup-to:mime-version :content-disposition:user-agent; bh=Wv2CPnUCOEsHBsWXgMw/je3pSEXlTMfq9yMEkw7CpTY=; b=au2tsGRlHxCQ1EbeH/2IqvE5iw5Y3OLZ6fS6J1JxZmioZ+Y5TIbzbxyaGINTxvKPoJ y9sIBMpkf071ufsYiex3iAW/218XDvchcuP5Ig7Y0RBdcrDdmd7/HkKQBNhvuLjFySu/ VzRd3YKqXVJGEtzyncF9YY47d2qXaYTahTXVHp/lAiIdvFVVE9/DVkKsyTaxTwq3XcPR OTwGdmLNXTBnV5mTgua4T1t2xh7dDmAG9lWqrJZJ+ylZodI55MfDdkAOiyfj0P7WV9jI t2K4aAdpbwGPn/Q7omK4Ibj/CSy1bl4o7NHVQxG1668OIxHDNSz9riSXOOsE2axcbGuM oYog==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mail-followup-to: Zsh hackers list <zsh-workers@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
$ typeset -A a=(1 2); a=(x y) eval typeset -p a
typeset -A a
a=( x y )
fine. But
$ unset a
$ typeset -A a; a=(x y) eval typeset -p a
zsh: segmentation fault zsh
same with typeset -A a; a=(); a=(x y) eval typeset -p a
same with other builtins or functions.
This:
diff --git a/Src/params.c b/Src/params.c
index 31ff044..de7730a 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -549,10 +549,13 @@ scancopyparams(HashNode hn, UNUSED(int flags))
HashTable
copyparamtable(HashTable ht, char *name)
{
- HashTable nht = newparamtable(ht->hsize, name);
- outtable = nht;
- scanhashtable(ht, 0, 0, 0, scancopyparams, 0);
- outtable = NULL;
+ HashTable nht = 0;
+ if (ht) {
+ nht = newparamtable(ht->hsize, name);
+ outtable = nht;
+ scanhashtable(ht, 0, 0, 0, scancopyparams, 0);
+ outtable = NULL;
+ }
return nht;
}
seens to fix it (as "ht" happens to be 0 here for empty hashes
which explains the segv) but I can't really tell if it's the
right/best fix.
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author