Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Aug 2005 14:39:51 GMT
From:      Stepan Koltsov <yozh@mx1.ru>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/85267: sh -e exits when command "false || return 1" appears in function
Message-ID:  <200508241439.j7OEdpvE030606@www.freebsd.org>
Resent-Message-ID: <200508241440.j7OEeEsP025544@freefall.freebsd.org>

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

>Number:         85267
>Category:       bin
>Synopsis:       sh -e exits when command "false || return 1" appears in function
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 24 14:40:14 GMT 2005
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:



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