Module Name: src Committed By: rillig Date: Wed Jun 16 03:56:59 UTC 2021
Modified Files: src/usr.bin/make: job.c Log Message: make: extract commands-ok check from JobWriteShellCommands This piece of code did not match the function name and thus could not reasonably be expected in that function. In job.c 1.399 from 2021-01-29 I missed exactly this little detail when I added code to skip the apparently unnecessary creation of empty shell files. The code I added only handled the happy case, not the case where the target could not be made. That code path then differed, leading to a much more verbose error message than before. before: don't know how to make ../missing/no-such.o. Stop after: don't know how to make ../missing/no-such.o. Stop ... `../missing/no-such.o' was not built (made BEINGMADE, ...)! `muck' was not built (made DEFERRED, type OP_DEPENDS|...)! `muck' has .ORDER dependency against build-all (made DEFERRED, ...) Thanks to sjg for finding and reproducing this unintended change of behavior. To generate a diff of this commit: cvs rdiff -u -r1.433 -r1.434 src/usr.bin/make/job.c 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.433 src/usr.bin/make/job.c:1.434 --- src/usr.bin/make/job.c:1.433 Wed Jun 16 03:15:47 2021 +++ src/usr.bin/make/job.c Wed Jun 16 03:56:59 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.433 2021/06/16 03:15:47 rillig Exp $ */ +/* $NetBSD: job.c,v 1.434 2021/06/16 03:56:59 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -142,7 +142,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.433 2021/06/16 03:15:47 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.434 2021/06/16 03:56:59 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -1585,7 +1585,7 @@ JobMakeArgv(Job *job, char **argv) } static void -JobWriteShellCommands(Job *job, GNode *gn, bool cmdsOK, bool *out_run) +JobWriteShellCommands(Job *job, GNode *gn, bool *out_run) { /* * tfile is the name of a file into which all shell commands @@ -1595,15 +1595,6 @@ JobWriteShellCommands(Job *job, GNode *g char tfile[MAXPATHLEN]; int tfd; /* File descriptor to the temp file */ - /* - * We're serious here, but if the commands were bogus, we're - * also dead... - */ - if (!cmdsOK) { - PrintOnError(gn, NULL); /* provide some clue */ - DieHorribly(); - } - tfd = Job_TempFile(TMPPAT, tfile, sizeof tfile); job->cmdFILE = fdopen(tfd, "w+"); @@ -1681,7 +1672,16 @@ JobStart(GNode *gn, bool special) * virtual targets. */ - JobWriteShellCommands(job, gn, cmdsOK, &run); + /* + * We're serious here, but if the commands were bogus, we're + * also dead... + */ + if (!cmdsOK) { + PrintOnError(gn, NULL); /* provide some clue */ + DieHorribly(); + } + + JobWriteShellCommands(job, gn, &run); (void)fflush(job->cmdFILE); } else if (!GNode_ShouldExecute(gn)) { /*