Module Name:    src
Committed By:   rillig
Date:           Tue Aug 25 21:16:54 UTC 2020

Modified Files:
        src/usr.bin/make: var.c
        src/usr.bin/make/unit-tests: varmod-assign.exp varmod-assign.mk

Log Message:
make(1): fix error message for ::!= modifier with shell error

It's just too easy to confuse st->val and val.


To generate a diff of this commit:
cvs rdiff -u -r1.471 -r1.472 src/usr.bin/make/var.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varmod-assign.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-assign.mk

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.471 src/usr.bin/make/var.c:1.472
--- src/usr.bin/make/var.c:1.471	Tue Aug 25 16:27:24 2020
+++ src/usr.bin/make/var.c	Tue Aug 25 21:16:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.471 2020/08/25 16:27:24 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.472 2020/08/25 21:16:53 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.471 2020/08/25 16:27:24 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.472 2020/08/25 21:16:53 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.471 2020/08/25 16:27:24 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.472 2020/08/25 21:16:53 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2906,7 +2906,7 @@ ApplyModifier_Assign(const char **pp, Ap
 	    const char *errfmt;
 	    char *cmd_output = Cmd_Exec(val, &errfmt);
 	    if (errfmt)
-		Error(errfmt, st->val);
+		Error(errfmt, val);
 	    else
 		Var_Set(st->v->name, cmd_output, v_ctxt);
 	    free(cmd_output);

Index: src/usr.bin/make/unit-tests/varmod-assign.exp
diff -u src/usr.bin/make/unit-tests/varmod-assign.exp:1.4 src/usr.bin/make/unit-tests/varmod-assign.exp:1.5
--- src/usr.bin/make/unit-tests/varmod-assign.exp:1.4	Tue Aug 25 21:07:39 2020
+++ src/usr.bin/make/unit-tests/varmod-assign.exp	Tue Aug 25 21:16:53 2020
@@ -21,6 +21,6 @@ sysv:y
 make: Unfinished modifier for ASSIGN ('}' missing)
 
 ok=word
-make: "previous" returned non-zero status
+make: " echo word; false " returned non-zero status
 err=previous
 exit status 0

Index: src/usr.bin/make/unit-tests/varmod-assign.mk
diff -u src/usr.bin/make/unit-tests/varmod-assign.mk:1.5 src/usr.bin/make/unit-tests/varmod-assign.mk:1.6
--- src/usr.bin/make/unit-tests/varmod-assign.mk:1.5	Tue Aug 25 21:07:39 2020
+++ src/usr.bin/make/unit-tests/varmod-assign.mk	Tue Aug 25 21:16:53 2020
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-assign.mk,v 1.5 2020/08/25 21:07:39 rillig Exp $
+# $NetBSD: varmod-assign.mk,v 1.6 2020/08/25 21:16:53 rillig Exp $
 #
 # Tests for the obscure ::= variable modifiers, which perform variable
 # assignments during evaluation, just like the = operator in C.
@@ -73,9 +73,9 @@ mod-assign-parse:
 
 mod-assign-shell-error:
 	# If the command succeeds, the variable is assigned.
-	@${SH_OK::!= echo word; true} echo ok=${SH_OK}
+	@${SH_OK::!= echo word; true } echo ok=${SH_OK}
 
 	# If the command fails, the variable keeps its previous value.
 	# FIXME: the error message says: "previous" returned non-zero status
 	@${SH_ERR::=previous}
-	@${SH_ERR::!= echo word; false} echo err=${SH_ERR}
+	@${SH_ERR::!= echo word; false } echo err=${SH_ERR}

Reply via email to