From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7950 invoked from network); 24 Aug 2008 16:14:08 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 24 Aug 2008 16:14:08 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 21607 invoked from network); 24 Aug 2008 16:14:01 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 24 Aug 2008 16:14:01 -0000 Received: (qmail 18769 invoked by alias); 24 Aug 2008 16:13:54 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25516 Received: (qmail 18759 invoked from network); 24 Aug 2008 16:13:53 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 24 Aug 2008 16:13:53 -0000 Received: from ik-out-1112.google.com (ik-out-1112.google.com [66.249.90.176]) by bifrost.dotsrc.org (Postfix) with ESMTP id 1AEC2801E2B4 for ; Sun, 24 Aug 2008 18:13:50 +0200 (CEST) Received: by ik-out-1112.google.com with SMTP id c28so1036084ika.5 for ; Sun, 24 Aug 2008 09:13:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=NNr/3QiuM66HleLLOEOrR0G07Wg0F/+XkMtBLxjk0+g=; b=wBFA9TvgM0POmpZtzkoDvLE2IfirXsjLj+MvI2Gk0KtUSyKgxJ4LYkfUuaM6FATjHB N3UrPeyMmr7FY+8MjP47RZwu5Ag5UQ1z2Lw517feK/zrGJt0bG1wkWQySe0qCFeumELF RbZruQJt/0nByCQv5MQv1y65ymFfm46FQZuu0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=vEj8/7nia3Ip1m6xl3bx+JcaoRyZl4lzRUV7KMjvh+OVySZWbenhp96YxZQQrlxiUk xYgykh5Rcp+KCq7UyHyWBoLxcwEdEdKqPzCYBuLQm87kGgRmyAsRKOwGxCDVHRWaPTfU McC2foPJLoQ2kVqG3Sv7aJsvITFxnuV7ZRQFQ= Received: by 10.210.23.3 with SMTP id 3mr1308520ebw.41.1219594429254; Sun, 24 Aug 2008 09:13:49 -0700 (PDT) Received: by 10.210.19.20 with HTTP; Sun, 24 Aug 2008 09:13:49 -0700 (PDT) Message-ID: <237967ef0808240913p54929e56k141a28b0f1176c7a@mail.gmail.com> Date: Sun, 24 Aug 2008 18:13:49 +0200 From: "Mikael Magnusson" To: "Zsh hackers list" Subject: Re: Weird error message when using bash or ksh form of array initialization In-Reply-To: <6cd6de210808240905s40c8c86ch4766b711e87ffde5@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <6cd6de210808240905s40c8c86ch4766b711e87ffde5@mail.gmail.com> X-Virus-Scanned: ClamAV 0.92.1/8081/Sun Aug 24 15:41:12 2008 on bifrost X-Virus-Status: Clean 2008/8/24 Rocky Bernstein : > When I run this (erroneous?) program: > > typeset -a fd=() > typeset -a sources > typeset -i xx > > I get a weird error message: > > typeset:3: maximum nested function level reached > > Note that neither of these give an error: > > typeset -a fd=() > typeset -a sources > > or > > typeset -a fd > typeset -a sources > typeset -i xx > > or > > typeset -a fd > fd=() > typeset -a sources > typeset -i xx > > Somehow fd= is treated as a function which is indicated out by adding > a request to print out fd=: > > typeset -a fd=() > typeset -a sources > typeset -i xx > declare -f fd= > > Which reports: > typeset:3: maximum nested function level reached > 'fd=' () { > typeset -a sources > } > > Can someone explain what's going on? > > Since both bash and ksh allow an array initialization via the form > used above, it increases the chance of getting this weird error > message. > > Thanks. I think you need to quote the arguments for typeset, % typeset -a 'fd=()' typeset: fd: can't assign initial value for array Also, % typeset -a fd=() {} % which typeset typeset () { } % which -- -a -a () { } The whole thing probably gets interpreted as a function definition of the form name1 name2 name3 () { name1 foo bar }; name1 The function then ends up calling itself recursively which zsh protects itself against by erroring out after some iterations, no idea how many. -- Mikael Magnusson