From scotto@remuda.com  Fri Apr 25 12:27:31 1997
Received: from popeye.remuda.com (fisbin.remuda.com [205.153.153.59])
          by hub.freebsd.org (8.8.5/8.8.5) with SMTP id MAA06303
          for <FreeBSD-gnats-submit@freebsd.org>; Fri, 25 Apr 1997 12:27:30 -0700 (PDT)
Received: (from scotto@localhost) by popeye.remuda.com (8.6.12/8.6.12) id MAA08948; Fri, 25 Apr 1997 12:25:05 -0700
Message-Id: <199704251925.MAA08948@popeye.remuda.com>
Date: Fri, 25 Apr 1997 12:25:05 -0700
From: scotto@remuda.com
Reply-To: scotto@remuda.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: /bin/sh doesn't return correct exit status
X-Send-Pr-Version: 3.2

>Number:         3388
>Category:       bin
>Synopsis:       /bin/sh doesn't return correct exit status
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    steve
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 25 12:30:01 PDT 1997
>Closed-Date:    Tue May 13 19:20:37 PDT 1997
>Last-Modified:  Tue May 13 19:22:18 PDT 1997
>Originator:     Scott Overholser
>Release:        FreeBSD 2.2.0-RELEASE i386
>Organization:
>Environment:
FreeBSD 2.2.0 systems in general
	

>Description:
A return in a /bin/sh script should return the exit status of the preceeding
command.  /bin/sh under FreeBSD 2.2.0-R does not - it returns 0.  FreeBSD
2.1.x does not exhibit this problem.

This behavior breaks many /bin/sh scripts.
	

>How-To-Repeat:
Execute the following commands:
$ /bin/sh
$ f()
return 78
$ g()
{
f
return
}
$ h()
{
f
}
$ f ; echo $?
78 # this is the observed result - it is correct
$ g ; echo $?
0 # this is the observed result - it is wrong.  we should see 78 here
$ h ; echo $?
78 # this is the observed result - it is correct
$ exit
	

>Fix:
	
	

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: steve 
State-Changed-When: Tue May 13 19:20:37 PDT 1997 
State-Changed-Why:  
Fix merged from -current. 
>Unformatted:
