Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Mar 2012 17:20:08 GMT
From:      Garrett Cooper <yanegomi@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/165589: [patch] make pmake errors more apparent
Message-ID:  <201203011720.q21HK8xi047419@red.freebsd.org>
Resent-Message-ID: <201203011730.q21HUBbD066927@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         165589
>Category:       bin
>Synopsis:       [patch] make pmake errors more apparent
>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:   Thu Mar 01 17:30:11 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Garrett Cooper
>Release:        9.0-STABLE
>Organization:
n/a
>Environment:
FreeBSD bayonetta.local 9.0-STABLE FreeBSD 9.0-STABLE #6 r231963M: Mon Feb 20 23:15:28 PST 2012     gcooper@bayonetta.local:/usr/obj/store/freebsd/stable/9/sys/BAYONETTA  amd64
>Description:
The attached patch makes pmake mimic gmake in the sense that the failing target is printed out in the error message. Example:

$ make -f ~/Makefile.bad
*** [all] Error code 1

Stop in /scratch/git/gitorious/freenas.

This makes life a lot easier for developers and end-users because then (if one's really slick, or just does manual inspection), it becomes really easy to determine the root cause of a build failure.

This is particularly important when dealing with -j > 1, as the output becomes interleaved and it becomes extremely hard to track down the exact source behind a given build failure.
>How-To-Repeat:
$ sh
$ cat > Makefile.bad <<EOF
all:
	@false
EOF
$ make -f Makefile.bad
>Fix:


Patch attached with submission follows:

Index: usr.bin/make/job.c
===================================================================
--- usr.bin/make/job.c	(revision 228107)
+++ usr.bin/make/job.c	(working copy)
@@ -954,17 +954,18 @@
 						lastNode = job->node;
 					}
 					fprintf(out,
-					    "*** Completed successfully\n");
+					    "*** [%s] Completed successfully\n",
+					    job->node->name);
 				}
 			} else {
 				if (usePipes && job->node != lastNode) {
-					MESSAGE(out, job->node);
 					lastNode = job->node;
 				}
-				fprintf(out, "*** Error code %d%s\n",
+				fprintf(out, "*** [%s] Error code %d%s\n",
+					job->node->name,
 					WEXITSTATUS(*status),
 					(job->flags & JOB_IGNERR) ?
-					"(ignored)" : "");
+					" (ignored)" : "");
 
 				if (job->flags & JOB_IGNERR) {
 					*status = 0;
@@ -1002,10 +1003,10 @@
 				 */
 				if (job->flags & (JOB_RESUME | JOB_RESTART)) {
 					if (usePipes && job->node != lastNode) {
-						MESSAGE(out, job->node);
 						lastNode = job->node;
 					}
-					fprintf(out, "*** Continued\n");
+					fprintf(out, "*** [%s] Continued\n",
+					    job->node->name);
 				}
 				if (!(job->flags & JOB_CONTINUING)) {
 					DEBUGF(JOB, ("Warning: process %jd was not "
@@ -1025,11 +1026,11 @@
 
 			} else {
 				if (usePipes && job->node != lastNode) {
-					MESSAGE(out, job->node);
 					lastNode = job->node;
 				}
 				fprintf(out,
-				    "*** Signal %d\n", WTERMSIG(*status));
+				    "*** [%s] Signal %d\n", job->node->name,
+				    WTERMSIG(*status));
 				fflush(out);
 			}
 		}
@@ -1053,10 +1054,10 @@
 
 		DEBUGF(JOB, ("Process %jd stopped.\n", (intmax_t) job->pid));
 		if (usePipes && job->node != lastNode) {
-			MESSAGE(out, job->node);
 			lastNode = job->node;
 		}
-		fprintf(out, "*** Stopped -- signal %d\n", WSTOPSIG(*status));
+		fprintf(out, "*** [%s] Stopped -- signal %d\n",
+		    job->node->name, WSTOPSIG(*status));
 		job->flags |= JOB_RESUME;
 		TAILQ_INSERT_TAIL(&stoppedJobs, job, link);
 		fflush(out);
@@ -3042,13 +3043,15 @@
 			if (status == 0) {
 				return (0);
   			} else {
-				printf("*** Error code %d", status);
+				printf("*** [%s] Error code %d",
+				    gn->name, status);
   			}
 		} else if (WIFSTOPPED(reason)) {
 			status = WSTOPSIG(reason);
 		} else {
 			status = WTERMSIG(reason);
-			printf("*** Signal %d", status);
+			printf("*** [%s] Signal %d",
+			    gn->name, status);
   		}
   
 		if (ps.errCheck) {


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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203011720.q21HK8xi047419>