Date: Mon, 20 Sep 2004 21:11:38 +0200 From: Matthias Andree <ma@dt.e-technik.uni-dortmund.de> To: freebsd-current@freebsd.org, re@freebsd.org, freebsd-hackers@freebsd.org, freebsd-standards@freebsd.org Subject: PATCH: fix bogus "unset" abort in /bin/sh (been pending for TWO YEARS) Message-ID: <m3mzzkoivp.fsf@merlin.emma.line.org>
next in thread | raw e-mail | index | archive | help
[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); } -- Matthias Andree Encrypted mail welcome: my GnuPG key ID is 0x052E7D95 (PGP/MIME preferred)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?m3mzzkoivp.fsf>