make(1): fix off-by-one bug in ParseTrackInput (since 2015-11-26)
This commit is contained in:
parent
97ce2a0641
commit
31dbea1d44
|
@ -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 @@ ParseTrackInput(const char *name)
|
|||
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] == ' '))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue