Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): fix error message of failed :!cmd! mod...



details:   https://anonhg.NetBSD.org/src/rev/5dfc574e9c5a
branches:  trunk
changeset: 978336:5dfc574e9c5a
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Nov 17 20:11:02 2020 +0000

description:
make(1): fix error message of failed :!cmd! modifier (since 2000-04-29)

diffstat:

 usr.bin/make/unit-tests/varmod-shell.exp |  4 ++--
 usr.bin/make/unit-tests/varmod-shell.mk  |  4 ++--
 usr.bin/make/var.c                       |  9 ++++-----
 3 files changed, 8 insertions(+), 9 deletions(-)

diffs (59 lines):

diff -r 5a089ad8d146 -r 5dfc574e9c5a usr.bin/make/unit-tests/varmod-shell.exp
--- a/usr.bin/make/unit-tests/varmod-shell.exp  Tue Nov 17 20:08:09 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-shell.exp  Tue Nov 17 20:11:02 2020 +0000
@@ -1,3 +1,3 @@
-make: "" returned non-zero status
-make: "previous value" returned non-zero status
+make: "echo word; false" returned non-zero status
+make: "echo word; false" returned non-zero status
 exit status 0
diff -r 5a089ad8d146 -r 5dfc574e9c5a usr.bin/make/unit-tests/varmod-shell.mk
--- a/usr.bin/make/unit-tests/varmod-shell.mk   Tue Nov 17 20:08:09 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-shell.mk   Tue Nov 17 20:11:02 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-shell.mk,v 1.4 2020/11/17 20:08:09 rillig Exp $
+# $NetBSD: varmod-shell.mk,v 1.5 2020/11/17 20:11:02 rillig Exp $
 #
 # Tests for the :sh variable modifier, which runs the shell command
 # given by the variable value and returns its output.
@@ -20,7 +20,7 @@
 # If the command exits with non-zero, an error message is printed.
 # XXX: Processing continues as usual though.
 #
-# Since 2000-04-29, the error message mentions the previous
+# Between 2000-04-29 and 2020-11-17, the error message mentioned the previous
 # value of the expression (which is usually an empty string) instead of the
 # command that was executed.  It's strange that such a simple bug could
 # survive such a long time.
diff -r 5a089ad8d146 -r 5dfc574e9c5a usr.bin/make/var.c
--- a/usr.bin/make/var.c        Tue Nov 17 20:08:09 2020 +0000
+++ b/usr.bin/make/var.c        Tue Nov 17 20:11:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.688 2020/11/16 21:39:22 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.689 2020/11/17 20:11:02 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.688 2020/11/16 21:39:22 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.689 2020/11/17 20:11:02 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -2308,11 +2308,10 @@
        st->newVal = Cmd_Exec(cmd, &errfmt);
     else
        st->newVal = bmake_strdup("");
+    if (errfmt != NULL)
+       Error(errfmt, cmd);     /* XXX: why still return AMR_OK? */
     free(cmd);
 
-    if (errfmt != NULL)
-       Error(errfmt, st->val); /* XXX: why still return AMR_OK? */
-
     ApplyModifiersState_Define(st);
     return AMR_OK;
 }



Home | Main Index | Thread Index | Old Index