Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make/unit-tests make(1): fix assertion failure for ....



details:   https://anonhg.NetBSD.org/src/rev/27337dcd650b
branches:  trunk
changeset: 937968:27337dcd650b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Aug 29 14:47:26 2020 +0000

description:
make(1): fix assertion failure for .SUFFIXES in archives

This occurred in the posix1.mk test, even though it is disabled in
unit-tests.  But in tests/usr.bin/make it still runs.  There, it should
have produced an "expected failure" but crashed instead.

The archive-suffix test is the stripped-down version of the posix1 test.

diffstat:

 distrib/sets/lists/tests/mi                |   4 +++-
 usr.bin/make/compat.c                      |   9 +++++----
 usr.bin/make/unit-tests/Makefile           |   3 ++-
 usr.bin/make/unit-tests/archive-suffix.exp |   2 ++
 usr.bin/make/unit-tests/archive-suffix.mk  |  23 +++++++++++++++++++++++
 5 files changed, 35 insertions(+), 6 deletions(-)

diffs (104 lines):

diff -r fc0a62991c45 -r 27337dcd650b distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Sat Aug 29 13:38:48 2020 +0000
+++ b/distrib/sets/lists/tests/mi       Sat Aug 29 14:47:26 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.912 2020/08/28 15:40:53 rillig Exp $
+# $NetBSD: mi,v 1.913 2020/08/29 14:47:26 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4540,6 +4540,8 @@
 ./usr/tests/usr.bin/make/unit-tests/Makefile   tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/archive.exp        tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/archive.mk tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/archive-suffix.exp tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/archive-suffix.mk  tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cmd-interrupt.exp  tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cmd-interrupt.mk   tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cmdline.exp        tests-usr.bin-tests     compattestfile,atf
diff -r fc0a62991c45 -r 27337dcd650b usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Sat Aug 29 13:38:48 2020 +0000
+++ b/usr.bin/make/compat.c     Sat Aug 29 14:47:26 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.134 2020/08/29 12:36:20 rillig Exp $      */
+/*     $NetBSD: compat.c,v 1.135 2020/08/29 14:47:26 rillig Exp $      */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.134 2020/08/29 12:36:20 rillig Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.135 2020/08/29 14:47:26 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)compat.c   8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: compat.c,v 1.134 2020/08/29 12:36:20 rillig Exp $");
+__RCSID("$NetBSD: compat.c,v 1.135 2020/08/29 14:47:26 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -635,7 +635,8 @@
     } else {
        if (Lst_Member(gn->iParents, pgn) != NULL) {
            char *p1;
-           Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn);
+           const char *target = Var_Value(TARGET, gn, &p1);
+           Var_Set(IMPSRC, target != NULL ? target : "", pgn);
            bmake_free(p1);
        }
        switch(gn->made) {
diff -r fc0a62991c45 -r 27337dcd650b usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Sat Aug 29 13:38:48 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Sat Aug 29 14:47:26 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.125 2020/08/29 10:52:47 rillig Exp $
+# $NetBSD: Makefile,v 1.126 2020/08/29 14:47:26 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -36,6 +36,7 @@
 # Any test that is commented out must be ignored in
 # src/tests/usr.bin/make/t_make.sh as well.
 TESTS+=                # archive       # broken on FreeBSD, enabled in t_make.sh
+TESTS+=                archive-suffix
 TESTS+=                cmd-interrupt
 TESTS+=                cmdline
 TESTS+=                comment
diff -r fc0a62991c45 -r 27337dcd650b usr.bin/make/unit-tests/archive-suffix.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/archive-suffix.exp        Sat Aug 29 14:47:26 2020 +0000
@@ -0,0 +1,2 @@
+`all' is up to date.
+exit status 0
diff -r fc0a62991c45 -r 27337dcd650b usr.bin/make/unit-tests/archive-suffix.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/archive-suffix.mk Sat Aug 29 14:47:26 2020 +0000
@@ -0,0 +1,23 @@
+# $NetBSD: archive-suffix.mk,v 1.1 2020/08/29 14:47:26 rillig Exp $
+#
+# Between 2020-08-23 and 2020-08-30, the below code produced an assertion
+# failure in Var_Set_with_flags, triggered by Compat_Make, when setting the
+# .IMPSRC of an archive node to its .TARGET.
+#
+# The code assumed that the .TARGET variable of every node would be set, but
+# but that is not guaranteed.
+#
+# Between 2016-03-15 and 2016-03-16 the behavior of the below code changed.
+# Until 2016-03-15, it remade the target, starting with 2016-03-16 it says
+# "`all' is up to date".
+
+.SUFFIXES:
+.SUFFIXES: .c .o
+
+all:   lib.a(obj1.o)
+
+.c.o:
+       : making $@
+
+obj1.c:
+       : $@



Home | Main Index | Thread Index | Old Index