Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make jobs mode handles '-' very differently to compa...



details:   https://anonhg.NetBSD.org/src/rev/0a32659857e8
branches:  trunk
changeset: 337282:0a32659857e8
user:      sjg <sjg%NetBSD.org@localhost>
date:      Thu Apr 09 18:21:01 2015 +0000

description:
jobs mode handles '-' very differently to compat mode, but this is not
reflected in make.1
Also fix handling to match the behavior described in the comment
of JobPrintCommand (only matters if shell sets hasErrCtl).

A better long term solution is needed since the current behavior
is sub-optimal wrt '-' and different from all other makes.

Reviewed by: christos

diffstat:

 usr.bin/make/job.c  |   8 ++++----
 usr.bin/make/make.1 |  12 +++++++++++-
 2 files changed, 15 insertions(+), 5 deletions(-)

diffs (75 lines):

diff -r 2bdbce018fe0 -r 0a32659857e8 usr.bin/make/job.c
--- a/usr.bin/make/job.c        Thu Apr 09 17:56:30 2015 +0000
+++ b/usr.bin/make/job.c        Thu Apr 09 18:21:01 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.177 2014/07/16 15:33:41 christos Exp $       */
+/*     $NetBSD: job.c,v 1.178 2015/04/09 18:21:01 sjg Exp $    */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: job.c,v 1.177 2014/07/16 15:33:41 christos Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.178 2015/04/09 18:21:01 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)job.c      8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: job.c,v 1.177 2014/07/16 15:33:41 christos Exp $");
+__RCSID("$NetBSD: job.c,v 1.178 2015/04/09 18:21:01 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -715,7 +715,6 @@
            shutUp = DEBUG(LOUD) ? FALSE : TRUE;
            break;
        case '-':
-           job->flags |= JOB_IGNERR;
            errOff = TRUE;
            break;
        case '+':
@@ -794,6 +793,7 @@
                 * to ignore errors. Set cmdTemplate to use the weirdness
                 * instead of the simple "%s\n" template.
                 */
+               job->flags |= JOB_IGNERR;
                if (!(job->flags & JOB_SILENT) && !shutUp) {
                        if (commandShell->hasEchoCtl) {
                                DBPRINTF("%s\n", commandShell->echoOff);
diff -r 2bdbce018fe0 -r 0a32659857e8 usr.bin/make/make.1
--- a/usr.bin/make/make.1       Thu Apr 09 17:56:30 2015 +0000
+++ b/usr.bin/make/make.1       Thu Apr 09 18:21:01 2015 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: make.1,v 1.243 2014/09/14 08:47:19 apb Exp $
+.\"    $NetBSD: make.1,v 1.244 2015/04/09 18:21:01 sjg Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -481,6 +481,7 @@
 except that the effect can be limited to a single line of a script.
 A
 .Ql Ic \-
+in compatibility mode 
 causes any non-zero exit status of the command line to be ignored.
 .Pp
 When
@@ -495,6 +496,15 @@
 it will be passed to the shell; otherwise
 .Nm
 will attempt direct execution.
+If a line starts with
+.Ql Ic \- 
+and the shell has ErrCtl enabled then failure of the command line
+will be ignored as in compatibility mode.
+Otherwise 
+.Ql Ic \-
+affects the entire job;
+the script will stop at the first command line that fails,
+but the target will not be deemed to have failed.
 .Pp
 Makefiles should be written so that the mode of
 .Nm



Home | Main Index | Thread Index | Old Index