Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Mar 2003 00:36:07 +0200 (EET)
From:      "Jukka A. Ukkonen" <jau@cs78135006.pp.htv.fi>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/49038: sh does not undefine a function when unset is issued
Message-ID:  <200303082236.AAA66784@cs78135006.pp.htv.fi>

next in thread | raw e-mail | index | archive | help

>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




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