From owner-freebsd-standards@FreeBSD.ORG Thu Jun 5 11:10:11 2003 Return-Path: Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7F53A37B401 for ; Thu, 5 Jun 2003 11:10:11 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6471A43F75 for ; Thu, 5 Jun 2003 11:10:10 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h55IAAUp069160 for ; Thu, 5 Jun 2003 11:10:10 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h55IAADg069159; Thu, 5 Jun 2003 11:10:10 -0700 (PDT) Resent-Date: Thu, 5 Jun 2003 11:10:10 -0700 (PDT) Resent-Message-Id: <200306051810.h55IAADg069159@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-standards@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Jens Schweikhardt Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6E28E37B401 for ; Thu, 5 Jun 2003 11:02:59 -0700 (PDT) Received: from bremen.shuttle.de (bremen.shuttle.de [194.95.249.251]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2030243F85 for ; Thu, 5 Jun 2003 11:02:58 -0700 (PDT) (envelope-from schweikh@schweikhardt.net) Received: from bremen.shuttle.de (localhost [127.0.0.1]) by bremen.shuttle.de (Postfix) with ESMTP id 1139917D76 for ; Thu, 5 Jun 2003 20:02:56 +0200 (CEST) Received: (from uucp@localhost)h55I2teK005237 for FreeBSD-gnats-submit@freebsd.org; Thu, 5 Jun 2003 20:02:55 +0200 Received: (from schweikh@localhost) by hal9000.schweikhardt.net (8.12.9/8.12.9) id h55I3GIT055188; Thu, 5 Jun 2003 20:03:16 +0200 (CEST) (envelope-from schweikh) Message-Id: <200306051803.h55I3GIT055188@hal9000.schweikhardt.net> Date: Thu, 5 Jun 2003 20:03:16 +0200 (CEST) From: Jens Schweikhardt To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: standards/52972: /bin/sh arithmetic not POSIX compliant X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Jens Schweikhardt List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jun 2003 18:10:11 -0000 >Number: 52972 >Category: standards >Synopsis: /bin/sh arithmetic not POSIX compliant >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-standards >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Jun 05 11:10:09 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Jens Schweikhardt >Release: FreeBSD 5.1-BETA i386 >Organization: Digital Details >Environment: System: FreeBSD hal9000.schweikhardt.net 5.1-BETA FreeBSD 5.1-BETA #0: Wed May 21 20:30:29 CEST 2003 toor@hal9000.schweikhardt.net:/usr/obj/share/src/HEAD/sys/HAL9000 i386 Any. >Description: /bin/sh implements only a subset of the operators in $(( ... )) arithmetic. It also does not understand variable names in arithmetic expressions. This missing feature makes it impossible to run the OpenGroup's POSIX validation test suite because the configuration process for the test suite expects a POSIX system shell and makes heavy use of $((var += number)). [I can't just edit the scripts in question to use zsh or ksh93 because the configuration process involves executables calling system(3), make(1) etc which use /bin/sh hardcoded. Replacing /bin/sh is not an option.] >How-To-Repeat: $ /bin/sh $ a=1 $ echo $((a + 1)) # should echo 2 arith: syntax error: "a + 1" $ echo $((a += 1)) # should echo 2 and increment a arith: syntax error: "a += 1" IEEE Std 1003.2-2001 requires the other 'op=' assignment operators as well. The zsh and ksh93 get this right: $ a=1 $ echo $((a + 1)) 2 $ echo $((a += 1)) 2 $ echo $a 2 >Fix: >Release-Note: >Audit-Trail: >Unformatted: