From owner-freebsd-standards@FreeBSD.ORG Tue Sep 21 18:26:15 2004 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CE05B16A4CE for ; Tue, 21 Sep 2004 18:26:15 +0000 (GMT) Received: from mail.vicor-nb.com (bigwoop.vicor-nb.com [208.206.78.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id C1D1E43D46 for ; Tue, 21 Sep 2004 18:26:14 +0000 (GMT) (envelope-from julian@elischer.org) Received: from elischer.org (julian.vicor-nb.com [208.206.78.97]) by mail.vicor-nb.com (Postfix) with ESMTP id 53D507A3D2 for ; Tue, 21 Sep 2004 11:26:14 -0700 (PDT) Message-ID: <41507246.2050809@elischer.org> Date: Tue, 21 Sep 2004 11:26:14 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.3.1) Gecko/20030516 X-Accept-Language: en, hu MIME-Version: 1.0 To: freebsd-standards@freebsd.org References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: PATCH: fix bogus "unset" abort in /bin/sh (been pending for TWO YEARS) X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2004 18:26:15 -0000 anyone handling this? Matthias Andree wrote: >[WARNING: Reply-To and Mail-Followup-To set to funnel the discussion.] > >Greetings, > >FreeBSD's /bin/sh has a long-standing bug that causes premature abort of >a script when set -e is set and a nonexistant variable is unset. > >This violates IEEE Std 1003.1 and harms portability of scripts to FreeBSD. >http://www.opengroup.org/onlinepubs/009695399/utilities/unset.html > >Either test of these must print "good" else the shell is b0rked: > >/bin/sh -c 'set -e ; BONK= ; unset BONK ; unset BONK ; echo good' >/bin/sh -c 'set -e ; f() { :; } ; unset -f f ; unset -f f ; echo good' > >After merging the patch below and MFC'ing, please close standards/45738. > >This patch (against 5.3-BETA) fixes the problems for me (yes I know it >is not very helpful without more context but I can't paste half the >files here for the mailing list): > >--- src/bin/sh/exec.c.orig Thu Apr 15 05:08:30 2004 >+++ src/bin/sh/exec.c Sat Sep 18 13:16:34 2004 >@@ -701,7 +701,7 @@ > delete_cmd_entry(); > return (0); > } >- return (1); >+ return (0); > } > > /* >--- src/bin/sh/var.c.orig Thu Apr 15 05:08:31 2004 >+++ src/bin/sh/var.c Sat Sep 18 13:16:34 2004 >@@ -761,7 +761,7 @@ > } > } > >- return (1); >+ return (0); > } > > >