From owner-freebsd-bugs@FreeBSD.ORG Sun Sep 13 22:50:07 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5667106566B for ; Sun, 13 Sep 2009 22:50:07 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id C43ED8FC0C for ; Sun, 13 Sep 2009 22:50:07 +0000 (UTC) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n8DMo7T4095594 for ; Sun, 13 Sep 2009 22:50:07 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n8DMo7SW095587; Sun, 13 Sep 2009 22:50:07 GMT (envelope-from gnats) Date: Sun, 13 Sep 2009 22:50:07 GMT Message-Id: <200909132250.n8DMo7SW095587@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Jilles Tjoelker Cc: Subject: Re: bin/111343: sh(1) and bash(1) with -e sometimes fail to test errors in functions X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jilles Tjoelker List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2009 22:50:07 -0000 The following reply was made to PR bin/111343; it has been noted by GNATS. From: Jilles Tjoelker To: bug-followup@FreeBSD.org, melkov@comptek.ru Cc: Subject: Re: bin/111343: sh(1) and bash(1) with -e sometimes fail to test errors in functions Date: Mon, 14 Sep 2009 00:43:27 +0200 Replacing the function call with the function definition, the behaviour seems reasonable. The command is tested, so -e should not trigger. In general, set -e is not a good idea for more complicated scripts because its rules can be confusing and inconsistent across shells. You can achieve a similar effect by putting '|| exit' after commands. -- Jilles Tjoelker