From owner-freebsd-bugs@FreeBSD.ORG Sun Sep 14 21:00:08 2008 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA09A106566B for ; Sun, 14 Sep 2008 21:00:08 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id ACADA8FC0C for ; Sun, 14 Sep 2008 21:00:08 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m8EL08iV011714 for ; Sun, 14 Sep 2008 21:00:08 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m8EL08qV011713; Sun, 14 Sep 2008 21:00:08 GMT (envelope-from gnats) Date: Sun, 14 Sep 2008 21:00:08 GMT Message-Id: <200809142100.m8EL08qV011713@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Christoph Mallon Cc: Subject: Re: bin/127370: [patch] sh(1): sh -c 'exit -1' fails with "Illegal number: -1", instead of exiting with a code of 255 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Christoph Mallon List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Sep 2008 21:00:08 -0000 The following reply was made to PR bin/127370; it has been noted by GNATS. From: Christoph Mallon To: bug-followup@FreeBSD.org, andy.lavr@reactor-xg.kiev.ua Cc: Subject: Re: bin/127370: [patch] sh(1): sh -c 'exit -1' fails with "Illegal number: -1", instead of exiting with a code of 255 Date: Sun, 14 Sep 2008 22:32:14 +0200 > Bourne shell (/bin/sh), as it stands, doesn't parse numbers properly, even though bash does: > > [gcooper at optimus /devel/ncvs/src/bin/sh]$ sh -c 'exit -1' > exit: Illegal number: -1 > [gcooper at optimus /devel/ncvs/src/bin/sh]$ sh -c 'exit +1' > exit: Illegal number: +1 > > These are valid numbers though, which are merely red herrings; The standard (SUSv2, chapter Shell Command Language, http://www.opengroup.org/onlinepubs/7990989775/xcu/chap2.html#tag_001_014_007) is pretty clear in this respect: "The exit utility causes the shell to exit with the exit status specified by the unsigned decimal integer n. If n is specified, but its value is not between 0 and 255 inclusively, the exit status is undefined." It clearly states that the exit status must be an *unsigned* decimal integer. The changes, which you propose, are clearly bashisms and should not be part of sh. Regards Christoph