From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22744 invoked from network); 26 Jul 2001 11:09:07 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 26 Jul 2001 11:09:07 -0000 Received: (qmail 13048 invoked by alias); 26 Jul 2001 11:08:58 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15499 Received: (qmail 13035 invoked from network); 26 Jul 2001 11:08:57 -0000 X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer goliath.siemens.de) From: Borsenkow Andrej To: Zsh hackers list Subject: RE: Nasty bug in array-element typeset assignments Date: Thu, 26 Jul 2001 15:08:38 +0400 Message-ID: <002001c115c3$524f76b0$21c9ca95@mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <3B5FEB29.884D31BF@u.genie.co.uk> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2479.0006 > > > Yes, recent changes has enabled it. > Commit log does not have article number, but diffs are here: > Really? So what would it do? Make the whole foo array local or just the > first element? Clearly neither works. > Probably, intent was to create new local array. > > Yuk. Whoever decided on this has got a job on their hands. > > > Typeset is going to get *very* confused. Each change like this > multiplies, > The problem is here: /* Take arguments literally. Don't glob */ while ((asg = getasg(*argv++))) { if (!typeset_single(name, asg->name, (Param) (paramtab == realparamtab ? gethashnode2(paramtab, asg->name) : paramtab->getnode(paramtab, asg->name)), func, on, off, roff, asg->value, NULL)) returnval = 1; } We get foo[1]=bar and try to fetch parameter `foo[1]' that does not exist of course, so later on in typeset_single we believe there is no such parameter. It means, that we just set element of existing one in } else if (PM_TYPE(on) == PM_SCALAR) { /* * This will either complain about bad identifiers, or will set * a hash element or array slice. This once worked by accident, * creating a stray parameter along the way via createparam(), * now called below in the isident() branch. */ if (!(pm = setsparam(pname, ztrdup(value ? value : "")))) return NULL; value = NULL; Later on we obviously change locality of this array in if (keeplocal) pm->level = keeplocal; So, this may work assuming that we change getasg() to properly recognize subscription. Note, that this bug affects 4.0.2 as well so we better fix it and issue 4.0.3. -andrej