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: print error about failed shell command be...
details: https://anonhg.NetBSD.org/src/rev/fb0536844096
branches: trunk
changeset: 952688:fb0536844096
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Feb 14 20:22:30 2021 +0000
description:
make: print error about failed shell command before overwriting variable
Memory management of the value of variable expressions is currently more
complicated than necessary. It is the responsibility of ApplyModifiers,
even though conceptually the value belongs to an expression, so it
should rather be in Expr. Right now, this is an alias for
ApplyModifiersState, but that will change soon.
When that is done, there will no longer be a "current value" and a "new
value", only a single "value" of an expression. At that point, before
Expr_SetValueOwn will overwrite the old value with the output of the
shell command, the error message needs to refer to the latter.
diffstat:
usr.bin/make/var.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diffs (30 lines):
diff -r 4b22efc9b9b4 -r fb0536844096 usr.bin/make/var.c
--- a/usr.bin/make/var.c Sun Feb 14 20:16:17 2021 +0000
+++ b/usr.bin/make/var.c Sun Feb 14 20:22:30 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.818 2021/02/14 18:59:36 rillig Exp $ */
+/* $NetBSD: var.c,v 1.819 2021/02/14 20:22:30 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.818 2021/02/14 18:59:36 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.819 2021/02/14 20:22:30 rillig Exp $");
typedef enum VarFlags {
VAR_NONE = 0,
@@ -3463,9 +3463,10 @@
if (p[1] == 'h' && (p[2] == st->endc || p[2] == ':')) {
if (st->eflags & VARE_WANTRES) {
const char *errfmt;
- Expr_SetValueOwn(st, Cmd_Exec(val, &errfmt));
+ char *output = Cmd_Exec(val, &errfmt);
if (errfmt != NULL)
Error(errfmt, val);
+ Expr_SetValueOwn(st, output);
} else
Expr_SetValueRefer(st, "");
*pp = p + 2;
Home |
Main Index |
Thread Index |
Old Index