Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Jul 2020 22:45:05 +0000 (UTC)
From:      "Simon J. Gerraty" <sjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r363115 - in vendor/NetBSD/bmake/dist: . filemon mk unit-tests
Message-ID:  <202007112245.06BMj5uU016947@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sjg
Date: Sat Jul 11 22:45:05 2020
New Revision: 363115
URL: https://svnweb.freebsd.org/changeset/base/363115

Log:
  Import bmake-20200710
  
  from ChangeLog:
  
      o filemon/filemon_dev.c: use O_CLOEXEC rather than extra syscall
      o meta.c: target flagged .META is out-of-date if meta file missing
      o cond.c: fix for compare_expression when doEval=0
      o unit-tests/Makefile: rework
      o filemon/filemon_dev.c: ensure filemon fd is closed on exec.

Modified:
  vendor/NetBSD/bmake/dist/ChangeLog
  vendor/NetBSD/bmake/dist/VERSION
  vendor/NetBSD/bmake/dist/cond.c
  vendor/NetBSD/bmake/dist/configure
  vendor/NetBSD/bmake/dist/configure.in
  vendor/NetBSD/bmake/dist/filemon/filemon_dev.c
  vendor/NetBSD/bmake/dist/meta.c
  vendor/NetBSD/bmake/dist/mk/ChangeLog
  vendor/NetBSD/bmake/dist/mk/dirdeps.mk
  vendor/NetBSD/bmake/dist/mk/host-target.mk
  vendor/NetBSD/bmake/dist/mk/install-mk
  vendor/NetBSD/bmake/dist/unit-tests/Makefile
  vendor/NetBSD/bmake/dist/unit-tests/cond-short.exp
  vendor/NetBSD/bmake/dist/unit-tests/cond-short.mk
  vendor/NetBSD/bmake/dist/unit-tests/modmisc.exp
  vendor/NetBSD/bmake/dist/unit-tests/modmisc.mk

Modified: vendor/NetBSD/bmake/dist/ChangeLog
==============================================================================
--- vendor/NetBSD/bmake/dist/ChangeLog	Sat Jul 11 22:14:44 2020	(r363114)
+++ vendor/NetBSD/bmake/dist/ChangeLog	Sat Jul 11 22:45:05 2020	(r363115)
@@ -1,3 +1,20 @@
+2020-07-10  Simon J Gerraty  <sjg@beast.crufty.net>
+
+	* configure.in: use AC_INCLUDES_DEFAULT rather than AC_HEADER_STDC
+
+	* VERSION (_MAKE_VERSION): 20200710
+	Merge with NetBSD make, pick up
+	o filemon/filemon_dev.c: use O_CLOEXEC rather than extra syscall
+	o meta.c: target flagged .META is out-of-date if meta file missing
+
+2020-07-09  Simon J Gerraty  <sjg@beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20200709
+	Merge with NetBSD make, pick up
+	o cond.c: fix for compare_expression when doEval=0
+	o unit-tests/Makefile: rework
+	o filemon/filemon_dev.c: ensure filemon fd is closed on exec.
+
 2020-07-04  Simon J Gerraty  <sjg@beast.crufty.net>
 
 	* VERSION (_MAKE_VERSION): 20200704

Modified: vendor/NetBSD/bmake/dist/VERSION
==============================================================================
--- vendor/NetBSD/bmake/dist/VERSION	Sat Jul 11 22:14:44 2020	(r363114)
+++ vendor/NetBSD/bmake/dist/VERSION	Sat Jul 11 22:45:05 2020	(r363115)
@@ -1,2 +1,2 @@
 # keep this compatible with sh and make
-_MAKE_VERSION=20200704
+_MAKE_VERSION=20200710

Modified: vendor/NetBSD/bmake/dist/cond.c
==============================================================================
--- vendor/NetBSD/bmake/dist/cond.c	Sat Jul 11 22:14:44 2020	(r363114)
+++ vendor/NetBSD/bmake/dist/cond.c	Sat Jul 11 22:45:05 2020	(r363115)
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.78 2020/07/03 08:13:23 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.79 2020/07/09 22:34:08 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.78 2020/07/03 08:13:23 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.79 2020/07/09 22:34:08 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.78 2020/07/03 08:13:23 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.79 2020/07/09 22:34:08 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -735,6 +735,11 @@ compare_expression(Boolean doEval)
     rhs = CondGetString(doEval, &rhsQuoted, &rhsFree, FALSE);
     if (!rhs)
 	goto done;
+
+    if (!doEval) {
+	t = TOK_FALSE;
+	goto done;
+    }
 
     if (rhsQuoted || lhsQuoted) {
 do_string_compare:

Modified: vendor/NetBSD/bmake/dist/configure
==============================================================================
Binary file (source and/or target). No diff available.

Modified: vendor/NetBSD/bmake/dist/configure.in
==============================================================================
--- vendor/NetBSD/bmake/dist/configure.in	Sat Jul 11 22:14:44 2020	(r363114)
+++ vendor/NetBSD/bmake/dist/configure.in	Sat Jul 11 22:45:05 2020	(r363115)
@@ -1,11 +1,11 @@
 dnl
 dnl RCSid:
-dnl	$Id: configure.in,v 1.65 2020/05/25 01:11:40 sjg Exp $
+dnl	$Id: configure.in,v 1.66 2020/07/10 16:34:38 sjg Exp $
 dnl
 dnl Process this file with autoconf to produce a configure script
 dnl
 AC_PREREQ(2.50)
-AC_INIT([bmake], [20200524], [sjg@NetBSD.org])
+AC_INIT([bmake], [20200710], [sjg@NetBSD.org])
 AC_CONFIG_HEADERS(config.h)
 
 dnl make srcdir absolute
@@ -128,7 +128,7 @@ dnl AC_C_CROSS
 dnl
 
 dnl Checks for header files.
-AC_HEADER_STDC
+AC_INCLUDES_DEFAULT
 AC_HEADER_SYS_WAIT
 AC_HEADER_DIRENT
 dnl Keep this list sorted
@@ -149,13 +149,11 @@ AC_CHECK_HEADERS( \
 	paths.h \
 	poll.h \
 	ranlib.h \
-	string.h \
 	sys/mman.h \
 	sys/select.h \
 	sys/socket.h \
 	sys/time.h \
 	sys/uio.h \
-	unistd.h \
 	utime.h \
 	)
 

Modified: vendor/NetBSD/bmake/dist/filemon/filemon_dev.c
==============================================================================
--- vendor/NetBSD/bmake/dist/filemon/filemon_dev.c	Sat Jul 11 22:14:44 2020	(r363114)
+++ vendor/NetBSD/bmake/dist/filemon/filemon_dev.c	Sat Jul 11 22:45:05 2020	(r363115)
@@ -1,4 +1,4 @@
-/*	$NetBSD: filemon_dev.c,v 1.1 2020/01/19 19:49:37 riastradh Exp $	*/
+/*	$NetBSD: filemon_dev.c,v 1.3 2020/07/10 15:53:30 sjg Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@ filemon_open(void)
 		return NULL;
 
 	/* Try opening /dev/filemon, up to six times (cargo cult!).  */
-	for (i = 0; (F->fd = open(_PATH_FILEMON, O_RDWR)) == -1; i++) {
+	for (i = 0; (F->fd = open(_PATH_FILEMON, O_RDWR|O_CLOEXEC)) == -1; i++) {
 		if (i == 5) {
 			error = errno;
 			goto fail0;

Modified: vendor/NetBSD/bmake/dist/meta.c
==============================================================================
--- vendor/NetBSD/bmake/dist/meta.c	Sat Jul 11 22:14:44 2020	(r363114)
+++ vendor/NetBSD/bmake/dist/meta.c	Sat Jul 11 22:45:05 2020	(r363115)
@@ -1,4 +1,4 @@
-/*      $NetBSD: meta.c,v 1.85 2020/07/03 08:13:23 rillig Exp $ */
+/*      $NetBSD: meta.c,v 1.86 2020/07/11 00:39:53 sjg Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -1610,7 +1610,7 @@ meta_oodate(GNode *gn, Boolean oodate)
 	    oodate = TRUE;
 	}
     } else {
-	if (writeMeta && metaMissing) {
+	if (writeMeta && (metaMissing || (gn->type & OP_META))) {
 	    cp = NULL;
 
 	    /* if target is in .CURDIR we do not need a meta file */

Modified: vendor/NetBSD/bmake/dist/mk/ChangeLog
==============================================================================
--- vendor/NetBSD/bmake/dist/mk/ChangeLog	Sat Jul 11 22:14:44 2020	(r363114)
+++ vendor/NetBSD/bmake/dist/mk/ChangeLog	Sat Jul 11 22:45:05 2020	(r363115)
@@ -1,3 +1,7 @@
+2020-07-10  Simon J Gerraty  <sjg@beast.crufty.net>
+
+	* dirdeps.mk: optimize content of dirdeps.cache
+
 2020-06-28  Simon J Gerraty  <sjg@beast.crufty.net>
 
 	* sys/*.mk: make it easier for local*sys.mk to customize by

Modified: vendor/NetBSD/bmake/dist/mk/dirdeps.mk
==============================================================================
--- vendor/NetBSD/bmake/dist/mk/dirdeps.mk	Sat Jul 11 22:14:44 2020	(r363114)
+++ vendor/NetBSD/bmake/dist/mk/dirdeps.mk	Sat Jul 11 22:45:05 2020	(r363115)
@@ -1,4 +1,4 @@
-# $Id: dirdeps.mk,v 1.104 2020/05/16 23:21:48 sjg Exp $
+# $Id: dirdeps.mk,v 1.106 2020/07/11 16:25:17 sjg Exp $
 
 # Copyright (c) 2010-2020, Simon J. Gerraty
 # Copyright (c) 2010-2018, Juniper Networks, Inc.
@@ -507,7 +507,7 @@ ${DIRDEPS_CACHE}:	.META .NOMETA_CMP
 # we want to capture the dirdeps count in the cache
 .END: _count_dirdeps
 _count_dirdeps: .NOMETA
-	@echo '.info $${.newline}$${TRACER}Makefiles read: total=${.MAKE.MAKEFILES:[#]} depend=${.MAKE.MAKEFILES:M*depend*:[#]} dirdeps=${.ALLTARGETS:M${SRCTOP}*:O:u:[#]}' >&3
+	@{ echo; echo '.info $${.newline}$${TRACER}Makefiles read: total=${.MAKE.MAKEFILES:[#]} depend=${.MAKE.MAKEFILES:M*depend*:[#]} dirdeps=${.ALLTARGETS:M${SRCTOP}*:O:u:[#]}'; } >&3
 
 .endif
 .elif !make(dirdeps) && !target(_count_dirdeps)
@@ -644,19 +644,19 @@ _build_all_dirs := ${_build_all_dirs:O:u}
 .if ${.MAKEFLAGS:M-V${_V_READ_DIRDEPS}} == ""
 .if !empty(_build_all_dirs)
 .if ${BUILD_DIRDEPS_CACHE} == "yes"
-# guard against _build_all_dirs being too big for a single command line
-# first get list of dirs that need _DIRDEP_USE
-# then export that and _build_all_dirs
+x!= echo; { echo; echo '\# ${DEP_RELDIR}.${DEP_TARGET_SPEC}'; } >&3
+# guard against _new_dirdeps being too big for a single command line
 _new_dirdeps := ${_build_all_dirs:@x@${target($x):?:$x}@}
-.export _new_dirdeps _build_all_dirs
-x!= echo; { echo '\# ${DEP_RELDIR}.${DEP_TARGET_SPEC}'; \
-	echo "dirdeps: \\"; \
-	for x in $$_build_all_dirs; do echo "	$$x \\"; done; echo; \
-	for x in $$_new_dirdeps; do echo "$$x: _DIRDEP_USE"; done; echo; } >&3
+.if !empty(_new_dirdeps)
+.export _new_dirdeps
+x!= echo; { echo; echo "dirdeps: \\"; \
+	for x in $$_new_dirdeps; do echo "	$$x \\"; done; echo; \
+	for x in $$_new_dirdeps; do echo "$$x: _DIRDEP_USE"; done; } >&3
+.endif
 .if !empty(DEP_EXPORT_VARS)
 # Discouraged, but there are always exceptions.
 # Handle it here rather than explain how.
-x!= { echo; ${DEP_EXPORT_VARS:@v@echo '$v=${$v}';@} echo '.export ${DEP_EXPORT_VARS}'; echo; } >&3; echo
+x!= echo; { echo; ${DEP_EXPORT_VARS:@v@echo '$v=${$v}';@} echo '.export ${DEP_EXPORT_VARS}'; echo; } >&3
 .endif
 .else
 # this makes it all happen
@@ -675,6 +675,9 @@ DEP_EXPORT_VARS=
 
 # this builds the dependency graph
 .for m in ${_machines}
+.if ${BUILD_DIRDEPS_CACHE} == "yes" && !empty(_build_dirs)
+x!= echo; { echo; echo "${_this_dir}.$m: \\"; } >&3
+.endif
 # it would be nice to do :N${.TARGET}
 .if !empty(__qual_depdirs)
 .for q in ${__qual_depdirs:${M_dep_qual_fixes:ts:}:E:O:u:N$m}
@@ -683,9 +686,10 @@ DEP_EXPORT_VARS=
 .endif
 .if ${BUILD_DIRDEPS_CACHE} == "yes"
 _cache_deps := ${_build_dirs:M*.$q}
+.if !empty(_cache_deps)
 .export _cache_deps
-x!= echo; { echo "${_this_dir}.$m: \\"; \
-	for x in $$_cache_deps; do echo "	$$x \\"; done; echo; } >&3
+x!= echo; for x in $$_cache_deps; do echo "	$$x \\"; done >&3
+.endif
 .else
 ${_this_dir}.$m: ${_build_dirs:M*.$q}
 .endif
@@ -696,9 +700,10 @@ ${_this_dir}.$m: ${_build_dirs:M*.$q}
 .endif
 .if ${BUILD_DIRDEPS_CACHE} == "yes"
 _cache_deps := ${_build_dirs:M*.$m:N${_this_dir}.$m}
+.if !empty(_cache_deps)
 .export _cache_deps
-x!= echo; { echo "${_this_dir}.$m: \\"; \
-	for x in $$_cache_deps; do echo "       $$x \\"; done; echo; } >&3
+x!= echo; for x in $$_cache_deps; do echo "	$$x \\"; done >&3
+.endif
 .else
 ${_this_dir}.$m: ${_build_dirs:M*.$m:N${_this_dir}.$m}
 .endif

Modified: vendor/NetBSD/bmake/dist/mk/host-target.mk
==============================================================================
--- vendor/NetBSD/bmake/dist/mk/host-target.mk	Sat Jul 11 22:14:44 2020	(r363114)
+++ vendor/NetBSD/bmake/dist/mk/host-target.mk	Sat Jul 11 22:45:05 2020	(r363115)
@@ -1,5 +1,5 @@
 # RCSid:
-#	$Id: host-target.mk,v 1.11 2015/10/25 00:07:20 sjg Exp $
+#	$Id: host-target.mk,v 1.12 2020/07/08 23:35:29 sjg Exp $
 
 # Host platform information; may be overridden
 .if !defined(_HOST_OSNAME)
@@ -37,6 +37,11 @@ HOST_OSTYPE  :=	${_HOST_OSNAME:S,/,,g}-${_HOST_OSREL:C
 HOST_OS      :=	${_HOST_OSNAME}
 host_os      :=	${_HOST_OSNAME:tl}
 HOST_TARGET  := ${host_os:S,/,,g}${HOST_OSMAJOR}-${_HOST_ARCH}
+# sometimes we want HOST_TARGET32
+MACHINE32.amd64 = i386
+MACHINE32.x86_64 = i386
+_HOST_ARCH32 := ${MACHINE32.${_HOST_ARCH}:U${_HOST_ARCH:S,64$,,}}
+HOST_TARGET32 := ${host_os:S,/,,g}${HOST_OSMAJOR}-${_HOST_ARCH32}
 
 # tr is insanely non-portable, accommodate the lowest common denominator
 TR ?= tr

Modified: vendor/NetBSD/bmake/dist/mk/install-mk
==============================================================================
--- vendor/NetBSD/bmake/dist/mk/install-mk	Sat Jul 11 22:14:44 2020	(r363114)
+++ vendor/NetBSD/bmake/dist/mk/install-mk	Sat Jul 11 22:45:05 2020	(r363115)
@@ -55,7 +55,7 @@
 #       Simon J. Gerraty <sjg@crufty.net>
 
 # RCSid:
-#	$Id: install-mk,v 1.173 2020/06/23 04:16:35 sjg Exp $
+#	$Id: install-mk,v 1.174 2020/07/10 21:50:14 sjg Exp $
 #
 #	@(#) Copyright (c) 1994 Simon J. Gerraty
 #
@@ -70,7 +70,7 @@
 #	sjg@crufty.net
 #
 
-MK_VERSION=20200622
+MK_VERSION=20200710
 OWNER=
 GROUP=
 MODE=444

Modified: vendor/NetBSD/bmake/dist/unit-tests/Makefile
==============================================================================
--- vendor/NetBSD/bmake/dist/unit-tests/Makefile	Sat Jul 11 22:14:44 2020	(r363114)
+++ vendor/NetBSD/bmake/dist/unit-tests/Makefile	Sat Jul 11 22:45:05 2020	(r363115)
@@ -1,87 +1,105 @@
-# $Id: Makefile,v 1.58 2020/07/04 22:33:00 sjg Exp $
+# $Id: Makefile,v 1.60 2020/07/10 00:48:32 sjg Exp $
 #
-# $NetBSD: Makefile,v 1.59 2020/06/28 09:42:40 rillig Exp $
+# $NetBSD: Makefile,v 1.63 2020/07/09 22:40:14 sjg Exp $
 #
 # Unit tests for make(1)
+#
 # The main targets are:
-# 
-# all:	run all the tests
-# test:	run 'all', and compare to expected results
-# accept: move generated output to expected results
 #
-# Adding a test case.  
+# all:
+#	run all the tests
+# test:
+#	run 'all', and compare to expected results
+# accept:
+#	move generated output to expected results
+#
+# Settable variables
+#
+# TEST_MAKE
+#	The make program to be tested.
+#
+#
+# Adding a test case
+#
 # Each feature should get its own set of tests in its own suitably
 # named makefile (*.mk), with its own set of expected results (*.exp),
-# and it should be added to the TESTNAMES list.
-# 
+# and it should be added to the TESTS list.
+#
+# Any added files must also be added to src/distrib/sets/lists/tests/mi.
+# Makefiles that are not added to TESTS must be ignored in
+# src/tests/usr.bin/make/t_make.sh (example: include-sub).
+#
 
-.MAIN: all
+# Each test is in a sub-makefile.
+# Keep the list sorted.
+TESTS+=		comment
+TESTS+=		cond-late
+TESTS+=		cond-short
+TESTS+=		cond1
+TESTS+=		cond2
+TESTS+=		dollar
+TESTS+=		doterror
+TESTS+=		dotwait
+TESTS+=		error
+TESTS+=		# escape	# broken by reverting POSIX changes
+TESTS+=		export
+TESTS+=		export-all
+TESTS+=		export-env
+TESTS+=		forloop
+TESTS+=		forsubst
+TESTS+=		hash
+TESTS+=		# impsrc	# broken by reverting POSIX changes
+TESTS+=		include-main
+TESTS+=		misc
+TESTS+=		moderrs
+TESTS+=		modmatch
+TESTS+=		modmisc
+TESTS+=		modorder
+TESTS+=		modts
+TESTS+=		modword
+TESTS+=		order
+TESTS+=		# phony-end	# broken by reverting POSIX changes
+TESTS+=		posix
+TESTS+=		# posix1	# broken by reverting POSIX changes
+TESTS+=		qequals
+TESTS+=		# suffixes	# broken by reverting POSIX changes
+TESTS+=		sunshcmd
+TESTS+=		sysv
+TESTS+=		ternary
+TESTS+=		unexport
+TESTS+=		unexport-env
+TESTS+=		varcmd
+TESTS+=		varmisc
+TESTS+=		varmod-edge
+TESTS+=		varquote
+TESTS+=		varshell
 
-.-include "Makefile.config"
+# Override make flags for certain tests; default is -k.
+FLAGS.doterror=		# none
+FLAGS.order=		-j1
 
-UNIT_TESTS:= ${.PARSEDIR}
-.PATH: ${UNIT_TESTS}
+# Some tests need extra post-processing.
+SED_CMDS.modmisc+=	-e 's,\(substitution error:\).*,\1 (details omitted),'
+SED_CMDS.varshell+=	-e 's,^[a-z]*sh: ,,'
+SED_CMDS.varshell+=	-e '/command/s,No such.*,not found,'
 
-# Each test is in a sub-makefile.
-# Keep the list sorted.
-TESTNAMES= \
-	comment \
-	cond-late \
-	cond-short \
-	cond1 \
-	cond2 \
-	dollar \
-	doterror \
-	dotwait \
-	error \
-	export \
-	export-all \
-	export-env \
-	forloop \
-	forsubst \
-	hash \
-	include-main \
-	misc \
-	moderrs \
-	modmatch \
-	modmisc \
-	modorder \
-	modts \
-	modword \
-	order \
-	posix \
-	qequals \
-	sunshcmd \
-	sysv \
-	ternary \
-	unexport \
-	unexport-env \
-	varcmd \
-	varmisc \
-	varmod-edge \
-	varquote \
-	varshell
+# End of the configuration section.
 
-# these tests were broken by referting POSIX chanegs
-STRICT_POSIX_TESTS = \
-	escape \
-	impsrc \
-	phony-end \
-	posix1 \
-	suffixes
+.MAIN: all
 
-# Override make flags for certain tests
-flags.doterror=
-flags.order=-j1
+.-include "Makefile.config"
 
-OUTFILES= ${TESTNAMES:S/$/.out/}
+UNIT_TESTS:=	${.PARSEDIR}
+.PATH: ${UNIT_TESTS}
 
+OUTFILES=	${TESTS:=.out}
+
 all: ${OUTFILES}
 
-CLEANFILES += *.rawout *.out *.status *.tmp *.core *.tmp
-CLEANFILES += obj*.[och] lib*.a		# posix1.mk
-CLEANFILES += issue* .[ab]*		# suffixes.mk
-CLEANRECURSIVE += dir dummy		# posix1.mk
+CLEANFILES+=		*.rawout *.out *.status *.tmp *.core *.tmp
+CLEANFILES+=		obj*.[och] lib*.a	# posix1.mk
+CLEANFILES+=		issue* .[ab]*		# suffixes.mk
+CLEANRECURSIVE+=	dir dummy		# posix1.mk
 
 clean:
 	rm -f ${CLEANFILES}
@@ -89,45 +107,42 @@ clean:
 	rm -rf ${CLEANRECURSIVE}
 .endif
 
-TEST_MAKE?= ${.MAKE}
-TOOL_SED?= sed
-TOOL_TR?= tr
-TOOL_DIFF?= diff
+TEST_MAKE?=	${.MAKE}
+TOOL_SED?=	sed
+TOOL_TR?=	tr
+TOOL_DIFF?=	diff
+DIFF_FLAGS?=	-u
 
 .if defined(.PARSEDIR)
 # ensure consistent results from sort(1)
-LC_ALL= C
-LANG= C
+LC_ALL=		C
+LANG=		C
 .export LANG LC_ALL
 .endif
 
-# some tests need extra post-processing
-SED_CMDS.varshell = -e 's,^[a-z]*sh: ,,' \
-	-e '/command/s,No such.*,not found,'
-
-# the detailed error message can vary across systems
-SED_CMDS.modmisc = -e 's,\(substitution error:\).*,\1 details omitted,'
-
 # the tests are actually done with sub-makes.
 .SUFFIXES: .mk .rawout .out
 .mk.rawout:
-	@echo ${TEST_MAKE} ${flags.${.TARGET:R}:U-k} -f ${.IMPSRC}
+	@echo ${TEST_MAKE} ${FLAGS.${.TARGET:R}:U-k} -f ${.IMPSRC}
 	-@cd ${.OBJDIR} && \
-	{ ${TEST_MAKE} ${flags.${.TARGET:R}:U-k} -f ${.IMPSRC} \
+	{ ${TEST_MAKE} ${FLAGS.${.TARGET:R}:U-k} -f ${.IMPSRC} \
 	  2>&1 ; echo $$? >${.TARGET:R}.status ; } > ${.TARGET}.tmp
 	@mv ${.TARGET}.tmp ${.TARGET}
 
-# We always pretend .MAKE was called 'make' 
-# and strip ${.CURDIR}/ from the output
-# and replace anything after 'stopped in' with unit-tests
-# so the results can be compared.
+# Post-process the test output so that the results can be compared.
+#
+# always pretend .MAKE was called 'make'
+_SED_CMDS+=	-e 's,^${TEST_MAKE:T:S,.,\\.,g}[][0-9]*:,make:,'
+_SED_CMDS+=	-e 's,${TEST_MAKE:S,.,\\.,g},make,'
+# replace anything after 'stopped in' with unit-tests
+_SED_CMDS+=	-e '/stopped/s, /.*, unit-tests,'
+# strip ${.CURDIR}/ from the output
+_SED_CMDS+=	-e 's,${.CURDIR:S,.,\\.,g}/,,g'
+_SED_CMDS+=	-e 's,${UNIT_TESTS:S,.,\\.,g}/,,g'
+
 .rawout.out:
 	@echo postprocess ${.TARGET}
-	@${TOOL_SED} -e 's,^${TEST_MAKE:T:C/\./\\\./g}[][0-9]*:,make:,' \
-	  -e 's,${TEST_MAKE:C/\./\\\./g},make,' \
-	  -e '/stopped/s, /.*, unit-tests,' \
-	  -e 's,${.CURDIR:C/\./\\\./g}/,,g' \
-	  -e 's,${UNIT_TESTS:C/\./\\\./g}/,,g' ${SED_CMDS.${.TARGET:T:R}} \
+	@${TOOL_SED} ${_SED_CMDS} ${SED_CMDS.${.TARGET:R}} \
 	  < ${.IMPSRC} > ${.TARGET}.tmp
 	@echo "exit status `cat ${.TARGET:R}.status`" >> ${.TARGET}.tmp
 	@mv ${.TARGET}.tmp ${.TARGET}
@@ -135,7 +150,7 @@ SED_CMDS.modmisc = -e 's,\(substitution error:\).*,\1 
 # Compare all output files
 test:	${OUTFILES} .PHONY
 	@failed= ; \
-	for test in ${TESTNAMES}; do \
+	for test in ${TESTS}; do \
 	  ${TOOL_DIFF} ${DIFF_FLAGS} ${UNIT_TESTS}/$${test}.exp $${test}.out \
 	  || failed="$${failed}$${failed:+ }$${test}" ; \
 	done ; \
@@ -146,14 +161,14 @@ test:	${OUTFILES} .PHONY
 	fi
 
 accept:
-	@for test in ${TESTNAMES}; do \
+	@for test in ${TESTS}; do \
 	  cmp -s ${UNIT_TESTS}/$${test}.exp $${test}.out \
 	  || { echo "Replacing $${test}.exp" ; \
 	       cp $${test}.out ${UNIT_TESTS}/$${test}.exp ; } \
 	done
 
 .if exists(${TEST_MAKE})
-${TESTNAMES:S/$/.rawout/}: ${TEST_MAKE}
+${TESTS:=.rawout}: ${TEST_MAKE}
 .endif
 
 .-include <obj.mk>

Modified: vendor/NetBSD/bmake/dist/unit-tests/cond-short.exp
==============================================================================
--- vendor/NetBSD/bmake/dist/unit-tests/cond-short.exp	Sat Jul 11 22:14:44 2020	(r363114)
+++ vendor/NetBSD/bmake/dist/unit-tests/cond-short.exp	Sat Jul 11 22:45:05 2020	(r363115)
@@ -7,4 +7,10 @@ expected M pattern
 expected or
 expected or exists
 expected or empty
+defined(V42) && 42 > 0: Ok
+defined(V66) && ( "" < 42 ): Ok
+1 || 42 < 42: Ok
+1 ||  < 42: Ok
+0 || 42 <= 42: Ok
+0 ||  < 42: Ok
 exit status 0

Modified: vendor/NetBSD/bmake/dist/unit-tests/cond-short.mk
==============================================================================
--- vendor/NetBSD/bmake/dist/unit-tests/cond-short.mk	Sat Jul 11 22:14:44 2020	(r363114)
+++ vendor/NetBSD/bmake/dist/unit-tests/cond-short.mk	Sat Jul 11 22:45:05 2020	(r363115)
@@ -1,4 +1,4 @@
-# $NetBSD: cond-short.mk,v 1.6 2020/07/02 16:37:56 rillig Exp $
+# $NetBSD: cond-short.mk,v 1.7 2020/07/09 22:34:09 sjg Exp $
 #
 # Demonstrates that in conditions, the right-hand side of an && or ||
 # is only evaluated if it can actually influence the result.
@@ -96,6 +96,58 @@ VAR=	# empty again, for the following tests
 .if 1
 .elif ${echo "unexpected nested or" 1>&2 :L:sh}
 .endif
+
+# make sure these do not cause complaint
+#.MAKEFLAGS: -dc
+
+V42 = 42
+iV1 = ${V42}
+iV2 = ${V66}
+
+.if defined(V42) && ${V42} > 0
+x=Ok
+.else
+x=Fail
+.endif
+x!= echo 'defined(V42) && ${V42} > 0: $x' >&2; echo
+# this one throws both String comparison operator and
+# Malformed conditional with cond.c 1.78
+# indirect iV2 would expand to "" and treated as 0
+.if defined(V66) && ( ${iV2} < ${V42} )
+x=Fail
+.else
+x=Ok
+.endif
+x!= echo 'defined(V66) && ( "${iV2}" < ${V42} ): $x' >&2; echo
+# next two thow String comparison operator with cond.c 1.78
+# indirect iV1 would expand to 42
+.if 1 || ${iV1} < ${V42}
+x=Ok
+.else
+x=Fail
+.endif
+x!= echo '1 || ${iV1} < ${V42}: $x' >&2; echo
+.if 1 || ${iV2:U2} < ${V42}
+x=Ok
+.else
+x=Fail
+.endif
+x!= echo '1 || ${iV2:U2} < ${V42}: $x' >&2; echo
+# the same expressions are fine when the lhs is expanded
+# ${iV1} expands to 42
+.if 0 || ${iV1} <= ${V42}
+x=Ok
+.else
+x=Fail
+.endif
+x!= echo '0 || ${iV1} <= ${V42}: $x' >&2; echo
+# ${iV2:U2} expands to 2
+.if 0 || ${iV2:U2} < ${V42}
+x=Ok
+.else
+x=Fail
+.endif
+x!= echo '0 || ${iV2:U2} < ${V42}: $x' >&2; echo
 
 all:
 	@:;:

Modified: vendor/NetBSD/bmake/dist/unit-tests/modmisc.exp
==============================================================================
--- vendor/NetBSD/bmake/dist/unit-tests/modmisc.exp	Sat Jul 11 22:14:44 2020	(r363114)
+++ vendor/NetBSD/bmake/dist/unit-tests/modmisc.exp	Sat Jul 11 22:45:05 2020	(r363115)
@@ -25,11 +25,27 @@ C:empty
 :a b b c:
 :a b b c:
 : b c:
-make: RE substitution error: details omitted
+make: RE substitution error: (details omitted)
 make: Unclosed substitution for  (, missing)
 :C,word,____,:Q}:
 :a c:
 :x__ 3 x__ 3:
 :+one+ +two+ +three+:
 mod-at-resolve:w1d2d3w w2i3w w1i2d3 2i${RES3}w w1d2d3 2i${RES3} 1i${RES2}w:
+mod-subst-dollar:$1:
+mod-subst-dollar:$2:
+mod-subst-dollar:$3:
+mod-subst-dollar:$4:
+mod-subst-dollar:$5:
+mod-subst-dollar:$6:
+mod-subst-dollar:$7:
+mod-subst-dollar:$8:
+mod-subst-dollar:U8:
+mod-subst-dollar:$$$$:
+mod-loop-dollar:1:
+mod-loop-dollar:${word}:
+mod-loop-dollar:$3$:
+mod-loop-dollar:$${word}$:
+mod-loop-dollar:$$5$$:
+mod-loop-dollar:$$${word}$$:
 exit status 0

Modified: vendor/NetBSD/bmake/dist/unit-tests/modmisc.mk
==============================================================================
--- vendor/NetBSD/bmake/dist/unit-tests/modmisc.mk	Sat Jul 11 22:14:44 2020	(r363114)
+++ vendor/NetBSD/bmake/dist/unit-tests/modmisc.mk	Sat Jul 11 22:45:05 2020	(r363115)
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.1.1.2 2020/07/04 17:52:46 sjg Exp $
+# $Id: modmisc.mk,v 1.1.1.3 2020/07/09 22:35:19 sjg Exp $
 #
 # miscellaneous modifier tests
 
@@ -17,6 +17,7 @@ MOD_SEP=S,:, ,g
 
 all:	modvar modvarloop modsysv mod-HTE emptyvar undefvar
 all:	mod-S mod-C mod-at-varname mod-at-resolve
+all:	mod-subst-dollar mod-loop-dollar
 
 modsysv:
 	@echo "The answer is ${libfoo.a:L:libfoo.a=42}"
@@ -93,3 +94,34 @@ RES3=		3
 
 mod-at-resolve:
 	@echo $@:${RESOLVE:@v@w${v}w@:Q}:
+
+# No matter how many dollar characters there are, they all get merged
+# into a single dollar by the :S modifier.
+mod-subst-dollar:
+	@echo $@:${:U1:S,^,$,:Q}:
+	@echo $@:${:U2:S,^,$$,:Q}:
+	@echo $@:${:U3:S,^,$$$,:Q}:
+	@echo $@:${:U4:S,^,$$$$,:Q}:
+	@echo $@:${:U5:S,^,$$$$$,:Q}:
+	@echo $@:${:U6:S,^,$$$$$$,:Q}:
+	@echo $@:${:U7:S,^,$$$$$$$,:Q}:
+	@echo $@:${:U8:S,^,$$$$$$$$,:Q}:
+# This generates no dollar at all:
+	@echo $@:${:UU8:S,^,${:U$$$$$$$$},:Q}:
+# Here is an alternative way to generate dollar characters.
+# It's unexpectedly complicated though.
+	@echo $@:${:U:range=5:ts\x24:C,[0-9],,g:Q}:
+
+# Demonstrate that it is possible to generate dollar characters using the
+# :@ modifier.
+#
+# These are edge cases that could have resulted in a parse error as well
+# since the $@ at the end could have been interpreted as a variable, which
+# would mean a missing closing @ delimiter.
+mod-loop-dollar:
+	@echo $@:${:U1:@word@${word}$@:Q}:
+	@echo $@:${:U2:@word@$${word}$$@:Q}:
+	@echo $@:${:U3:@word@$$${word}$$$@:Q}:
+	@echo $@:${:U4:@word@$$$${word}$$$$@:Q}:
+	@echo $@:${:U5:@word@$$$$${word}$$$$$@:Q}:
+	@echo $@:${:U6:@word@$$$$$${word}$$$$$$@:Q}:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007112245.06BMj5uU016947>