Date: Sun, 25 Jul 1999 10:49:36 -0400 (EDT) From: Andrew Arensburger <arensb@clue.umiacs.umd.edu> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/12806: `sh -e' doesn't parse multi-command lines correctly Message-ID: <199907251449.KAA13223@clue.umiacs.umd.edu>
next in thread | raw e-mail | index | archive | help
>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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199907251449.KAA13223>