Module Name:    src
Committed By:   sjg
Date:           Sun Oct 25 17:37:36 UTC 2020

Modified Files:
        src/usr.bin/make: main.c
        src/usr.bin/make/unit-tests: varmod-match-escape.exp

Log Message:
Skip reading .MAKE.DEPENDFILE if set to
"/dev/null" or anything starting with "no".

Ref: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223564


To generate a diff of this commit:
cvs rdiff -u -r1.388 -r1.389 src/usr.bin/make/main.c
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varmod-match-escape.exp

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/main.c
diff -u src/usr.bin/make/main.c:1.388 src/usr.bin/make/main.c:1.389
--- src/usr.bin/make/main.c:1.388	Sat Oct 24 20:29:40 2020
+++ src/usr.bin/make/main.c	Sun Oct 25 17:37:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.388 2020/10/24 20:29:40 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.389 2020/10/25 17:37:36 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -118,7 +118,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.388 2020/10/24 20:29:40 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.389 2020/10/25 17:37:36 sjg Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	    "The Regents of the University of California.  "
@@ -1408,12 +1408,15 @@ main(int argc, char **argv)
 
 	/* In particular suppress .depend for '-r -V .OBJDIR -f /dev/null' */
 	if (!noBuiltins || !printVars) {
-	    (void)Var_Subst("${.MAKE.DEPENDFILE:T}",
+	    /* ignore /dev/null and anything starting with "no" */
+	    (void)Var_Subst("${.MAKE.DEPENDFILE:N/dev/null:Nno*:T}",
 		VAR_CMD, VARE_WANTRES, &makeDependfile);
-	    /* TODO: handle errors */
-	    doing_depend = TRUE;
-	    (void)ReadMakefile(makeDependfile);
-	    doing_depend = FALSE;
+	    if (makeDependfile[0] != '\0') {
+		/* TODO: handle errors */
+		doing_depend = TRUE;
+		(void)ReadMakefile(makeDependfile);
+		doing_depend = FALSE;
+	    }
 	}
 
 	if (enterFlagObj)

Index: src/usr.bin/make/unit-tests/varmod-match-escape.exp
diff -u src/usr.bin/make/unit-tests/varmod-match-escape.exp:1.1 src/usr.bin/make/unit-tests/varmod-match-escape.exp:1.2
--- src/usr.bin/make/unit-tests/varmod-match-escape.exp:1.1	Sun Aug 16 20:03:53 2020
+++ src/usr.bin/make/unit-tests/varmod-match-escape.exp	Sun Oct 25 17:37:36 2020
@@ -1,3 +1,5 @@
 Pattern[SPECIALS] for [\: : \\ * \*] is [\:]
 Pattern[SPECIALS] for [\: : \\ * \*] is [:]
+Pattern[.MAKE.DEPENDFILE] for [.depend] is [/dev/null]
+Pattern[.MAKE.DEPENDFILE] for [.depend] is [no*]
 exit status 0

Reply via email to