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 unbalanced Lst_Open/Lst_Close in S...



details:   https://anonhg.NetBSD.org/src/rev/e5eaed8a2478
branches:  trunk
changeset: 943316:e5eaed8a2478
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Aug 31 05:56:02 2020 +0000

description:
make(1): fix unbalanced Lst_Open/Lst_Close in SuffFindCmds

This bug had been there since the initial import of make, on 1993-03-21.
It just never broke the build because of the missing assertion.

https://mail-index.netbsd.org/tech-toolchain/2020/08/30/msg003847.html

The error message "cd: can't cd to include" that I got when I first
applied the fix was unrelated.  It was caused by an extra directory
"include" in src/tools/compat that didn't belong there.  With that
directory removed, running "./build.sh -j8 tools" succeeds as expected.

diffstat:

 usr.bin/make/lst.c  |  13 ++++---------
 usr.bin/make/suff.c |   8 ++++----
 2 files changed, 8 insertions(+), 13 deletions(-)

diffs (79 lines):

diff -r f44e5bd86f91 -r e5eaed8a2478 usr.bin/make/lst.c
--- a/usr.bin/make/lst.c        Sun Aug 30 21:20:06 2020 +0000
+++ b/usr.bin/make/lst.c        Mon Aug 31 05:56:02 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.59 2020/08/30 21:20:06 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.60 2020/08/31 05:56:02 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -37,11 +37,11 @@
 #include "make.h"
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: lst.c,v 1.59 2020/08/30 21:20:06 rillig Exp $";
+static char rcsid[] = "$NetBSD: lst.c,v 1.60 2020/08/31 05:56:02 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: lst.c,v 1.59 2020/08/30 21:20:06 rillig Exp $");
+__RCSID("$NetBSD: lst.c,v 1.60 2020/08/31 05:56:02 rillig Exp $");
 #endif /* not lint */
 #endif
 
@@ -542,12 +542,7 @@
 Lst_Open(Lst list)
 {
     assert(list != NULL);
-
-    /* XXX: This assertion fails for NetBSD's "build.sh -j1 tools", somewhere
-     * between "dependall ===> compat" and "dependall ===> binstall".
-     * Building without the "-j1" succeeds though. */
-    if (DEBUG(LINT) && list->isOpen)
-       Parse_Error(PARSE_WARNING, "Internal inconsistency: list opened twice");
+    assert(!list->isOpen);
 
     list->isOpen = TRUE;
     list->lastAccess = LstIsEmpty(list) ? Head : Unknown;
diff -r f44e5bd86f91 -r e5eaed8a2478 usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Sun Aug 30 21:20:06 2020 +0000
+++ b/usr.bin/make/suff.c       Mon Aug 31 05:56:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: suff.c,v 1.140 2020/08/30 18:26:41 rillig Exp $        */
+/*     $NetBSD: suff.c,v 1.141 2020/08/31 05:56:02 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.140 2020/08/30 18:26:41 rillig Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.141 2020/08/31 05:56:02 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)suff.c     8.4 (Berkeley) 3/21/94";
 #else
-__RCSID("$NetBSD: suff.c,v 1.140 2020/08/30 18:26:41 rillig Exp $");
+__RCSID("$NetBSD: suff.c,v 1.141 2020/08/31 05:56:02 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -230,7 +230,6 @@
 static int SuffScanTargets(void *, void *);
 static int SuffAddSrc(void *, void *);
 static void SuffAddLevel(Lst, Src *);
-static Src *SuffFindCmds(Src *, Lst);
 static void SuffExpandChildren(LstNode, GNode *);
 static void SuffExpandWildcards(LstNode, GNode *);
 static Boolean SuffApplyTransform(GNode *, GNode *, Suff *, Suff *);
@@ -1232,6 +1231,7 @@
 #endif
     Lst_Append(slst, ret);
     SUFF_DEBUG1("\tusing existing source %s\n", s->name);
+    Lst_Close(t->children);
     return ret;
 }
 



Home | Main Index | Thread Index | Old Index