CVS commit: src/usr.bin

2020-12-27 Thread Hisashi T Fujinaka
Module Name:src
Committed By:   htodd
Date:   Mon Dec 28 03:48:41 UTC 2020

Modified Files:
src/usr.bin: Makefile

Log Message:
Go into the resize directory to build/install the files since they're in the 
sets.


To generate a diff of this commit:
cvs rdiff -u -r1.233 -r1.234 src/usr.bin/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/Makefile
diff -u src/usr.bin/Makefile:1.233 src/usr.bin/Makefile:1.234
--- src/usr.bin/Makefile:1.233	Sun Feb  2 21:49:43 2020
+++ src/usr.bin/Makefile	Mon Dec 28 03:48:41 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.233 2020/02/02 21:49:43 kamil Exp $
+#	$NetBSD: Makefile,v 1.234 2020/12/28 03:48:41 htodd Exp $
 #	from: @(#)Makefile	8.3 (Berkeley) 1/7/94
 
 .include 
@@ -22,7 +22,7 @@ SUBDIR= apply asa at audio audiocfg \
 	nbperf nc netgroup netstat newgrp newsyslog nfsstat nice nl nohup \
 	pagesize passwd paste patch pathchk pkill pmap pr \
 	printenv printf progress pwait pwhash qsubst quota radioctl rdist \
-	realpath renice rev revoke rfcomm_sppd rlogin rpcgen rpcinfo rs rsh \
+	realpath renice resize rev revoke rfcomm_sppd rlogin rpcgen rpcinfo rs rsh \
 	rup ruptime rusers rwall rwho \
 	script sdiff sdpquery sed seq shar shlock \
 	showmount shuffle sockstat sort sortinfo \



CVS commit: src/usr.bin/make

2020-12-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Dec 28 00:46:25 UTC 2020

Modified Files:
src/usr.bin/make: enum.h main.c make.h nonints.h parse.c var.c
src/usr.bin/make/unit-tests: varmod-defined.exp varmod-indirect.exp
varname-dot-shell.exp

Log Message:
make(1): replace global preserveUndefined with VARE_KEEP_UNDEF

Controlling the expansion of variable expressions using a global
variable and a VARE flag was inconsistent.

Converting the global variable into a flag had to prerequisites:

1.  The unintended duplicate variable assignment had to be fixed, as
done in parse.c 1.520 from 2020-12-27.  Without this fix, it would have
been necessary to add more flags to Var_Exists and Var_SetWithFlags, and
this would have become too complex.

2.  There had to be a unit test demonstrating that VARE_KEEP_DOLLAR only
applies to the top-level expression and is not passed to the
subexpressions, while VARE_KEEP_UNDEF applies to all subexpressions as
well.  This test is in var-op-expand.mk 1.10 from 2020-12-28, at least
for the ':@word@' modifier.  In ParseModifierPartSubst, VARE_KEEP_UNDEF
is not passed down either, in the same way.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/enum.h
cvs rdiff -u -r1.505 -r1.506 src/usr.bin/make/main.c
cvs rdiff -u -r1.239 -r1.240 src/usr.bin/make/make.h
cvs rdiff -u -r1.185 -r1.186 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.520 -r1.521 src/usr.bin/make/parse.c
cvs rdiff -u -r1.773 -r1.774 src/usr.bin/make/var.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-defined.exp
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/varmod-indirect.exp
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/varname-dot-shell.exp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/enum.h
diff -u src/usr.bin/make/enum.h:1.12 src/usr.bin/make/enum.h:1.13
--- src/usr.bin/make/enum.h:1.12	Fri Sep 25 15:54:50 2020
+++ src/usr.bin/make/enum.h	Mon Dec 28 00:46:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: enum.h,v 1.12 2020/09/25 15:54:50 rillig Exp $	*/
+/*	$NetBSD: enum.h,v 1.13 2020/12/28 00:46:24 rillig Exp $	*/
 
 /*
  Copyright (c) 2020 Roland Illig 
@@ -130,6 +130,17 @@ const char *Enum_ValueToString(int, cons
 		ENUM__JOIN_STR_1(v3)))
 
 /* Declare the necessary data structures for calling Enum_FlagsToString
+ * for an enum with 4 flags. */
+#define ENUM_FLAGS_RTTI_4(typnam, v1, v2, v3, v4) \
+	ENUM__FLAGS_RTTI(typnam, \
+	ENUM__SPECS_2( \
+		ENUM__SPEC_2(v1, v2), \
+		ENUM__SPEC_2(v3, v4)), \
+	ENUM__JOIN_2( \
+		ENUM__JOIN_STR_2(v1, v2), \
+		ENUM__JOIN_STR_2(v3, v4)))
+
+/* Declare the necessary data structures for calling Enum_FlagsToString
  * for an enum with 6 flags. */
 #define ENUM_FLAGS_RTTI_6(typnam, v1, v2, v3, v4, v5, v6) \
 	ENUM__FLAGS_RTTI(typnam, \

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.505 src/usr.bin/make/main.c:1.506
--- src/usr.bin/make/main.c:1.505	Sun Dec 27 11:47:04 2020
+++ src/usr.bin/make/main.c	Mon Dec 28 00:46:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.505 2020/12/27 11:47:04 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.506 2020/12/28 00:46:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.505 2020/12/27 11:47:04 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.506 2020/12/28 00:46:24 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -125,7 +125,6 @@ Boolean deleteOnError;		/* .DELETE_ON_ER
 static int maxJobTokens;	/* -j argument */
 Boolean enterFlagObj;		/* -w and objdir != srcdir */
 
-Boolean preserveUndefined;
 static int jp_0 = -1, jp_1 = -1; /* ends of parent job pipe */
 Boolean doing_depend;		/* Set while reading .depend */
 static Boolean jobsRunning;	/* TRUE if the jobs might be running */

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.239 src/usr.bin/make/make.h:1.240
--- src/usr.bin/make/make.h:1.239	Wed Dec 23 14:05:32 2020
+++ src/usr.bin/make/make.h	Mon Dec 28 00:46:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.239 2020/12/23 14:05:32 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.240 2020/12/28 00:46:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -496,21 +496,6 @@ extern char var_Error[];
 /* The time at the start of this whole process */
 extern time_t now;
 
-/*
- * If FALSE (the default behavior), undefined subexpressions in a variable
- * expression are discarded.  If TRUE (only during variable assignments using
- * the ':=' assignment operator, no matter how deeply nested), they are
- * preserved and possibly expanded later when the variable from the
- * subexpression has been defined.
- *
- * Example for a ':=' assignment:
- *	CFLAGS = 

CVS commit: src/usr.bin/make/unit-tests

2020-12-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Dec 28 00:19:42 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: var-op-expand.mk

Log Message:
make(1): extend test for modifier parts in ':=' assignments


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/var-op-expand.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/var-op-expand.mk
diff -u src/usr.bin/make/unit-tests/var-op-expand.mk:1.9 src/usr.bin/make/unit-tests/var-op-expand.mk:1.10
--- src/usr.bin/make/unit-tests/var-op-expand.mk:1.9	Sun Dec 27 23:25:33 2020
+++ src/usr.bin/make/unit-tests/var-op-expand.mk	Mon Dec 28 00:19:41 2020
@@ -1,4 +1,4 @@
-# $NetBSD: var-op-expand.mk,v 1.9 2020/12/27 23:25:33 rillig Exp $
+# $NetBSD: var-op-expand.mk,v 1.10 2020/12/28 00:19:41 rillig Exp $
 #
 # Tests for the := variable assignment operator, which expands its
 # right-hand side.
@@ -118,22 +118,32 @@ VAR:=		top:$$ ${:Unest1\:\$\$} ${:Unest2
 
 # In variable assignments using the ':=' operator, there may be expressions
 # containing variable modifiers, and these modifiers may refer to other
-# variables.
+# variables.  These referred-to variables are expanded at the time of
+# assignment.  The undefined variables are kept as-is and are later expanded
+# when evaluating the condition.
 #
 # Contrary to the assignment operator '=', the assignment operator ':='
 # consumes the '$' from modifier parts.
 REF.word=	1:$$ 2: 4:
-VAR:=		${:Uword:@word@${REF.${word}}@}, direct: ${REF.word}
-.if ${VAR} != "1:2:\$ 4:\$\$, direct: 1:\$ 2:\$\$ 4:\$\$\$\$"
+.undef REF.undef
+VAR:=		${:Uword undef:@word@${REF.${word}}@}, direct: ${REF.word} ${REF.undef}
+REF.word=	word.after
+REF.undef=	undef.after
+.if ${VAR} != "1:2:\$ 4:\$\$ undef.after, direct: 1:\$ 2:\$\$ 4:\$\$\$\$ undef.after"
 .  error
 .endif
 
-
 # Just for comparison, the previous example using the assignment operator '='
-# instead of ':='.
+# instead of ':='.  The right-hand side of the assignment is not evaluated at
+# the time of assignment but only later, when ${VAR} appears in the condition.
+#
+# At that point, both REF.word and REF.undef are defined.
 REF.word=	1:$$ 2: 4:
-VAR=		${:Uword:@word@${REF.${word}}@}, direct: ${REF.word}
-.if ${VAR} != "1:\$ 2:\$\$ 4:\$\$\$\$, direct: 1:\$ 2:\$\$ 4:\$\$\$\$"
+.undef REF.undef
+VAR=		${:Uword undef:@word@${REF.${word}}@}, direct: ${REF.word} ${REF.undef}
+REF.word=	word.after
+REF.undef=	undef.after
+.if ${VAR} != "word.after undef.after, direct: word.after undef.after"
 .  error
 .endif
 



CVS commit: src/sys/dev/wscons

2020-12-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Dec 28 00:14:18 UTC 2020

Modified Files:
src/sys/dev/wscons: wsdisplay_vcons.c

Log Message:
provide (bug)compatibility with vga in WSDISPLAYIO_{PUT|GET}WSCHAR
if row == 0 treat col as linear index into the text / attribute buffer,
transform into proper coordinates as needed for putchar()

with this wsmoused works as expected


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/wscons/wsdisplay_vcons.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/wscons/wsdisplay_vcons.c
diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.43 src/sys/dev/wscons/wsdisplay_vcons.c:1.44
--- src/sys/dev/wscons/wsdisplay_vcons.c:1.43	Wed Dec 23 05:50:51 2020
+++ src/sys/dev/wscons/wsdisplay_vcons.c	Mon Dec 28 00:14:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_vcons.c,v 1.43 2020/12/23 05:50:51 macallan Exp $ */
+/*	$NetBSD: wsdisplay_vcons.c,v 1.44 2020/12/28 00:14:18 macallan Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.43 2020/12/23 05:50:51 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.44 2020/12/28 00:14:18 macallan Exp $");
 
 #include 
 #include 
@@ -1297,25 +1297,33 @@ vcons_putwschar(struct vcons_screen *scr
 
 	ri = >scr_ri;
 
-	if (__predict_false((unsigned int)wsc->col > ri->ri_cols ||
-	(unsigned int)wsc->row > ri->ri_rows))
+	/* allow col as linear index if row == 0 */
+	if (wsc->row == 0) {
+		if (wsc->col < 0 || wsc->col > (ri->ri_cols * ri->ri_rows))
+			return EINVAL;
+		int rem;
+		rem = wsc->col % ri->ri_cols;
+		wsc->row = wsc->col / ri->ri_cols;
+		DPRINTF("off %d -> %d, %d\n", wsc->col, rem, wsc->row);
+		wsc->col = rem;
+	} else {
+		if (__predict_false(wsc->col < 0 || wsc->col >= ri->ri_cols))
 			return (EINVAL);
 	
-	if ((wsc->row >= 0) && (wsc->row < ri->ri_rows) && (wsc->col >= 0) && 
-	 (wsc->col < ri->ri_cols)) {
+		if (__predict_false(wsc->row < 0 || wsc->row >= ri->ri_rows))
+			return (EINVAL);
+	}
 
-		error = ri->ri_ops.allocattr(ri, wsc->foreground,
-		wsc->background, wsc->flags, );
-		if (error)
-			return error;
-		vcons_putchar(ri, wsc->row, wsc->col, wsc->letter, attr);
+	error = ri->ri_ops.allocattr(ri, wsc->foreground,
+	wsc->background, wsc->flags, );
+	if (error)
+		return error;
+	vcons_putchar(ri, wsc->row, wsc->col, wsc->letter, attr);
 #ifdef VCONS_DEBUG
-		printf("vcons_putwschar(%d, %d, %x, %lx\n", wsc->row, wsc->col,
-		wsc->letter, attr);
+	printf("vcons_putwschar(%d, %d, %x, %lx\n", wsc->row, wsc->col,
+	wsc->letter, attr);
 #endif
-		return 0;
-	} else
-		return EINVAL;
+	return 0;
 }
 
 static int
@@ -1329,31 +1337,43 @@ vcons_getwschar(struct vcons_screen *scr
 
 	ri = >scr_ri;
 
-	if ((wsc->row >= 0) && (wsc->row < ri->ri_rows) && (wsc->col >= 0) && 
-	 (wsc->col < ri->ri_cols)) {
+	/* allow col as linear index if row == 0 */
+	if (wsc->row == 0) {
+		if (wsc->col < 0 || wsc->col > (ri->ri_cols * ri->ri_rows))
+			return EINVAL;
+		int rem;
+		rem = wsc->col % ri->ri_cols;
+		wsc->row = wsc->col / ri->ri_cols;
+		DPRINTF("off %d -> %d, %d\n", wsc->col, rem, wsc->row);
+		wsc->col = rem;
+	} else {
+		if (__predict_false(wsc->col < 0 || wsc->col >= ri->ri_cols))
+			return (EINVAL);
+	
+		if (__predict_false(wsc->row < 0 || wsc->row >= ri->ri_rows))
+			return (EINVAL);
+	}
 
-		offset = ri->ri_cols * wsc->row + wsc->col;
+	offset = ri->ri_cols * wsc->row + wsc->col;
 #ifdef WSDISPLAY_SCROLLSUPPORT
-		offset += scr->scr_offset_to_zero;
+	offset += scr->scr_offset_to_zero;
 #endif
-		wsc->letter = scr->scr_chars[offset];
-		attr = scr->scr_attrs[offset];
+	wsc->letter = scr->scr_chars[offset];
+	attr = scr->scr_attrs[offset];
 
-		/* 
-		 * this is ugly. We need to break up an attribute into colours and
-		 * flags but there's no rasops method to do that so we must rely on
-		 * the 'canonical' encoding.
-		 */
+	/* 
+	 * this is ugly. We need to break up an attribute into colours and
+	 * flags but there's no rasops method to do that so we must rely on
+	 * the 'canonical' encoding.
+	 */
 #ifdef VCONS_DEBUG
-		printf("vcons_getwschar: %d, %d, %x, %lx\n", wsc->row,
-		wsc->col, wsc->letter, attr);
+	printf("vcons_getwschar: %d, %d, %x, %lx\n", wsc->row,
+	wsc->col, wsc->letter, attr);
 #endif
-		wsc->foreground = (attr >> 24) & 0xff;
-		wsc->background = (attr >> 16) & 0xff;
-		wsc->flags  = attr & 0xff;
-		return 0;
-	} else
-		return EINVAL;
+	wsc->foreground = (attr >> 24) & 0xff;
+	wsc->background = (attr >> 16) & 0xff;
+	wsc->flags  = attr & 0xff;
+	return 0;
 }
 
 #ifdef WSDISPLAY_SCROLLSUPPORT



CVS commit: src/usr.bin/make/unit-tests

2020-12-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 27 23:25:33 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: var-op-expand.mk

Log Message:
make(1): add test for modifier parts in ':=' assignments


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/var-op-expand.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/var-op-expand.mk
diff -u src/usr.bin/make/unit-tests/var-op-expand.mk:1.8 src/usr.bin/make/unit-tests/var-op-expand.mk:1.9
--- src/usr.bin/make/unit-tests/var-op-expand.mk:1.8	Sun Dec 27 22:29:37 2020
+++ src/usr.bin/make/unit-tests/var-op-expand.mk	Sun Dec 27 23:25:33 2020
@@ -1,4 +1,4 @@
-# $NetBSD: var-op-expand.mk,v 1.8 2020/12/27 22:29:37 rillig Exp $
+# $NetBSD: var-op-expand.mk,v 1.9 2020/12/27 23:25:33 rillig Exp $
 #
 # Tests for the := variable assignment operator, which expands its
 # right-hand side.
@@ -116,6 +116,28 @@ VAR:=		top:$$ ${:Unest1\:\$\$} ${:Unest2
 .endif
 
 
+# In variable assignments using the ':=' operator, there may be expressions
+# containing variable modifiers, and these modifiers may refer to other
+# variables.
+#
+# Contrary to the assignment operator '=', the assignment operator ':='
+# consumes the '$' from modifier parts.
+REF.word=	1:$$ 2: 4:
+VAR:=		${:Uword:@word@${REF.${word}}@}, direct: ${REF.word}
+.if ${VAR} != "1:2:\$ 4:\$\$, direct: 1:\$ 2:\$\$ 4:\$\$\$\$"
+.  error
+.endif
+
+
+# Just for comparison, the previous example using the assignment operator '='
+# instead of ':='.
+REF.word=	1:$$ 2: 4:
+VAR=		${:Uword:@word@${REF.${word}}@}, direct: ${REF.word}
+.if ${VAR} != "1:\$ 2:\$\$ 4:\$\$\$\$, direct: 1:\$ 2:\$\$ 4:\$\$\$\$"
+.  error
+.endif
+
+
 # Between var.c 1.42 from 2000-05-11 and before parse.c 1.520 from 2020-12-27,
 # if the variable name in a ':=' assignment referred to an undefined variable,
 # there were actually 2 assignments to different variables:



CVS commit: src/usr.bin/make

2020-12-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 27 22:29:37 UTC 2020

Modified Files:
src/usr.bin/make: parse.c
src/usr.bin/make/unit-tests: var-op-expand.mk

Log Message:
make(1): fix edge case in := with undefined in variable name

Previously, the assignment "VAR${UNDEF} := value" actually assigned to 2
variables.  See var-op-expand.mk for details.


To generate a diff of this commit:
cvs rdiff -u -r1.519 -r1.520 src/usr.bin/make/parse.c
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/var-op-expand.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.519 src/usr.bin/make/parse.c:1.520
--- src/usr.bin/make/parse.c:1.519	Sun Dec 27 18:22:28 2020
+++ src/usr.bin/make/parse.c	Sun Dec 27 22:29:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.519 2020/12/27 18:22:28 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.520 2020/12/27 22:29:37 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.519 2020/12/27 18:22:28 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.520 2020/12/27 22:29:37 rillig Exp $");
 
 /* types and constants */
 
@@ -1931,17 +1931,6 @@ VarAssign_EvalSubst(const char *name, co
 	char *evalue;
 	Boolean savedPreserveUndefined = preserveUndefined;
 
-	/* TODO: Can this assignment to preserveUndefined be moved further down
-	 * to the actually interesting Var_Subst call, without affecting any
-	 * edge cases?
-	 *
-	 * It might affect the implicit expansion of the variable name in the
-	 * Var_Exists and Var_Set calls, even though it's unlikely that anyone
-	 * cared about this edge case when adding this code.  In addition,
-	 * variable assignments should not refer to any undefined variables in
-	 * the variable name. */
-	preserveUndefined = TRUE;
-
 	/*
 	 * make sure that we set the variable the first time to nothing
 	 * so that it gets substituted!
@@ -1949,9 +1938,11 @@ VarAssign_EvalSubst(const char *name, co
 	if (!Var_Exists(name, ctxt))
 		Var_Set(name, "", ctxt);
 
+	preserveUndefined = TRUE;
 	(void)Var_Subst(uvalue, ctxt, VARE_WANTRES | VARE_KEEP_DOLLAR, );
-	/* TODO: handle errors */
 	preserveUndefined = savedPreserveUndefined;
+	/* TODO: handle errors */
+
 	avalue = evalue;
 	Var_Set(name, avalue, ctxt);
 

Index: src/usr.bin/make/unit-tests/var-op-expand.mk
diff -u src/usr.bin/make/unit-tests/var-op-expand.mk:1.7 src/usr.bin/make/unit-tests/var-op-expand.mk:1.8
--- src/usr.bin/make/unit-tests/var-op-expand.mk:1.7	Sun Dec 27 21:31:27 2020
+++ src/usr.bin/make/unit-tests/var-op-expand.mk	Sun Dec 27 22:29:37 2020
@@ -1,4 +1,4 @@
-# $NetBSD: var-op-expand.mk,v 1.7 2020/12/27 21:31:27 rillig Exp $
+# $NetBSD: var-op-expand.mk,v 1.8 2020/12/27 22:29:37 rillig Exp $
 #
 # Tests for the := variable assignment operator, which expands its
 # right-hand side.
@@ -116,26 +116,25 @@ VAR:=		top:$$ ${:Unest1\:\$\$} ${:Unest2
 .endif
 
 
-# XXX: edge case: When a variable name refers to an undefined variable, the
-# behavior differs between the '=' and the ':=' assignment operators.
-# This bug exists since var.c 1.42 from 2000-05-11.
-#
-# The '=' operator expands the undefined variable to an empty string, thus
-# assigning to VAR_ASSIGN_.  In the name of variables to be set, it should
-# really be forbidden to refer to undefined variables.
-#
-# The ':=' operator expands the variable name twice.  In one of these
-# expansions, the undefined variable expression is preserved (controlled by
-# preserveUndefined in VarAssign_EvalSubst), in the other expansion it expands
-# to an empty string.  This way, 2 variables are created using a single
-# variable assignment.  It's magic. :-/
+# Between var.c 1.42 from 2000-05-11 and before parse.c 1.520 from 2020-12-27,
+# if the variable name in a ':=' assignment referred to an undefined variable,
+# there were actually 2 assignments to different variables:
+#
+#	Global["VAR_SUBST_${UNDEF}"] = ""
+#	Global["VAR_SUBST_"] = ""
+#
+# The variable name with the empty value actually included a dollar sign.
+# Variable names with dollars are not used in practice.
+#
+# It might be a good idea to forbid undefined variables on the left-hand side
+# of a variable assignment.
 .undef UNDEF
 VAR_ASSIGN_${UNDEF}=	assigned by '='
 VAR_SUBST_${UNDEF}:=	assigned by ':='
 .if ${VAR_ASSIGN_} != "assigned by '='"
 .  error
 .endif
-.if ${${:UVAR_SUBST_\${UNDEF\}}} != ""
+.if defined(${:UVAR_SUBST_\${UNDEF\}})
 .  error
 .endif
 .if ${VAR_SUBST_} != "assigned by ':='"



CVS commit: src/usr.bin/make/unit-tests

2020-12-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 27 21:31:28 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: var-op-expand.exp var-op-expand.mk

Log Message:
make(1): move test result of var-op-expand.mk from exp to mk

This makes it easier to run this test in older versions of make.  Empty
output means success.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/var-op-expand.exp
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/var-op-expand.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/var-op-expand.exp
diff -u src/usr.bin/make/unit-tests/var-op-expand.exp:1.2 src/usr.bin/make/unit-tests/var-op-expand.exp:1.3
--- src/usr.bin/make/unit-tests/var-op-expand.exp:1.2	Sun Nov  8 13:46:15 2020
+++ src/usr.bin/make/unit-tests/var-op-expand.exp	Sun Dec 27 21:31:27 2020
@@ -1,10 +1 @@
-Var_Parse: ${UNDEF} with VARE_WANTRES
-Global:VAR_ASSIGN_ = undef value
-Var_Parse: ${UNDEF} with VARE_WANTRES
-Var_Parse: ${UNDEF} with VARE_WANTRES
-Global:VAR_SUBST_${UNDEF} = 
-Var_Parse: ${UNDEF} with VARE_WANTRES
-Global:VAR_SUBST_ = undef value
-Global:.MAKEFLAGS =  -r -k -d v -d
-Global:.MAKEFLAGS =  -r -k -d v -d 0
 exit status 0

Index: src/usr.bin/make/unit-tests/var-op-expand.mk
diff -u src/usr.bin/make/unit-tests/var-op-expand.mk:1.6 src/usr.bin/make/unit-tests/var-op-expand.mk:1.7
--- src/usr.bin/make/unit-tests/var-op-expand.mk:1.6	Sun Dec 27 21:19:13 2020
+++ src/usr.bin/make/unit-tests/var-op-expand.mk	Sun Dec 27 21:31:27 2020
@@ -1,4 +1,4 @@
-# $NetBSD: var-op-expand.mk,v 1.6 2020/12/27 21:19:13 rillig Exp $
+# $NetBSD: var-op-expand.mk,v 1.7 2020/12/27 21:31:27 rillig Exp $
 #
 # Tests for the := variable assignment operator, which expands its
 # right-hand side.
@@ -130,10 +130,17 @@ VAR:=		top:$$ ${:Unest1\:\$\$} ${:Unest2
 # to an empty string.  This way, 2 variables are created using a single
 # variable assignment.  It's magic. :-/
 .undef UNDEF
-.MAKEFLAGS: -dv
-VAR_ASSIGN_${UNDEF}=	undef value
-VAR_SUBST_${UNDEF}:=	undef value
-.MAKEFLAGS: -d0
+VAR_ASSIGN_${UNDEF}=	assigned by '='
+VAR_SUBST_${UNDEF}:=	assigned by ':='
+.if ${VAR_ASSIGN_} != "assigned by '='"
+.  error
+.endif
+.if ${${:UVAR_SUBST_\${UNDEF\}}} != ""
+.  error
+.endif
+.if ${VAR_SUBST_} != "assigned by ':='"
+.  error
+.endif
 
 all:
 	@:;



CVS commit: src/usr.bin/resize

2020-12-27 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sun Dec 27 21:25:02 UTC 2020

Modified Files:
src/usr.bin/resize: resize.1

Log Message:
Make the new resize(1) manpage indistinguisable from the original


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/resize/resize.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/resize/resize.1
diff -u src/usr.bin/resize/resize.1:1.1 src/usr.bin/resize/resize.1:1.2
--- src/usr.bin/resize/resize.1:1.1	Sun Dec 27 21:13:18 2020
+++ src/usr.bin/resize/resize.1	Sun Dec 27 21:25:02 2020
@@ -44,7 +44,7 @@
 .el   .ds `` ``
 .ie \n(.g .ds '' \(rq
 .el   .ds '' ''
-.TH RESIZE 1 "__app_date__" "__app_version__" "X Window System"
+.TH RESIZE 1 "2017-06-20" "Patch 330" "X Window System"
 .SH NAME
 resize \- set environment and terminal settings to current xterm window size
 .SH SYNOPSIS
@@ -187,7 +187,7 @@ so it is possible for \fI\*n\fP to be co
 .TP 15
 TERM
 .I \*N
-sets this to "__default_termname__" if not already set.
+sets this to "xterm" if not already set.
 .TP 15
 TERMCAP
 .I \*N
@@ -206,7 +206,7 @@ use_env(3x)
 .br
 csh(1), stty(1), tset(1)
 .br
-xterm(__mansuffix__)
+xterm(1)
 .SH AUTHORS
 Mark Vandevoorde (MIT-Athena), Edward Moy (Berkeley)
 .br
@@ -215,5 +215,5 @@ Thomas Dickey (invisible-island.net).
 Copyright (c) 1984, 1985 by X Consortium
 .br
 See
-.IR X (__miscmansuffix__)
+.IR X (7)
 for a complete copyright notice.



CVS commit: src/usr.bin/make/unit-tests

2020-12-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 27 21:19:13 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: var-op-expand.mk

Log Message:
make(1): add more tests for ':=' assignments


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/var-op-expand.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/var-op-expand.mk
diff -u src/usr.bin/make/unit-tests/var-op-expand.mk:1.5 src/usr.bin/make/unit-tests/var-op-expand.mk:1.6
--- src/usr.bin/make/unit-tests/var-op-expand.mk:1.5	Sun Dec 27 20:45:52 2020
+++ src/usr.bin/make/unit-tests/var-op-expand.mk	Sun Dec 27 21:19:13 2020
@@ -1,4 +1,4 @@
-# $NetBSD: var-op-expand.mk,v 1.5 2020/12/27 20:45:52 rillig Exp $
+# $NetBSD: var-op-expand.mk,v 1.6 2020/12/27 21:19:13 rillig Exp $
 #
 # Tests for the := variable assignment operator, which expands its
 # right-hand side.
@@ -86,6 +86,36 @@ UNDEF=		Uwas undefined
 .endif
 
 
+# In variable assignments using the ':=' operator, undefined variables are
+# preserved, no matter how indirectly they are referenced.
+.undef REF3
+REF2=		<${REF3}>
+REF=		${REF2}
+VAR:=		${REF}
+REF3=		too late
+.if ${VAR} != ""
+.  error
+.endif
+
+
+# In variable assignments using the ':=' operator, '$$' are preserved, no
+# matter how indirectly they are referenced.
+REF2=		REF2:$$ 
+REF=		REF:$$  ${REF2}
+VAR:=		VAR:$$  ${REF}
+.if ${VAR} != "VAR:\$ \$\$ REF:\$ \$\$ REF2:\$ \$\$"
+.  error
+.endif
+
+
+# In variable assignments using the ':=' operator, '$$' are preserved in the
+# expressions of the top level, but not in expressions that are nested.
+VAR:=		top:$$ ${:Unest1\:\$\$} ${:Unest2${:U\:\$\$}}
+.if ${VAR} != "top:\$ nest1:\$ nest2:\$"
+.  error
+.endif
+
+
 # XXX: edge case: When a variable name refers to an undefined variable, the
 # behavior differs between the '=' and the ':=' assignment operators.
 # This bug exists since var.c 1.42 from 2000-05-11.



CVS commit: src

2020-12-27 Thread Reinoud Zandijk
/setxkbmap.0			xbase-setxkbmap-catman	.cat,xorg
@@ -1457,7 +1457,7 @@
 ./usr/X11R7/man/html1/mkhtmlindex.html			xbase-mkhtmlindex-htmlman	html,xorg
 ./usr/X11R7/man/html1/oclock.html			xbase-oclock-htmlman	html,xorg
 ./usr/X11R7/man/html1/proxymngr.html			xbase-proxymngr-htmlman	html,xorg
-./usr/X11R7/man/html1/resize.html			xbase-resize-htmlman	html,xorg
+./usr/X11R7/man/html1/resize.html			xbase-obsolete		obsolete
 ./usr/X11R7/man/html1/revpath.html			xbase-revpath-htmlman	html,xorg
 ./usr/X11R7/man/html1/sessreg.html			xbase-sessreg-htmlman	html,xorg
 ./usr/X11R7/man/html1/setxkbmap.html			xbase-setxkbmap-htmlman	html,xorg
@@ -1606,7 +1606,7 @@
 ./usr/X11R7/man/man1/mkhtmlindex.1			xbase-mkhtmlindex-man	.man,xorg
 ./usr/X11R7/man/man1/oclock.1xbase-oclock-man	.man,xorg
 ./usr/X11R7/man/man1/proxymngr.1			xbase-proxymngr-man	.man,xorg
-./usr/X11R7/man/man1/resize.1xbase-xterm-man	.man,xorg
+./usr/X11R7/man/man1/resize.1xbase-obsolete		obsolete
 ./usr/X11R7/man/man1/revpath.1xbase-revpath-man	.man,xorg
 ./usr/X11R7/man/man1/sessreg.1xbase-sessreg-man	.man,xorg
 ./usr/X11R7/man/man1/setxkbmap.1			xbase-setxkbmap-man	.man,xorg

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2770 src/doc/CHANGES:1.2771
--- src/doc/CHANGES:1.2770	Sun Dec 27 20:56:14 2020
+++ src/doc/CHANGES	Sun Dec 27 21:13:17 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2770 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2771 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -322,4 +322,6 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 		framebuffer for HP9000/425t. [tsutsui 20201223]
 	openresolv: Update to version 3.12.0 [roy 20201227]
 	nvmm: implement support for trapping REP CMPS [reinoud 20201227]
+	resize: Import Xterm's resize(1) for querying (x)terminal sizes in
+		base for headless clients [reinoud 20201227]
 

Index: src/external/mit/xorg/bin/xterm/Makefile
diff -u src/external/mit/xorg/bin/xterm/Makefile:1.18 src/external/mit/xorg/bin/xterm/Makefile:1.19
--- src/external/mit/xorg/bin/xterm/Makefile:1.18	Fri Oct  2 13:08:07 2020
+++ src/external/mit/xorg/bin/xterm/Makefile	Sun Dec 27 21:13:18 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.18 2020/10/02 13:08:07 nia Exp $
+#	$NetBSD: Makefile,v 1.19 2020/12/27 21:13:18 reinoud Exp $
 
 .include 
 
@@ -38,7 +38,7 @@ DPADD+=	${LIBXAW} ${LIBXMU} ${LIBXT} ${L
 LDADD+=	-lXpm -lXext -lX11 -lcurses -lterminfo -lutil
 DPADD+=	${LIBXPM} ${LIBXEXT} ${LIBX11} ${LIBCURSES} ${LIBTERMINFO} ${LIBUTIL}
 
-SUBDIR=	resize uxterm
+SUBDIR=	uxterm
 
 .PATH:	${X11SRCDIR.${PROG}}
 

Added files:

Index: src/usr.bin/resize/Makefile
diff -u /dev/null src/usr.bin/resize/Makefile:1.1
--- /dev/null	Sun Dec 27 21:13:18 2020
+++ src/usr.bin/resize/Makefile	Sun Dec 27 21:13:18 2020
@@ -0,0 +1,7 @@
+#	$NetBSD: Makefile,v 1.1 2020/12/27 21:13:18 reinoud Exp $
+
+WARNS=	3
+PROG=	resize
+SRCS=	resize.c xstrings.c
+
+.include 
Index: src/usr.bin/resize/resize.1
diff -u /dev/null src/usr.bin/resize/resize.1:1.1
--- /dev/null	Sun Dec 27 21:13:18 2020
+++ src/usr.bin/resize/resize.1	Sun Dec 27 21:13:18 2020
@@ -0,0 +1,219 @@
+.\" $XTermId: resize.man,v 1.32 2016/09/24 11:14:15 tom Exp $
+.\"
+.\" Copyright 1998-2013,2016 by Thomas E. Dickey
+.\"
+.\" All Rights Reserved
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining a
+.\" copy of this software and associated documentation files (the
+.\" "Software"), to deal in the Software without restriction, including
+.\" without limitation the rights to use, copy, modify, merge, publish,
+.\" distribute, sublicense, and/or sell copies of the Software, and to
+.\" permit persons to whom the Software is furnished to do so, subject to
+.\" the following conditions:
+.\"
+.\" The above copyright notice and this permission notice shall be included
+.\" in all copies or substantial portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+.\" IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+.\" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+.\" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+.\"
+.\" Except as contained in this notice, the name(s) of the above copyright
+.\" holders shall not be used in advertising or otherwise to promote the
+.\" sale, use or other dealings in this Software without prior written
+.\" authorization.
+.\"
+.\" updated by Thomas E. Dickey for XFree86, 1998-2006.
+.\"
+.ds N Resize
+.ds n resize
+.\&q

CVS commit: src

2020-12-27 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sun Dec 27 20:56:14 UTC 2020

Modified Files:
src/doc: CHANGES
src/lib/libnvmm: libnvmm_x86.c
src/tests/lib/libnvmm: h_mem_assist.c h_mem_assist_asm.S

Log Message:
Implement support for trapping REP CMPS instructions in NVMM.

Qemu would abort hard when NVMM would get a memory trap on the instruction
since it didn't know it.


To generate a diff of this commit:
cvs rdiff -u -r1.2769 -r1.2770 src/doc/CHANGES
cvs rdiff -u -r1.42 -r1.43 src/lib/libnvmm/libnvmm_x86.c
cvs rdiff -u -r1.19 -r1.20 src/tests/lib/libnvmm/h_mem_assist.c
cvs rdiff -u -r1.9 -r1.10 src/tests/lib/libnvmm/h_mem_assist_asm.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2769 src/doc/CHANGES:1.2770
--- src/doc/CHANGES:1.2769	Sun Dec 27 18:28:25 2020
+++ src/doc/CHANGES	Sun Dec 27 20:56:14 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2769 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2770 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -321,3 +321,5 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	sti(4), hp300: Add bitmap access ops support for SGC CRX (A1659-66001)
 		framebuffer for HP9000/425t. [tsutsui 20201223]
 	openresolv: Update to version 3.12.0 [roy 20201227]
+	nvmm: implement support for trapping REP CMPS [reinoud 20201227]
+

Index: src/lib/libnvmm/libnvmm_x86.c
diff -u src/lib/libnvmm/libnvmm_x86.c:1.42 src/lib/libnvmm/libnvmm_x86.c:1.43
--- src/lib/libnvmm/libnvmm_x86.c:1.42	Sat Oct 31 15:44:01 2020
+++ src/lib/libnvmm/libnvmm_x86.c	Sun Dec 27 20:56:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: libnvmm_x86.c,v 1.42 2020/10/31 15:44:01 reinoud Exp $	*/
+/*	$NetBSD: libnvmm_x86.c,v 1.43 2020/12/27 20:56:14 reinoud Exp $	*/
 
 /*
  * Copyright (c) 2018-2020 Maxime Villard, m00nbsd.net
@@ -869,7 +869,6 @@ static void x86_func_test(struct nvmm_vc
 static void x86_func_mov(struct nvmm_vcpu *, struct nvmm_mem *, uint64_t *);
 static void x86_func_stos(struct nvmm_vcpu *, struct nvmm_mem *, uint64_t *);
 static void x86_func_lods(struct nvmm_vcpu *, struct nvmm_mem *, uint64_t *);
-static void x86_func_movs(struct nvmm_vcpu *, struct nvmm_mem *, uint64_t *);
 
 static const struct x86_emul x86_emul_or = {
 	.readreg = true,
@@ -919,10 +918,6 @@ static const struct x86_emul x86_emul_lo
 	.func = x86_func_lods
 };
 
-static const struct x86_emul x86_emul_movs = {
-	.func = x86_func_movs
-};
-
 /* Legacy prefixes. */
 #define LEG_LOCK	0xF0
 #define LEG_REPN	0xF2
@@ -941,6 +936,7 @@ struct x86_legpref {
 	bool adr_ovr:1;
 	bool rep:1;
 	bool repn:1;
+	bool repe:1;
 	int8_t seg;
 };
 
@@ -1049,6 +1045,7 @@ struct x86_opcode {
 	bool dmo:1;
 	bool todmo:1;
 	bool movs:1;
+	bool cmps:1;
 	bool stos:1;
 	bool lods:1;
 	bool szoverride:1;
@@ -1451,7 +1448,7 @@ static const struct x86_opcode primary_o
 		.movs = true,
 		.szoverride = false,
 		.defsize = OPSIZE_BYTE,
-		.emul = _emul_movs
+		.emul = NULL
 	},
 	[0xA5] = {
 		/* Yv, Xv */
@@ -1459,7 +1456,27 @@ static const struct x86_opcode primary_o
 		.movs = true,
 		.szoverride = true,
 		.defsize = -1,
-		.emul = _emul_movs
+		.emul = NULL
+	},
+
+	/*
+	 * CMPS
+	 */
+	[0xA6] = {
+		/* Yb, Xb */
+		.valid = true,
+		.cmps = true,
+		.szoverride = false,
+		.defsize = OPSIZE_BYTE,
+		.emul = NULL
+	},
+	[0xA7] = {
+		/* Yv, Xv */
+		.valid = true,
+		.cmps = true,
+		.szoverride = true,
+		.defsize = -1,
+		.emul = NULL
 	},
 
 	/*
@@ -1871,6 +1888,35 @@ node_movs(struct x86_decode_fsm *fsm, st
 }
 
 /*
+ * Special node, for CMPS. Fake two displacements of zero on the source and
+ * destination registers.
+ * XXX coded as clone of movs as its similar in register usage
+ * XXX might be merged with node_movs()
+ */
+static int
+node_cmps(struct x86_decode_fsm *fsm, struct x86_instr *instr)
+{
+	size_t adrsize;
+
+	adrsize = instr->address_size;
+
+	/* DS:RSI */
+	instr->src.type = STORE_REG;
+	instr->src.u.reg = _map__special[1][2][adrsize-1];
+	instr->src.disp.type = DISP_0;
+
+	/* ES:RDI, force ES */
+	instr->dst.type = STORE_REG;
+	instr->dst.u.reg = _map__special[1][3][adrsize-1];
+	instr->dst.disp.type = DISP_0;
+	instr->dst.hardseg = NVMM_X64_SEG_ES;
+
+	fsm_advance(fsm, 0, NULL);
+
+	return 0;
+}
+
+/*
  * Special node, for STOS and LODS. Fake a displacement of zero on the
  * destination register.
  */
@@ -2470,6 +2516,8 @@ node_primary_opcode(struct x86_decode_fs
 		fsm_advance(fsm, 1, node_stlo);
 	} else if (opcode->movs) {
 		fsm_advance(fsm, 1, node_movs);
+	} else if (opcode->cmps) {
+		fsm_advance(fsm, 1, node_cmps);
 	} else {
 		return -1;
 	}
@@ -2646,8 +2694,17 @@ x86_decode(uint8_t *inst_bytes, size_t i
 
 	while (fsm.fn != NULL) {
 		ret = (*fsm.fn)(, instr);
-		if (ret == -1)
+		if (ret == -1) {
+#ifdef NVMM_DEBUG
+			printf(&

CVS commit: src/usr.bin/make/unit-tests

2020-12-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 27 20:45:52 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: var-op-expand.mk

Log Message:
make(1): add tests for variable assignments using the ':=' operator


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/var-op-expand.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/var-op-expand.mk
diff -u src/usr.bin/make/unit-tests/var-op-expand.mk:1.4 src/usr.bin/make/unit-tests/var-op-expand.mk:1.5
--- src/usr.bin/make/unit-tests/var-op-expand.mk:1.4	Sun Nov  8 14:00:52 2020
+++ src/usr.bin/make/unit-tests/var-op-expand.mk	Sun Dec 27 20:45:52 2020
@@ -1,9 +1,90 @@
-# $NetBSD: var-op-expand.mk,v 1.4 2020/11/08 14:00:52 rillig Exp $
+# $NetBSD: var-op-expand.mk,v 1.5 2020/12/27 20:45:52 rillig Exp $
 #
 # Tests for the := variable assignment operator, which expands its
 # right-hand side.
 
-# TODO: Implementation
+
+# If the right-hand side does not contain a dollar sign, the ':=' assignment
+# operator has the same effect as the '=' assignment operator.
+VAR:=			value
+.if ${VAR} != "value"
+.  error
+.endif
+
+# When a ':=' assignment is performed, its right-hand side is evaluated and
+# expanded as far as possible.  Contrary to other situations, '$$' and
+# variable expressions based on undefined variables are preserved though.
+#
+# Whether a variable expression is undefined or not is determined at the end
+# of evaluating the expression.  The consequence is that ${:Ufallback} expands
+# to "fallback"; initially this expression is undefined since it is based on
+# the variable named "", which is guaranteed to be never defined, but at the
+# end of evaluating the expression ${:Ufallback}, the modifier ':U' has turned
+# the expression into a defined expression.
+
+
+# literal dollar signs
+VAR:=		$$  
+.if ${VAR} != "\$ \$\$ \$\$\$\$"
+.  error
+.endif
+
+
+# reference to a variable containing a literal dollar sign
+REF=		$$  
+VAR:=		${REF}
+REF=		too late
+.if ${VAR} != "\$ \$\$ \$\$\$\$"
+.  error
+.endif
+
+
+# reference to an undefined variable
+.undef UNDEF
+VAR:=		<${UNDEF}>
+UNDEF=		after
+.if ${VAR} != ""
+.  error
+.endif
+
+
+# reference to a variable whose name is computed from another variable
+REF2=		referred to
+REF=		REF2
+VAR:=		${${REF}}
+REF=		too late
+.if ${VAR} != "referred to"
+.  error
+.endif
+
+
+# expression with an indirect modifier referring to an undefined variable
+.undef UNDEF
+VAR:=		${:${UNDEF}}
+UNDEF=		Uwas undefined
+.if ${VAR} != "was undefined"
+.  error
+.endif
+
+
+# expression with an indirect modifier referring to another variable that
+# in turn refers to an undefined variable
+#
+# XXX: Even though this is a ':=' assignment, the '${UNDEF}' in the part of
+# the variable modifier is not preserved.  To preserve it, ParseModifierPart
+# would have to call VarSubstExpr somehow since this is the only piece of
+# code that takes care of this global variable.
+.undef UNDEF
+REF=		U${UNDEF}
+#.MAKEFLAGS: -dv
+VAR:=		${:${REF}}
+#.MAKEFLAGS: -d0
+REF=		too late
+UNDEF=		Uwas undefined
+.if ${VAR} != ""
+.  error
+.endif
+
 
 # XXX: edge case: When a variable name refers to an undefined variable, the
 # behavior differs between the '=' and the ':=' assignment operators.
@@ -18,6 +99,7 @@
 # preserveUndefined in VarAssign_EvalSubst), in the other expansion it expands
 # to an empty string.  This way, 2 variables are created using a single
 # variable assignment.  It's magic. :-/
+.undef UNDEF
 .MAKEFLAGS: -dv
 VAR_ASSIGN_${UNDEF}=	undef value
 VAR_SUBST_${UNDEF}:=	undef value



CVS commit: src/doc

2020-12-27 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Dec 27 18:28:25 UTC 2020

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
Note openresolv-3.12.0 update


To generate a diff of this commit:
cvs rdiff -u -r1.1769 -r1.1770 src/doc/3RDPARTY
cvs rdiff -u -r1.2768 -r1.2769 src/doc/CHANGES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1769 src/doc/3RDPARTY:1.1770
--- src/doc/3RDPARTY:1.1769	Sat Dec 12 11:02:06 2020
+++ src/doc/3RDPARTY	Sun Dec 27 18:28:25 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1769 2020/12/12 11:02:06 wiz Exp $
+#	$NetBSD: 3RDPARTY,v 1.1770 2020/12/27 18:28:25 roy Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1043,12 +1043,12 @@ Location:	external/bsd/openpam/dist
 Notes:
 
 Package:	openresolv
-Version:	3.11.0
-Current Vers:	3.11.0
+Version:	3.12.0
+Current Vers:	3.12.0
 Maintainer:	roy
 Archive Site:	ftp://roy.marples.name/pub/openresolv/
 Home Page:	http://roy.marples.name/projects/openresolv/
-Date:		2020-07-22
+Date:		2020-12-27
 Mailing List: 	openresolv-disc...@marples.name
 License:	BSD (2-clause)
 Location:	external/bsd/openresolv/dist

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2768 src/doc/CHANGES:1.2769
--- src/doc/CHANGES:1.2768	Wed Dec 23 08:38:45 2020
+++ src/doc/CHANGES	Sun Dec 27 18:28:25 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2768 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2769 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -320,3 +320,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	sparc64: Add environment monitoring for the E250 [jdc 20201223]
 	sti(4), hp300: Add bitmap access ops support for SGC CRX (A1659-66001)
 		framebuffer for HP9000/425t. [tsutsui 20201223]
+	openresolv: Update to version 3.12.0 [roy 20201227]



CVS commit: src/external/bsd/openresolv/dist

2020-12-27 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Dec 27 18:26:50 UTC 2020

Modified Files:
src/external/bsd/openresolv/dist: resolvconf.8.in resolvconf.conf.5.in
resolvconf.in

Log Message:
Sync with openresolv-3.12.0


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/openresolv/dist/resolvconf.8.in
cvs rdiff -u -r1.20 -r1.21 \
src/external/bsd/openresolv/dist/resolvconf.conf.5.in
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/openresolv/dist/resolvconf.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/openresolv/dist/resolvconf.8.in
diff -u src/external/bsd/openresolv/dist/resolvconf.8.in:1.10 src/external/bsd/openresolv/dist/resolvconf.8.in:1.11
--- src/external/bsd/openresolv/dist/resolvconf.8.in:1.10	Mon Jan 27 21:13:05 2020
+++ src/external/bsd/openresolv/dist/resolvconf.8.in	Sun Dec 27 18:26:50 2020
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd November 29, 2016
+.Dd December 23, 2016
 .Dt RESOLVCONF 8
 .Os
 .Sh NAME
@@ -38,6 +38,10 @@
 .Fl a Ar interface Ns Op Ar .protocol
 .No < Ns Pa file
 .Nm
+.Fl C Ar pattern
+.Nm
+.Fl c Ar pattern
+.Nm
 .Op Fl f
 .Fl d Ar interface Ns Op Ar .protocol
 .Nm
@@ -126,6 +130,15 @@ file(s) for all the
 .Ar protocols
 on the
 .Ar interface .
+For systems that support the concept of persisting configuration when
+the carrier goes down, then it should instead call
+.Nm
+with
+.Fl C Ar interface.*
+arguments to deprecate the matching interfaces and
+.Fl c Ar interface.*
+to activate the matching interfaces when the carrier comes up.
+This only affects the order in which interfaces are processed.
 .Pp
 Here are some options for the above commands:-
 .Bl -tag -width pattern_opt

Index: src/external/bsd/openresolv/dist/resolvconf.conf.5.in
diff -u src/external/bsd/openresolv/dist/resolvconf.conf.5.in:1.20 src/external/bsd/openresolv/dist/resolvconf.conf.5.in:1.21
--- src/external/bsd/openresolv/dist/resolvconf.conf.5.in:1.20	Mon Jan 27 21:13:05 2020
+++ src/external/bsd/openresolv/dist/resolvconf.conf.5.in	Sun Dec 27 18:26:50 2020
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd September 8, 2019
+.Dd October 1, 2020
 .Dt RESOLVCONF.CONF 5
 .Os
 .Sh NAME
@@ -220,7 +220,7 @@ openresolv ships with subscribers for th
 and
 .Xr unbound 8 .
 Each subscriber can create configuration files which should be included in
-in the subscribers main configuration file.
+the subscribers main configuration file.
 .Pp
 To disable a subscriber, simply set it's name to NO.
 For example, to disable the libc subscriber you would set:

Index: src/external/bsd/openresolv/dist/resolvconf.in
diff -u src/external/bsd/openresolv/dist/resolvconf.in:1.8 src/external/bsd/openresolv/dist/resolvconf.in:1.9
--- src/external/bsd/openresolv/dist/resolvconf.in:1.8	Wed Jul 22 13:19:17 2020
+++ src/external/bsd/openresolv/dist/resolvconf.in	Sun Dec 27 18:26:50 2020
@@ -25,7 +25,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 RESOLVCONF="$0"
-OPENRESOLV_VERSION="3.11.0"
+OPENRESOLV_VERSION="3.12.0"
 SYSCONFDIR=@SYSCONFDIR@
 LIBEXECDIR=@LIBEXECDIR@
 VARDIR=@VARDIR@
@@ -64,6 +64,7 @@ IFACEDIR="$VARDIR/interfaces"
 METRICDIR="$VARDIR/metrics"
 PRIVATEDIR="$VARDIR/private"
 EXCLUSIVEDIR="$VARDIR/exclusive"
+DEPRECATEDDIR="$VARDIR/deprecated"
 LOCKDIR="$VARDIR/lock"
 _PWD="$PWD"
 
@@ -88,6 +89,8 @@ usage()
 	Commands:
 	  -a \$INTERFACEAdd DNS information to the specified interface
 	   (DNS supplied via stdin in resolv.conf format)
+	  -C \$PATTERN  Deprecate DNS information for matched interfaces
+	  -c \$PATTERN  Configure DNS information for matched interfaces
 	  -d \$INTERFACEDelete DNS information from the specified interface
 	  -h   Show this help cruft
 	  -i [\$PATTERN]Show interfaces that have supplied DNS information
@@ -275,19 +278,14 @@ dirname()
 
 config_mkdirs()
 {
-	e=0
 	for f; do
 		[ -n "$f" ] || continue
 		d="$(dirname "$f")"
 		if [ ! -d "$d" ]; then
-			if type install >/dev/null 2>&1; then
-install -d "$d" || e=$?
-			else
-mkdir "$d" || e=$?
-			fi
+			mkdir -p "$d" || return $?
 		fi
 	done
-	return $e
+	return 0
 }
 
 # With the advent of alternative init systems, it's possible to have
@@ -412,6 +410,22 @@ echo_resolv()
 	IFS="$OIFS"
 }
 
+deprecated_interface()
+{
+	[ -d "$DEPRECATEDDIR" ] || return 1
+
+	cd "$DEPRECATEDDIR"
+	for da; do
+		for daf in *; do
+			[ -f "$daf" ] || continue
+			case "$da" in
+			$daf) return 0;;
+			esac
+		done
+	done
+	return 1
+}
+
 list_resolv()
 {
 	[ -d "$IFACEDIR" ] || return 0
@@ -453,12 +467,14 @@ list_resolv()
 		$force || report=true
 	elif ! $excl; then
 		cd "$IFACEDIR"
+
 		for i in $interface_order; do
 			[ -f "$i" ] && list="$list $i"
 			for 

CVS import: src/external/bsd/openresolv/dist

2020-12-27 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Dec 27 18:25:08 UTC 2020

Update of /cvsroot/src/external/bsd/openresolv/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv14098

Log Message:
Update to openresolv-3.12.0 with the following changes:

 * Allow configurations to be marked as Deprecated and Acivtated
 * Harden resolvconf lock detection

Status:

Vendor Tag: ROY
Release Tags:   openresolv-3_12_0

U src/external/bsd/openresolv/dist/LICENSE
U src/external/bsd/openresolv/dist/README.md
C src/external/bsd/openresolv/dist/resolvconf.in
C src/external/bsd/openresolv/dist/resolvconf.8.in
C src/external/bsd/openresolv/dist/resolvconf.conf.5.in
U src/external/bsd/openresolv/dist/libc.in
U src/external/bsd/openresolv/dist/dnsmasq.in
U src/external/bsd/openresolv/dist/named.in
U src/external/bsd/openresolv/dist/pdnsd.in
U src/external/bsd/openresolv/dist/pdns_recursor.in
U src/external/bsd/openresolv/dist/unbound.in
U src/external/bsd/openresolv/dist/avahi-daemon.in
U src/external/bsd/openresolv/dist/mdnsd.in
U src/external/bsd/openresolv/dist/resolvconf.conf

3 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jROY:yesterday -jROY src/external/bsd/openresolv/dist



CVS commit: src/usr.bin/make

2020-12-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 27 18:22:28 UTC 2020

Modified Files:
src/usr.bin/make: parse.c

Log Message:
make(1): skip variable expansion in ParseDependencyTargetWord

The goal of the code is just to skip over the variable expression, thus
there is no need to evaluate it.


To generate a diff of this commit:
cvs rdiff -u -r1.518 -r1.519 src/usr.bin/make/parse.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.518 src/usr.bin/make/parse.c:1.519
--- src/usr.bin/make/parse.c:1.518	Sun Dec 27 11:47:04 2020
+++ src/usr.bin/make/parse.c	Sun Dec 27 18:22:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.518 2020/12/27 11:47:04 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.519 2020/12/27 18:22:28 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.518 2020/12/27 11:47:04 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.519 2020/12/27 18:22:28 rillig Exp $");
 
 /* types and constants */
 
@@ -1084,9 +1084,8 @@ ParseDependencyTargetWord(const char **p
 			const char *nested_p = cp;
 			FStr nested_val;
 
-			/* XXX: Why VARE_WANTRES? */
-			(void)Var_Parse(_p, VAR_CMDLINE,
-			VARE_WANTRES | VARE_UNDEFERR, _val);
+			(void)Var_Parse(_p, VAR_CMDLINE, VARE_NONE,
+			_val);
 			/* TODO: handle errors */
 			FStr_Done(_val);
 			cp += nested_p - cp;



CVS commit: src/usr.bin/make/unit-tests

2020-12-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 27 18:20:26 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: deptgt.exp deptgt.mk

Log Message:
make(1): add test for ParseDependencyTargetWord


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/deptgt.exp
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/deptgt.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/deptgt.exp
diff -u src/usr.bin/make/unit-tests/deptgt.exp:1.5 src/usr.bin/make/unit-tests/deptgt.exp:1.6
--- src/usr.bin/make/unit-tests/deptgt.exp:1.5	Sun Nov 15 11:57:00 2020
+++ src/usr.bin/make/unit-tests/deptgt.exp	Sun Dec 27 18:20:26 2020
@@ -8,6 +8,7 @@ ParseDoDependency(: empty-source)
 ParseReadLine (37): '	: command for empty targets list'
 ParseReadLine (38): '.MAKEFLAGS: -d0'
 ParseDoDependency(.MAKEFLAGS: -d0)
+make: "deptgt.mk" line 46: Unknown modifier 'Z'
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/deptgt.mk
diff -u src/usr.bin/make/unit-tests/deptgt.mk:1.9 src/usr.bin/make/unit-tests/deptgt.mk:1.10
--- src/usr.bin/make/unit-tests/deptgt.mk:1.9	Sun Nov 15 11:57:00 2020
+++ src/usr.bin/make/unit-tests/deptgt.mk	Sun Dec 27 18:20:26 2020
@@ -1,4 +1,4 @@
-# $NetBSD: deptgt.mk,v 1.9 2020/11/15 11:57:00 rillig Exp $
+# $NetBSD: deptgt.mk,v 1.10 2020/12/27 18:20:26 rillig Exp $
 #
 # Tests for special targets like .BEGIN or .SUFFIXES in dependency
 # declarations.
@@ -37,5 +37,13 @@ ${:U}: empty-source
 	: command for empty targets list
 .MAKEFLAGS: -d0
 
+# Just to show that a malformed expression is only expanded once in
+# ParseDependencyTargetWord.  The only way to produce an expression that
+# is well-formed on the first expansion and ill-formed on the second
+# expansion would be to use the variable modifier '::=' to modify the
+# targets.  This in turn would be such an extreme and unreliable edge case
+# that nobody uses it.
+{:U:Z}:
+
 all:
 	@:;



CVS commit: src/usr.bin/make/unit-tests

2020-12-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 27 17:32:25 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: varmod-indirect.exp varmod-indirect.mk

Log Message:
make(1): split test for indirect modifiers into paragraphs


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-indirect.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varmod-indirect.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/varmod-indirect.exp
diff -u src/usr.bin/make/unit-tests/varmod-indirect.exp:1.5 src/usr.bin/make/unit-tests/varmod-indirect.exp:1.6
--- src/usr.bin/make/unit-tests/varmod-indirect.exp:1.5	Sun Dec 27 17:17:46 2020
+++ src/usr.bin/make/unit-tests/varmod-indirect.exp	Sun Dec 27 17:32:25 2020
@@ -8,11 +8,11 @@ make: "varmod-indirect.mk" line 120: aft
 make: "varmod-indirect.mk" line 124: Unknown modifier 'Z'
 make: "varmod-indirect.mk" line 125: before
 make: "varmod-indirect.mk" line 125: after
-ParseReadLine (133): '_:=	before ${UNDEF} after'
+ParseReadLine (134): '_:=	before ${UNDEF} after'
 Global:_ = 
 Var_Parse: ${UNDEF} after with VARE_WANTRES|VARE_KEEP_DOLLAR
 Global:_ = before ${UNDEF} after
-ParseReadLine (135): '_:=	before ${UNDEF:${:US,a,a,}} after'
+ParseReadLine (137): '_:=	before ${UNDEF:${:US,a,a,}} after'
 Var_Parse: ${UNDEF:${:US,a,a,}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
 Var_Parse: ${:US,a,a,}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
 Applying ${:U...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
@@ -27,7 +27,7 @@ Var_Parse: ${:US,a,a,}} after with VARE_
 Applying ${:U...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
 Result of ${:US,a,a,} is "S,a,a," (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF|VEF_DEF)
 Global:_ = before ${UNDEF:S,a,a,} after
-ParseReadLine (143): '_:=	before ${UNDEF:${:U}} after'
+ParseReadLine (147): '_:=	before ${UNDEF:${:U}} after'
 Var_Parse: ${UNDEF:${:U}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
 Var_Parse: ${:U}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
 Applying ${:U} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
@@ -37,20 +37,20 @@ Var_Parse: ${:U}} after with VARE_WANTRE
 Applying ${:U} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
 Result of ${:U} is "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF|VEF_DEF)
 Global:_ = before ${UNDEF:} after
-ParseReadLine (147): '_:=	before ${UNDEF:${:UZ}} after'
+ParseReadLine (152): '_:=	before ${UNDEF:${:UZ}} after'
 Var_Parse: ${UNDEF:${:UZ}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
 Var_Parse: ${:UZ}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
 Applying ${:U...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
 Result of ${:UZ} is "Z" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF|VEF_DEF)
 Indirect modifier "Z" from "${:UZ}"
 Applying ${UNDEF:Z} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
-make: "varmod-indirect.mk" line 147: Unknown modifier 'Z'
+make: "varmod-indirect.mk" line 152: Unknown modifier 'Z'
 Result of ${UNDEF:Z} is error (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
 Var_Parse: ${:UZ}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
 Applying ${:U...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
 Result of ${:UZ} is "Z" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF|VEF_DEF)
 Global:_ = before ${UNDEF:Z} after
-ParseReadLine (148): '.MAKEFLAGS: -d0'
+ParseReadLine (154): '.MAKEFLAGS: -d0'
 ParseDoDependency(.MAKEFLAGS: -d0)
 Global:.MAKEFLAGS =  -r -k -d 0 -d pv -d
 Global:.MAKEFLAGS =  -r -k -d 0 -d pv -d 0

Index: src/usr.bin/make/unit-tests/varmod-indirect.mk
diff -u src/usr.bin/make/unit-tests/varmod-indirect.mk:1.4 src/usr.bin/make/unit-tests/varmod-indirect.mk:1.5
--- src/usr.bin/make/unit-tests/varmod-indirect.mk:1.4	Sun Dec 27 17:17:46 2020
+++ src/usr.bin/make/unit-tests/varmod-indirect.mk	Sun Dec 27 17:32:25 2020
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-indirect.mk,v 1.4 2020/12/27 17:17:46 rillig Exp $
+# $NetBSD: varmod-indirect.mk,v 1.5 2020/12/27 17:32:25 rillig Exp $
 #
 # Tests for indirect variable modifiers, such as in ${VAR:${M_modifiers}}.
 # These can be used for very basic purposes like converting a string to either
@@ -129,22 +129,28 @@ M_NoPrimes=	${PRIMES:${M_ListToSkip}}
 # Another slightly different evaluation context is the right-hand side of
 # a variable assignment using ':='.
 .MAKEFLAGS: -dpv
+
 # The undefined variable expression is kept as-is.
 _:=	before ${UNDEF} after
+
 # The undefined variable expression is kept as-is.
 _:=	before ${UNDEF:${:US,a,a,}} after
+
 # XXX: The subexpression ${:U} is fully defined, therefore it is expanded.
 # This results in ${UNDEF:}, which can lead to tricky parse errors later,
 # when the variable '_' is expanded further.
+#
 # XXX: What should be the correct strategy here?  One possibility is to
-# expand the defined subexpression and replace them with ${:U...}, just like
+# expand 

CVS commit: src/usr.bin/make/unit-tests

2020-12-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 27 17:17:47 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: varmod-indirect.exp varmod-indirect.mk

Log Message:
make(1): add tests for parsing indirect modifiers in nested expressions


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varmod-indirect.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-indirect.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/varmod-indirect.exp
diff -u src/usr.bin/make/unit-tests/varmod-indirect.exp:1.4 src/usr.bin/make/unit-tests/varmod-indirect.exp:1.5
--- src/usr.bin/make/unit-tests/varmod-indirect.exp:1.4	Sun Dec 27 16:31:58 2020
+++ src/usr.bin/make/unit-tests/varmod-indirect.exp	Sun Dec 27 17:17:46 2020
@@ -1,8 +1,59 @@
 make: "varmod-indirect.mk" line 13: Unknown modifier '$'
-make: "varmod-indirect.mk" line 106: before
-make: "varmod-indirect.mk" line 106: after
-make: "varmod-indirect.mk" line 112: before
-make: "varmod-indirect.mk" line 112: after
+make: "varmod-indirect.mk" line 108: before
+make: "varmod-indirect.mk" line 108: after
+make: "varmod-indirect.mk" line 114: before
+make: "varmod-indirect.mk" line 114: after
+make: "varmod-indirect.mk" line 120: before
+make: "varmod-indirect.mk" line 120: after
+make: "varmod-indirect.mk" line 124: Unknown modifier 'Z'
+make: "varmod-indirect.mk" line 125: before
+make: "varmod-indirect.mk" line 125: after
+ParseReadLine (133): '_:=	before ${UNDEF} after'
+Global:_ = 
+Var_Parse: ${UNDEF} after with VARE_WANTRES|VARE_KEEP_DOLLAR
+Global:_ = before ${UNDEF} after
+ParseReadLine (135): '_:=	before ${UNDEF:${:US,a,a,}} after'
+Var_Parse: ${UNDEF:${:US,a,a,}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
+Var_Parse: ${:US,a,a,}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
+Applying ${:U...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
+Result of ${:US,a,a,} is "S,a,a," (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF|VEF_DEF)
+Indirect modifier "S,a,a," from "${:US,a,a,}"
+Applying ${UNDEF:S...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
+Modifier part: "a"
+Modifier part: "a"
+ModifyWords: split "" into 1 words
+Result of ${UNDEF:S,a,a,} is "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
+Var_Parse: ${:US,a,a,}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
+Applying ${:U...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
+Result of ${:US,a,a,} is "S,a,a," (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF|VEF_DEF)
+Global:_ = before ${UNDEF:S,a,a,} after
+ParseReadLine (143): '_:=	before ${UNDEF:${:U}} after'
+Var_Parse: ${UNDEF:${:U}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
+Var_Parse: ${:U}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
+Applying ${:U} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
+Result of ${:U} is "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF|VEF_DEF)
+Indirect modifier "" from "${:U}"
+Var_Parse: ${:U}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
+Applying ${:U} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
+Result of ${:U} is "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF|VEF_DEF)
+Global:_ = before ${UNDEF:} after
+ParseReadLine (147): '_:=	before ${UNDEF:${:UZ}} after'
+Var_Parse: ${UNDEF:${:UZ}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
+Var_Parse: ${:UZ}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
+Applying ${:U...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
+Result of ${:UZ} is "Z" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF|VEF_DEF)
+Indirect modifier "Z" from "${:UZ}"
+Applying ${UNDEF:Z} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
+make: "varmod-indirect.mk" line 147: Unknown modifier 'Z'
+Result of ${UNDEF:Z} is error (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
+Var_Parse: ${:UZ}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
+Applying ${:U...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
+Result of ${:UZ} is "Z" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF|VEF_DEF)
+Global:_ = before ${UNDEF:Z} after
+ParseReadLine (148): '.MAKEFLAGS: -d0'
+ParseDoDependency(.MAKEFLAGS: -d0)
+Global:.MAKEFLAGS =  -r -k -d 0 -d pv -d
+Global:.MAKEFLAGS =  -r -k -d 0 -d pv -d 0
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/varmod-indirect.mk
diff -u src/usr.bin/make/unit-tests/varmod-indirect.mk:1.3 src/usr.bin/make/unit-tests/varmod-indirect.mk:1.4
--- src/usr.bin/make/unit-tests/varmod-indirect.mk:1.3	Sun Dec 27 16:31:58 2020
+++ src/usr.bin/make/unit-tests/varmod-indirect.mk	Sun Dec 27 17:17:46 2020
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-indirect.mk,v 1.3 2020/12/27 16:31:58 rillig Exp $
+# $NetBSD: varmod-indirect.mk,v 1.4 2020/12/27 17:17:46 rillig Exp $
 #
 # Tests for indirect variable modifiers, such as in ${VAR:${M_modifiers}}.
 # These can be used for very basic purposes like converting a 

CVS commit: src/sys/dev/ic

2020-12-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Dec 27 16:52:01 UTC 2020

Modified Files:
src/sys/dev/ic: nvme.c

Log Message:
Zero DMA memory after load, and add PREREAD sync op after to ensure it is 
visible


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/ic/nvme.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.53 src/sys/dev/ic/nvme.c:1.54
--- src/sys/dev/ic/nvme.c:1.53	Fri Dec  4 23:03:11 2020
+++ src/sys/dev/ic/nvme.c	Sun Dec 27 16:52:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.53 2020/12/04 23:03:11 kardel Exp $	*/
+/*	$NetBSD: nvme.c,v 1.54 2020/12/27 16:52:01 jmcneill Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.53 2020/12/04 23:03:11 kardel Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.54 2020/12/27 16:52:01 jmcneill Exp $");
 
 #include 
 #include 
@@ -1925,12 +1925,14 @@ nvme_dmamem_alloc(struct nvme_softc *sc,
 	if (bus_dmamem_map(sc->sc_dmat, >ndm_seg, nsegs, size,
 	>ndm_kva, BUS_DMA_WAITOK) != 0)
 		goto free;
-	memset(ndm->ndm_kva, 0, size);
 
 	if (bus_dmamap_load(sc->sc_dmat, ndm->ndm_map, ndm->ndm_kva, size,
 	NULL, BUS_DMA_WAITOK) != 0)
 		goto unmap;
 
+	memset(ndm->ndm_kva, 0, size);
+	bus_dmamap_sync(sc->sc_dmat, ndm->ndm_map, 0, size, BUS_DMASYNC_PREREAD);
+
 	return ndm;
 
 unmap:



CVS commit: src/usr.bin/make

2020-12-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 27 16:31:58 UTC 2020

Modified Files:
src/usr.bin/make: var.c
src/usr.bin/make/unit-tests: varmod-indirect.exp varmod-indirect.mk

Log Message:
make(1): remove dead code from ApplyModifiersIndirect

At that point, the expression can never be varUndefined.  At the
beginning of ParseVarnameLong, the expression is initialized to a simple
empty string, and that string is only ever converted to varUndefined at
the very end of Var_Parse.


To generate a diff of this commit:
cvs rdiff -u -r1.772 -r1.773 src/usr.bin/make/var.c
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-indirect.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-indirect.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.772 src/usr.bin/make/var.c:1.773
--- src/usr.bin/make/var.c:1.772	Sun Dec 27 14:41:25 2020
+++ src/usr.bin/make/var.c	Sun Dec 27 16:31:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.772 2020/12/27 14:41:25 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.773 2020/12/27 16:31:58 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.772 2020/12/27 14:41:25 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.773 2020/12/27 16:31:58 rillig Exp $");
 
 typedef enum VarFlags {
 	VAR_NONE	= 0,
@@ -3473,8 +3473,7 @@ ApplyModifiersIndirect(ApplyModifiersSta
 		FStr newVal = ApplyModifiers(, *inout_value, '\0', '\0',
 		st->var, >exprFlags, st->ctxt, st->eflags);
 		*inout_value = newVal;
-		if (newVal.str == var_Error || newVal.str == varUndefined ||
-		*modsp != '\0') {
+		if (newVal.str == var_Error || *modsp != '\0') {
 			FStr_Done();
 			*pp = p;
 			return AMIR_OUT;	/* error already reported */

Index: src/usr.bin/make/unit-tests/varmod-indirect.exp
diff -u src/usr.bin/make/unit-tests/varmod-indirect.exp:1.3 src/usr.bin/make/unit-tests/varmod-indirect.exp:1.4
--- src/usr.bin/make/unit-tests/varmod-indirect.exp:1.3	Sun Dec 20 19:47:34 2020
+++ src/usr.bin/make/unit-tests/varmod-indirect.exp	Sun Dec 27 16:31:58 2020
@@ -1,4 +1,8 @@
 make: "varmod-indirect.mk" line 13: Unknown modifier '$'
+make: "varmod-indirect.mk" line 106: before
+make: "varmod-indirect.mk" line 106: after
+make: "varmod-indirect.mk" line 112: before
+make: "varmod-indirect.mk" line 112: after
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/varmod-indirect.mk
diff -u src/usr.bin/make/unit-tests/varmod-indirect.mk:1.2 src/usr.bin/make/unit-tests/varmod-indirect.mk:1.3
--- src/usr.bin/make/unit-tests/varmod-indirect.mk:1.2	Sun Dec 20 19:29:06 2020
+++ src/usr.bin/make/unit-tests/varmod-indirect.mk	Sun Dec 27 16:31:58 2020
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-indirect.mk,v 1.2 2020/12/20 19:29:06 rillig Exp $
+# $NetBSD: varmod-indirect.mk,v 1.3 2020/12/27 16:31:58 rillig Exp $
 #
 # Tests for indirect variable modifiers, such as in ${VAR:${M_modifiers}}.
 # These can be used for very basic purposes like converting a string to either
@@ -99,4 +99,17 @@ M_NoPrimes=	${PRIMES:${M_ListToSkip}}
 .endif
 .MAKEFLAGS: -d0
 
+
+# In contrast to the .if conditions, the .for loop allows undefined variable
+# expressions.  These expressions expand to empty strings.
+.for var in before ${UNDEF} ${UNDEF:${:US,a,a,}} after
+.  info ${var}
+.endfor
+
+# Even in an indirect modifier based on an undefined variable, the value of
+# the expression in Var_Parse is a simple empty string.
+.for var in before ${UNDEF} ${UNDEF:${:U}} after
+.  info ${var}
+.endfor
+
 all:



CVS commit: src/sys/dev/wscons

2020-12-27 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Dec 27 16:09:33 UTC 2020

Modified Files:
src/sys/dev/wscons: wsbell.c wsdisplay.c wskbd.c wsmouse.c

Log Message:
Explicitly include generated ioconf.h for struct cfdrivers.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/wscons/wsbell.c
cvs rdiff -u -r1.161 -r1.162 src/sys/dev/wscons/wsdisplay.c
cvs rdiff -u -r1.143 -r1.144 src/sys/dev/wscons/wskbd.c
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/wscons/wsmouse.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/wscons/wsbell.c
diff -u src/sys/dev/wscons/wsbell.c:1.12 src/sys/dev/wscons/wsbell.c:1.13
--- src/sys/dev/wscons/wsbell.c:1.12	Sat Jun 22 08:03:01 2019
+++ src/sys/dev/wscons/wsbell.c	Sun Dec 27 16:09:33 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: wsbell.c,v 1.12 2019/06/22 08:03:01 isaki Exp $ */
+/* $NetBSD: wsbell.c,v 1.13 2020/12/27 16:09:33 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2017 Nathanial Sloss 
@@ -107,7 +107,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.12 2019/06/22 08:03:01 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.13 2020/12/27 16:09:33 tsutsui Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "wsmux.h"
@@ -174,8 +174,6 @@ static int  wsbell_do_ioctl(struct wsbel
 CFATTACH_DECL_NEW(wsbell, sizeof (struct wsbell_softc),
 wsbell_match, wsbell_attach, wsbell_detach, wsbell_activate);
 
-extern struct cfdriver wsbell_cd;
-
 extern dev_type_open(spkropen);
 extern dev_type_close(spkrclose);
 extern dev_type_ioctl(spkrioctl);

Index: src/sys/dev/wscons/wsdisplay.c
diff -u src/sys/dev/wscons/wsdisplay.c:1.161 src/sys/dev/wscons/wsdisplay.c:1.162
--- src/sys/dev/wscons/wsdisplay.c:1.161	Fri Dec 25 21:12:15 2020
+++ src/sys/dev/wscons/wsdisplay.c	Sun Dec 27 16:09:33 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay.c,v 1.161 2020/12/25 21:12:15 tsutsui Exp $ */
+/* $NetBSD: wsdisplay.c,v 1.162 2020/12/27 16:09:33 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.161 2020/12/25 21:12:15 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.162 2020/12/27 16:09:33 tsutsui Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_wsdisplay_compat.h"
@@ -71,6 +71,7 @@ __KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,
 #include 
 
 #include "locators.h"
+#include "ioconf.h"
 
 #ifdef WSDISPLAY_MULTICONS
 static bool wsdisplay_multicons_enable = true;
@@ -177,8 +178,6 @@ struct wsdisplay_scroll_data wsdisplay_d
 };
 #endif
 
-extern struct cfdriver wsdisplay_cd;
-
 /* Autoconfiguration definitions. */
 static int wsdisplay_emul_match(device_t , cfdata_t, void *);
 static void wsdisplay_emul_attach(device_t, device_t, void *);

Index: src/sys/dev/wscons/wskbd.c
diff -u src/sys/dev/wscons/wskbd.c:1.143 src/sys/dev/wscons/wskbd.c:1.144
--- src/sys/dev/wscons/wskbd.c:1.143	Tue Feb  5 10:04:49 2019
+++ src/sys/dev/wscons/wskbd.c	Sun Dec 27 16:09:33 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: wskbd.c,v 1.143 2019/02/05 10:04:49 mrg Exp $ */
+/* $NetBSD: wskbd.c,v 1.144 2020/12/27 16:09:33 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -105,7 +105,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.143 2019/02/05 10:04:49 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.144 2020/12/27 16:09:33 tsutsui Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -143,11 +143,14 @@ __KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.
 #include 
 #include 
 #include 
+#include 
 
 #ifdef KGDB
 #include 
 #endif
 
+#include "ioconf.h"
+
 #ifdef WSKBD_DEBUG
 #define DPRINTF(x)	if (wskbddebug) printf x
 int	wskbddebug = 0;
@@ -155,8 +158,6 @@ int	wskbddebug = 0;
 #define DPRINTF(x)
 #endif
 
-#include 
-
 struct wskbd_internal {
 	const struct wskbd_mapdata *t_keymap;
 
@@ -290,8 +291,6 @@ static int wskbd_do_ioctl(device_t, u_lo
 CFATTACH_DECL_NEW(wskbd, sizeof (struct wskbd_softc),
 wskbd_match, wskbd_attach, wskbd_detach, wskbd_activate);
 
-extern struct cfdriver wskbd_cd;
-
 dev_type_open(wskbdopen);
 dev_type_close(wskbdclose);
 dev_type_read(wskbdread);

Index: src/sys/dev/wscons/wsmouse.c
diff -u src/sys/dev/wscons/wsmouse.c:1.68 src/sys/dev/wscons/wsmouse.c:1.69
--- src/sys/dev/wscons/wsmouse.c:1.68	Fri Nov  3 19:49:23 2017
+++ src/sys/dev/wscons/wsmouse.c	Sun Dec 27 16:09:33 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: wsmouse.c,v 1.68 2017/11/03 19:49:23 maya Exp $ */
+/* $NetBSD: wsmouse.c,v 1.69 2020/12/27 16:09:33 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -104,7 +104,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v 1.68 2017/11/03 19:49:23 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v 1.69 2020/12/27 16:09:33 tsutsui Exp $");
 
 #include "wsmouse.h"
 #include "wsdisplay.h"
@@ -130,6 +130,8 @@ __KERNEL_RCSID(0, "$NetBSD: 

CVS commit: src/sys/dev/ata

2020-12-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Dec 27 15:15:45 UTC 2020

Modified Files:
src/sys/dev/ata: satareg.h

Log Message:
Add G3 and DevSleep definitions. This changes the mask used by
SControl_IPM_NONE from 0x3 to 0x7.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ata/satareg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ata/satareg.h
diff -u src/sys/dev/ata/satareg.h:1.5 src/sys/dev/ata/satareg.h:1.6
--- src/sys/dev/ata/satareg.h:1.5	Mon Apr 28 20:23:47 2008
+++ src/sys/dev/ata/satareg.h	Sun Dec 27 15:15:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: satareg.h,v 1.5 2008/04/28 20:23:47 martin Exp $	*/
+/*	$NetBSD: satareg.h,v 1.6 2020/12/27 15:15:45 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -65,6 +65,7 @@
 #define	SStatus_SPD_NONE	(0x0 << 4)	/* no negotiated speed */
 #define	SStatus_SPD_G1		(0x1 << 4)	/* Generation 1 (1.5Gb/s) */
 #define	SStatus_SPD_G2		(0x2 << 4)	/* Generation 2 (3.0Gb/s) */
+#define	SStatus_SPD_G3		(0x3 << 4)	/* Generation 3 (6.0Gb/s) */
 #define	SStatus_SPD_mask	(0xf << 4)
 #define	SStatus_SPD_shift	4
 	/*
@@ -75,6 +76,7 @@
 #define	SStatus_IPM_ACTIVE	(0x1 << 8)	/* ACTIVE state */
 #define	SStatus_IPM_PARTIAL	(0x2 << 8)	/* PARTIAL pm state */
 #define	SStatus_IPM_SLUMBER	(0x6 << 8)	/* SLUMBER pm state */
+#define	SStatus_IPM_DEVSLEEP	(0x8 << 8)	/* DevSleep pm state */
 #define	SStatus_IPM_mask	(0xf << 8)
 #define	SStatus_IPM_shift	8
 
@@ -130,6 +132,7 @@
 #define	SControl_SPD_ANY	(0x0 << 4)	/* No restrictions */
 #define	SControl_SPD_G1		(0x1 << 4)	/* Generation 1 (1.5Gb/s) */
 #define	SControl_SPD_G2		(0x2 << 4)	/* Generation 2 (3.0Gb/s) */
+#define	SControl_SPD_G3		(0x3 << 4)	/* Generation 3 (6.0Gb/s) */
 	/*
 	 * The IPM field represents the enabled interface power management
 	 * states that can be invoked via the Serial ATA interface power
@@ -138,7 +141,8 @@
 #define	SControl_IPM_ANY	(0x0 << 8)	/* No restrictions */
 #define	SControl_IPM_NOPARTIAL	(0x1 << 8)	/* PARTIAL disabled */
 #define	SControl_IPM_NOSLUMBER	(0x2 << 8)	/* SLUMBER disabled */
-#define	SControl_IPM_NONE	(0x3 << 8)	/* No power management */
+#define	SControl_IPM_NODEVSLEEP	(0x4 << 8)	/* DevSleep disabled */
+#define	SControl_IPM_NONE	(0x7 << 8)	/* No power management */
 	/*
 	 * The SPM field selects a power management state.  A non-zero
 	 * value written to this field causes initiation of the selected



CVS commit: src/sys/dev/ic

2020-12-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Dec 27 15:13:07 UTC 2020

Modified Files:
src/sys/dev/ic: ahcisata_core.c

Log Message:
AHCI 1.3.1 section 5.5.3 "Processing Completed Commands" says that we
should clear PxIS before IS.IPS.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/dev/ic/ahcisata_core.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.89 src/sys/dev/ic/ahcisata_core.c:1.90
--- src/sys/dev/ic/ahcisata_core.c:1.89	Sat Dec 26 15:40:29 2020
+++ src/sys/dev/ic/ahcisata_core.c	Sun Dec 27 15:13:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.89 2020/12/26 15:40:29 jmcneill Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.90 2020/12/27 15:13:07 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.89 2020/12/26 15:40:29 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.90 2020/12/27 15:13:07 jmcneill Exp $");
 
 #include 
 #include 
@@ -599,13 +599,13 @@ ahci_intr(void *v)
 		AHCIDEBUG_PRINT(("%s ahci_intr 0x%x\n", AHCINAME(sc), is),
 		DEBUG_INTR);
 		r = 1;
-		AHCI_WRITE(sc, AHCI_IS, is);
 		ports = is;
 		while ((bit = ffs(ports)) != 0) {
 			bit--;
 			ahci_intr_port(>sc_channels[bit]);
 			ports &= ~(1U << bit);
 		}
+		AHCI_WRITE(sc, AHCI_IS, is);
 	}
 
 	return r;



CVS commit: src/usr.bin/make

2020-12-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 27 14:41:25 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): remove outdated comment about string comparisons

Back in 1993, the variables in a context were stored in a linked list.
Searching such a list indeed required literally thousands of calls to
strcmp.  In make.h 1.22 from 1999-09-15, the linked list was replaced
with a hash table, requiring much fewer string comparisons.  Since then,
the rationale doesn't apply anymore.


To generate a diff of this commit:
cvs rdiff -u -r1.771 -r1.772 src/usr.bin/make/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.771 src/usr.bin/make/var.c:1.772
--- src/usr.bin/make/var.c:1.771	Sun Dec 27 14:02:12 2020
+++ src/usr.bin/make/var.c	Sun Dec 27 14:41:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.771 2020/12/27 14:02:12 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.772 2020/12/27 14:41:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.771 2020/12/27 14:02:12 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.772 2020/12/27 14:41:25 rillig Exp $");
 
 typedef enum VarFlags {
 	VAR_NONE	= 0,
@@ -988,16 +988,6 @@ Var_SetWithFlags(const char *name, const
  *	name		name of the variable to set, is expanded once
  *	val		value to give to the variable
  *	ctxt		context in which to set it
- *
- * Notes:
- *	The variable is searched for only in its context before being
- *	created in that context. I.e. if the context is VAR_GLOBAL,
- *	only VAR_GLOBAL->context is searched. Likewise if it is VAR_CMDLINE,
- *	only VAR_CMDLINE->context is searched. This is done to avoid the
- *	literally thousands of unnecessary strcmp's that used to be done to
- *	set, say, $(@) or $(<).
- *	If the context is VAR_GLOBAL though, we check if the variable
- *	was set in VAR_CMDLINE from the command line and skip it if so.
  */
 void
 Var_Set(const char *name, const char *val, GNode *ctxt)



CVS commit: [netbsd-8] src/doc

2020-12-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 27 14:10:28 UTC 2020

Modified Files:
src/doc [netbsd-8]: CHANGES-8.3

Log Message:
Ticket #1641


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.61 -r1.1.2.62 src/doc/CHANGES-8.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-8.3
diff -u src/doc/CHANGES-8.3:1.1.2.61 src/doc/CHANGES-8.3:1.1.2.62
--- src/doc/CHANGES-8.3:1.1.2.61	Sat Dec 19 19:06:12 2020
+++ src/doc/CHANGES-8.3	Sun Dec 27 14:10:28 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.3,v 1.1.2.61 2020/12/19 19:06:12 martin Exp $
+# $NetBSD: CHANGES-8.3,v 1.1.2.62 2020/12/27 14:10:28 martin Exp $
 
 A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3
 release:
@@ -1496,3 +1496,8 @@ sys/dev/scsipi/scsiconf.c			1.283
 	Add NOLUNS quirk for more SEAGATE SCA/WIDE drives.
 	[tsutsui, ticket #1640]
 
+usr.bin/calendar/calendars/calendar.judaic	1.8-1.10
+
+	Update to 2021.
+	[maya, ticket #1641]
+



CVS commit: [netbsd-8] src/usr.bin/calendar/calendars

2020-12-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 27 14:09:22 UTC 2020

Modified Files:
src/usr.bin/calendar/calendars [netbsd-8]: calendar.judaic

Log Message:
Pull up following revision(s) (requested by maya in ticket #1160):

usr.bin/calendar/calendars/calendar.judaic: revision 1.8-1.10

Update to 2021, hopefully less errors made in this year.


To generate a diff of this commit:
cvs rdiff -u -r1.6.6.1 -r1.6.6.2 \
src/usr.bin/calendar/calendars/calendar.judaic

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/calendar/calendars/calendar.judaic
diff -u src/usr.bin/calendar/calendars/calendar.judaic:1.6.6.1 src/usr.bin/calendar/calendars/calendar.judaic:1.6.6.2
--- src/usr.bin/calendar/calendars/calendar.judaic:1.6.6.1	Fri Jul 13 14:35:55 2018
+++ src/usr.bin/calendar/calendars/calendar.judaic	Sun Dec 27 14:09:22 2020
@@ -1,27 +1,29 @@
-01/21*  Tu B'Shvat (Feast of Trees)
-03/19*	Fast of Esther (Battle of Purim; 1 day before Purim; fast day)
-03/20*	Purim (Feast of Lots; 30 days before Pesach)
-04/19*	Pesach (First Day of Passover; sabbatical)
-04/20*	Pesach (sabbatical)
-04/21*	Pesach (sabbatical)
-04/26*	Pesach (Last Day of Passover; 8th day of Pesach; sabbatical)
-05/09*	Yom HaAtzma'ut (Israel Independence Day)
-05/23*	Lag B'Omer (Commemoration of the Great Rebellion)
-06/01*	Yom Yerushalayim (Reunification of Jerusalem)
-06/08*	Shavuot (Festival of Weeks; 50 days after Pesach; sabbatical)
-07/20*	Fast of Shiv'a Asar B'Tammuz (Tzom Tammuz) (Romans breach Wall of Jerusalem;
+01/28*  Tu B'Shvat (Feast of Trees)
+02/25*	Fast of Esther (Battle of Purim; 1 day before Purim; fast day)
+02/26*	Purim (Feast of Lots; 30 days before Pesach)
+03/29*	Pesach (First Day of Passover; sabbatical)
+03/30*	Pesach (sabbatical)
+03/31*	Pesach (sabbatical)
+04/04*	Pesach (Last Day of Passover; 8th day of Pesach; sabbatical)
+04/05*	Mimouna (Morrocan Jewish Celebration of End of Pesach)
+04/15*	Yom HaAtzma'ut (Israel Independence Day)
+04/30*	Lag B'Omer (Commemoration of the Great Rebellion)
+05/10*	Yom Yerushalayim (Reunification of Jerusalem)
+05/17*	Shavuot (Festival of Weeks; 50 days after Pesach; sabbatical)
+06/27*	Fast of Shiv'a Asar B'Tammuz (Tzom Tammuz) (Romans breach Wall of Jerusalem;
 	fast day)
-07/21*	Fast of Tish'a B'Av (Babylon/Rome destroys Holy Temple; fast day)
-09/09*	First Day of Rosh Hashanah (Jewish Lunar New Year; 5778 == 2017;
+07/18*	Fast of Tish'a B'Av (Babylon/Rome destroys Holy Temple; fast day)
+09/07*	First Day of Rosh Hashanah (Jewish Lunar New Year; 5782 == 2022;
 	sabbatical)
-09/09*	Rosh Hashanah (sabbatical)
-09/10*	Fast of Gedalya (Murder of Gedalya and subsequent Exile; 1 day
+09/08*	Rosh Hashanah (sabbatical)
+09/09*	Fast of Gedalya (Murder of Gedalya and subsequent Exile; 1 day
 	after Rosh Hashanah; fast day)
-09/18*	Yom Kippur (Day of Atonement; 9 days after Rosh Hashanah;
+09/16*	Yom Kippur (Day of Atonement; 9 days after Rosh Hashanah;
 	sabbatical, fast day)
-09/23*	Succos (Festival of Tabernacles; 14 days after Rosh Hashanah;
+09/21*	Sukkot (Festival of Tabernacles; 14 days after Rosh Hashanah;
 	sabbatical)
-09/30*	Hoshanah Rabba (7th day of Succos)
-10/01*	Shmini Atzeres (8th Day of Gathering; 1 day after Succos; sabbatical)
-12/02*	First Day of Chanukah
-12/18*	Fast of Asara B'Tevet (Babylonians put siege on Jerusalem; fast day)
+09/27*	Hoshanah Rabba (7th day of Sukkot)
+09/28*	Shmini Atzeret (8th Day of Gathering; 1 day after Sukkot; sabbatical)
+11/04*	Sigd (Beta Israel; 50 days after Yom Kippur)
+11/28*	First Day of Chanukah
+12/14*	Fast of Asara B'Tevet (Babylonians put siege on Jerusalem; fast day)



CVS commit: [netbsd-9] src/doc

2020-12-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 27 14:07:13 UTC 2020

Modified Files:
src/doc [netbsd-9]: CHANGES-9.2

Log Message:
Ticket #1160


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.26 -r1.1.2.27 src/doc/CHANGES-9.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-9.2
diff -u src/doc/CHANGES-9.2:1.1.2.26 src/doc/CHANGES-9.2:1.1.2.27
--- src/doc/CHANGES-9.2:1.1.2.26	Wed Dec 23 12:37:03 2020
+++ src/doc/CHANGES-9.2	Sun Dec 27 14:07:13 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.2,v 1.1.2.26 2020/12/23 12:37:03 martin Exp $
+# $NetBSD: CHANGES-9.2,v 1.1.2.27 2020/12/27 14:07:13 martin Exp $
 
 A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2
 release:
@@ -1292,3 +1292,8 @@ sys/external/bsd/dwc2/dwc2.c			1.75
 	Remove bogus assertions in USB abort paths.
 	[riastradh, ticket #1159]
 
+usr.bin/calendar/calendars/calendar.judaic	1.10
+
+	Update to 2021.
+	[maya, ticket #1160]
+



CVS commit: [netbsd-9] src/usr.bin/calendar/calendars

2020-12-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 27 14:05:47 UTC 2020

Modified Files:
src/usr.bin/calendar/calendars [netbsd-9]: calendar.judaic

Log Message:
Pull up following revision(s) (requested by maya in ticket #1160):

usr.bin/calendar/calendars/calendar.judaic: revision 1.10

Update to 2021, hopefully less errors made in this year.


To generate a diff of this commit:
cvs rdiff -u -r1.7.4.1 -r1.7.4.2 \
src/usr.bin/calendar/calendars/calendar.judaic

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/calendar/calendars/calendar.judaic
diff -u src/usr.bin/calendar/calendars/calendar.judaic:1.7.4.1 src/usr.bin/calendar/calendars/calendar.judaic:1.7.4.2
--- src/usr.bin/calendar/calendars/calendar.judaic:1.7.4.1	Tue Dec 24 17:37:24 2019
+++ src/usr.bin/calendar/calendars/calendar.judaic	Sun Dec 27 14:05:47 2020
@@ -1,29 +1,29 @@
-01/21*  Tu B'Shvat (Feast of Trees)
-03/09*	Fast of Esther (Battle of Purim; 1 day before Purim; fast day)
-03/10*	Purim (Feast of Lots; 30 days before Pesach)
-04/09*	Pesach (First Day of Passover; sabbatical)
-04/10*	Pesach (sabbatical)
-04/11*	Pesach (sabbatical)
-04/16*	Pesach (Last Day of Passover; 8th day of Pesach; sabbatical)
-04/17*	Mimouna (Morrocan Jewish Celebration of End of Pesach)
-04/09*	Yom HaAtzma'ut (Israel Independence Day)
-05/12*	Lag B'Omer (Commemoration of the Great Rebellion)
-05/22*	Yom Yerushalayim (Reunification of Jerusalem)
-05/29*	Shavuot (Festival of Weeks; 50 days after Pesach; sabbatical)
-07/09*	Fast of Shiv'a Asar B'Tammuz (Tzom Tammuz) (Romans breach Wall of Jerusalem;
+01/28*  Tu B'Shvat (Feast of Trees)
+02/25*	Fast of Esther (Battle of Purim; 1 day before Purim; fast day)
+02/26*	Purim (Feast of Lots; 30 days before Pesach)
+03/29*	Pesach (First Day of Passover; sabbatical)
+03/30*	Pesach (sabbatical)
+03/31*	Pesach (sabbatical)
+04/04*	Pesach (Last Day of Passover; 8th day of Pesach; sabbatical)
+04/05*	Mimouna (Morrocan Jewish Celebration of End of Pesach)
+04/15*	Yom HaAtzma'ut (Israel Independence Day)
+04/30*	Lag B'Omer (Commemoration of the Great Rebellion)
+05/10*	Yom Yerushalayim (Reunification of Jerusalem)
+05/17*	Shavuot (Festival of Weeks; 50 days after Pesach; sabbatical)
+06/27*	Fast of Shiv'a Asar B'Tammuz (Tzom Tammuz) (Romans breach Wall of Jerusalem;
 	fast day)
-07/30*	Fast of Tish'a B'Av (Babylon/Rome destroys Holy Temple; fast day)
-09/19*	First Day of Rosh Hashanah (Jewish Lunar New Year; 5781 == 2021;
+07/18*	Fast of Tish'a B'Av (Babylon/Rome destroys Holy Temple; fast day)
+09/07*	First Day of Rosh Hashanah (Jewish Lunar New Year; 5782 == 2022;
 	sabbatical)
-09/20*	Rosh Hashanah (sabbatical)
-09/21*	Fast of Gedalya (Murder of Gedalya and subsequent Exile; 1 day
+09/08*	Rosh Hashanah (sabbatical)
+09/09*	Fast of Gedalya (Murder of Gedalya and subsequent Exile; 1 day
 	after Rosh Hashanah; fast day)
-09/28*	Yom Kippur (Day of Atonement; 9 days after Rosh Hashanah;
+09/16*	Yom Kippur (Day of Atonement; 9 days after Rosh Hashanah;
 	sabbatical, fast day)
-10/03*	Sukkot (Festival of Tabernacles; 14 days after Rosh Hashanah;
+09/21*	Sukkot (Festival of Tabernacles; 14 days after Rosh Hashanah;
 	sabbatical)
-10/09*	Hoshanah Rabba (7th day of Sukkot)
-10/01*	Shmini Atzeret (8th Day of Gathering; 1 day after Sukkot; sabbatical)
-11/16*	Sigd (Beta Israel; 50 days after Yom Kippur)
-12/10*	First Day of Chanukah
-12/25*	Fast of Asara B'Tevet (Babylonians put siege on Jerusalem; fast day)
+09/27*	Hoshanah Rabba (7th day of Sukkot)
+09/28*	Shmini Atzeret (8th Day of Gathering; 1 day after Sukkot; sabbatical)
+11/04*	Sigd (Beta Israel; 50 days after Yom Kippur)
+11/28*	First Day of Chanukah
+12/14*	Fast of Asara B'Tevet (Babylonians put siege on Jerusalem; fast day)



CVS commit: src/usr.bin/make

2020-12-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 27 14:02:12 UTC 2020

Modified Files:
src/usr.bin/make: nonints.h var.c

Log Message:
make(1): remove unnecessary VPR_ERR_SILENT


To generate a diff of this commit:
cvs rdiff -u -r1.184 -r1.185 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.770 -r1.771 src/usr.bin/make/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.184 src/usr.bin/make/nonints.h:1.185
--- src/usr.bin/make/nonints.h:1.184	Sun Dec 27 10:53:23 2020
+++ src/usr.bin/make/nonints.h	Sun Dec 27 14:02:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.184 2020/12/27 10:53:23 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.185 2020/12/27 14:02:12 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -325,9 +325,6 @@ typedef enum VarParseResult {
 	/* Parsing or evaluating failed, with an error message. */
 	VPR_ERR,
 
-	/* deprecated */
-	VPR_ERR_SILENT,
-
 	/*
 	 * Parsing succeeded, undefined expressions are allowed and the
 	 * expression was still undefined after applying all modifiers.

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.770 src/usr.bin/make/var.c:1.771
--- src/usr.bin/make/var.c:1.770	Sun Dec 27 13:15:43 2020
+++ src/usr.bin/make/var.c	Sun Dec 27 14:02:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.770 2020/12/27 13:15:43 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.771 2020/12/27 14:02:12 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.770 2020/12/27 13:15:43 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.771 2020/12/27 14:02:12 rillig Exp $");
 
 typedef enum VarFlags {
 	VAR_NONE	= 0,
@@ -3754,10 +3754,8 @@ ValidShortVarname(char varname, const ch
 		return VPR_OK;
 	}
 
-	if (!opts.strict) {
-		/* XXX: Should rather be a parse error with error message. */
-		return VPR_ERR_SILENT;
-	}
+	if (!opts.strict)
+		return VPR_ERR;	/* XXX: Missing error message */
 
 	if (varname == '$')
 		Parse_Error(PARSE_FATAL,



CVS commit: src/usr.bin/make

2020-12-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 27 13:15:44 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): do not inspect output variables in ParseVarnameShort


To generate a diff of this commit:
cvs rdiff -u -r1.769 -r1.770 src/usr.bin/make/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.769 src/usr.bin/make/var.c:1.770
--- src/usr.bin/make/var.c:1.769	Sun Dec 27 13:12:34 2020
+++ src/usr.bin/make/var.c	Sun Dec 27 13:15:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.769 2020/12/27 13:12:34 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.770 2020/12/27 13:15:43 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.769 2020/12/27 13:12:34 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.770 2020/12/27 13:15:43 rillig Exp $");
 
 typedef enum VarFlags {
 	VAR_NONE	= 0,
@@ -3801,18 +3801,18 @@ ParseVarnameShort(char startc, const cha
 	name[1] = '\0';
 	v = VarFind(name, ctxt, TRUE);
 	if (v == NULL) {
+		const char *val;
 		*pp += 2;
 
-		*out_FALSE_val = UndefinedShortVarValue(startc, ctxt);
-		if (*out_FALSE_val == NULL) {
-			*out_FALSE_val =
-			eflags & VARE_UNDEFERR ? var_Error : varUndefined;
-		}
+		val = UndefinedShortVarValue(startc, ctxt);
+		if (val == NULL)
+			val = eflags & VARE_UNDEFERR ? var_Error : varUndefined;
 
-		if (opts.strict && *out_FALSE_val == var_Error) {
+		if (opts.strict && val == var_Error) {
 			Parse_Error(PARSE_FATAL,
 			"Variable \"%s\" is undefined", name);
 			*out_FALSE_res = VPR_ERR;
+			*out_FALSE_val = val;
 			return FALSE;
 		}
 
@@ -3827,6 +3827,7 @@ ParseVarnameShort(char startc, const cha
 		 * be VPR_UNDEF instead of VPR_OK.
 		 */
 		*out_FALSE_res = eflags & VARE_UNDEFERR ? VPR_UNDEF : VPR_OK;
+		*out_FALSE_val = val;
 		return FALSE;
 	}
 



CVS commit: src/usr.bin/make

2020-12-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 27 13:12:34 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): move error handling code out of UndefinedShortVarValue


To generate a diff of this commit:
cvs rdiff -u -r1.768 -r1.769 src/usr.bin/make/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.768 src/usr.bin/make/var.c:1.769
--- src/usr.bin/make/var.c:1.768	Sun Dec 27 11:03:00 2020
+++ src/usr.bin/make/var.c	Sun Dec 27 13:12:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.768 2020/12/27 11:03:00 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.769 2020/12/27 13:12:34 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.768 2020/12/27 11:03:00 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.769 2020/12/27 13:12:34 rillig Exp $");
 
 typedef enum VarFlags {
 	VAR_NONE	= 0,
@@ -3673,7 +3673,7 @@ VarnameIsDynamic(const char *name, size_
 }
 
 static const char *
-UndefinedShortVarValue(char varname, const GNode *ctxt, VarEvalFlags eflags)
+UndefinedShortVarValue(char varname, const GNode *ctxt)
 {
 	if (ctxt == VAR_CMDLINE || ctxt == VAR_GLOBAL) {
 		/*
@@ -3696,7 +3696,7 @@ UndefinedShortVarValue(char varname, con
 			return "$(.ARCHIVE)";
 		}
 	}
-	return eflags & VARE_UNDEFERR ? var_Error : varUndefined;
+	return NULL;
 }
 
 /* Parse a variable name, until the end character or a colon, whichever
@@ -3803,7 +3803,12 @@ ParseVarnameShort(char startc, const cha
 	if (v == NULL) {
 		*pp += 2;
 
-		*out_FALSE_val = UndefinedShortVarValue(startc, ctxt, eflags);
+		*out_FALSE_val = UndefinedShortVarValue(startc, ctxt);
+		if (*out_FALSE_val == NULL) {
+			*out_FALSE_val =
+			eflags & VARE_UNDEFERR ? var_Error : varUndefined;
+		}
+
 		if (opts.strict && *out_FALSE_val == var_Error) {
 			Parse_Error(PARSE_FATAL,
 			"Variable \"%s\" is undefined", name);



CVS commit: src/sys/kern

2020-12-27 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Dec 27 12:45:33 UTC 2020

Modified Files:
src/sys/kern: kern_event.c

Log Message:
reduce indentation for the main processing loop in kqueue_scan(), this also
makes the code more similar to FreeBSD; NFCI

part of PR kern/50094


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/kern/kern_event.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_event.c
diff -u src/sys/kern/kern_event.c:1.109 src/sys/kern/kern_event.c:1.110
--- src/sys/kern/kern_event.c:1.109	Fri Dec 11 03:00:09 2020
+++ src/sys/kern/kern_event.c	Sun Dec 27 12:45:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_event.c,v 1.109 2020/12/11 03:00:09 thorpej Exp $	*/
+/*	$NetBSD: kern_event.c,v 1.110 2020/12/27 12:45:33 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.109 2020/12/11 03:00:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.110 2020/12/27 12:45:33 jdolecek Exp $");
 
 #include 
 #include 
@@ -1445,139 +1445,142 @@ kqueue_scan(file_t *fp, size_t maxevents
 			}
 		}
 		mutex_spin_exit(>kq_lock);
-	} else {
-		/* mark end of knote list */
-		TAILQ_INSERT_TAIL(>kq_head, marker, kn_tqe);
+		goto done;
+	}
 
-		/*
-		 * Acquire the fdp->fd_lock interlock to avoid races with
-		 * file creation/destruction from other threads.
-		 */
-		mutex_spin_exit(>kq_lock);
-		mutex_enter(>fd_lock);
-		mutex_spin_enter(>kq_lock);
+	/* mark end of knote list */
+	TAILQ_INSERT_TAIL(>kq_head, marker, kn_tqe);
 
-		while (count != 0) {
-			kn = TAILQ_FIRST(>kq_head);	/* get next knote */
-			while ((kn->kn_status & KN_MARKER) != 0) {
-if (kn == marker) {
-	/* it's our marker, stop */
-	TAILQ_REMOVE(>kq_head, kn, kn_tqe);
-	if (count < maxevents || (tsp != NULL &&
-	(timeout = gettimeleft(,
-	)) <= 0))
-		goto done;
-	mutex_exit(>fd_lock);
-	goto retry;
-}
-/* someone else's marker. */
-kn = TAILQ_NEXT(kn, kn_tqe);
+	/*
+	 * Acquire the fdp->fd_lock interlock to avoid races with
+	 * file creation/destruction from other threads.
+	 */
+	mutex_spin_exit(>kq_lock);
+	mutex_enter(>fd_lock);
+	mutex_spin_enter(>kq_lock);
+
+	while (count != 0) {
+		kn = TAILQ_FIRST(>kq_head);	/* get next knote */
+		while ((kn->kn_status & KN_MARKER) != 0) {
+			if (kn == marker) {
+/* it's our marker, stop */
+TAILQ_REMOVE(>kq_head, kn, kn_tqe);
+if (count < maxevents || (tsp != NULL &&
+(timeout = gettimeleft(,
+)) <= 0))
+	goto queue_processed;
+mutex_exit(>fd_lock);
+goto retry;
 			}
-			kq_check(kq);
-			kq->kq_count--;
-			TAILQ_REMOVE(>kq_head, kn, kn_tqe);
-			kn->kn_status &= ~KN_QUEUED;
-			kn->kn_status |= KN_BUSY;
-			kq_check(kq);
-			if (kn->kn_status & KN_DISABLED) {
+			/* someone else's marker. */
+			kn = TAILQ_NEXT(kn, kn_tqe);
+		}
+		kq_check(kq);
+		kq->kq_count--;
+		TAILQ_REMOVE(>kq_head, kn, kn_tqe);
+		kn->kn_status &= ~KN_QUEUED;
+		kn->kn_status |= KN_BUSY;
+		kq_check(kq);
+		if (kn->kn_status & KN_DISABLED) {
+			kn->kn_status &= ~KN_BUSY;
+			/* don't want disabled events */
+			continue;
+		}
+		if ((kn->kn_flags & EV_ONESHOT) == 0) {
+			mutex_spin_exit(>kq_lock);
+			KASSERT(kn->kn_fop != NULL);
+			KASSERT(kn->kn_fop->f_event != NULL);
+			KERNEL_LOCK(1, NULL);		/* XXXSMP */
+			KASSERT(mutex_owned(>fd_lock));
+			rv = (*kn->kn_fop->f_event)(kn, 0);
+			KERNEL_UNLOCK_ONE(NULL);	/* XXXSMP */
+			mutex_spin_enter(>kq_lock);
+			/* Re-poll if note was re-enqueued. */
+			if ((kn->kn_status & KN_QUEUED) != 0) {
 kn->kn_status &= ~KN_BUSY;
-/* don't want disabled events */
 continue;
 			}
-			if ((kn->kn_flags & EV_ONESHOT) == 0) {
-mutex_spin_exit(>kq_lock);
-KASSERT(kn->kn_fop != NULL);
-KASSERT(kn->kn_fop->f_event != NULL);
-KERNEL_LOCK(1, NULL);		/* XXXSMP */
-KASSERT(mutex_owned(>fd_lock));
-rv = (*kn->kn_fop->f_event)(kn, 0);
-KERNEL_UNLOCK_ONE(NULL);	/* XXXSMP */
-mutex_spin_enter(>kq_lock);
-/* Re-poll if note was re-enqueued. */
-if ((kn->kn_status & KN_QUEUED) != 0) {
-	kn->kn_status &= ~KN_BUSY;
-	continue;
-}
-if (rv == 0) {
-	/*
-	 * non-ONESHOT event that hasn't
-	 * triggered again, so de-queue.
-	 */
-	kn->kn_status &= ~(KN_ACTIVE|KN_BUSY);
-	continue;
-}
-			}
-			KASSERT(kn->kn_fop != NULL);
-			touch = (!kn->kn_fop->f_isfd &&
-	kn->kn_fop->f_touch != NULL);
-			/* XXXAD should be got from f_event if !oneshot. */
-			if (touch) {
-mutex_spin_exit(>kq_lock);
-KERNEL_LOCK(1, NULL);		/* XXXSMP */
-(*kn->kn_fop->f_touch)(kn, kevp, EVENT_PROCESS);
-KERNEL_UNLOCK_ONE(NULL);	/* XXXSMP */
-mutex_spin_enter(>kq_lock);
-			} else {
-*kevp = kn->kn_kevent;
-			}
-			kevp++;
-			nkev++;
-			if 

CVS commit: src/usr.bin/make

2020-12-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 27 11:47:04 UTC 2020

Modified Files:
src/usr.bin/make: dir.c main.c parse.c
src/usr.bin/make/unit-tests: opt-chdir.exp

Log Message:
make(1): exit 2 on technical errors

This allows the -q option to distinguish errors from out-of-date
targets.  Granted, it's an edge case but it should be solved
consistently anyway.

The majority of cases in which make exits with exit status 1, even in -q
mode, is when there are parse errors.  These have been kept as-is for
now as they affect many of the unit tests.

The technical errors, on the other hand, occur so rarely that it's hard
to write reliable tests for them that fail consistently on all platforms
supported by make.


To generate a diff of this commit:
cvs rdiff -u -r1.252 -r1.253 src/usr.bin/make/dir.c
cvs rdiff -u -r1.504 -r1.505 src/usr.bin/make/main.c
cvs rdiff -u -r1.517 -r1.518 src/usr.bin/make/parse.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/opt-chdir.exp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.252 src/usr.bin/make/dir.c:1.253
--- src/usr.bin/make/dir.c:1.252	Sun Dec 13 20:14:48 2020
+++ src/usr.bin/make/dir.c	Sun Dec 27 11:47:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.252 2020/12/13 20:14:48 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.253 2020/12/27 11:47:04 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -136,7 +136,7 @@
 #include "job.h"
 
 /*	"@(#)dir.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: dir.c,v 1.252 2020/12/13 20:14:48 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.253 2020/12/27 11:47:04 rillig Exp $");
 
 /* A search path is a list of CachedDir structures. A CachedDir has in it the
  * name of the directory and the names of all the files in the directory.
@@ -506,7 +506,7 @@ Dir_InitDot(void)
 	dir = Dir_AddDir(NULL, ".");
 	if (dir == NULL) {
 		Error("Cannot open `.' (%s)", strerror(errno));
-		exit(1);
+		exit(2);	/* Not 1 so -q can distinguish error */
 	}
 
 	CachedDir_Assign(, dir);

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.504 src/usr.bin/make/main.c:1.505
--- src/usr.bin/make/main.c:1.504	Sun Dec 27 05:16:26 2020
+++ src/usr.bin/make/main.c	Sun Dec 27 11:47:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.504 2020/12/27 05:16:26 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.505 2020/12/27 11:47:04 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.504 2020/12/27 05:16:26 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.505 2020/12/27 11:47:04 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -373,7 +373,7 @@ MainParseArgChdir(const char *argvalue)
 	if (chdir(argvalue) == -1) {
 		(void)fprintf(stderr, "%s: chdir %s: %s\n",
 		progname, argvalue, strerror(errno));
-		exit(1);
+		exit(2);	/* Not 1 so -q can distinguish error */
 	}
 	if (getcwd(curdir, MAXPATHLEN) == NULL) {
 		(void)fprintf(stderr, "%s: %s.\n", progname, strerror(errno));
@@ -426,7 +426,7 @@ MainParseArgJobs(const char *argvalue)
 		(void)fprintf(stderr,
 		"%s: illegal argument to -j -- must be positive integer!\n",
 		progname);
-		exit(1);	/* XXX: why not 2? */
+		exit(2);	/* Not 1 so -q can distinguish error */
 	}
 	Var_Append(MAKEFLAGS, "-j", VAR_GLOBAL);
 	Var_Append(MAKEFLAGS, argvalue, VAR_GLOBAL);
@@ -1241,7 +1241,7 @@ InitMaxJobs(void)
 		"%s: illegal value for .MAKE.JOBS "
 		"-- must be positive integer!\n",
 		progname);
-		exit(1);
+		exit(2);	/* Not 1 so -q can distinguish error */
 	}
 
 	if (n != opts.maxJobs) {
@@ -1931,7 +1931,7 @@ DieHorribly(void)
 	if (DEBUG(GRAPH2))
 		Targ_PrintGraph(2);
 	Trace_Log(MAKEERROR, NULL);
-	exit(2);		/* Not 1, so -q can distinguish error */
+	exit(2);		/* Not 1 so -q can distinguish error */
 }
 
 /* Called when aborting due to errors in child shell to signal abnormal exit.

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.517 src/usr.bin/make/parse.c:1.518
--- src/usr.bin/make/parse.c:1.517	Sun Dec 27 05:06:17 2020
+++ src/usr.bin/make/parse.c	Sun Dec 27 11:47:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.517 2020/12/27 05:06:17 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.518 2020/12/27 11:47:04 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.517 2020/12/27 05:06:17 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.518 2020/12/27 11:47:04 rillig Exp $");
 
 /* types and constants */
 
@@ -527,7 +527,7 @@ loadfile(const char *path, int fd)
 			if (lf->len > 

CVS commit: src/usr.bin/make

2020-12-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 27 11:03:00 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): split Var_Subst into easily understandable functions

Extracting the character-level details makes the essence of Var_Subst
visible in the code, which is to iterate over the given text, handling a
few types of tokens.


To generate a diff of this commit:
cvs rdiff -u -r1.767 -r1.768 src/usr.bin/make/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.767 src/usr.bin/make/var.c:1.768
--- src/usr.bin/make/var.c:1.767	Sun Dec 27 10:53:23 2020
+++ src/usr.bin/make/var.c	Sun Dec 27 11:03:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.767 2020/12/27 10:53:23 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.768 2020/12/27 11:03:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.767 2020/12/27 10:53:23 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.768 2020/12/27 11:03:00 rillig Exp $");
 
 typedef enum VarFlags {
 	VAR_NONE	= 0,
@@ -4177,8 +4177,21 @@ Var_Parse(const char **pp, GNode *ctxt, 
 }
 
 static void
-VarSubstNested(const char **pp, Buffer *buf, GNode *ctxt,
-	   VarEvalFlags eflags, Boolean *inout_errorReported)
+VarSubstDollarDollar(const char **pp, Buffer *res, VarEvalFlags eflags)
+{
+	/*
+	 * A dollar sign may be escaped with another dollar
+	 * sign.
+	 */
+	if (save_dollars && (eflags & VARE_KEEP_DOLLAR))
+		Buf_AddByte(res, '$');
+	Buf_AddByte(res, '$');
+	*pp += 2;
+}
+
+static void
+VarSubstExpr(const char **pp, Buffer *buf, GNode *ctxt,
+	 VarEvalFlags eflags, Boolean *inout_errorReported)
 {
 	const char *p = *pp;
 	const char *nested_p = p;
@@ -4229,6 +4242,22 @@ VarSubstNested(const char **pp, Buffer *
 	*pp = p;
 }
 
+/*
+ * Skip as many characters as possible -- either to the end of the string
+ * or to the next dollar sign (variable expression).
+ */
+static void
+VarSubstPlain(const char **pp, Buffer *res)
+{
+	const char *p = *pp;
+	const char *start = p;
+
+	for (p++; *p != '$' && *p != '\0'; p++)
+		continue;
+	Buf_AddBytesBetween(res, start, p);
+	*pp = p;
+}
+
 /* Expand all variable expressions like $V, ${VAR}, $(VAR:Modifiers) in the
  * given string.
  *
@@ -4254,31 +4283,12 @@ Var_Subst(const char *str, GNode *ctxt, 
 	errorReported = FALSE;
 
 	while (*p != '\0') {
-		if (p[0] == '$' && p[1] == '$') {
-			/*
-			 * A dollar sign may be escaped with another dollar
-			 * sign.
-			 */
-			if (save_dollars && (eflags & VARE_KEEP_DOLLAR))
-Buf_AddByte(, '$');
-			Buf_AddByte(, '$');
-			p += 2;
-
-		} else if (p[0] == '$') {
-			VarSubstNested(, , ctxt, eflags, );
-
-		} else {
-			/*
-			 * Skip as many characters as possible -- either to
-			 * the end of the string or to the next dollar sign
-			 * (variable expression).
-			 */
-			const char *plainStart = p;
-
-			for (p++; *p != '$' && *p != '\0'; p++)
-continue;
-			Buf_AddBytesBetween(, plainStart, p);
-		}
+		if (p[0] == '$' && p[1] == '$')
+			VarSubstDollarDollar(, , eflags);
+		else if (p[0] == '$')
+			VarSubstExpr(, , ctxt, eflags, );
+		else
+			VarSubstPlain(, );
 	}
 
 	*out_res = Buf_DestroyCompact();



CVS commit: src/usr.bin/make

2020-12-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 27 10:53:23 UTC 2020

Modified Files:
src/usr.bin/make: cond.c nonints.h var.c

Log Message:
make(1): clean up VarParseResult constants

The many constants were invented because at that time I didn't quite
understand the actual outcomes of Var_Parse that need to be
distinguished.  There are only a few:

(1) Errors, whether they are parse errors, or evaluation errors or
undefined variables.  The old constants VPR_PARSE_MSG and
VPR_UNDEF_MSG are merged into VPR_ERR.

(2) Undefined expressions in a situation in which they are allowed.
Previously the documentation for VPR_UNDEF_SILENT talked about
undefined expressions in situations where they were not allowed.
That case is fully covered by VPR_ERR instead.

(3) Errors that are silently ignored.  These are probably bugs.

(4) Everything went fine, the expression has a defined value.


To generate a diff of this commit:
cvs rdiff -u -r1.231 -r1.232 src/usr.bin/make/cond.c
cvs rdiff -u -r1.183 -r1.184 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.766 -r1.767 src/usr.bin/make/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.231 src/usr.bin/make/cond.c:1.232
--- src/usr.bin/make/cond.c:1.231	Wed Dec 23 13:50:54 2020
+++ src/usr.bin/make/cond.c	Sun Dec 27 10:53:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.231 2020/12/23 13:50:54 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.232 2020/12/27 10:53:23 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -94,7 +94,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.231 2020/12/23 13:50:54 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.232 2020/12/27 10:53:23 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -452,7 +452,7 @@ CondParser_String(CondParser *par, Boole
 			);
 			/* TODO: handle errors */
 			if (str.str == var_Error) {
-if (parseResult & VPR_ANY_MSG)
+if (parseResult == VPR_ERR)
 	par->printedError = TRUE;
 /*
  * XXX: Can there be any situation in which

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.183 src/usr.bin/make/nonints.h:1.184
--- src/usr.bin/make/nonints.h:1.183	Sun Dec 27 10:09:53 2020
+++ src/usr.bin/make/nonints.h	Sun Dec 27 10:53:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.183 2020/12/27 10:09:53 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.184 2020/12/27 10:53:23 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -316,67 +316,29 @@ typedef enum VarSetFlags {
 	VAR_SET_READONLY	= 1 << 1
 } VarSetFlags;
 
-/* The state of error handling returned by Var_Parse.
- *
- * As of 2020-09-13, this bitset looks quite bloated,
- * with all the constants doubled.
- *
- * Its purpose is to first document the existing behavior,
- * and then migrate away from the SILENT constants, step by step,
- * as these are not suited for reliable, consistent error handling
- * and reporting. */
+/* The state of error handling returned by Var_Parse. */
 typedef enum VarParseResult {
 
 	/* Both parsing and evaluation succeeded. */
-	VPR_OK		= 0x,
-
-	/* See if a message has already been printed for this error. */
-	VPR_ANY_MSG		= 0x0001,
-
-	/*
-	 * Parsing failed.
-	 * No error message has been printed yet.
-	 * Deprecated, migrate to VPR_PARSE_MSG instead.
-	 */
-	VPR_PARSE_SILENT	= 0x0002,
-
-	/*
-	 * Parsing failed.
-	 * An error message has already been printed.
-	 */
-	VPR_PARSE_MSG	= VPR_PARSE_SILENT | VPR_ANY_MSG,
+	VPR_OK,
 
-	/*
-	 * Parsing succeeded.
-	 * During evaluation, VARE_UNDEFERR was set and there was an undefined
-	 * variable.
-	 * No error message has been printed yet.
-	 * Deprecated, migrate to VPR_UNDEF_MSG instead.
-	 */
-	VPR_UNDEF_SILENT	= 0x0004,
+	/* Parsing or evaluating failed, with an error message. */
+	VPR_ERR,
 
-	/*
-	 * Parsing succeeded.
-	 * During evaluation, VARE_UNDEFERR was set and there was an undefined
-	 * variable.
-	 * An error message has already been printed.
-	 */
-	VPR_UNDEF_MSG	= VPR_UNDEF_SILENT | VPR_ANY_MSG,
+	/* deprecated */
+	VPR_ERR_SILENT,
 
 	/*
-	 * Parsing succeeded.
-	 * Evaluation failed.
-	 * No error message has been printed yet.
-	 * Deprecated, migrate to VPR_EVAL_MSG instead.
-	 */
-	VPR_EVAL_SILENT	= 0x0006,
-
-	/*
-	 * Parsing succeeded.
-	 * Evaluation failed.
-	 * An error message has already been printed.
+	 * Parsing succeeded, undefined expressions are allowed and the
+	 * expression was still undefined after applying all modifiers.
+	 * No error message is printed in this case.
+	 *
+	 * Some callers handle this case differently, so return this
+	 * information to them, for now.
+	 *
+	 * TODO: Replace this with a new flag VARE_KEEP_UNDEFINED.
 	 */
-	VPR_EVAL_MSG	= VPR_EVAL_SILENT | 

CVS commit: src/usr.bin/make

2020-12-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 27 10:09:53 UTC 2020

Modified Files:
src/usr.bin/make: nonints.h var.c

Log Message:
make(1): remove unnecessary VPR_UNKNOWN for error handling

There is no sensible way for a caller of Var_Parse to deal with an error
state of "maybe successful, maybe not", therefore remove the constant
for it.


To generate a diff of this commit:
cvs rdiff -u -r1.182 -r1.183 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.765 -r1.766 src/usr.bin/make/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.182 src/usr.bin/make/nonints.h:1.183
--- src/usr.bin/make/nonints.h:1.182	Sun Dec 27 05:06:17 2020
+++ src/usr.bin/make/nonints.h	Sun Dec 27 10:09:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.182 2020/12/27 05:06:17 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.183 2020/12/27 10:09:53 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -376,13 +376,8 @@ typedef enum VarParseResult {
 	 * Evaluation failed.
 	 * An error message has already been printed.
 	 */
-	VPR_EVAL_MSG	= VPR_EVAL_SILENT | VPR_ANY_MSG,
+	VPR_EVAL_MSG	= VPR_EVAL_SILENT | VPR_ANY_MSG
 
-	/*
-	 * The exact error handling status is not known yet.
-	 * Deprecated, migrate to VPR_OK or any VPE_*_MSG instead.
-	 */
-	VPR_UNKNOWN		= 0x0008
 } VarParseResult;
 
 typedef enum VarExportMode {

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.765 src/usr.bin/make/var.c:1.766
--- src/usr.bin/make/var.c:1.765	Sun Dec 27 05:06:17 2020
+++ src/usr.bin/make/var.c	Sun Dec 27 10:09:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.765 2020/12/27 05:06:17 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.766 2020/12/27 10:09:53 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.765 2020/12/27 05:06:17 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.766 2020/12/27 10:09:53 rillig Exp $");
 
 typedef enum VarFlags {
 	VAR_NONE	= 0,
@@ -4161,7 +4161,7 @@ Var_Parse(const char **pp, GNode *ctxt, 
 		free(v);
 	}
 	*out_val = (FStr){ value.str, value.freeIt };
-	return VPR_UNKNOWN;
+	return VPR_OK;		/* XXX: Is not correct in all cases */
 }
 
 static void



CVS commit: src/usr.bin/make

2020-12-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 27 10:04:32 UTC 2020

Modified Files:
src/usr.bin/make: for.c

Log Message:
make(1): add error handling for .for loop items

Right now, Var_Subst always returns VPR_OK, even if there had been parse
errors or evaluation errors.  If that is no longer true, the errors will
be reported properly.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/usr.bin/make/for.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/for.c
diff -u src/usr.bin/make/for.c:1.120 src/usr.bin/make/for.c:1.121
--- src/usr.bin/make/for.c:1.120	Sat Dec 19 13:31:37 2020
+++ src/usr.bin/make/for.c	Sun Dec 27 10:04:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: for.c,v 1.120 2020/12/19 13:31:37 rillig Exp $	*/
+/*	$NetBSD: for.c,v 1.121 2020/12/27 10:04:32 rillig Exp $	*/
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -60,7 +60,7 @@
 #include "make.h"
 
 /*	"@(#)for.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: for.c,v 1.120 2020/12/19 13:31:37 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.121 2020/12/27 10:04:32 rillig Exp $");
 
 static int forLevel = 0;	/* Nesting level */
 
@@ -206,8 +206,12 @@ For_Eval(const char *line)
 
 	{
 		char *items;
-		(void)Var_Subst(p, VAR_GLOBAL, VARE_WANTRES, );
-		/* TODO: handle errors */
+		if (Var_Subst(p, VAR_GLOBAL, VARE_WANTRES, ) != VPR_OK) {
+			Parse_Error(PARSE_FATAL, "Error in .for loop items");
+			f->items.len = 0;
+			goto done;
+		}
+
 		f->items = Str_Words(items, FALSE);
 		free(items);
 
@@ -233,6 +237,7 @@ For_Eval(const char *line)
 		}
 	}
 
+done:
 	accumFor = f;
 	forLevel = 1;
 	return 1;



CVS commit: src/usr.bin/make/unit-tests

2020-12-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 27 09:58:35 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: directive-for.exp directive-for.mk

Log Message:
make(1): add test for missing error handling in .for loop


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/directive-for.exp
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/directive-for.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/directive-for.exp
diff -u src/usr.bin/make/unit-tests/directive-for.exp:1.7 src/usr.bin/make/unit-tests/directive-for.exp:1.8
--- src/usr.bin/make/unit-tests/directive-for.exp:1.7	Sun Nov 15 20:20:58 2020
+++ src/usr.bin/make/unit-tests/directive-for.exp	Sun Dec 27 09:58:35 2020
@@ -16,4 +16,9 @@ make: "directive-for.mk" line 140: ][ ][
 make: "directive-for.mk" line 140: }{ }{ }{
 make: "directive-for.mk" line 148: outer value value
 make: "directive-for.mk" line 148: outer "quoted" \"quoted\"
-exit status 0
+make: "directive-for.mk" line 154: Unknown modifier 'Z'
+make: "directive-for.mk" line 155: XXX: Not reached word1
+make: "directive-for.mk" line 155: XXX: Not reached word3
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1

Index: src/usr.bin/make/unit-tests/directive-for.mk
diff -u src/usr.bin/make/unit-tests/directive-for.mk:1.9 src/usr.bin/make/unit-tests/directive-for.mk:1.10
--- src/usr.bin/make/unit-tests/directive-for.mk:1.9	Sun Nov 15 20:20:58 2020
+++ src/usr.bin/make/unit-tests/directive-for.mk	Sun Dec 27 09:58:35 2020
@@ -1,4 +1,4 @@
-# $NetBSD: directive-for.mk,v 1.9 2020/11/15 20:20:58 rillig Exp $
+# $NetBSD: directive-for.mk,v 1.10 2020/12/27 09:58:35 rillig Exp $
 #
 # Tests for the .for directive.
 #
@@ -148,5 +148,12 @@ var=	outer
 .  info ${var} ${var:Q} ${var:Q:Q}
 .endfor
 
+
+# XXX: A parse error or evaluation error in the items of the .for loop
+# should skip the whole loop.  As of 2020-12-27, the loop is expanded twice.
+.for var in word1 ${:Uword2:Z} word3
+.  info XXX: Not reached ${var}
+.endfor
+
 all:
 	@:;