From owner-freebsd-bugs@freebsd.org Thu Dec 10 22:58:39 2015 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34AB29D774D for ; Thu, 10 Dec 2015 22:58:39 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0BAC01BB0 for ; Thu, 10 Dec 2015 22:58:39 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id tBAMwcPb050563 for ; Thu, 10 Dec 2015 22:58:38 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 205176] Handling of errors in shell cycle in make(1) depends on the subsequent commands (this shouldn't happen) Date: Thu, 10 Dec 2015 22:58:38 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 10.0-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: jilles@FreeBSD.org X-Bugzilla-Status: Closed X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: resolution cc bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Dec 2015 22:58:39 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=205176 Jilles Tjoelker changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |Works As Intended CC| |jilles@FreeBSD.org Status|New |Closed --- Comment #3 from Jilles Tjoelker --- Although this may be confusing, I see no way to fix it. To avoid major compatibility problems, make must continue to use sh's -e option. Unfortunately, the shell language and environment do not really permit a proper "abort on error" mechanism, and therefore and for historical reasons, -e has various confusing properties. To avoid making things even more confusing and becoming incompatible with other shells, this will not change. The confusing property that is biting you here is that the left command of a && control operator is considered "tested", so its failure does not cause the shell to exit. This includes everything nested within the left command. Replacing the && after done in cycle2 with a ; will fix your problem. As an exception, a subshell's non-zero exit status may cause the shell to exit even if that exit status was caused by a "tested" command within the subshell. Therefore, the part (echo $$i && false) does not cause this kind of problem. See also the commit message for r291605: Say it with me, "I will not chain commands with && in Makefiles". This should be fine if the command is in a sub-shell such as: (cmd1 && cmd2) -- You are receiving this mail because: You are the assignee for the bug.