Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Sep 2004 11:26:14 -0700
From:      Julian Elischer <julian@elischer.org>
To:        freebsd-standards@freebsd.org
Subject:    Re: PATCH: fix bogus "unset" abort in /bin/sh (been pending for TWO YEARS)
Message-ID:  <41507246.2050809@elischer.org>
In-Reply-To: <m3mzzkoivp.fsf@merlin.emma.line.org>
References:  <m3mzzkoivp.fsf@merlin.emma.line.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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);
> }
>
>  
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?41507246.2050809>