From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21152 invoked from network); 7 Oct 1999 10:41:07 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 7 Oct 1999 10:41:07 -0000 Received: (qmail 24736 invoked by alias); 7 Oct 1999 10:41:00 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8151 Received: (qmail 24724 invoked from network); 7 Oct 1999 10:40:59 -0000 From: "Bart Schaefer" Message-Id: <991007104018.ZM25846@candle.brasslantern.com> Date: Thu, 7 Oct 1999 10:40:18 +0000 X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.auc.dk Subject: PATCH: 3.1.6-pws-6: $compstate[unambiguous] could be garbage MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Earlier today I started noticing _main_complete: 95: bad set of key/value pairs for associative array Line 95 is copying the entire $compstate assoc int $lastcomp. I eventually tracked the problem to the value of `unambiguous' which it seemed was being dropped from the ${(@kv)compstate} expansion. Turns out the reason it was being dropped is that it pointed to a garbage string because unambig_data() was being called twice and was freeing and reallocating the cached value each time; the string returned the first time ended up pointing into free memory. I don't know whether the `|| !ainfo' is necessary in the patch below, but it seemed safest to have it there. It was always nonzero in the bug case, but I didn't go through every possible call to the function. Index: Src/Zle/zle_tricky.c =================================================================== @@ -7963,7 +7963,7 @@ scache = cline_str((ainfo->count ? ainfo->line : fainfo->line), 0, &ccache); } - } else { + } else if (mnum != unambig_mnum || !ainfo || !scache) { zsfree(scache); scache = ztrdup(""); ccache = 0; -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com