From owner-freebsd-bugs Sun Jul 25 8: 0: 3 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 3AE0115172 for ; Sun, 25 Jul 1999 08:00:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id IAA24515; Sun, 25 Jul 1999 08:00:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from clue.umiacs.umd.edu (clue.umiacs.umd.edu [128.8.120.175]) by hub.freebsd.org (Postfix) with ESMTP id 329671516E for ; Sun, 25 Jul 1999 07:50:41 -0700 (PDT) (envelope-from arensb@clue.umiacs.umd.edu) Received: (from arensb@localhost) by clue.umiacs.umd.edu (8.9.3/8.9.3) id KAA13223; Sun, 25 Jul 1999 10:49:36 -0400 (EDT) (envelope-from arensb) Message-Id: <199907251449.KAA13223@clue.umiacs.umd.edu> Date: Sun, 25 Jul 1999 10:49:36 -0400 (EDT) From: Andrew Arensburger Reply-To: arensb@clue.umiacs.umd.edu To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/12806: `sh -e' doesn't parse multi-command lines correctly Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 12806 >Category: bin >Synopsis: `sh -e' doesn't parse multi-command lines correctly >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Jul 25 08:00:00 PDT 1999 >Closed-Date: >Last-Modified: >Originator: Andrew Arensburger >Release: FreeBSD 3.2-RELEASE i386 >Organization: University of Maryland Institute for Advanced Computer Studies >Environment: I've found this bug under every version of FreeBSD where I've tested it: FreeBSD 2.2.7-RELEASE i386 FreeBSD 3.1-RELEASE i386 FreeBSD 3.2-RELEASE i386 >Description: sh(1) says, : -e errexit : If not interactive, exit immediately if any untested command : fails. The exit status of a command is considered to be explic- : itly tested if the command is used to control an if, elif, while, : or until; or if the command is the left hand operand of an ``&&'' : or ``||'' operator. This works fine if the script is of the form cmd1 cmd2 && cmd3 but not if it is of the form cmd1; cmd2 && cmd3 One practical upshot is that if you have a Makefile built with GNU automake, "make clean" does not work. >How-To-Repeat: The following two scripts should behave identically: #!/bin/sh -e echo before test foo = bar && echo blah echo after #!/bin/sh -e echo before; test foo = bar && echo blah echo after The first one prints before after as expected. The second one, however, prints before and exits. >Fix: Don't know. If I come up with one, I'll let you know. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message