Subject: bin/14267: make: .END failure ignored in compat mode.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <sjg@juniper.net>
List: netbsd-bugs
Date: 10/16/2001 10:34:41
>Number:         14267
>Category:       bin
>Synopsis:       make: .END failure ignored in compat mode.
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 16 10:59:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Simon Gerraty
>Release:        -current
>Organization:
	
>Environment:
	
System: NetBSD hobbit.juniper.net 1.5X NetBSD 1.5X (HOBBIT) #0: Thu Aug 16 16:03:17 PDT 2001 root@hobbit.juniper.net:/u1/obj/sys/arch/sparc64/compile/HOBBIT sparc64


>Description:
	
In compat mode, make ignores errors during processing of .END.

>How-To-Repeat:
	
Given the makefile:


ok:
	echo ok

.if make(for)
for:
.else
.END:
.endif
	for i in 1 2 3; do no-such $i; done
	echo ok


$ make for
for i in 1 2 3; do no-such ; done
no-such: not found
*** Error code 127

Stop.
make: stopped in /root
$ echo $?
1

$ make ok
echo ok
ok
for i in 1 2 3; do no-such ; done
no-such: not found
*** Error code 127$ echo $?
0

>Fix:
	

Index: compat.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/make/compat.c,v
retrieving revision 1.35
diff -u -p -r1.35 compat.c
--- compat.c	2001/06/12 23:36:17	1.35
+++ compat.c	2001/10/16 17:49:30
@@ -617,5 +617,9 @@ Compat_Run(targs)
      */
     if (errors == 0) {
 	Lst_ForEach(ENDNode->commands, CompatRunCommand, (ClientData)gn);
+	if (gn->made == ERROR) {
+	    PrintOnError("\n\nStop.");
+	    exit(1);
+	}
     }
 }

>Release-Note:
>Audit-Trail:
>Unformatted: