From nobody@FreeBSD.org  Wed Aug 24 14:39:52 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id D8E8616A41F
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 24 Aug 2005 14:39:52 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id AA6FA43D49
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 24 Aug 2005 14:39:52 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j7OEdqh8030618
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 24 Aug 2005 14:39:52 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j7OEdpvE030606;
	Wed, 24 Aug 2005 14:39:51 GMT
	(envelope-from nobody)
Message-Id: <200508241439.j7OEdpvE030606@www.freebsd.org>
Date: Wed, 24 Aug 2005 14:39:51 GMT
From: Stepan Koltsov <yozh@mx1.ru>
To: freebsd-gnats-submit@FreeBSD.org
Subject: sh -e exits when command "false || return 1" appears in function
X-Send-Pr-Version: www-2.3

>Number:         85267
>Category:       bin
>Synopsis:       sh -e exits when command "false || return 1" appears in function
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    stefanf
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 24 14:40:14 GMT 2005
>Closed-Date:    Mon Dec 26 18:21:51 GMT 2005
>Last-Modified:  Mon Dec 26 18:21:51 GMT 2005
>Originator:     Stepan Koltsov
>Release:        5.4
>Organization:
>Environment:
FreeBSD grep.po.cs.msu.su 5.4-RELEASE-p2 FreeBSD 5.4-RELEASE-p2 #3: Thu Jun 16 19:39:43 MSD 2005     root@phobos.cs.msu.su:/usr/obj/usr/src/sys/GREP  i386

>Description:
Command "false || return 1" in function causes sh to exit if "set -e" is turned on.
>How-To-Repeat:
Script

===
#!/bin/sh -e

set -e

f() {
        false || return 1
        return 0
}

f || true
===

prints "the end" in bash and in zsh (and should print I believe), but prints nothing and exists with error in sh.
>Fix:

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->stefanf 
Responsible-Changed-By: stefanf 
Responsible-Changed-When: Sun Sep 4 19:48:45 GMT 2005 
Responsible-Changed-Why:  
Over to me. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=85267 
State-Changed-From-To: open->patched 
State-Changed-By: stefanf 
State-Changed-When: Sat Sep 10 08:39:43 GMT 2005 
State-Changed-Why:  
Fixed in -current, thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=85267 
State-Changed-From-To: patched->closed 
State-Changed-By: stefanf 
State-Changed-When: Mon Dec 26 18:21:46 UTC 2005 
State-Changed-Why:  
Also fixed in RELENG_{5,6}. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=85267 
>Unformatted:
