Dear almighty tech,

For releasing taken resources like vnd device, for example :

#       $OpenBSD: Makefile,v 1.2 2012/10/12 14:07:46 jsing Exp $

.PATH: ${.CURDIR}/../ramdiskB
BOOT=${DESTDIR}/usr/mdec/fdboot
RAMDISK=RAMDISK
NOBSDRD=1

.include "${.CURDIR}/../common/Makefile.inc"

.ERROR:
        echo "HELLLLLLLLO"
        -umount /mnt
        -vnconfig -u vnd0

.END:
        echo "HUUUUUUUUH"

.INTERRUPT:
        echo "INTERRUPT"

LISTS+=         ${.CURDIR}/list.local


I patched make to call an error target (Makefile.inc in common has the
correct rd_teardown this makefile is just for test) , and then realize
.END is not called not .INTERRUPT (putted here to check, i  did not
send signal).

>/usr/src/distrib/amd64/ramdiskB[OK] 10:23:16 -ksh
root@bsd56 # /usr/src/usr.bin/make/obj/make
dd if=/dev/zero of=/var/tmp/image.31550 bs=512 count=8960
*** Error 1 in /usr/src/distrib/amd64/ramdiskB
(../common/Makefile.inc:127 'do_files')
>/usr/src/distrib/amd64/ramdiskB[1] 10:23:20 -ksh
root@bsd56 #

bug ? misused of target ?

Best regards, (follow the .ERROR patch)


Index: generate.c
===================================================================
RCS file: /cvs/src/usr.bin/make/generate.c,v
retrieving revision 1.16
diff -u -p -u -r1.16 generate.c
--- generate.c  18 May 2014 08:08:50 -0000      1.16
+++ generate.c  5 Nov 2014 15:14:35 -0000
@@ -115,6 +115,7 @@ char *table_nodes[] = {
        M(NODE_WAIT),
        M(NODE_BEGIN),
        M(NODE_END),
+       M(NODE_ERROR),
        M(NODE_INTERRUPT),
        M(NODE_CHEAP),
        M(NODE_EXPENSIVE),
Index: job.c
===================================================================
RCS file: /cvs/src/usr.bin/make/job.c,v
retrieving revision 1.135
diff -u -p -u -r1.135 job.c
--- job.c       14 Dec 2012 11:10:03 -0000      1.135
+++ job.c       5 Nov 2014 15:14:36 -0000
@@ -988,7 +988,8 @@ Job_Finish(void)

        if ((end_node->type & OP_DUMMY) == 0) {
                if (problem) {
-                       Error("Errors reported so .END ignored");
+                       Job_Make(error_node);
+                       loop_handle_running_jobs();
                } else {
                        Job_Make(end_node);
                        loop_handle_running_jobs();
Index: node_int.h
===================================================================
RCS file: /cvs/src/usr.bin/make/node_int.h,v
retrieving revision 1.4
diff -u -p -u -r1.4 node_int.h
--- node_int.h  9 Oct 2012 19:45:34 -0000       1.4
+++ node_int.h  5 Nov 2014 15:14:36 -0000
@@ -58,6 +58,7 @@

 #define NODE_BEGIN     ".BEGIN"
 #define NODE_END       ".END"
+#define NODE_ERROR     ".ERROR"
 #define NODE_INTERRUPT ".INTERRUPT"
 #define NODE_CHEAP     ".CHEAP"
 #define NODE_EXPENSIVE ".EXPENSIVE"
Index: targ.c
===================================================================
RCS file: /cvs/src/usr.bin/make/targ.c,v
retrieving revision 1.75
diff -u -p -u -r1.75 targ.c
--- targ.c      12 May 2014 19:11:19 -0000      1.75
+++ targ.c      5 Nov 2014 15:14:36 -0000
@@ -125,7 +125,7 @@ struct ohash_info gnode_info = {
 #define Targ_FindConstantNode(n, f) Targ_FindNodeh(n, sizeof(n), K_##n, f)


-GNode *begin_node, *end_node, *interrupt_node, *DEFAULT;
+GNode *begin_node, *end_node, *error_node, *interrupt_node, *DEFAULT;

 void
 Targ_Init(void)
@@ -136,6 +136,8 @@ Targ_Init(void)
        begin_node->type |= OP_DUMMY | OP_NOTMAIN | OP_NODEFAULT;
        end_node = Targ_FindConstantNode(NODE_END, TARG_CREATE);
        end_node->type |= OP_DUMMY | OP_NOTMAIN | OP_NODEFAULT;
+       error_node = Targ_FindConstantNode(NODE_ERROR, TARG_CREATE);
+       error_node->type |= OP_DUMMY | OP_NOTMAIN | OP_NODEFAULT;
        interrupt_node = Targ_FindConstantNode(NODE_INTERRUPT, TARG_CREATE);
        interrupt_node->type |= OP_DUMMY | OP_NOTMAIN | OP_NODEFAULT;
        DEFAULT = Targ_FindConstantNode(NODE_DEFAULT, TARG_CREATE);
Index: targ.h
===================================================================
RCS file: /cvs/src/usr.bin/make/targ.h,v
retrieving revision 1.13
diff -u -p -u -r1.13 targ.h
--- targ.h      23 Apr 2013 14:32:53 -0000      1.13
+++ targ.h      5 Nov 2014 15:14:36 -0000
@@ -65,7 +65,7 @@ extern void Targ_PrintCmd(void *);
 extern void Targ_PrintType(int);
 extern void Targ_PrintGraph(int);

-extern GNode *begin_node, *end_node, *interrupt_node, *DEFAULT;
+extern GNode *begin_node, *end_node, *error_node, *interrupt_node, *DEFAULT;
 struct ohash_info;

 extern struct ohash_info gnode_info;


-- 
---------------------------------------------------------------------------------------------------------------------
() ascii ribbon campaign - against html e-mail
/\

Reply via email to