Module Name: src Committed By: sjg Date: Thu Apr 9 18:21:01 UTC 2015
Modified Files: src/usr.bin/make: job.c make.1 Log Message: 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 To generate a diff of this commit: cvs rdiff -u -r1.177 -r1.178 src/usr.bin/make/job.c cvs rdiff -u -r1.243 -r1.244 src/usr.bin/make/make.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.177 src/usr.bin/make/job.c:1.178 --- src/usr.bin/make/job.c:1.177 Wed Jul 16 15:33:41 2014 +++ src/usr.bin/make/job.c Thu Apr 9 18:21:01 2015 @@ -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 @@ JobPrintCommand(void *cmdp, void *jobp) shutUp = DEBUG(LOUD) ? FALSE : TRUE; break; case '-': - job->flags |= JOB_IGNERR; errOff = TRUE; break; case '+': @@ -794,6 +793,7 @@ JobPrintCommand(void *cmdp, void *jobp) * 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); Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.243 src/usr.bin/make/make.1:1.244 --- src/usr.bin/make/make.1:1.243 Sun Sep 14 08:47:19 2014 +++ src/usr.bin/make/make.1 Thu Apr 9 18:21:01 2015 @@ -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 @@ This is similar to the effect of the .MA 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 @@ If the command contains any shell meta c 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