From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 233 invoked by alias); 7 Jun 2015 01:14:59 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35406 Received: (qmail 9269 invoked from network); 7 Jun 2015 01:14:55 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.0 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=XYY7GdhzYQ0bUyDDetwH8oEK2TaboNRvHjlxm34tHH0=; b=JEbBHi5xr3vOpfSFIiTYeMbBYgebfrKcI9xj+EZddmbUOKe/o4oSdm/GtQaT7rOFeT 9pIc/tJvUKzQVOA8fp6/rvVITOXyucGomb8oAIpTLe/E5Zd4Xe29rE+AmG/26pcnKQgj U8cuLXpWQxQ+74nwk+/RCLPe2IKLzm51GiY+6AIZB+EgLLZUFa/2pzj2+ym4NL5WoaEj jq8CILjNV7T0Hxj5wahBdcwy5Y/Q02lujoWgpvRxnmKuHoVaO6pD3dpJFS5h8Dd+JSmR 861VCOUPDxVwei1Pf8HdwDNRUlY5y2J/oPhgcGd2jujr2ltevevG+qRdt12wLWUwfMrF 8f1A== X-Gm-Message-State: ALoCoQkKXGrdE3hMM8mSjwWeHnyedrL5J0gS+/FAAXyfEe3ckzVlbP5RzZVmIfs/+KfO9+RI53G0 MIME-Version: 1.0 X-Received: by 10.194.109.36 with SMTP id hp4mr18740470wjb.4.1433639304381; Sat, 06 Jun 2015 18:08:24 -0700 (PDT) In-Reply-To: <20150529160237.6f329071@pwslap01u.europe.root.pri> References: <55676FB1.9080401@inlv.org> <20150529160237.6f329071@pwslap01u.europe.root.pri> Date: Sat, 6 Jun 2015 18:08:24 -0700 Message-ID: Subject: Re: Arith parsing bug with minus after $# From: Bart Schaefer To: Peter Stephenson Cc: Zsh hackers list Content-Type: text/plain; charset=UTF-8 On Fri, May 29, 2015 at 8:02 AM, Peter Stephenson wrote: > On Thu, 28 May 2015 21:42:41 +0200 > Martijn Dekker wrote: >> % set -- >> % echo $# >> 0 >> % echo $(($#-1)) >> 41 > > That's not a compatibility issue, that's just plain weird. I don't know > the POSIX terminology. > > The problem is the overloading of "#" --- the test to establish what to > do with it is trying too hard to resolve to ${#-}, which is a valid > substitution, because it hasn't taken into account that there are no > braces. So what you're seeing is ${#-}1. Incidentally, here is a few-years-old austin-group thread that is related: http://thread.gmane.org/gmane.comp.standards.posix.austin.general/3784