Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Apr 1997 12:25:05 -0700
From:      scotto@remuda.com
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/3388: /bin/sh doesn't return correct exit status
Message-ID:  <199704251925.MAA08948@popeye.remuda.com>
Resent-Message-ID: <199704251930.MAA06461@hub.freebsd.org>

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

>Number:         3388
>Category:       bin
>Synopsis:       /bin/sh doesn't return correct exit status
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 25 12:30:01 PDT 1997
>Last-Modified:
>Originator:     Scott Overholser
>Organization:
>Release:        FreeBSD 2.2.0-RELEASE i386
>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:
	
	

>Audit-Trail:
>Unformatted:



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