Module Name: src Committed By: rillig Date: Sat Aug 29 14:47:26 UTC 2020
Modified Files: src/distrib/sets/lists/tests: mi src/usr.bin/make: compat.c src/usr.bin/make/unit-tests: Makefile Added Files: src/usr.bin/make/unit-tests: archive-suffix.exp archive-suffix.mk Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.912 -r1.913 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.134 -r1.135 src/usr.bin/make/compat.c cvs rdiff -u -r1.125 -r1.126 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/archive-suffix.exp \ src/usr.bin/make/unit-tests/archive-suffix.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.912 src/distrib/sets/lists/tests/mi:1.913 --- src/distrib/sets/lists/tests/mi:1.912 Fri Aug 28 15:40:53 2020 +++ src/distrib/sets/lists/tests/mi Sat Aug 29 14:47:26 2020 @@ -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 Index: src/usr.bin/make/compat.c diff -u src/usr.bin/make/compat.c:1.134 src/usr.bin/make/compat.c:1.135 --- src/usr.bin/make/compat.c:1.134 Sat Aug 29 12:36:20 2020 +++ src/usr.bin/make/compat.c Sat Aug 29 14:47:26 2020 @@ -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 @@ Compat_Make(void *gnp, void *pgnp) } 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) { Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.125 src/usr.bin/make/unit-tests/Makefile:1.126 --- src/usr.bin/make/unit-tests/Makefile:1.125 Sat Aug 29 10:52:47 2020 +++ src/usr.bin/make/unit-tests/Makefile Sat Aug 29 14:47:26 2020 @@ -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 Added files: Index: src/usr.bin/make/unit-tests/archive-suffix.exp diff -u /dev/null src/usr.bin/make/unit-tests/archive-suffix.exp:1.1 --- /dev/null Sat Aug 29 14:47:26 2020 +++ src/usr.bin/make/unit-tests/archive-suffix.exp Sat Aug 29 14:47:26 2020 @@ -0,0 +1,2 @@ +`all' is up to date. +exit status 0 Index: src/usr.bin/make/unit-tests/archive-suffix.mk diff -u /dev/null src/usr.bin/make/unit-tests/archive-suffix.mk:1.1 --- /dev/null Sat Aug 29 14:47:26 2020 +++ src/usr.bin/make/unit-tests/archive-suffix.mk Sat Aug 29 14:47:26 2020 @@ -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: + : $@