Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

segv on typeset -A; a=(x y) builtin



$ 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