From owner-freebsd-bugs Sat Mar 8 14:40:21 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BF8CA37B405 for ; Sat, 8 Mar 2003 14:40:14 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id D205F43F93 for ; Sat, 8 Mar 2003 14:40:07 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h28Me7NS087483 for ; Sat, 8 Mar 2003 14:40:07 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h28Me7W0087482; Sat, 8 Mar 2003 14:40:07 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B6E1C37B401 for ; Sat, 8 Mar 2003 14:36:11 -0800 (PST) Received: from cs78135006.pp.htv.fi (cs78135006.pp.htv.fi [62.78.135.6]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6A78143F93 for ; Sat, 8 Mar 2003 14:36:10 -0800 (PST) (envelope-from jau@cs78135006.pp.htv.fi) Received: (from jau@localhost) by cs78135006.pp.htv.fi (8.9.3/8.9.3/JAU-2.2) id AAA66784; Sun, 9 Mar 2003 00:36:07 +0200 (EET) Message-Id: <200303082236.AAA66784@cs78135006.pp.htv.fi> Date: Sun, 9 Mar 2003 00:36:07 +0200 (EET) From: "Jukka A. Ukkonen" Reply-To: jau@iki.fi To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.2 Subject: bin/49038: sh does not undefine a function when unset is issued Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 49038 >Category: bin >Synopsis: /bin/sh does not undefine a function when unset is issued >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Mar 08 14:40:07 PST 2003 >Closed-Date: >Last-Modified: >Originator: Jukka A. Ukkonen >Release: Multiple - all that I have had a chance to try this on >Organization: Private person >Environment: FreeBSD Bourne shell >Description: The bourne shell does not undefine a previously declared shell function when unset command is given though the manual pages so imply. This is a serious portability problem for imported shell scripts. Just figure how will a script behave, if there is a function called exit which invokes another function which in turn tries first "unset exit", does its own work and now tries to invoke the real exit... Exit() { unset exit Logger -stderr "$*" exit 0 } exit() { ... Exit "EXIT:" "$*" } >How-To-Repeat: sticky() { echo "STICKY STILL HERE" echo "$*" } unset sticky sticky peekaboo STICKY STILL HERE peekaboo The last two lines are the output from the echo. >Fix: This is probably simple oversight in forgetting to clean the unset name in the function symbol table though the variable name gets gets cleared out of the variable symbol table. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message