Date: Sat, 7 Apr 2007 03:11:10 GMT From: Alexander Melkov<melkov@comptek.ru> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/111343: sh and bash with -e sometimes fail to test errors in functions Message-ID: <200704070311.l373BAaL000574@www.freebsd.org> Resent-Message-ID: <200704070320.l373K2uS050210@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 111343 >Category: bin >Synopsis: sh and bash with -e sometimes fail to test errors in functions >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: Sat Apr 07 03:20:02 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Alexander Melkov >Release: 6.2 >Organization: >Environment: FreeBSD melkov.ru 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #9: Thu Jan 11 23:13:53 MSK 2007 ----@melkov.ru:/usr/obj/usr/src/sys/MELKOV i386 >Description: When shell function is called as a part of complex command with || operator, effect of -e (i.e. exit after first untested command returns error status) within that function is disabled. >How-To-Repeat: 1. Create script ==> test.sh <== set -e qq ( ) { false echo ok } qq || echo failed <end script> 2a) FreeBSD 4.11 Command: sh -e test.sh <no output> Command: bash -e test.sh Output: ok 2b) FreeBSD 6.2 Command: sh -e test.sh Output: ok Command: bash -e test.sh Output: ok In all cases, expected output is: failed >Fix: >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200704070311.l373BAaL000574>