From owner-freebsd-stable@FreeBSD.ORG Sun Sep 23 17:23:47 2012 Return-Path: Delivered-To: stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C0F6106564A; Sun, 23 Sep 2012 17:23:47 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (unknown [IPv6:2001:610:1108:5012::107]) by mx1.freebsd.org (Postfix) with ESMTP id 9AA298FC14; Sun, 23 Sep 2012 17:23:46 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 95EA61203C4; Sun, 23 Sep 2012 19:23:42 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 700302847B; Sun, 23 Sep 2012 19:23:42 +0200 (CEST) Date: Sun, 23 Sep 2012 19:23:42 +0200 From: Jilles Tjoelker To: David O'Brien Message-ID: <20120923172342.GB41504@stack.nl> References: <20120921170902.GC28959@albert.catwhisker.org> <20120921173406.GC9070@stack.nl> <20120921222637.GA58984@hub.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120921222637.GA58984@hub.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: stable@freebsd.org Subject: Re: /bin/sh arithmetic doesn't seem to like leading 0 now X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 17:23:47 -0000 On Fri, Sep 21, 2012 at 10:26:37PM +0000, David O'Brien wrote: > On Fri, Sep 21, 2012 at 07:34:06PM +0200, Jilles Tjoelker wrote: > > On Fri, Sep 21, 2012 at 10:09:02AM -0700, David Wolfskill wrote: > > > $ echo $(( ( $( date +%m ) - 1 ) / 3 + 1 )) > > > arithmetic expression: expecting ')': " ( 09 - 1 ) / 3 + 1 " > ... > > This was done to avoid an inconsistency where constants starting with > > "0" and containing "8" or "9" were decimal, so something like > > $((018-017)) expanded to 3. > Jilles, > Would it be possible to improve on the error message? > If David had been given the Bash error message, I suspect he would have > figured out the issue right away. It would certainly be possible to add a new error message, but from the embedded point of view the extra code size may not be worth it (also considering that error messages can be enhanced in many other places as well). -- Jilles Tjoelker