Module Name:    src
Committed By:   rillig
Date:           Sat Aug  1 18:14:09 UTC 2020

Modified Files:
        src/usr.bin/make: var.c
        src/usr.bin/make/unit-tests: Makefile modmisc.exp

Log Message:
make(1): fix error message when regcomp fails

If regcomp fails, it's not the regex substitution that is erroneous, but
the regex compilation.


To generate a diff of this commit:
cvs rdiff -u -r1.384 -r1.385 src/usr.bin/make/var.c
cvs rdiff -u -r1.79 -r1.80 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/make/unit-tests/modmisc.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/var.c
diff -u src/usr.bin/make/var.c:1.384 src/usr.bin/make/var.c:1.385
--- src/usr.bin/make/var.c:1.384	Sat Aug  1 18:02:37 2020
+++ src/usr.bin/make/var.c	Sat Aug  1 18:14:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.384 2020/08/01 18:02:37 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.385 2020/08/01 18:14:08 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.384 2020/08/01 18:02:37 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.385 2020/08/01 18:14:08 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.384 2020/08/01 18:02:37 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.385 2020/08/01 18:14:08 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2476,7 +2476,7 @@ ApplyModifier_Regex(const char *mod, App
     int error = regcomp(&args.re, re, REG_EXTENDED);
     free(re);
     if (error) {
-	VarREError(error, &args.re, "RE substitution error");
+	VarREError(error, &args.re, "Regex compilation error");
 	free(args.replace);
 	return AMR_CLEANUP;
     }

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.79 src/usr.bin/make/unit-tests/Makefile:1.80
--- src/usr.bin/make/unit-tests/Makefile:1.79	Sat Aug  1 15:28:28 2020
+++ src/usr.bin/make/unit-tests/Makefile	Sat Aug  1 18:14:08 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.79 2020/08/01 15:28:28 rillig Exp $
+# $NetBSD: Makefile,v 1.80 2020/08/01 18:14:08 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -98,8 +98,8 @@ FLAGS.order=		-j1
 FLAGS.vardebug=		-k -dv FROM_CMDLINE=
 
 # Some tests need extra post-processing.
-SED_CMDS.moderrs+=	-e 's,\(substitution error:\).*,\1 (details omitted),'
-SED_CMDS.modmisc+=	-e 's,\(substitution error:\).*,\1 (details omitted),'
+SED_CMDS.moderrs+=	-e 's,\(Regex compilation error:\).*,\1 (details omitted),'
+SED_CMDS.modmisc+=	-e 's,\(Regex compilation error:\).*,\1 (details omitted),'
 SED_CMDS.varmod-edge+=	-e 's, line [0-9]*:, line omitted:,'
 SED_CMDS.varshell+=	-e 's,^[a-z]*sh: ,,'
 SED_CMDS.varshell+=	-e '/command/s,No such.*,not found,'

Index: src/usr.bin/make/unit-tests/modmisc.exp
diff -u src/usr.bin/make/unit-tests/modmisc.exp:1.34 src/usr.bin/make/unit-tests/modmisc.exp:1.35
--- src/usr.bin/make/unit-tests/modmisc.exp:1.34	Sat Aug  1 17:20:42 2020
+++ src/usr.bin/make/unit-tests/modmisc.exp	Sat Aug  1 18:14:08 2020
@@ -31,7 +31,7 @@ mod-regex:
 :a b b c:
 :a b b c:
 : b c:
-make: RE substitution error: (details omitted)
+make: Regex compilation error: (details omitted)
 :C,word,____,:Q}:
 :a c:
 :x__ 3 x__ 3:
@@ -75,7 +75,7 @@ make: No subexpression \2
 mod-regex-limits:22-missing:1 6
 mod-regex-limits:22-ok:1 33 556
 mod-regex-limits:capture:ihgfedcbaabcdefghijABCDEFGHIJa0a1a2rest
-make: RE substitution error: (details omitted)
+make: Regex compilation error: (details omitted)
 mod-regex-errors:
 mod-assign: first=1.
 mod-assign: last=3.

Reply via email to