Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Oct 1999 01:20:02 -0700 (PDT)
From:      Ruslan Ermilov <ru@ucb.crimea.ua>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/14509: bug in make(1)
Message-ID:  <199910250820.BAA75329@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/14509; it has been noted by GNATS.

From: Ruslan Ermilov <ru@ucb.crimea.ua>
To: Archie Cobbs <archie@whistle.com>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/14509: bug in make(1)
Date: Mon, 25 Oct 1999 11:15:31 +0300

 Hi!
 
 It turns out to be a sh(1) bug:
 
 $ sh -e -c 'test "yes" = "no" && :; echo OK'; echo $?
 OK
 0
 $ sh -e -c ':; test "yes" = "no" && :; echo OK'; echo $?
 1
 
 Here is what sh(1) manpage says about `-e' option:
 :
 :-e errexit
 :        If not interactive, exit immediately if any untested command
 :        fails.  The exit status of a command is considered to be explicitly
 :        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.
 
 
 On Mon, Oct 25, 1999 at 10:08:43AM +0300, Ruslan Ermilov wrote:
 > On Sun, Oct 24, 1999 at 08:44:41PM -0700, Archie Cobbs wrote:
 > > 
 > > >How-To-Repeat:
 > > 
 > > 	$ cat makefile
 > > 	foo1:
 > > 		var1=yes; test "$$var1" = "no" && var2=". $$var2"; echo OK
 > > 	foo2:
 > > 		test "$$var1" = "no" && var2=". $$var2"; echo OK
 > > 	$ make foo1
 > > 	var1=yes; test "$var1" = "no" && var2=". $var2"; echo OK
 > > 	*** Error code 1
 > > 
 > > 	Stop.
 > > 	$ make foo2
 > > 	test "$var1" = "no" && var2=". $var2"; echo OK
 > > 	OK
 > > 
 > Certainly, there is a problem somewhere above, but the following makefiles
 > work as expected:
 > 
 > # cat ~/Makefile.1
 > foo1:
 > 	var1=yes; test "$$var1" = "no" && var2=". $$var2" || :; echo OK
 > 
 > foo2:
 > 	test "$$var1" = "no" && var2=". $$var2" || :; echo OK
 > 
 > # cat ~/Makefile.2
 > foo1:
 > 	var1=yes; if test "$$var1" = "no"; then var2=". $$var2"; fi; echo OK
 > 
 > foo2:
 > 	if test "$$var1" = "no"; then var2=". $$var2"; fi; echo OK
 > 
 
 -- 
 Ruslan Ermilov		Sysadmin and DBA of the
 ru@ucb.crimea.ua	United Commercial Bank,
 ru@FreeBSD.org		FreeBSD committer,
 +380.652.247.647	Simferopol, Ukraine
 
 http://www.FreeBSD.org	The Power To Serve
 http://www.oracle.com	Enabling The Information Age
 


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?199910250820.BAA75329>