From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14002 invoked from network); 28 Aug 1999 05:00:30 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 28 Aug 1999 05:00:30 -0000 Received: (qmail 8144 invoked by alias); 28 Aug 1999 05:00:16 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 2529 Received: (qmail 8137 invoked from network); 28 Aug 1999 05:00:14 -0000 From: "Bart Schaefer" Message-Id: <990828050003.ZM30545@candle.brasslantern.com> Date: Sat, 28 Aug 1999 05:00:03 +0000 In-Reply-To: <19990827194419.A7511@vmunix.com> Comments: In reply to Gabor "Re: Files modified after a given date" (Aug 27, 7:44pm) References: <199908230809.KAA02317@beta.informatik.hu-berlin.de> <19990827175122.A2818@vmunix.com> <990827224347.ZM28594@candle.brasslantern.com> <19990827194419.A7511@vmunix.com> X-Mailer: Z-Mail (5.0.0 30July97) To: Gabor , zsh-users@sunsite.auc.dk Subject: PATCH: ksharrays and assoc array assignments (was Re: Files modified after a given date) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Aug 27, 7:44pm, Gabor wrote: } Subject: Re: Files modified after a given date } } On Fri, Aug 27, 1999 at 10:43:47PM +0000, Bart Schaefer wrote: } # On Aug 27, 5:51pm, Gabor wrote: } # > Subject: Re: Files modified after a given date } # > === gabor $ builtin stat -H foo .zshrc } # > zsh: attempt to set slice of associative array } # } Well, I figured it out. I believe this to be a bug, though you } decide. I always set ksharrays since I like 0 based indexing and use } ksh for scripting at work. With ksharrays unset, it works. Aha. Yes, that's a bug. You can see it more easily with zsh% setopt ksharrays zsh% : ${(AA)=foo:=a b c d} zsh: attempt to set slice of associative array Here'a patch. Index: Src/params.c =================================================================== @@ -1697,9 +1697,14 @@ v = NULL; } } - if (!v) - if (!(v = getvalue(&t, 1))) - return NULL; + if (!v) { + int k = opts[KSHARRAYS]; /* Remember the value of KSHARRAYS */ + opts[KSHARRAYS] = 0; /* and clear it to avoid special- */ + v = getvalue(&t, 1); /* case of $array --> ${array[0]}. */ + opts[KSHARRAYS] = k; /* OK because we can't assign to a */ + if (!v) /* slice of an association anyway, */ + return NULL; /* so ANY subscript will be wrong. */ + } setarrvalue(v, val); return v->pm; } -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com