bin/85267: sh -e exits when command "false || return 1" appears in function

Stepan Koltsov yozh at mx1.ru
Wed Aug 24 14:40:15 GMT 2005


>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 at 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:


More information about the freebsd-bugs mailing list