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 off-by-one bug in ParseTrackInput ...
details: https://anonhg.NetBSD.org/src/rev/3ce5fd40ab43
branches: trunk
changeset: 941870:3ce5fd40ab43
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Oct 31 23:01:23 2020 +0000
description:
make(1): fix off-by-one bug in ParseTrackInput (since 2015-11-26)
diffstat:
usr.bin/make/parse.c | 6 +++---
usr.bin/make/unit-tests/directive-include.exp | 6 ++----
usr.bin/make/unit-tests/directive-include.mk | 15 ++++-----------
3 files changed, 9 insertions(+), 18 deletions(-)
diffs (70 lines):
diff -r 12427d9ca671 -r 3ce5fd40ab43 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c Sat Oct 31 22:55:35 2020 +0000
+++ b/usr.bin/make/parse.c Sat Oct 31 23:01:23 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.415 2020/10/31 21:52:56 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.416 2020/10/31 23:01:23 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.415 2020/10/31 21:52:56 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.416 2020/10/31 23:01:23 rillig Exp $");
/* types and constants */
@@ -2366,7 +2366,7 @@
for (; old != NULL; old = strchr(old, ' ')) {
if (*old == ' ')
old++;
- if (old >= ep)
+ if (old > ep)
break; /* cannot contain name */
if (memcmp(old, name, name_len) == 0 &&
(old[name_len] == '\0' || old[name_len] == ' '))
diff -r 12427d9ca671 -r 3ce5fd40ab43 usr.bin/make/unit-tests/directive-include.exp
--- a/usr.bin/make/unit-tests/directive-include.exp Sat Oct 31 22:55:35 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-include.exp Sat Oct 31 23:01:23 2020 +0000
@@ -1,7 +1,5 @@
CondParser_Eval: ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null"
lhs = "directive-include.mk null", rhs = "directive-include.mk null", op = !=
-CondParser_Eval: ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null null"
-lhs = "directive-include.mk null null", rhs = "directive-include.mk null null", op = !=
-CondParser_Eval: ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null null"
-lhs = "directive-include.mk null null", rhs = "directive-include.mk null null", op = !=
+CondParser_Eval: ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null"
+lhs = "directive-include.mk null", rhs = "directive-include.mk null", op = !=
exit status 0
diff -r 12427d9ca671 -r 3ce5fd40ab43 usr.bin/make/unit-tests/directive-include.mk
--- a/usr.bin/make/unit-tests/directive-include.mk Sat Oct 31 22:55:35 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-include.mk Sat Oct 31 23:01:23 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: directive-include.mk,v 1.2 2020/10/31 22:55:35 rillig Exp $
+# $NetBSD: directive-include.mk,v 1.3 2020/10/31 23:01:23 rillig Exp $
#
# Tests for the .include directive, which includes another file.
@@ -15,17 +15,10 @@
.endif
# Each file is recorded only once in the variable .MAKE.MAKEFILES.
-# XXX: As of 2020-10-31, the very last file can be repeated, due to an
-# off-by-one bug in ParseTrackInput.
+# Between 2015-11-26 and 2020-10-31, the very last file could be repeated,
+# due to an off-by-one bug in ParseTrackInput.
.include "/dev/null"
-.if ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null null"
-. error
-.endif
-
-# Since the file /dev/null is not only recorded at the very end of the
-# variable .MAKE.MAKEFILES, it is not added a third time.
-.include "/dev/null"
-.if ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null null"
+.if ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null"
. error
.endif
Home |
Main Index |
Thread Index |
Old Index