CVS commit: src/tests/net/if_pppoe

2020-09-22 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Wed Sep 23 05:56:55 UTC 2020

Modified Files:
src/tests/net/if_pppoe: t_pppoe.sh

Log Message:
Fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/tests/net/if_pppoe/t_pppoe.sh

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

Modified files:

Index: src/tests/net/if_pppoe/t_pppoe.sh
diff -u src/tests/net/if_pppoe/t_pppoe.sh:1.19 src/tests/net/if_pppoe/t_pppoe.sh:1.20
--- src/tests/net/if_pppoe/t_pppoe.sh:1.19	Mon Aug 19 03:22:05 2019
+++ src/tests/net/if_pppoe/t_pppoe.sh	Wed Sep 23 05:56:55 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: t_pppoe.sh,v 1.19 2019/08/19 03:22:05 ozaki-r Exp $
+#	$NetBSD: t_pppoe.sh,v 1.20 2020/09/23 05:56:55 yamaguchi Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -183,7 +183,7 @@ run_test()
 	atf_check -s exit:0 -o match:'PADI sent' -x "$HIJACKING pppoectl -d pppoe0"
 	unset RUMP_SERVER
 
-	# test for recoonecting
+	# test for reconnecting
 	atf_check -s exit:0 -x "env RUMP_SERVER=$SERVER rump.ifconfig pppoe0 up"
 	export RUMP_SERVER=$CLIENT
 	wait_for_session_established
@@ -325,7 +325,7 @@ run_test6()
 	atf_check -s exit:0 -o not-match:"$session_id" -x "$HIJACKING pppoectl -d pppoe0"
 	unset RUMP_SERVER
 
-	# test for recoonecting
+	# test for reconnecting
 	export RUMP_SERVER=$SERVER
 	atf_check -s exit:0 rump.ifconfig pppoe0 up
 	wait_for_session_established



CVS commit: src/sys/arch/aarch64/include

2020-09-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Sep 23 05:02:27 UTC 2020

Modified Files:
src/sys/arch/aarch64/include: vmparam.h

Log Message:
Readability of a comment


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/aarch64/include/vmparam.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/arch/aarch64/include/vmparam.h
diff -u src/sys/arch/aarch64/include/vmparam.h:1.14 src/sys/arch/aarch64/include/vmparam.h:1.15
--- src/sys/arch/aarch64/include/vmparam.h:1.14	Sat Sep 19 16:31:40 2020
+++ src/sys/arch/aarch64/include/vmparam.h	Wed Sep 23 05:02:27 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: vmparam.h,v 1.14 2020/09/19 16:31:40 skrll Exp $ */
+/* $NetBSD: vmparam.h,v 1.15 2020/09/23 05:02:27 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -131,14 +131,14 @@
 
 /*
  * kernel virtual space layout:
- *   0x-   64T KSEG(direct mapping)
- *   0x4000-   32T (KASAN SHADOW MAP)
- *   0x6000-   32T (not used)
- *   0x8000-1G EFI_RUNTIME
- *   0x80004000-   64T (not used)
- *   0xc000-   64T KERNEL VM Space (including kernel text/data/bss)
- *   0xf000-  254M KERNEL_IO for pmap_devmap
- *   0xffe0-2M RESERVED
+ *   0x___  -   64T  KSEG(direct mapping)
+ *   0x_4000__  -   32T  (KASAN SHADOW MAP)
+ *   0x_6000__  -   32T  (not used)
+ *   0x_8000__  -1G  EFI_RUNTIME
+ *   0x_8000_4000_  -   64T  (not used)
+ *   0x_c000__  -   64T  KERNEL VM Space (including text/data/bss)
+ *   0x__f000_  -  254M  KERNEL_IO for pmap_devmap
+ *   0x__ffe0_  -2M  RESERVED
  */
 #define VM_MIN_KERNEL_ADDRESS	((vaddr_t) 0xc000L)
 #define VM_MAX_KERNEL_ADDRESS	((vaddr_t) 0xffe0L)



CVS commit: src/usr.bin/make

2020-09-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Sep 23 04:27:39 UTC 2020

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

Log Message:
make(1): inline local variable delim

Now that ParseModifierPart generates the error message itself, there is
no need to keep this variable around since it is read a single time.


To generate a diff of this commit:
cvs rdiff -u -r1.534 -r1.535 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.534 src/usr.bin/make/var.c:1.535
--- src/usr.bin/make/var.c:1.534	Tue Sep 22 20:23:57 2020
+++ src/usr.bin/make/var.c	Wed Sep 23 04:27:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.534 2020/09/22 20:23:57 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.535 2020/09/23 04:27:39 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
 #include"metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.534 2020/09/22 20:23:57 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.535 2020/09/23 04:27:39 rillig Exp $");
 
 #define VAR_DEBUG_IF(cond, fmt, ...)	\
 if (!(DEBUG(VAR) && (cond)))	\
@@ -1978,7 +1978,6 @@ static ApplyModifierResult
 ApplyModifier_Loop(const char **pp, ApplyModifiersState *st)
 {
 ModifyWord_LoopArgs args;
-char delim;
 char prev_sep;
 VarEvalFlags eflags = st->eflags & ~(unsigned)VARE_WANTRES;
 VarParseResult res;
@@ -1986,8 +1985,7 @@ ApplyModifier_Loop(const char **pp, Appl
 args.ctx = st->ctxt;
 
 (*pp)++;			/* Skip the first '@' */
-delim = '@';
-res = ParseModifierPart(pp, delim, eflags, st,
+res = ParseModifierPart(pp, '@', eflags, st,
 			, NULL, NULL, NULL);
 if (res != VPR_OK)
 	return AMR_CLEANUP;
@@ -1999,7 +1997,7 @@ ApplyModifier_Loop(const char **pp, Appl
 	return AMR_CLEANUP;
 }
 
-res = ParseModifierPart(pp, delim, eflags, st,
+res = ParseModifierPart(pp, '@', eflags, st,
 			, NULL, NULL, NULL);
 if (res != VPR_OK)
 	return AMR_CLEANUP;
@@ -2159,14 +2157,12 @@ ApplyModifier_Path(const char **pp, Appl
 static ApplyModifierResult
 ApplyModifier_ShellCommand(const char **pp, ApplyModifiersState *st)
 {
-char delim;
 char *cmd;
 const char *errfmt;
 VarParseResult res;
 
 (*pp)++;
-delim = '!';
-res = ParseModifierPart(pp, delim, st->eflags, st,
+res = ParseModifierPart(pp, '!', st->eflags, st,
 			, NULL, NULL, NULL);
 if (res != VPR_OK)
 	return AMR_CLEANUP;
@@ -2568,15 +2564,13 @@ ApplyModifier_To(const char **pp, ApplyM
 static ApplyModifierResult
 ApplyModifier_Words(const char **pp, ApplyModifiersState *st)
 {
-char delim;
 char *estr;
 char *ep;
 int first, last;
 VarParseResult res;
 
 (*pp)++;			/* skip the '[' */
-delim = ']';		/* look for closing ']' */
-res = ParseModifierPart(pp, delim, st->eflags, st,
+res = ParseModifierPart(pp, ']', st->eflags, st,
 			, NULL, NULL, NULL);
 if (res != VPR_OK)
 	return AMR_CLEANUP;
@@ -2726,7 +2720,6 @@ ApplyModifier_Order(const char **pp, App
 static ApplyModifierResult
 ApplyModifier_IfElse(const char **pp, ApplyModifiersState *st)
 {
-char delim;
 char *then_expr, *else_expr;
 VarParseResult res;
 
@@ -2744,14 +2737,12 @@ ApplyModifier_IfElse(const char **pp, Ap
 }
 
 (*pp)++;			/* skip past the '?' */
-delim = ':';
-res = ParseModifierPart(pp, delim, then_eflags, st,
+res = ParseModifierPart(pp, ':', then_eflags, st,
 			_expr, NULL, NULL, NULL);
 if (res != VPR_OK)
 	return AMR_CLEANUP;
 
-delim = st->endc;		/* BRCLOSE or PRCLOSE */
-res = ParseModifierPart(pp, delim, else_eflags, st,
+res = ParseModifierPart(pp, st->endc, else_eflags, st,
 			_expr, NULL, NULL, NULL);
 if (res != VPR_OK)
 	return AMR_CLEANUP;
@@ -2919,7 +2910,7 @@ ApplyModifier_WordFunc(const char **pp, 
 	return AMR_UNKNOWN;
 
 st->newVal = ModifyWords(st->ctxt, st->sep, st->oneBigWord,
-			st->val, modifyWord, NULL);
+			 st->val, modifyWord, NULL);
 (*pp)++;
 return AMR_OK;
 }
@@ -2929,7 +2920,6 @@ ApplyModifier_WordFunc(const char **pp, 
 static ApplyModifierResult
 ApplyModifier_SysV(const char **pp, ApplyModifiersState *st)
 {
-char delim;
 char *lhs, *rhs;
 VarParseResult res;
 
@@ -2957,14 +2947,14 @@ ApplyModifier_SysV(const char **pp, Appl
 if (*next != st->endc || !eqFound)
 	return AMR_UNKNOWN;
 
-delim = '=';
 *pp = mod;
-res = ParseModifierPart(pp, delim, st->eflags, st, , NULL, NULL, NULL);
+res = ParseModifierPart(pp, '=', st->eflags, st,
+			, NULL, NULL, NULL);
 if (res != VPR_OK)
 	return AMR_CLEANUP;
 
-delim = st->endc;
-res = ParseModifierPart(pp, delim, st->eflags, st, , NULL, NULL, NULL);
+res = ParseModifierPart(pp, st->endc, st->eflags, st,
+			, NULL, NULL, NULL);
 if (res != VPR_OK)
 	

CVS commit: src

2020-09-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Sep 23 03:33:55 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/usr.bin/make/unit-tests: Makefile counter.mk
Added Files:
src/usr.bin/make/unit-tests: counter-append.exp counter-append.mk

Log Message:
make(1): add variant of the counter test

I had expected that using the ::+= modifier instead of the ::= modifier
would work, since the assignment modifier for COUNTER no longer contains
a reference to itself.  But instead of ending up at 4, the counter even
goes up to 6.


To generate a diff of this commit:
cvs rdiff -u -r1.926 -r1.927 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.146 -r1.147 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/counter-append.exp \
src/usr.bin/make/unit-tests/counter-append.mk
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/counter.mk

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.926 src/distrib/sets/lists/tests/mi:1.927
--- src/distrib/sets/lists/tests/mi:1.926	Wed Sep 23 03:06:38 2020
+++ src/distrib/sets/lists/tests/mi	Wed Sep 23 03:33:54 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.926 2020/09/23 03:06:38 rillig Exp $
+# $NetBSD: mi,v 1.927 2020/09/23 03:33:54 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4610,6 +4610,8 @@
 ./usr/tests/usr.bin/make/unit-tests/cond1.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cond2.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cond2.mk	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/counter-append.exptests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/counter-append.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/counter.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/counter.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-colon.exptests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.146 src/usr.bin/make/unit-tests/Makefile:1.147
--- src/usr.bin/make/unit-tests/Makefile:1.146	Wed Sep 23 03:06:38 2020
+++ src/usr.bin/make/unit-tests/Makefile	Wed Sep 23 03:33:55 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.146 2020/09/23 03:06:38 rillig Exp $
+# $NetBSD: Makefile,v 1.147 2020/09/23 03:33:55 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -71,6 +71,7 @@ TESTS+=		cond-undef-lint
 TESTS+=		cond1
 TESTS+=		cond2
 TESTS+=		counter
+TESTS+=		counter-append
 TESTS+=		dep
 TESTS+=		dep-colon
 TESTS+=		dep-double-colon
@@ -359,7 +360,6 @@ ENV.varmisc+=		FROM_ENV_AFTER=env
 # Override make flags for some of the tests; default is -k.
 # If possible, write ".MAKEFLAGS: -dv" in the test .mk file instead of
 # settings FLAGS.test=-dv here, since that is closer to the test code.
-FLAGS.counter=		-dv
 FLAGS.directive-ifmake=	first second
 FLAGS.doterror=		# none
 FLAGS.envfirst=		-e
@@ -398,6 +398,8 @@ SED_CMDS.varname-dot-shell+=	-e 's,\[/[^
 
 # Some tests need an additional round of postprocessing.
 POSTPROC.counter=	${TOOL_SED} -n -e '/:RELEVANT = yes/,/:RELEVANT = no/p'
+POSTPROC.counter-append= ${POSTPROC.counter}
+
 POSTPROC.deptgt-suffixes= \
 			${TOOL_SED} -n -e '/^\#\*\*\* Suffixes/,/^\#\*/p'
 POSTPROC.vardebug=	${TOOL_SED} -n -e '/:RELEVANT = yes/,/:RELEVANT = no/p'

Index: src/usr.bin/make/unit-tests/counter.mk
diff -u src/usr.bin/make/unit-tests/counter.mk:1.1 src/usr.bin/make/unit-tests/counter.mk:1.2
--- src/usr.bin/make/unit-tests/counter.mk:1.1	Sun Aug  2 14:53:02 2020
+++ src/usr.bin/make/unit-tests/counter.mk	Wed Sep 23 03:33:55 2020
@@ -1,7 +1,8 @@
-# $NetBSD: counter.mk,v 1.1 2020/08/02 14:53:02 rillig Exp $
+# $NetBSD: counter.mk,v 1.2 2020/09/23 03:33:55 rillig Exp $
 #
 # Demonstrates that it is not easily possible to let make count
-# the number of times a variable is actually accessed.
+# the number of times a variable is actually accessed, using the
+# ::= variable modifier.
 #
 # As of 2020-08-02, the counter ends up at having 4 words, even
 # though the NEXT variable is only accessed 3 times.  This is
@@ -11,6 +12,8 @@
 # get fully expanded.  For example, A does not simply contain the
 # value "1" but an additional unexpanded ${COUNTER:...} before it.
 
+.MAKEFLAGS: -dv
+
 RELEVANT=	yes (load-time part)	# just to filter the output
 
 COUNTER=	# zero

Added files:

Index: src/usr.bin/make/unit-tests/counter-append.exp
diff -u /dev/null src/usr.bin/make/unit-tests/counter-append.exp:1.1
--- /dev/null	Wed Sep 23 03:33:55 2020
+++ src/usr.bin/make/unit-tests/counter-append.exp	Wed Sep 23 03:33:55 2020
@@ -0,0 +1,82 @@
+Global:RELEVANT = yes (load-time 

CVS commit: src

2020-09-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Sep 23 03:06:39 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/usr.bin/make: compat.c job.c make.h nonints.h targ.c
src/usr.bin/make/unit-tests: Makefile deptgt-end.mk
Added Files:
src/usr.bin/make/unit-tests: deptgt-end-jobs.exp deptgt-end-jobs.mk

Log Message:
make(1): fix assertion failure in -j mode with .END node

There had been two separate global variables for the .END node, and in
parallel mode, only the one in jobs.c was initialized.

The code in JobRun heads over to Compat_Make without calling Compat_Run
first, which left the variable ENDNode uninitialized.


To generate a diff of this commit:
cvs rdiff -u -r1.925 -r1.926 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.148 -r1.149 src/usr.bin/make/compat.c
cvs rdiff -u -r1.234 -r1.235 src/usr.bin/make/job.c
cvs rdiff -u -r1.144 -r1.145 src/usr.bin/make/make.h
cvs rdiff -u -r1.126 -r1.127 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.89 -r1.90 src/usr.bin/make/targ.c
cvs rdiff -u -r1.145 -r1.146 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/deptgt-end-jobs.exp \
src/usr.bin/make/unit-tests/deptgt-end-jobs.mk
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/deptgt-end.mk

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.925 src/distrib/sets/lists/tests/mi:1.926
--- src/distrib/sets/lists/tests/mi:1.925	Tue Sep 22 01:09:33 2020
+++ src/distrib/sets/lists/tests/mi	Wed Sep 23 03:06:38 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.925 2020/09/22 01:09:33 kamil Exp $
+# $NetBSD: mi,v 1.926 2020/09/23 03:06:38 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4670,6 +4670,8 @@
 ./usr/tests/usr.bin/make/unit-tests/deptgt-default.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/deptgt-delete_on_error.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/deptgt-delete_on_error.mk			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/deptgt-end-jobs.exptests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/deptgt-end-jobs.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/deptgt-end.exptests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/deptgt-end.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/deptgt-error.exptests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.148 src/usr.bin/make/compat.c:1.149
--- src/usr.bin/make/compat.c:1.148	Tue Sep 22 20:19:46 2020
+++ src/usr.bin/make/compat.c	Wed Sep 23 03:06:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.148 2020/09/22 20:19:46 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.149 2020/09/23 03:06:38 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -99,10 +99,9 @@
 #include"pathnames.h"
 
 /*	"@(#)compat.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: compat.c,v 1.148 2020/09/22 20:19:46 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.149 2020/09/23 03:06:38 rillig Exp $");
 
 static GNode	*curTarg = NULL;
-static GNode	*ENDNode;
 static void CompatInterrupt(int);
 static pid_t compatChild;
 static int compatSigno;
@@ -226,10 +225,12 @@ Compat_RunCommand(char *cmdp, struct GNo
 cmd = cmdStart;
 LstNode_Set(cmdNode, cmdStart);
 
-if ((gn->type & OP_SAVE_CMDS) && (gn != ENDNode)) {
-	assert(ENDNode != NULL);
-	Lst_Append(ENDNode->commands, cmdStart);
-	return 0;
+if (gn->type & OP_SAVE_CMDS) {
+	GNode *endNode = Targ_GetEndNode();
+	if (gn != endNode) {
+	Lst_Append(endNode->commands, cmdStart);
+	return 0;
+	}
 }
 if (strcmp(cmdStart, "...") == 0) {
 	gn->type |= OP_SAVE_CMDS;
@@ -682,8 +683,10 @@ Compat_Run(GNodeList *targs)
 	bmake_signal(SIGQUIT, CompatInterrupt);
 }
 
-ENDNode = Targ_FindNode(".END", TARG_CREATE);
-ENDNode->type = OP_SPECIAL;
+/* Create the .END node now, to keep the (debug) output of the
+ * counter.mk test the same as before 2020-09-23.  This implementation
+ * detail probably doesn't matter though. */
+(void)Targ_GetEndNode();
 /*
  * If the user has defined a .BEGIN target, execute the commands attached
  * to it.
@@ -732,7 +735,9 @@ Compat_Run(GNodeList *targs)
  * If the user has defined a .END target, run its commands.
  */
 if (errors == 0) {
-	Compat_Make(ENDNode, ENDNode);
+GNode *endNode = Targ_GetEndNode();
+	Compat_Make(endNode, endNode);
+	/* XXX: Did you mean endNode->made instead of gn->made? */
 	if (gn->made == ERROR) {
 	PrintOnError(gn, "\nStop.");
 	exit(1);

Index: src/usr.bin/make/job.c

CVS commit: src/usr.sbin/ifwatchd

2020-09-22 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Sep 23 02:32:04 UTC 2020

Modified Files:
src/usr.sbin/ifwatchd: ifwatchd.c

Log Message:
ifwatchd: Check link state if no media is supported on initial ups.

We can check this via SIOCGIFDATA and ifi_link_state.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/usr.sbin/ifwatchd/ifwatchd.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.sbin/ifwatchd/ifwatchd.c
diff -u src/usr.sbin/ifwatchd/ifwatchd.c:1.43 src/usr.sbin/ifwatchd/ifwatchd.c:1.44
--- src/usr.sbin/ifwatchd/ifwatchd.c:1.43	Wed Mar  7 10:06:41 2018
+++ src/usr.sbin/ifwatchd/ifwatchd.c	Wed Sep 23 02:32:04 2020
@@ -1,6 +1,6 @@
-/*	$NetBSD: ifwatchd.c,v 1.43 2018/03/07 10:06:41 roy Exp $	*/
+/*	$NetBSD: ifwatchd.c,v 1.44 2020/09/23 02:32:04 roy Exp $	*/
 #include 
-__RCSID("$NetBSD: ifwatchd.c,v 1.43 2018/03/07 10:06:41 roy Exp $");
+__RCSID("$NetBSD: ifwatchd.c,v 1.44 2020/09/23 02:32:04 roy Exp $");
 
 /*-
  * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -536,6 +536,40 @@ find_interface(int idx)
 	return NULL;
 }
 
+static bool
+has_carrier(int s, const char *ifname)
+{
+	struct ifmediareq ifmr = { .ifm_status = 0 };
+
+	strlcpy(ifmr.ifm_name, ifname, sizeof(ifmr.ifm_name));
+	if (ioctl(s, SIOCGIFMEDIA, ) == -1) {
+		struct ifdatareq ifdr = { .ifdr_data.ifi_link_state = 0 };
+
+		strlcpy(ifdr.ifdr_name, ifname, sizeof(ifdr.ifdr_name));
+		if (ioctl(s, SIOCGIFDATA, ) == -1) {
+			/* Should not be possible. */
+			return false;
+		}
+		if (ifdr.ifdr_data.ifi_link_state == LINK_STATE_UP)
+			return true;
+		else
+			return false;
+	}
+
+	if (!(ifmr.ifm_status & IFM_AVALID)) {
+		/*
+		 * Interface doesn't report media-valid status.
+		 * assume ok.
+		 */
+		return true;
+	}
+
+	if (ifmr.ifm_status & IFM_ACTIVE)
+		return true;
+	else
+		return false;
+}
+
 static void
 run_initial_ups(void)
 {
@@ -568,18 +602,11 @@ run_initial_ups(void)
 		if (ifa == NULL)
 			continue;
 		if (ifa->sa_family == AF_LINK) {
-			struct ifmediareq ifmr;
-
-			memset(, 0, sizeof(ifmr));
-			strncpy(ifmr.ifm_name, ifd->ifname,
-			sizeof(ifmr.ifm_name));
-			if (ioctl(s, SIOCGIFMEDIA, ) != -1
-			&& (ifmr.ifm_status & IFM_AVALID)
-			&& (ifmr.ifm_status & IFM_ACTIVE)) {
+			if (has_carrier(s, ifd->ifname) == 0) {
 invoke_script(ifd->ifname, CARRIER, NULL, NULL);
 ifd->last_carrier_status =
 LINK_STATE_UP;
-			}
+			}
 			continue;
 		}
 		aflag = check_addrflags(ifa->sa_family, p->ifa_addrflags);



CVS commit: src/sbin/ifconfig

2020-09-22 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Sep 23 02:09:18 UTC 2020

Modified Files:
src/sbin/ifconfig: ifconfig.8 ifconfig.c

Log Message:
ifconfig: teach carrier test about ifi_link_state from SIOCGIFDATA

Because not all interfaces support media.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sbin/ifconfig/ifconfig.8
cvs rdiff -u -r1.243 -r1.244 src/sbin/ifconfig/ifconfig.c

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

Modified files:

Index: src/sbin/ifconfig/ifconfig.8
diff -u src/sbin/ifconfig/ifconfig.8:1.119 src/sbin/ifconfig/ifconfig.8:1.120
--- src/sbin/ifconfig/ifconfig.8:1.119	Mon Jul  8 03:04:15 2019
+++ src/sbin/ifconfig/ifconfig.8	Wed Sep 23 02:09:18 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ifconfig.8,v 1.119 2019/07/08 03:04:15 msaitoh Exp $
+.\"	$NetBSD: ifconfig.8,v 1.120 2020/09/23 02:09:18 roy Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)ifconfig.8	8.4 (Berkeley) 6/1/94
 .\"
-.Dd July 8, 2019
+.Dd September 23, 2020
 .Dt IFCONFIG 8
 .Os
 .Sh NAME
@@ -757,12 +757,17 @@ not appear to be connected to a network,
 .Nm
 will exit with status of 1
 .Pq false ;
-otherwise, it will exit with a
-zero
+otherwise, it will exit with a zero
+.Pq true
+exit status.
+For interface drivers that do not support media status reporting.
+then if the link state is not reported to be up,
+.Nm
+will exit with a status of 1
+.Pq false ;
+otherwise, it will exit with a zero
 .Pq true
 exit status.
-Not all interface drivers support media
-status reporting.
 .Pp
 If the
 .Fl m

Index: src/sbin/ifconfig/ifconfig.c
diff -u src/sbin/ifconfig/ifconfig.c:1.243 src/sbin/ifconfig/ifconfig.c:1.244
--- src/sbin/ifconfig/ifconfig.c:1.243	Tue Sep 22 14:14:17 2020
+++ src/sbin/ifconfig/ifconfig.c	Wed Sep 23 02:09:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ifconfig.c,v 1.243 2020/09/22 14:14:17 roy Exp $	*/
+/*	$NetBSD: ifconfig.c,v 1.244 2020/09/23 02:09:18 roy Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1983, 1993\
  The Regents of the University of California.  All rights reserved.");
-__RCSID("$NetBSD: ifconfig.c,v 1.243 2020/09/22 14:14:17 roy Exp $");
+__RCSID("$NetBSD: ifconfig.c,v 1.244 2020/09/23 02:09:18 roy Exp $");
 #endif /* not lint */
 
 #include 
@@ -1213,16 +1213,21 @@ setifmtu(prop_dictionary_t env, prop_dic
 static int
 carrier(prop_dictionary_t env)
 {
-	struct ifmediareq ifmr;
-
-	memset(, 0, sizeof(ifmr));
+	struct ifmediareq ifmr = { .ifm_status = 0 };
 
 	if (direct_ioctl(env, SIOCGIFMEDIA, ) == -1) {
 		/*
 		 * Interface doesn't support SIOC{G,S}IFMEDIA;
-		 * assume ok.
+		 * check link state.
 		 */
-		return EXIT_SUCCESS;
+		struct ifdatareq ifdr = { .ifdr_data.ifi_link_state = 0 };
+
+		if (direct_ioctl(env, SIOCGIFDATA, ) == -1)
+			return EXIT_FAILURE;
+		if (ifdr.ifdr_data.ifi_link_state == LINK_STATE_UP)
+			return EXIT_SUCCESS;
+		else
+			return EXIT_FAILURE;
 	}
 	if ((ifmr.ifm_status & IFM_AVALID) == 0) {
 		/*



CVS commit: src/sys/arch/alpha/include

2020-09-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Sep 23 00:52:49 UTC 2020

Modified Files:
src/sys/arch/alpha/include: mutex.h

Log Message:
Move the compile-time assert outside of the __MUTEX_PRIVATE guard.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/alpha/include/mutex.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/arch/alpha/include/mutex.h
diff -u src/sys/arch/alpha/include/mutex.h:1.7 src/sys/arch/alpha/include/mutex.h:1.8
--- src/sys/arch/alpha/include/mutex.h:1.7	Wed Sep 23 00:51:59 2020
+++ src/sys/arch/alpha/include/mutex.h	Wed Sep 23 00:52:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mutex.h,v 1.7 2020/09/23 00:51:59 thorpej Exp $	*/
+/*	$NetBSD: mutex.h,v 1.8 2020/09/23 00:52:49 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007 The NetBSD Foundation, Inc.
@@ -52,8 +52,6 @@ struct kmutex {
 	} u;
 };
 
-__CTASSERT(sizeof(struct kmutex) == sizeof(uintptr_t));
-
 #define	mtx_owner 			u.mtxa_owner
 #define	mtx_flags 			u.s.mtxs_flags
 #define	mtx_ipl 			u.s.mtxs_ipl
@@ -68,4 +66,6 @@ int	_lock_cas(volatile uintptr_t *, uint
 
 #endif	/* __MUTEX_PRIVATE */
 
+__CTASSERT(sizeof(struct kmutex) == sizeof(uintptr_t));
+
 #endif /* _ALPHA_MUTEX_H_ */



CVS commit: src/sys/arch/alpha/include

2020-09-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Sep 23 00:51:59 UTC 2020

Modified Files:
src/sys/arch/alpha/include: mutex.h

Log Message:
Move the simple lock used for spin mutexes into the sub-structure that
contains the spin lock IPL field.  This shrinks kmutex_t to sizeof(uintptr_t)
on Alpha.

This should have been done in rev 1.3 when the lock ID field was removed,
but better late than never, I guess.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/alpha/include/mutex.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/arch/alpha/include/mutex.h
diff -u src/sys/arch/alpha/include/mutex.h:1.6 src/sys/arch/alpha/include/mutex.h:1.7
--- src/sys/arch/alpha/include/mutex.h:1.6	Fri Nov 29 22:55:33 2019
+++ src/sys/arch/alpha/include/mutex.h	Wed Sep 23 00:51:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mutex.h,v 1.6 2019/11/29 22:55:33 riastradh Exp $	*/
+/*	$NetBSD: mutex.h,v 1.7 2020/09/23 00:51:59 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007 The NetBSD Foundation, Inc.
@@ -36,7 +36,6 @@
 
 struct kmutex {
 	uintptr_t	mtx_pad1;
-	uint32_t	mtx_pad2;
 };
 
 #else	/* __MUTEX_PRIVATE */
@@ -48,14 +47,17 @@ struct kmutex {
 			volatile uint8_t	mtxs_flags;
 			ipl_cookie_t		mtxs_ipl;
 			volatile uint16_t	mtxs_unused;
+			__cpu_simple_lock_t	mtxs_lock;
 		} s;
 	} u;
-	__cpu_simple_lock_t	mtx_lock;
 };
 
+__CTASSERT(sizeof(struct kmutex) == sizeof(uintptr_t));
+
 #define	mtx_owner 			u.mtxa_owner
 #define	mtx_flags 			u.s.mtxs_flags
 #define	mtx_ipl 			u.s.mtxs_ipl
+#define	mtx_lock 			u.s.mtxs_lock
 
 #define	__HAVE_SIMPLE_MUTEXES		1
 #define	__HAVE_MUTEX_STUBS		1



CVS commit: src/sys/arch/alpha/pci

2020-09-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Sep 23 00:46:17 UTC 2020

Modified Files:
src/sys/arch/alpha/pci: tsreg.h

Log Message:
Define some additional Cchip registers.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/alpha/pci/tsreg.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/arch/alpha/pci/tsreg.h
diff -u src/sys/arch/alpha/pci/tsreg.h:1.7 src/sys/arch/alpha/pci/tsreg.h:1.8
--- src/sys/arch/alpha/pci/tsreg.h:1.7	Fri Feb 21 12:23:30 2014
+++ src/sys/arch/alpha/pci/tsreg.h	Wed Sep 23 00:46:17 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: tsreg.h,v 1.7 2014/02/21 12:23:30 jdc Exp $ */
+/* $NetBSD: tsreg.h,v 1.8 2020/09/23 00:46:17 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 by Ross Harvey.  All rights reserved.
@@ -124,6 +124,12 @@
 
 #define TS_C_TTR	0x101##a000##0580UL
 #define TS_C_TDR	0x101##a000##05c0UL
+#define TS_C_DIM2	0x101##a000##0600UL
+#define TS_C_DIM3	0x101##a000##0640UL
+#define TS_C_DIR2	0x101##a000##0680UL
+#define TS_C_DIR3	0x101##a000##06c0UL
+#define TS_C_IIC2	0x101##a000##0700UL
+#define TS_C_IIC3	0x101##a000##0740UL
 
 /*
  * Dchip CSR Map



CVS commit: xsrc/external/mit/ctwm/dist

2020-09-22 Thread Nia Alarie
Module Name:xsrc
Committed By:   nia
Date:   Tue Sep 22 23:20:59 UTC 2020

Modified Files:
xsrc/external/mit/ctwm/dist: system.ctwmrc

Log Message:
avoid stippling effect in titlebars


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 xsrc/external/mit/ctwm/dist/system.ctwmrc

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

Modified files:

Index: xsrc/external/mit/ctwm/dist/system.ctwmrc
diff -u xsrc/external/mit/ctwm/dist/system.ctwmrc:1.3 xsrc/external/mit/ctwm/dist/system.ctwmrc:1.4
--- xsrc/external/mit/ctwm/dist/system.ctwmrc:1.3	Tue Sep 22 21:28:10 2020
+++ xsrc/external/mit/ctwm/dist/system.ctwmrc	Tue Sep 22 23:20:59 2020
@@ -1,5 +1,5 @@
 #
-# $NetBSD: system.ctwmrc,v 1.3 2020/09/22 21:28:10 nia Exp $
+# $NetBSD: system.ctwmrc,v 1.4 2020/09/22 23:20:59 nia Exp $
 #
 # ctwmrc by nia
 #
@@ -93,6 +93,8 @@ NoTitleFocus
 WindowRing
 WarpRingOnScreen
 
+NoTitleHighlight
+
 TitleButtonShadowDepth1
 TitleShadowDepth  1
 TitleButtonBorderWidth0



CVS commit: src/distrib/sets/lists/comp

2020-09-22 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Sep 22 23:12:06 UTC 2020

Modified Files:
src/distrib/sets/lists/comp: mi

Log Message:
remove getentropy


To generate a diff of this commit:
cvs rdiff -u -r1.2356 -r1.2357 src/distrib/sets/lists/comp/mi

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2356 src/distrib/sets/lists/comp/mi:1.2357
--- src/distrib/sets/lists/comp/mi:1.2356	Tue Sep 15 07:00:03 2020
+++ src/distrib/sets/lists/comp/mi	Tue Sep 22 23:12:06 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2356 2020/09/15 07:00:03 mrg Exp $
+#	$NetBSD: mi,v 1.2357 2020/09/22 23:12:06 nia Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -7408,7 +7408,6 @@
 ./usr/share/man/cat3/getdiskrawname.0		comp-c-catman		.cat
 ./usr/share/man/cat3/getdomainname.0		comp-c-catman		.cat
 ./usr/share/man/cat3/getdtablesize.0		comp-c-catman		.cat
-./usr/share/man/cat3/getentropy.0		comp-c-catman		.cat
 ./usr/share/man/cat3/getenv.0			comp-c-catman		.cat
 ./usr/share/man/cat3/getenv_r.0			comp-c-catman		.cat
 ./usr/share/man/cat3/getfsent.0			comp-c-catman		.cat
@@ -15659,7 +15658,6 @@
 ./usr/share/man/html3/getdiskrawname.html	comp-c-htmlman		html
 ./usr/share/man/html3/getdomainname.html	comp-c-htmlman		html
 ./usr/share/man/html3/getdtablesize.html	comp-c-htmlman		html
-./usr/share/man/html3/getentropy.html		comp-c-htmlman		html
 ./usr/share/man/html3/getenv.html		comp-c-htmlman		html
 ./usr/share/man/html3/getenv_r.html		comp-c-htmlman		html
 ./usr/share/man/html3/getfsent.html		comp-c-htmlman		html
@@ -23847,7 +23845,6 @@
 ./usr/share/man/man3/getdiskrawname.3		comp-c-man		.man
 ./usr/share/man/man3/getdomainname.3		comp-c-man		.man
 ./usr/share/man/man3/getdtablesize.3		comp-c-man		.man
-./usr/share/man/man3/getentropy.3		comp-c-man		.man
 ./usr/share/man/man3/getenv.3			comp-c-man		.man
 ./usr/share/man/man3/getenv_r.3			comp-c-man		.man
 ./usr/share/man/man3/getfsent.3			comp-c-man		.man



CVS commit: src/lib/libc/include

2020-09-22 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Sep 22 21:38:50 UTC 2020

Modified Files:
src/lib/libc/include: namespace.h

Log Message:
remove getentropy bits


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/lib/libc/include/namespace.h

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

Modified files:

Index: src/lib/libc/include/namespace.h
diff -u src/lib/libc/include/namespace.h:1.199 src/lib/libc/include/namespace.h:1.200
--- src/lib/libc/include/namespace.h:1.199	Wed May  6 16:17:36 2020
+++ src/lib/libc/include/namespace.h	Tue Sep 22 21:38:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: namespace.h,v 1.199 2020/05/06 16:17:36 nia Exp $	*/
+/*	$NetBSD: namespace.h,v 1.200 2020/09/22 21:38:50 nia Exp $	*/
 
 /*-
  * Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
@@ -362,7 +362,6 @@
 #define getdevmajor		_getdevmajor
 #define getdiskbyname		_getdiskbyname
 #define getdomainname		_getdomainname
-#define getentropy		_getentropy
 #define getfsent		_getfsent
 #define getfsfile		_getfsfile
 #define getfsspec		_getfsspec



CVS commit: src

2020-09-22 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Sep 22 21:37:47 UTC 2020

Modified Files:
src/include: unistd.h
src/lib/libc/gen: Makefile.inc
Removed Files:
src/lib/libc/gen: getentropy.3 getentropy.c

Log Message:
remove getentropy bits


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/include/unistd.h
cvs rdiff -u -r1.205 -r1.206 src/lib/libc/gen/Makefile.inc
cvs rdiff -u -r1.2 -r0 src/lib/libc/gen/getentropy.3
cvs rdiff -u -r1.1 -r0 src/lib/libc/gen/getentropy.c

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

Modified files:

Index: src/include/unistd.h
diff -u src/include/unistd.h:1.158 src/include/unistd.h:1.159
--- src/include/unistd.h:1.158	Sat May 16 18:31:47 2020
+++ src/include/unistd.h	Tue Sep 22 21:37:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: unistd.h,v 1.158 2020/05/16 18:31:47 christos Exp $	*/
+/*	$NetBSD: unistd.h,v 1.159 2020/09/22 21:37:47 nia Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2008 The NetBSD Foundation, Inc.
@@ -338,7 +338,6 @@ int	 fchroot(int);
 int	 fdiscard(int, off_t, off_t);
 int	 fsync_range(int, int, off_t, off_t);
 int	 getdomainname(char *, size_t);
-int	 getentropy(void *, size_t);
 int	 getgrouplist(const char *, gid_t, gid_t *, int *);
 int	 getgroupmembership(const char *, gid_t, gid_t *, int, int *);
 mode_t	 getmode(const void *, mode_t);

Index: src/lib/libc/gen/Makefile.inc
diff -u src/lib/libc/gen/Makefile.inc:1.205 src/lib/libc/gen/Makefile.inc:1.206
--- src/lib/libc/gen/Makefile.inc:1.205	Sun Jul  5 01:09:48 2020
+++ src/lib/libc/gen/Makefile.inc	Tue Sep 22 21:37:47 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.205 2020/07/05 01:09:48 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.206 2020/09/22 21:37:47 nia Exp $
 #	from: @(#)Makefile.inc	8.6 (Berkeley) 5/4/95
 
 # gen sources
@@ -60,7 +60,7 @@ MAN+=	alarm.3 arc4random.3 basename.3 bs
 	fmtcheck.3 fmtmsg.3 fnmatch.3 fpclassify.3 fpgetmask.3 \
 	ftok.3 fts.3 ftw.3 \
 	getbsize.3 cgetcap.3 getcwd.3 getdevmajor.3 \
-	getdomainname.3 getdiskbyname.3 getentropy.3 getfsent.3 \
+	getdomainname.3 getdiskbyname.3 getfsent.3 \
 	getgrent.3 getgrouplist.3 gethostname.3 getlastlogx.3 getloadavg.3 \
 	getmntinfo.3 getnetgrent.3 getpagesize.3 getpass.3 \
 	getprogname.3 getpwent.3 getttyent.3 getusershell.3 glob.3 \



CVS commit: xsrc/external/mit/ctwm/dist

2020-09-22 Thread Nia Alarie
Module Name:xsrc
Committed By:   nia
Date:   Tue Sep 22 21:28:10 UTC 2020

Modified Files:
xsrc/external/mit/ctwm/dist: system.ctwmrc

Log Message:
add menu entries for workspace occupation


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 xsrc/external/mit/ctwm/dist/system.ctwmrc

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

Modified files:

Index: xsrc/external/mit/ctwm/dist/system.ctwmrc
diff -u xsrc/external/mit/ctwm/dist/system.ctwmrc:1.2 xsrc/external/mit/ctwm/dist/system.ctwmrc:1.3
--- xsrc/external/mit/ctwm/dist/system.ctwmrc:1.2	Tue Sep 22 21:08:56 2020
+++ xsrc/external/mit/ctwm/dist/system.ctwmrc	Tue Sep 22 21:28:10 2020
@@ -1,5 +1,5 @@
 #
-# $NetBSD: system.ctwmrc,v 1.2 2020/09/22 21:08:56 nia Exp $
+# $NetBSD: system.ctwmrc,v 1.3 2020/09/22 21:28:10 nia Exp $
 #
 # ctwmrc by nia
 #
@@ -211,6 +211,9 @@ menu "titleops"
 " Resize"  f.resize
 " Move"f.move
 "" f.separator
+" Occupy ..."  f.occupy
+" Occupy All"  f.occupyall
+"" f.separator
 " Raise"   f.raise
 " Lower"   f.lower
 "" f.separator



CVS commit: xsrc/external/mit/ctwm/dist

2020-09-22 Thread Nia Alarie
Module Name:xsrc
Committed By:   nia
Date:   Tue Sep 22 21:08:56 UTC 2020

Modified Files:
xsrc/external/mit/ctwm/dist: system.ctwmrc

Log Message:
replace default ctwmrc by mine from tech-x11


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 xsrc/external/mit/ctwm/dist/system.ctwmrc

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

Modified files:

Index: xsrc/external/mit/ctwm/dist/system.ctwmrc
diff -u xsrc/external/mit/ctwm/dist/system.ctwmrc:1.1 xsrc/external/mit/ctwm/dist/system.ctwmrc:1.2
--- xsrc/external/mit/ctwm/dist/system.ctwmrc:1.1	Thu Sep  3 22:16:33 2015
+++ xsrc/external/mit/ctwm/dist/system.ctwmrc	Tue Sep 22 21:08:56 2020
@@ -1,181 +1,375 @@
 #
-# $XConsortium: system.twmrc,v 1.8 91/04/23 21:10:58 gildea Exp $
+# $NetBSD: system.ctwmrc,v 1.2 2020/09/22 21:08:56 nia Exp $
 #
-# Default twm configuration file; needs to be kept small to conserve string
-# space in systems whose compilers don't handle medium-sized strings.
+# ctwmrc by nia
 #
-# Sites should tailor this file, providing any extra title buttons, menus, etc.
-# that may be appropriate for their environment.  For example, if most of the
-# users were accustomed to uwm, the defaults could be set up not to decorate
-# any windows and to use meta-keys.
+# An attempt to strike a usability balance that makes keys and buttons
+# do the thing users of various operating systems expect them to do.
+#
+# Most things should be possible to accomplish with only the keyboard.
+#
+# Also, mostly inoffensive colours (avoiding potentially inaccessible
+# combinations like red-green).
 #
 
-NoGrabServer
+# don't use the default buttons or key bindings, we define our own
+NoDefaults
+
+ShowWorkSpaceManager
+ShowIconManager
+
+# 3D icon managers do not seemingly honor IconManagerHighlight,
+# which makes them slightly less useful
+#UseThreeDIconManagers
+#UseThreeDWMap
+UseThreeDBorders
+#UseThreeDMenus
+UseThreeDTitles
+
+ThreeDBorderWidth 3
+
+# TODO: we can use syscmd() in combination with xdpyinfo to detect
+# HiDPI screens and set appropiate fonts.
+#
+# need some good scaled bitmap fonts imported - terminus or spleen
+# would be good candidates
+MenuFont "-misc-fixed-medium-r-*-*-14-*-*-*-*-*-*-*"
+TitleFont"-misc-fixed-bold-r-*-*-18-*-*-*-*-*-*-*"
+IconManagerFont  "-misc-fixed-medium-r-*-*-14-*-*-*-*-*-*-*"
+IconFont "-misc-fixed-bold-r-*-*-18-*-*-*-*-*-*-*"
+ResizeFont   "-misc-fixed-medium-r-*-*-18-*-*-*-*-*-*-*"
+WorkSpaceFont"-misc-fixed-medium-r-*-*-14-*-*-*-*-*-*-*"
+
 RestartPreviousState
+
 DecorateTransients
-TitleFont	"-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*"
-ResizeFont	"-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*"
-MenuFont	"-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*"
-IconFont	"-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*"
-IconManagerFont	"-adobe-helvetica-bold-r-normal--*-100-*-*-*"
-ShowWorkSpaceManager			# start with workspace manager up
-UseThreeDMenus
-UseThreeDTitles
-UseThreeDIconManagers
-UseThreeDBorders
-UseThreeDWMap
-SunkFocusWindowTitle
 
-WorkSpaceManagerGeometry"360x60+60-0" 4
-WorkSpaces {
-"One"   {"#686B9F" "white" "DeepSkyBlue3" "white" "xpm:background8.xpm"}
-"Two"   {"#619AAE" "white" "firebrick" "white" "plaid"}
-"Three" {"#727786" "white" "brown"}
-"Four"  {"#8C5b7A" "white" "MidnightBlue"}
-
-"Five"  {"#727786" "white" "firebrick"}
-"Six"   {"#619AAE" "white" "DeepSkyBlue3"}
-"Seven" {"#8C5b7A" "white" "chartreuse4"}
-"Eight" {"#686B9F" "white" "MidnightBlue"}
+# hide window contents while altering windows for performance
+NoOpaqueMove
+NoOpaqueResize
+
+SloppyFocus
+
+AutoOccupy
+AutoRelativeResize
+
+CenterFeedbackWindow
+
+NoGrabServer
+
+RaiseOnClick
+
+DontMoveOff
+MoveOffResistance	  150
+
+ConstrainedMoveTime   0
+
+IgnoreLockModifier
+
+# Not actually that random.
+# Means that windows do not have to be placed by hand with a mouse,
+# which helps if you are using a keyboard only.
+RandomPlacement  "on"
+
+MoveDelta 3
+ClearShadowContrast   50
+DarkShadowContrast50
+MovePackResistance100
+
+RaiseWhenAutoUnSqueeze
+ShortAllWindowsMenus
+
+#BeNiceToColorMap
+
+NoStackMode
+
+StayUpMenus
+WarpToDefaultMenuEntry
+MenuShadowDepth  1
+
+NoTitleFocus
+
+# warp through all windows in the current workspace
+WindowRing
+WarpRingOnScreen
+
+TitleButtonShadowDepth1
+TitleShadowDepth  1
+TitleButtonBorderWidth0
+TitlePadding  0
+TitleJustification"left"
+ButtonIndent  0
+FramePadding		  0
+
+LeftTitleButton   ":xpm:dot"  = f.menu "titleops"
+RightTitleButton  ":xpm:resize"   = f.resize
+RightTitleButton  ":xpm:cross"= f.delete
+
+BorderWidth   4
+BorderShadowDepth 2
+BorderResizeCursors
+
+MaxIconTitleWidth 120
+NoIconManagerFocus
+IconManagerShadowDepth 

CVS commit: src/usr.bin/make

2020-09-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Sep 22 20:23:57 UTC 2020

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

Log Message:
make(1): condense code in Var_Subst


To generate a diff of this commit:
cvs rdiff -u -r1.533 -r1.534 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.533 src/usr.bin/make/var.c:1.534
--- src/usr.bin/make/var.c:1.533	Tue Sep 22 20:19:46 2020
+++ src/usr.bin/make/var.c	Tue Sep 22 20:23:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.533 2020/09/22 20:19:46 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.534 2020/09/22 20:23:57 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
 #include"metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.533 2020/09/22 20:19:46 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.534 2020/09/22 20:23:57 rillig Exp $");
 
 #define VAR_DEBUG_IF(cond, fmt, ...)	\
 if (!(DEBUG(VAR) && (cond)))	\
@@ -3793,12 +3793,8 @@ Var_Subst(const char *str, GNode *ctxt, 
 		str++;
 		}
 	} else {
-		size_t val_len;
-
 		str = nested_str;
-
-		val_len = strlen(val);
-		Buf_AddBytes(, val, val_len);
+		Buf_AddStr(, val);
 	}
 	free(freeIt);
 	freeIt = NULL;



CVS commit: src/usr.bin/make

2020-09-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Sep 22 20:19:46 UTC 2020

Modified Files:
src/usr.bin/make: arch.c compat.c for.c job.c main.c make.c meta.c
nonints.h parse.c suff.c var.c

Log Message:
make(1): prepare Var_Subst for proper error handling

Returning a VarParseResult instead of a string makes it possible to let
the error bubble up, until it reaches the main expression.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/usr.bin/make/arch.c
cvs rdiff -u -r1.147 -r1.148 src/usr.bin/make/compat.c
cvs rdiff -u -r1.84 -r1.85 src/usr.bin/make/for.c
cvs rdiff -u -r1.233 -r1.234 src/usr.bin/make/job.c
cvs rdiff -u -r1.340 -r1.341 src/usr.bin/make/main.c
cvs rdiff -u -r1.137 -r1.138 src/usr.bin/make/make.c
cvs rdiff -u -r1.116 -r1.117 src/usr.bin/make/meta.c
cvs rdiff -u -r1.125 -r1.126 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.322 -r1.323 src/usr.bin/make/parse.c
cvs rdiff -u -r1.157 -r1.158 src/usr.bin/make/suff.c
cvs rdiff -u -r1.532 -r1.533 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/arch.c
diff -u src/usr.bin/make/arch.c:1.117 src/usr.bin/make/arch.c:1.118
--- src/usr.bin/make/arch.c:1.117	Tue Sep 22 04:05:41 2020
+++ src/usr.bin/make/arch.c	Tue Sep 22 20:19:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.117 2020/09/22 04:05:41 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.118 2020/09/22 20:19:46 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -133,7 +133,7 @@
 #include"config.h"
 
 /*	"@(#)arch.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: arch.c,v 1.117 2020/09/22 04:05:41 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.118 2020/09/22 20:19:46 rillig Exp $");
 
 #ifdef TARGET_MACHINE
 #undef MAKE_MACHINE
@@ -247,7 +247,8 @@ Arch_ParseArchive(char **linePtr, GNodeL
 
 *cp++ = '\0';
 if (subLibName) {
-	libName = Var_Subst(libName, ctxt, VARE_UNDEFERR|VARE_WANTRES);
+	(void)Var_Subst(libName, ctxt, VARE_UNDEFERR|VARE_WANTRES, );
+	/* TODO: handle errors */
 }
 
 
@@ -327,7 +328,9 @@ Arch_ParseArchive(char **linePtr, GNodeL
 	char*sacrifice;
 	char*oldMemName = memName;
 
-	memName = Var_Subst(memName, ctxt, VARE_UNDEFERR | VARE_WANTRES);
+	(void)Var_Subst(memName, ctxt, VARE_UNDEFERR | VARE_WANTRES,
+			);
+	/* TODO: handle errors */
 
 	/*
 	 * Now form an archive spec and recurse to deal with nested

Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.147 src/usr.bin/make/compat.c:1.148
--- src/usr.bin/make/compat.c:1.147	Tue Sep 22 04:05:41 2020
+++ src/usr.bin/make/compat.c	Tue Sep 22 20:19:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.147 2020/09/22 04:05:41 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.148 2020/09/22 20:19:46 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -99,7 +99,7 @@
 #include"pathnames.h"
 
 /*	"@(#)compat.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: compat.c,v 1.147 2020/09/22 04:05:41 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.148 2020/09/22 20:19:46 rillig Exp $");
 
 static GNode	*curTarg = NULL;
 static GNode	*ENDNode;
@@ -209,7 +209,8 @@ Compat_RunCommand(char *cmdp, struct GNo
 doIt = FALSE;
 
 cmdNode = Lst_FindDatum(gn->commands, cmd);
-cmdStart = Var_Subst(cmd, gn, VARE_WANTRES);
+(void)Var_Subst(cmd, gn, VARE_WANTRES, );
+/* TODO: handle errors */
 
 /*
  * brk_string will return an argv with a NULL in av[0], thus causing

Index: src/usr.bin/make/for.c
diff -u src/usr.bin/make/for.c:1.84 src/usr.bin/make/for.c:1.85
--- src/usr.bin/make/for.c:1.84	Mon Sep 14 20:43:44 2020
+++ src/usr.bin/make/for.c	Tue Sep 22 20:19:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: for.c,v 1.84 2020/09/14 20:43:44 rillig Exp $	*/
+/*	$NetBSD: for.c,v 1.85 2020/09/22 20:19:46 rillig Exp $	*/
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -60,7 +60,7 @@
 #include"strlist.h"
 
 /*	"@(#)for.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: for.c,v 1.84 2020/09/14 20:43:44 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.85 2020/09/22 20:19:46 rillig Exp $");
 
 typedef enum {
 FOR_SUB_ESCAPE_CHAR = 0x0001,
@@ -190,7 +190,9 @@ For_Eval(const char *line)
  * we will be substituting into ${...} or $(...).
  */
 {
-	char *items = Var_Subst(ptr, VAR_GLOBAL, VARE_WANTRES);
+	char *items;
+	(void)Var_Subst(ptr, VAR_GLOBAL, VARE_WANTRES, );
+	/* TODO: handle errors */
 	words = Str_Words(items, FALSE);
 	free(items);
 }

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.233 src/usr.bin/make/job.c:1.234
--- src/usr.bin/make/job.c:1.233	Mon Sep 21 17:44:25 2020
+++ src/usr.bin/make/job.c	Tue Sep 22 20:19:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.233 2020/09/21 17:44:25 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.234 2020/09/22 20:19:46 rillig Exp $	*/
 

CVS commit: src/usr.bin/make

2020-09-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Sep 22 19:51:19 UTC 2020

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

Log Message:
make(1): fix unnecessary length limitation for -v option


To generate a diff of this commit:
cvs rdiff -u -r1.339 -r1.340 src/usr.bin/make/main.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/main.c
diff -u src/usr.bin/make/main.c:1.339 src/usr.bin/make/main.c:1.340
--- src/usr.bin/make/main.c:1.339	Tue Sep 22 05:12:08 2020
+++ src/usr.bin/make/main.c	Tue Sep 22 19:51:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.339 2020/09/22 05:12:08 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.340 2020/09/22 19:51:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -126,7 +126,7 @@
 #endif
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.339 2020/09/22 05:12:08 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.340 2020/09/22 19:51:19 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\
  The Regents of the University of California.  All rights reserved.");
@@ -867,13 +867,9 @@ doPrintVars(void)
 		if (strchr(var, '$')) {
 			value = p1 = Var_Subst(var, VAR_GLOBAL, VARE_WANTRES);
 		} else if (expandVars) {
-			char tmp[128];
-			int len = snprintf(tmp, sizeof(tmp), "${%s}", var);
-
-			if (len >= (int)sizeof(tmp))
-Fatal("%s: variable name too big: %s",
-progname, var);
-			value = p1 = Var_Subst(tmp, VAR_GLOBAL, VARE_WANTRES);
+			char *expr = str_concat3("${", var, "}");
+			value = p1 = Var_Subst(expr, VAR_GLOBAL, VARE_WANTRES);
+			free(expr);
 		} else {
 			value = Var_Value(var, VAR_GLOBAL, );
 		}



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

2020-09-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Sep 22 19:41:09 UTC 2020

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

Log Message:
make(1): add test for unintended double expansion of deferred commands


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/deptgt-end.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/deptgt-end.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-end.exp
diff -u src/usr.bin/make/unit-tests/deptgt-end.exp:1.2 src/usr.bin/make/unit-tests/deptgt-end.exp:1.3
--- src/usr.bin/make/unit-tests/deptgt-end.exp:1.2	Sat Aug 29 17:34:21 2020
+++ src/usr.bin/make/unit-tests/deptgt-end.exp	Tue Sep 22 19:41:09 2020
@@ -1,4 +1,7 @@
-: .BEGIN
-: all
-: .END
+: .BEGIN '${VAR}'
+: all '${VAR}'
+: .END '${VAR}'
+: .END '${VAR}' deferred
+: .BEGIN 'Should not be expanded.' deferred
+: all 'Should not be expanded.' deferred
 exit status 0

Index: src/usr.bin/make/unit-tests/deptgt-end.mk
diff -u src/usr.bin/make/unit-tests/deptgt-end.mk:1.3 src/usr.bin/make/unit-tests/deptgt-end.mk:1.4
--- src/usr.bin/make/unit-tests/deptgt-end.mk:1.3	Sat Aug 29 17:34:21 2020
+++ src/usr.bin/make/unit-tests/deptgt-end.mk	Tue Sep 22 19:41:09 2020
@@ -1,13 +1,36 @@
-# $NetBSD: deptgt-end.mk,v 1.3 2020/08/29 17:34:21 rillig Exp $
+# $NetBSD: deptgt-end.mk,v 1.4 2020/09/22 19:41:09 rillig Exp $
 #
 # Tests for the special target .END in dependency declarations,
 # which is run after making the desired targets.
 
+VAR=	Should not be expanded.
+
 .BEGIN:
-	: $@
+	: $@ '$${VAR}'
+	...
+	: $@ '$${VAR}' deferred
+# Oops: The deferred command must not be expanded twice.
+# The Var_Subst in Compat_RunCommand looks suspicious.
 
 .END:
-	: $@
+	: $@ '$${VAR}'
+	...
+	: $@ '$${VAR}' deferred
 
 all:
-	: $@
+	: $@ '$${VAR}'
+	...
+	: $@ '$${VAR}' deferred
+# Oops: The deferred command must not be expanded twice.
+# The Var_Subst in Compat_RunCommand looks suspicious.
+
+# The deferred commands are run in the order '.END .BEGIN all'.
+# This may be unexpected at first since the natural order would be
+# '.BEGIN all .END', but it is implemented correctly.
+#
+# At the point where the commands of a node with deferred commands are run,
+# the deferred commands are appended to the commands of the .END node.
+# This happens in Compat_RunCommand, and to prevent an endless loop, the
+# deferred commands of the .END node itself are not appended to itself.
+# Instead, the deferred commands of the .END node are run as if they were
+# immediate commands.



CVS commit: src/usr.bin/make

2020-09-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Sep 22 19:08:48 UTC 2020

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

Log Message:
make(1): remove obsolete fix for PR bin/29985


To generate a diff of this commit:
cvs rdiff -u -r1.531 -r1.532 src/usr.bin/make/var.c
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/directive-for.exp
cvs rdiff -u -r1.4 -r1.5 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/var.c
diff -u src/usr.bin/make/var.c:1.531 src/usr.bin/make/var.c:1.532
--- src/usr.bin/make/var.c:1.531	Tue Sep 22 18:07:58 2020
+++ src/usr.bin/make/var.c	Tue Sep 22 19:08:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.531 2020/09/22 18:07:58 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.532 2020/09/22 19:08:47 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
 #include"metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.531 2020/09/22 18:07:58 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.532 2020/09/22 19:08:47 rillig Exp $");
 
 #define VAR_DEBUG_IF(cond, fmt, ...)	\
 if (!(DEBUG(VAR) && (cond)))	\
@@ -3709,7 +3709,6 @@ char *
 Var_Subst(const char *str, GNode *ctxt, VarEvalFlags eflags)
 {
 Buffer buf;			/* Buffer for forming things */
-Boolean trailingBackslash;
 
 /* Set true if an error has already been reported,
  * to prevent a plethora of messages when recursing */
@@ -3717,12 +3716,8 @@ Var_Subst(const char *str, GNode *ctxt, 
 
 Buf_Init(, 0);
 errorReported = FALSE;
-trailingBackslash = FALSE;	/* variable ends in \ */
 
 while (*str) {
-	if (*str == '\n' && trailingBackslash)
-	Buf_AddByte(, ' ');
-
 	if (*str == '$' && str[1] == '$') {
 	/*
 	 * A dollar sign may be escaped with another dollar sign.
@@ -3782,7 +3777,6 @@ Var_Subst(const char *str, GNode *ctxt, 
 
 		val_len = strlen(val);
 		Buf_AddBytes(, val, val_len);
-		trailingBackslash = val_len > 0 && val[val_len - 1] == '\\';
 	}
 	free(freeIt);
 	freeIt = NULL;

Index: src/usr.bin/make/unit-tests/directive-for.exp
diff -u src/usr.bin/make/unit-tests/directive-for.exp:1.3 src/usr.bin/make/unit-tests/directive-for.exp:1.4
--- src/usr.bin/make/unit-tests/directive-for.exp:1.3	Tue Sep 22 18:54:50 2020
+++ src/usr.bin/make/unit-tests/directive-for.exp	Tue Sep 22 19:08:48 2020
@@ -1,3 +1,5 @@
 make: "directive-for.mk" line 100: outer
 make: "directive-for.mk" line 125: a:\ a:\file.txt
+make: "directive-for.mk" line 125: d:\\
+make: "directive-for.mk" line 125: d:\\file.txt
 exit status 0

Index: src/usr.bin/make/unit-tests/directive-for.mk
diff -u src/usr.bin/make/unit-tests/directive-for.mk:1.4 src/usr.bin/make/unit-tests/directive-for.mk:1.5
--- src/usr.bin/make/unit-tests/directive-for.mk:1.4	Tue Sep 22 18:54:51 2020
+++ src/usr.bin/make/unit-tests/directive-for.mk	Tue Sep 22 19:08:48 2020
@@ -1,4 +1,4 @@
-# $NetBSD: directive-for.mk,v 1.4 2020/09/22 18:54:51 rillig Exp $
+# $NetBSD: directive-for.mk,v 1.5 2020/09/22 19:08:48 rillig Exp $
 #
 # Tests for the .for directive.
 
@@ -121,7 +121,7 @@ EXPANSION${plus}=	value
 # interpreted as part of the code.  Because of this, the trailingBackslash
 # hack in Var_Subst is no longer needed and as of 2020-09-22, has been
 # removed.
-.for path in a:\ a:\file.txt
+.for path in a:\ a:\file.txt d:\\ d:\\file.txt
 .  info ${path}
 .endfor
 



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

2020-09-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Sep 22 18:54:51 UTC 2020

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

Log Message:
make(1): add test for .for loop from PR bin/29985


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/directive-for.exp
cvs rdiff -u -r1.3 -r1.4 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.2 src/usr.bin/make/unit-tests/directive-for.exp:1.3
--- src/usr.bin/make/unit-tests/directive-for.exp:1.2	Mon Sep 14 18:49:24 2020
+++ src/usr.bin/make/unit-tests/directive-for.exp	Tue Sep 22 18:54:50 2020
@@ -1,2 +1,3 @@
 make: "directive-for.mk" line 100: outer
+make: "directive-for.mk" line 125: a:\ a:\file.txt
 exit status 0

Index: src/usr.bin/make/unit-tests/directive-for.mk
diff -u src/usr.bin/make/unit-tests/directive-for.mk:1.3 src/usr.bin/make/unit-tests/directive-for.mk:1.4
--- src/usr.bin/make/unit-tests/directive-for.mk:1.3	Mon Sep 14 18:49:24 2020
+++ src/usr.bin/make/unit-tests/directive-for.mk	Tue Sep 22 18:54:51 2020
@@ -1,4 +1,4 @@
-# $NetBSD: directive-for.mk,v 1.3 2020/09/14 18:49:24 rillig Exp $
+# $NetBSD: directive-for.mk,v 1.4 2020/09/22 18:54:51 rillig Exp $
 #
 # Tests for the .for directive.
 
@@ -101,5 +101,29 @@ EXPANSION${plus}=	value
 .  endfor
 .endfor
 
+# From https://gnats.netbsd.org/29985.
+#
+# Until 2008-12-21, the .for loop was expanded by replacing the variable
+# value literally in the body.  This could lead to situations where the
+# characters from the variable value were interpreted as markup rather than
+# plain text.
+#
+# Until 2012-06-03, the .for loop had split the words at whitespace, without
+# taking quotes into account.  This made it possible to have variable values
+# like "a:\ a:\file.txt" that ended in a single backslash.  Since then, the
+# variable values have been replaced with expressions of the form ${:U...},
+# which are not interpreted as code anymore.
+#
+# As of 2020-09-22, a comment in for.c says that it may be possible to
+# produce an "unwanted substitution", but there is no demonstration code yet.
+#
+# The above changes prevent a backslash at the end of a word from being
+# interpreted as part of the code.  Because of this, the trailingBackslash
+# hack in Var_Subst is no longer needed and as of 2020-09-22, has been
+# removed.
+.for path in a:\ a:\file.txt
+.  info ${path}
+.endfor
+
 all:
 	@:;



CVS commit: [netbsd-9] src/doc

2020-09-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Sep 22 18:43:22 UTC 2020

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

Log Message:
Tickets #1091 and #1092


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.114 -r1.1.2.115 src/doc/CHANGES-9.1

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.1
diff -u src/doc/CHANGES-9.1:1.1.2.114 src/doc/CHANGES-9.1:1.1.2.115
--- src/doc/CHANGES-9.1:1.1.2.114	Sun Sep 20 10:17:44 2020
+++ src/doc/CHANGES-9.1	Tue Sep 22 18:43:22 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.1,v 1.1.2.114 2020/09/20 10:17:44 martin Exp $
+# $NetBSD: CHANGES-9.1,v 1.1.2.115 2020/09/22 18:43:22 martin Exp $
 
 A complete list of changes from the NetBSD 9.0 release to the NetBSD 9.1
 release:
@@ -5006,3 +5006,15 @@ sys/dev/pci/virtio_pci.c			1.13
 	Fix virtio interrupts after MSI-X vector exhaustion.
 	[jakllsch, ticket #1090]
 
+sys/kern/uipc_socket.c1.291
+sys/kern/uipc_socket2.c1.138
+sys/kern/uipc_usrreq.c1.199
+
+	Add socket info for user and group for unix sockets in fstat.
+	[christos, ticket #1091]
+
+sys/arch/arm/arm/undefined.c			1.67
+
+	Allow an undefined instruction to use lr (r14) as Rt.
+	[skrll, ticket #1092]
+



CVS commit: [netbsd-9] src/sys/arch/arm/arm

2020-09-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Sep 22 18:41:48 UTC 2020

Modified Files:
src/sys/arch/arm/arm [netbsd-9]: undefined.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1092):

sys/arch/arm/arm/undefined.c: revision 1.67

Allow an undefined instruction to use lr (r14) as Rt. New gcc emits this
with TPIDRURO read.

Not sure why the exception handler cares if sp or pc are used as Rt


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.65.4.1 src/sys/arch/arm/arm/undefined.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/arch/arm/arm/undefined.c
diff -u src/sys/arch/arm/arm/undefined.c:1.65 src/sys/arch/arm/arm/undefined.c:1.65.4.1
--- src/sys/arch/arm/arm/undefined.c:1.65	Sat Apr  6 03:06:24 2019
+++ src/sys/arch/arm/arm/undefined.c	Tue Sep 22 18:41:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: undefined.c,v 1.65 2019/04/06 03:06:24 thorpej Exp $	*/
+/*	$NetBSD: undefined.c,v 1.65.4.1 2020/09/22 18:41:48 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 Ben Harris.
@@ -55,7 +55,7 @@
 #include 
 #endif
 
-__KERNEL_RCSID(0, "$NetBSD: undefined.c,v 1.65 2019/04/06 03:06:24 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: undefined.c,v 1.65.4.1 2020/09/22 18:41:48 martin Exp $");
 
 #include 
 #include 
@@ -137,7 +137,7 @@ cp15_trapper(u_int addr, u_int insn, str
 	 * Don't overwrite sp, pc, etc.
 	 */
 	const u_int regno = (insn >> 12) & 15;
-	if (regno > 12)
+	if (regno == 13 || regno == 15)
 		return 1;
 
 	/*



CVS commit: [netbsd-9] src/sys/kern

2020-09-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Sep 22 18:39:01 UTC 2020

Modified Files:
src/sys/kern [netbsd-9]: uipc_socket.c uipc_socket2.c uipc_usrreq.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #1091):

sys/kern/uipc_socket.c: revision 1.291
sys/kern/uipc_usrreq.c: revision 1.199
sys/kern/uipc_socket2.c: revision 1.138

add socket info for user and group for unix sockets in fstat.


To generate a diff of this commit:
cvs rdiff -u -r1.281.2.2 -r1.281.2.3 src/sys/kern/uipc_socket.c
cvs rdiff -u -r1.134 -r1.134.2.1 src/sys/kern/uipc_socket2.c
cvs rdiff -u -r1.194 -r1.194.2.1 src/sys/kern/uipc_usrreq.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/uipc_socket.c
diff -u src/sys/kern/uipc_socket.c:1.281.2.2 src/sys/kern/uipc_socket.c:1.281.2.3
--- src/sys/kern/uipc_socket.c:1.281.2.2	Tue Feb 25 19:10:51 2020
+++ src/sys/kern/uipc_socket.c	Tue Sep 22 18:39:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_socket.c,v 1.281.2.2 2020/02/25 19:10:51 martin Exp $	*/
+/*	$NetBSD: uipc_socket.c,v 1.281.2.3 2020/09/22 18:39:01 martin Exp $	*/
 
 /*
  * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.281.2.2 2020/02/25 19:10:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.281.2.3 2020/09/22 18:39:01 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -526,6 +526,7 @@ socreate(int dom, struct socket **aso, i
 #endif
 	uid = kauth_cred_geteuid(l->l_cred);
 	so->so_uidinfo = uid_find(uid);
+	so->so_egid = kauth_cred_getegid(l->l_cred);
 	so->so_cpid = l->l_proc->p_pid;
 
 	/*

Index: src/sys/kern/uipc_socket2.c
diff -u src/sys/kern/uipc_socket2.c:1.134 src/sys/kern/uipc_socket2.c:1.134.2.1
--- src/sys/kern/uipc_socket2.c:1.134	Thu Jul 11 17:30:44 2019
+++ src/sys/kern/uipc_socket2.c	Tue Sep 22 18:39:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_socket2.c,v 1.134 2019/07/11 17:30:44 maxv Exp $	*/
+/*	$NetBSD: uipc_socket2.c,v 1.134.2.1 2020/09/22 18:39:01 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket2.c,v 1.134 2019/07/11 17:30:44 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket2.c,v 1.134.2.1 2020/09/22 18:39:01 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -317,6 +317,7 @@ sonewconn(struct socket *head, bool sore
 	so->so_send = head->so_send;
 	so->so_receive = head->so_receive;
 	so->so_uidinfo = head->so_uidinfo;
+	so->so_egid = head->so_egid;
 	so->so_cpid = head->so_cpid;
 
 	/*

Index: src/sys/kern/uipc_usrreq.c
diff -u src/sys/kern/uipc_usrreq.c:1.194 src/sys/kern/uipc_usrreq.c:1.194.2.1
--- src/sys/kern/uipc_usrreq.c:1.194	Mon Jul 29 09:42:17 2019
+++ src/sys/kern/uipc_usrreq.c	Tue Sep 22 18:39:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_usrreq.c,v 1.194 2019/07/29 09:42:17 maxv Exp $	*/
+/*	$NetBSD: uipc_usrreq.c,v 1.194.2.1 2020/09/22 18:39:01 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2004, 2008, 2009 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.194 2019/07/29 09:42:17 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.194.2.1 2020/09/22 18:39:01 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -898,6 +898,8 @@ unp_stat(struct socket *so, struct stat 
 		unp->unp_ino = unp_ino++;
 	ub->st_atimespec = ub->st_mtimespec = ub->st_ctimespec = unp->unp_ctime;
 	ub->st_ino = unp->unp_ino;
+	ub->st_uid = so->so_uidinfo->ui_uid;
+	ub->st_gid = so->so_egid;
 	return (0);
 }
 



CVS commit: src/usr.bin/make

2020-09-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Sep 22 18:07:58 UTC 2020

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

Log Message:
make(1): prepare error handling in nested variable expressions

Having ParseModifierPart return VarParseResult allows to report the
errors from nested variable expressions.


To generate a diff of this commit:
cvs rdiff -u -r1.530 -r1.531 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.530 src/usr.bin/make/var.c:1.531
--- src/usr.bin/make/var.c:1.530	Tue Sep 22 17:51:06 2020
+++ src/usr.bin/make/var.c	Tue Sep 22 18:07:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.530 2020/09/22 17:51:06 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.531 2020/09/22 18:07:58 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
 #include"metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.530 2020/09/22 17:51:06 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.531 2020/09/22 18:07:58 rillig Exp $");
 
 #define VAR_DEBUG_IF(cond, fmt, ...)	\
 if (!(DEBUG(VAR) && (cond)))	\
@@ -1809,7 +1809,7 @@ typedef enum {
  * after the delimiter.  The delimiter is not included in the returned
  * value though.
  */
-static char *
+static VarParseResult
 ParseModifierPart(
 const char **pp,		/* The parsing position, updated upon return */
 int delim,			/* Parsing stops at this delimiter */
@@ -1817,6 +1817,7 @@ ParseModifierPart(
  * if VARE_WANTRES is not set, the text is
  * only parsed */
 ApplyModifiersState *st,
+char **out_part,
 size_t *out_length,		/* Optionally stores the length of the returned
  * string, just to save another strlen call. */
 VarPatternFlags *out_pflags,/* For the first part of the :S modifier,
@@ -1828,7 +1829,6 @@ ParseModifierPart(
 ) {
 Buffer buf;
 const char *p;
-char *rstr;
 
 Buf_Init(, 0);
 
@@ -1922,16 +1922,17 @@ ParseModifierPart(
 if (*p != delim) {
 	*pp = p;
 	Error("Unfinished modifier for %s ('%c' missing)", st->v->name, delim);
-	return NULL;
+	*out_part = NULL;
+	return VPR_PARSE_MSG;
 }
 
 *pp = ++p;
 if (out_length != NULL)
 	*out_length = Buf_Size();
 
-rstr = Buf_Destroy(, FALSE);
-VAR_DEBUG("Modifier part: \"%s\"\n", rstr);
-return rstr;
+*out_part = Buf_Destroy(, FALSE);
+VAR_DEBUG("Modifier part: \"%s\"\n", *out_part);
+return VPR_OK;
 }
 
 /* Test whether mod starts with modname, followed by a delimiter. */
@@ -1960,14 +1961,15 @@ ApplyModifier_Loop(const char **pp, Appl
 char delim;
 char prev_sep;
 VarEvalFlags eflags = st->eflags & ~(unsigned)VARE_WANTRES;
+VarParseResult res;
 
 args.ctx = st->ctxt;
 
 (*pp)++;			/* Skip the first '@' */
 delim = '@';
-args.tvar = ParseModifierPart(pp, delim, eflags, st,
-  NULL, NULL, NULL);
-if (args.tvar == NULL)
+res = ParseModifierPart(pp, delim, eflags, st,
+			, NULL, NULL, NULL);
+if (res != VPR_OK)
 	return AMR_CLEANUP;
 if (DEBUG(LINT) && strchr(args.tvar, '$') != NULL) {
 	Parse_Error(PARSE_FATAL,
@@ -1977,9 +1979,9 @@ ApplyModifier_Loop(const char **pp, Appl
 	return AMR_CLEANUP;
 }
 
-args.str = ParseModifierPart(pp, delim, eflags, st,
- NULL, NULL, NULL);
-if (args.str == NULL)
+res = ParseModifierPart(pp, delim, eflags, st,
+			, NULL, NULL, NULL);
+if (res != VPR_OK)
 	return AMR_CLEANUP;
 
 args.eflags = st->eflags & (VARE_UNDEFERR | VARE_WANTRES);
@@ -2140,12 +2142,13 @@ ApplyModifier_ShellCommand(const char **
 char delim;
 char *cmd;
 const char *errfmt;
+VarParseResult res;
 
 (*pp)++;
 delim = '!';
-cmd = ParseModifierPart(pp, delim, st->eflags, st,
-			NULL, NULL, NULL);
-if (cmd == NULL)
+res = ParseModifierPart(pp, delim, st->eflags, st,
+			, NULL, NULL, NULL);
+if (res != VPR_OK)
 	return AMR_CLEANUP;
 
 errfmt = NULL;
@@ -2285,6 +2288,7 @@ ApplyModifier_Subst(const char **pp, App
 ModifyWord_SubstArgs args;
 char *lhs, *rhs;
 Boolean oneBigWord;
+VarParseResult res;
 
 char delim = (*pp)[1];
 if (delim == '\0') {
@@ -2307,15 +2311,15 @@ ApplyModifier_Subst(const char **pp, App
 	(*pp)++;
 }
 
-lhs = ParseModifierPart(pp, delim, st->eflags, st,
-			, , NULL);
-if (lhs == NULL)
+res = ParseModifierPart(pp, delim, st->eflags, st,
+			, , , NULL);
+if (res != VPR_OK)
 	return AMR_CLEANUP;
 args.lhs = lhs;
 
-rhs = ParseModifierPart(pp, delim, st->eflags, st,
-			, NULL, );
-if (rhs == NULL)
+res = ParseModifierPart(pp, delim, st->eflags, st,
+			, , NULL, );
+if (res != VPR_OK)
 	return AMR_CLEANUP;
 args.rhs = rhs;
 
@@ -2353,6 +2357,7 @@ ApplyModifier_Regex(const char **pp, App
 ModifyWord_SubstRegexArgs args;
 Boolean 

CVS commit: src/usr.bin/make

2020-09-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Sep 22 17:51:06 UTC 2020

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

Log Message:
make(1): handle errors about missing delimiter in a single place


To generate a diff of this commit:
cvs rdiff -u -r1.529 -r1.530 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.529 src/usr.bin/make/var.c:1.530
--- src/usr.bin/make/var.c:1.529	Tue Sep 22 17:42:57 2020
+++ src/usr.bin/make/var.c	Tue Sep 22 17:51:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.529 2020/09/22 17:42:57 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.530 2020/09/22 17:51:06 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
 #include"metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.529 2020/09/22 17:42:57 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.530 2020/09/22 17:51:06 rillig Exp $");
 
 #define VAR_DEBUG_IF(cond, fmt, ...)	\
 if (!(DEBUG(VAR) && (cond)))	\
@@ -1709,7 +1709,7 @@ VarStrftime(const char *fmt, Boolean zul
  * st->endc.
  *
  * If parsing fails because of a missing delimiter (as in the :S, :C or :@
- * modifiers), set st->missing_delim and return AMR_CLEANUP.
+ * modifiers), return AMR_CLEANUP.
  *
  * If parsing fails because the modifier is unknown, return AMR_UNKNOWN to
  * try the SysV modifier ${VAR:from=to} as fallback.  This should only be
@@ -1775,8 +1775,6 @@ typedef struct {
  * before applying the modifier, never NULL */
 char *newVal;		/* The new value of the expression,
  * after applying the modifier, never NULL */
-char missing_delim;		/* For error reporting */
-
 char sep;			/* Word separator in expansions
  * (see the :ts modifier) */
 Boolean oneBigWord;		/* TRUE if some modifiers that otherwise split
@@ -1797,8 +1795,7 @@ typedef enum {
 AMR_OK,			/* Continue parsing */
 AMR_UNKNOWN,		/* Not a match, try other modifiers as well */
 AMR_BAD,			/* Error out with "Bad modifier" message */
-AMR_CLEANUP			/* Error out, with "Unfinished modifier"
- * if st->missing_delim is set. */
+AMR_CLEANUP			/* Error out without error message */
 } ApplyModifierResult;
 
 /*-
@@ -1924,6 +1921,7 @@ ParseModifierPart(
 
 if (*p != delim) {
 	*pp = p;
+	Error("Unfinished modifier for %s ('%c' missing)", st->v->name, delim);
 	return NULL;
 }
 
@@ -1969,10 +1967,8 @@ ApplyModifier_Loop(const char **pp, Appl
 delim = '@';
 args.tvar = ParseModifierPart(pp, delim, eflags, st,
   NULL, NULL, NULL);
-if (args.tvar == NULL) {
-	st->missing_delim = delim;
+if (args.tvar == NULL)
 	return AMR_CLEANUP;
-}
 if (DEBUG(LINT) && strchr(args.tvar, '$') != NULL) {
 	Parse_Error(PARSE_FATAL,
 		"In the :@ modifier of \"%s\", the variable name \"%s\" "
@@ -1983,10 +1979,8 @@ ApplyModifier_Loop(const char **pp, Appl
 
 args.str = ParseModifierPart(pp, delim, eflags, st,
  NULL, NULL, NULL);
-if (args.str == NULL) {
-	st->missing_delim = delim;
+if (args.str == NULL)
 	return AMR_CLEANUP;
-}
 
 args.eflags = st->eflags & (VARE_UNDEFERR | VARE_WANTRES);
 prev_sep = st->sep;
@@ -2151,10 +2145,8 @@ ApplyModifier_ShellCommand(const char **
 delim = '!';
 cmd = ParseModifierPart(pp, delim, st->eflags, st,
 			NULL, NULL, NULL);
-if (cmd == NULL) {
-	st->missing_delim = delim;
+if (cmd == NULL)
 	return AMR_CLEANUP;
-}
 
 errfmt = NULL;
 if (st->eflags & VARE_WANTRES)
@@ -2317,18 +2309,14 @@ ApplyModifier_Subst(const char **pp, App
 
 lhs = ParseModifierPart(pp, delim, st->eflags, st,
 			, , NULL);
-if (lhs == NULL) {
-	st->missing_delim = delim;
+if (lhs == NULL)
 	return AMR_CLEANUP;
-}
 args.lhs = lhs;
 
 rhs = ParseModifierPart(pp, delim, st->eflags, st,
 			, NULL, );
-if (rhs == NULL) {
-	st->missing_delim = delim;
+if (rhs == NULL)
 	return AMR_CLEANUP;
-}
 args.rhs = rhs;
 
 oneBigWord = st->oneBigWord;
@@ -2377,16 +2365,13 @@ ApplyModifier_Regex(const char **pp, App
 
 re = ParseModifierPart(pp, delim, st->eflags, st,
 			   NULL, NULL, NULL);
-if (re == NULL) {
-	st->missing_delim = delim;
+if (re == NULL)
 	return AMR_CLEANUP;
-}
 
 args.replace = ParseModifierPart(pp, delim, st->eflags, st,
  NULL, NULL, NULL);
 if (args.replace == NULL) {
 	free(re);
-	st->missing_delim = delim;
 	return AMR_CLEANUP;
 }
 
@@ -2566,10 +2551,8 @@ ApplyModifier_Words(const char **pp, App
 delim = ']';		/* look for closing ']' */
 estr = ParseModifierPart(pp, delim, st->eflags, st,
 			 NULL, NULL, NULL);
-if (estr == NULL) {
-	st->missing_delim = delim;
+if (estr == NULL)
 	return AMR_CLEANUP;
-}
 
 /* now *pp points just after the closing ']' */
 if (**pp != ':' && **pp != st->endc)
@@ 

CVS commit: src/usr.bin/make

2020-09-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Sep 22 17:42:58 UTC 2020

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

Log Message:
make(1): move ParseModifierPart further down in the code

This way, it can access the ApplyModifierState, which will be used in a
follow-up commit to reduce the code duplication around the error
handling for missing delimiters.


To generate a diff of this commit:
cvs rdiff -u -r1.528 -r1.529 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.528 src/usr.bin/make/var.c:1.529
--- src/usr.bin/make/var.c:1.528	Tue Sep 22 06:23:33 2020
+++ src/usr.bin/make/var.c	Tue Sep 22 17:42:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.528 2020/09/22 06:23:33 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.529 2020/09/22 17:42:57 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
 #include"metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.528 2020/09/22 06:23:33 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.529 2020/09/22 17:42:57 rillig Exp $");
 
 #define VAR_DEBUG_IF(cond, fmt, ...)	\
 if (!(DEBUG(VAR) && (cond)))	\
@@ -1585,141 +1585,6 @@ VarUniq(const char *str)
 }
 
 
-/*-
- * Parse a part of a modifier such as the "from" and "to" in :S/from/to/
- * or the "var" or "replacement" in :@var@replacement+${var}@, up to and
- * including the next unescaped delimiter.  The delimiter, as well as the
- * backslash or the dollar, can be escaped with a backslash.
- *
- * Return the parsed (and possibly expanded) string, or NULL if no delimiter
- * was found.  On successful return, the parsing position pp points right
- * after the delimiter.  The delimiter is not included in the returned
- * value though.
- */
-static char *
-ParseModifierPart(
-const char **pp,		/* The parsing position, updated upon return */
-int delim,			/* Parsing stops at this delimiter */
-VarEvalFlags eflags,	/* Flags for evaluating nested variables;
- * if VARE_WANTRES is not set, the text is
- * only parsed */
-GNode *ctxt,		/* For looking up nested variables */
-size_t *out_length,		/* Optionally stores the length of the returned
- * string, just to save another strlen call. */
-VarPatternFlags *out_pflags,/* For the first part of the :S modifier,
- * sets the VARP_ANCHOR_END flag if the last
- * character of the pattern is a $. */
-ModifyWord_SubstArgs *subst	/* For the second part of the :S modifier,
- * allow ampersands to be escaped and replace
- * unescaped ampersands with subst->lhs. */
-) {
-Buffer buf;
-const char *p;
-char *rstr;
-
-Buf_Init(, 0);
-
-/*
- * Skim through until the matching delimiter is found;
- * pick up variable substitutions on the way. Also allow
- * backslashes to quote the delimiter, $, and \, but don't
- * touch other backslashes.
- */
-p = *pp;
-while (*p != '\0' && *p != delim) {
-	const char *varstart;
-
-	Boolean is_escaped = p[0] == '\\' && (
-	p[1] == delim || p[1] == '\\' || p[1] == '$' ||
-	(p[1] == '&' && subst != NULL));
-	if (is_escaped) {
-	Buf_AddByte(, p[1]);
-	p += 2;
-	continue;
-	}
-
-	if (*p != '$') {	/* Unescaped, simple text */
-	if (subst != NULL && *p == '&')
-		Buf_AddBytes(, subst->lhs, subst->lhsLen);
-	else
-		Buf_AddByte(, *p);
-	p++;
-	continue;
-	}
-
-	if (p[1] == delim) {	/* Unescaped $ at end of pattern */
-	if (out_pflags != NULL)
-		*out_pflags |= VARP_ANCHOR_END;
-	else
-		Buf_AddByte(, *p);
-	p++;
-	continue;
-	}
-
-	if (eflags & VARE_WANTRES) {	/* Nested variable, evaluated */
-	const char *nested_p = p;
-	const char *nested_val;
-	void *nested_val_freeIt;
-	VarEvalFlags nested_eflags = eflags & ~(unsigned)VARE_ASSIGN;
-
-	(void)Var_Parse(_p, ctxt, nested_eflags,
-			_val, _val_freeIt);
-	/* TODO: handle errors */
-	Buf_AddStr(, nested_val);
-	free(nested_val_freeIt);
-	p += nested_p - p;
-	continue;
-	}
-
-	/* XXX: This whole block is very similar to Var_Parse without
-	 * VARE_WANTRES.  There may be subtle edge cases though that are
-	 * not yet covered in the unit tests and that are parsed differently,
-	 * depending on whether they are evaluated or not.
-	 *
-	 * This subtle difference is not documented in the manual page,
-	 * neither is the difference between parsing :D and :M documented.
-	 * No code should ever depend on these details, but who knows. */
-
-	varstart = p;		/* Nested variable, only parsed */
-	if (p[1] == '(' || p[1] == '{') {
-	/*
-	 * Find the end of this variable reference
-	 * and suck it in without further ado.
-	 * It will be interpreted later.
-	 */
-	int have = p[1];
-	int want = have == '(' ? ')' : '}';
-	int depth = 1;
-
-	for (p += 2; *p 

CVS commit: xsrc/external/mit/xsm/dist

2020-09-22 Thread Nia Alarie
Module Name:xsrc
Committed By:   nia
Date:   Tue Sep 22 16:20:40 UTC 2020

Modified Files:
xsrc/external/mit/xsm/dist: system.xsm

Log Message:
update the default xsm session to ctwm/uxterm


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 xsrc/external/mit/xsm/dist/system.xsm

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

Modified files:

Index: xsrc/external/mit/xsm/dist/system.xsm
diff -u xsrc/external/mit/xsm/dist/system.xsm:1.1.1.1 xsrc/external/mit/xsm/dist/system.xsm:1.2
--- xsrc/external/mit/xsm/dist/system.xsm:1.1.1.1	Wed Jul 30 04:38:48 2008
+++ xsrc/external/mit/xsm/dist/system.xsm	Tue Sep 22 16:20:39 2020
@@ -1,4 +1,4 @@
-! $Xorg: system.xsm,v 1.3 2000/08/17 19:55:06 cpqbld Exp $
-twm
+! $NetBSD: system.xsm,v 1.2 2020/09/22 16:20:39 nia Exp $
+ctwm
 smproxy
-xterm
+uxterm



CVS commit: src/usr.sbin/sysinst

2020-09-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Sep 22 16:18:54 UTC 2020

Modified Files:
src/usr.sbin/sysinst: bsddisklabel.c defs.h install.c label.c util.c

Log Message:
Keep a list of all partition tables from which we have deleted partitions
and make sure we update those partition tables when writing partitions,
even if no install related partition remains on them.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/sysinst/bsddisklabel.c
cvs rdiff -u -r1.62 -r1.63 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/sysinst/install.c
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/sysinst/label.c
cvs rdiff -u -r1.45 -r1.46 src/usr.sbin/sysinst/util.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.sbin/sysinst/bsddisklabel.c
diff -u src/usr.sbin/sysinst/bsddisklabel.c:1.42 src/usr.sbin/sysinst/bsddisklabel.c:1.43
--- src/usr.sbin/sysinst/bsddisklabel.c:1.42	Tue May 12 06:23:07 2020
+++ src/usr.sbin/sysinst/bsddisklabel.c	Tue Sep 22 16:18:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bsddisklabel.c,v 1.42 2020/05/12 06:23:07 martin Exp $	*/
+/*	$NetBSD: bsddisklabel.c,v 1.43 2020/09/22 16:18:54 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1774,6 +1774,8 @@ make_bsd_partitions(struct install_parti
 		/* update install infos */
 		install->num = wanted.num;
 		install->infos = wanted.infos;
+		install->write_back = wanted.write_back;
+		install->num_write_back = wanted.num_write_back;
 		/* and check them */
 		if (check_partitions(install))
 			break;
@@ -1781,6 +1783,7 @@ make_bsd_partitions(struct install_parti
 
 	/* we moved infos from wanted to install target */
 	wanted.infos = NULL;
+	wanted.write_back = NULL;
 	free_usage_set();
 
 	/* Everything looks OK. */

Index: src/usr.sbin/sysinst/defs.h
diff -u src/usr.sbin/sysinst/defs.h:1.62 src/usr.sbin/sysinst/defs.h:1.63
--- src/usr.sbin/sysinst/defs.h:1.62	Mon May 18 21:19:36 2020
+++ src/usr.sbin/sysinst/defs.h	Tue Sep 22 16:18:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.62 2020/05/18 21:19:36 jmcneill Exp $	*/
+/*	$NetBSD: defs.h,v 1.63 2020/09/22 16:18:54 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -322,9 +322,15 @@ struct part_usage_info {
  * A list of partition suggestions, bundled for editing
  */
 struct partition_usage_set {
-	struct disk_partitions *parts;
-	size_t num;
+	struct disk_partitions *parts;	/* main partition table */
+	size_t num;			/* number of infos */
 	struct part_usage_info *infos;	/* 0 .. num-1 */
+	struct disk_partitions **write_back;
+	/* partition tables from which we
+	 * did delete some partitions and
+	 * that need updating, even if
+	 * no active partition remains. */
+	size_t num_write_back;		/* number of write_back */
 	daddr_t cur_free_space;		/* estimate of free sectors */
 	menu_ent *menu_opts;		/* 0 .. num+N */
 	int menu;			/* the menu to edit this */
@@ -360,6 +366,12 @@ struct single_part_fs_edit {
 struct install_partition_desc {
 	size_t num;/* how many entries in infos */
 	struct part_usage_info *infos;		/* individual partitions */
+	struct disk_partitions **write_back;	/* partition tables from 
+		 * which we did delete some
+		 * partitions and that need
+		 * updating, even if no
+		 * active partition remains. */
+	size_t num_write_back;			/* number of write_back */
 	bool cur_system;			/* target is the life system */
 };
 

Index: src/usr.sbin/sysinst/install.c
diff -u src/usr.sbin/sysinst/install.c:1.16 src/usr.sbin/sysinst/install.c:1.17
--- src/usr.sbin/sysinst/install.c:1.16	Tue May 12 17:04:00 2020
+++ src/usr.sbin/sysinst/install.c	Tue Sep 22 16:18:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: install.c,v 1.16 2020/05/12 17:04:00 martin Exp $	*/
+/*	$NetBSD: install.c,v 1.17 2020/09/22 16:18:54 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -57,12 +57,28 @@ write_all_parts(struct install_partition
 	bool found, res;
 
 	/* pessimistic assumption: all partitions on different devices */
-	allparts = calloc(install->num, sizeof(*allparts));
+	allparts = calloc(install->num + install->num_write_back,
+	sizeof(*allparts));
 	if (allparts == NULL)
 		return false;
 
 	/* collect all different partition sets */
 	num_parts = 0;
+	for (i = 0; i < install->num_write_back; i++) {
+		parts = install->write_back[i];
+		if (parts == NULL)
+			continue;
+		found = false;
+		for (j = 0; j < num_parts; j++) {
+			if (allparts[j] == parts) {
+found = true;
+break;
+			}
+		}
+		if (found)
+			continue;
+		allparts[num_parts++] = parts;
+	}
 	for (i = 0; i < install->num; i++) {
 		parts = install->infos[i].parts;
 		if (parts == NULL)

Index: src/usr.sbin/sysinst/label.c
diff -u src/usr.sbin/sysinst/label.c:1.23 src/usr.sbin/sysinst/label.c:1.24
--- src/usr.sbin/sysinst/label.c:1.23	Tue Sep 22 12:21:11 2020
+++ 

CVS commit: src/usr.sbin/sysinst

2020-09-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Sep 22 15:16:49 UTC 2020

Modified Files:
src/usr.sbin/sysinst: disks.c

Log Message:
Typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/usr.sbin/sysinst/disks.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.sbin/sysinst/disks.c
diff -u src/usr.sbin/sysinst/disks.c:1.67 src/usr.sbin/sysinst/disks.c:1.68
--- src/usr.sbin/sysinst/disks.c:1.67	Tue May 12 17:26:43 2020
+++ src/usr.sbin/sysinst/disks.c	Tue Sep 22 15:16:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: disks.c,v 1.67 2020/05/12 17:26:43 martin Exp $ */
+/*	$NetBSD: disks.c,v 1.68 2020/09/22 15:16:49 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1120,7 +1120,7 @@ make_filesystems(struct install_partitio
 
 	for (i = 0; i < install->num; i++) {
 		/*
-		 * Newfs all file systems mareked as needing this.
+		 * Newfs all file systems marked as needing this.
 		 * Mount the ones that have a mountpoint in the target.
 		 */
 		ptn = >infos[i];



CVS commit: xsrc/external/mit

2020-09-22 Thread Nia Alarie
Module Name:xsrc
Committed By:   nia
Date:   Tue Sep 22 14:32:03 UTC 2020

Modified Files:
xsrc/external/mit/xdm/dist/config: Xsession.in
xsrc/external/mit/xinit/dist: xinitrc.cpp

Log Message:
turn off the ctwm "welcome" screen

while this is nice for Branding(tm), it adds a slight delay to startup,
which is slightly annoying, and a departure from how we've done things
previously.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 xsrc/external/mit/xdm/dist/config/Xsession.in
cvs rdiff -u -r1.5 -r1.6 xsrc/external/mit/xinit/dist/xinitrc.cpp

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

Modified files:

Index: xsrc/external/mit/xdm/dist/config/Xsession.in
diff -u xsrc/external/mit/xdm/dist/config/Xsession.in:1.2 xsrc/external/mit/xdm/dist/config/Xsession.in:1.3
--- xsrc/external/mit/xdm/dist/config/Xsession.in:1.2	Tue Sep 22 14:22:54 2020
+++ xsrc/external/mit/xdm/dist/config/Xsession.in	Tue Sep 22 14:32:03 2020
@@ -63,5 +63,5 @@ else
 		BINDIR/xrdb -load "$resources"
 	fi
 	$BINDIR/uxterm &
-	exec BINDIR/ctwm
+	exec BINDIR/ctwm -W
 fi

Index: xsrc/external/mit/xinit/dist/xinitrc.cpp
diff -u xsrc/external/mit/xinit/dist/xinitrc.cpp:1.5 xsrc/external/mit/xinit/dist/xinitrc.cpp:1.6
--- xsrc/external/mit/xinit/dist/xinitrc.cpp:1.5	Tue Sep 22 14:20:47 2020
+++ xsrc/external/mit/xinit/dist/xinitrc.cpp	Tue Sep 22 14:32:03 2020
@@ -49,4 +49,4 @@ if [ -d XINITDIR/xinitrc.d ] ; then
 fi
 
 UXTERM &
-exec CTWM
+exec CTWM -W



CVS commit: xsrc/external/mit/xdm/dist/config

2020-09-22 Thread Nia Alarie
Module Name:xsrc
Committed By:   nia
Date:   Tue Sep 22 14:22:54 UTC 2020

Modified Files:
xsrc/external/mit/xdm/dist/config: Xsession.in

Log Message:
spawn ctwm in the default xdm Xsession


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 xsrc/external/mit/xdm/dist/config/Xsession.in

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

Modified files:

Index: xsrc/external/mit/xdm/dist/config/Xsession.in
diff -u xsrc/external/mit/xdm/dist/config/Xsession.in:1.1.1.1 xsrc/external/mit/xdm/dist/config/Xsession.in:1.2
--- xsrc/external/mit/xdm/dist/config/Xsession.in:1.1.1.1	Tue Mar  5 08:26:49 2019
+++ xsrc/external/mit/xdm/dist/config/Xsession.in	Tue Sep 22 14:22:54 2020
@@ -62,5 +62,6 @@ else
 	if [ -r "$resources" ]; then
 		BINDIR/xrdb -load "$resources"
 	fi
-	exec BINDIR/xsm
+	$BINDIR/uxterm &
+	exec BINDIR/ctwm
 fi



CVS commit: xsrc/external/mit/xinit/dist

2020-09-22 Thread Nia Alarie
Module Name:xsrc
Committed By:   nia
Date:   Tue Sep 22 14:20:47 UTC 2020

Modified Files:
xsrc/external/mit/xinit/dist: xinitrc.cpp

Log Message:
make the default xinitrc a bit nicer

spawn only one xterm in unicode mode and use ctwm instead of twm

ctwm is a backwards compatible fork of twm that includes some extra
features like virtual desktops


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 xsrc/external/mit/xinit/dist/xinitrc.cpp

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

Modified files:

Index: xsrc/external/mit/xinit/dist/xinitrc.cpp
diff -u xsrc/external/mit/xinit/dist/xinitrc.cpp:1.4 xsrc/external/mit/xinit/dist/xinitrc.cpp:1.5
--- xsrc/external/mit/xinit/dist/xinitrc.cpp:1.4	Wed Jul 22 08:36:10 2015
+++ xsrc/external/mit/xinit/dist/xinitrc.cpp	Tue Sep 22 14:20:47 2020
@@ -48,8 +48,5 @@ if [ -d XINITDIR/xinitrc.d ] ; then
 	unset f
 fi
 
-TWM &
-XCLOCK -geometry 50x50-1+1 &
-XTERM -geometry 80x50+494+51 &
-XTERM -geometry 80x20+494-0 &
-exec XTERM -geometry 80x66+0+0 -name login
+UXTERM &
+exec CTWM



CVS commit: src

2020-09-22 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Tue Sep 22 14:14:17 UTC 2020

Modified Files:
src/sbin/ifconfig: ifconfig.c media.c media.h
src/sys/net: if.h

Log Message:
ifconfig: Report link state even if media is not supported

For AF_LINK addrs from getifaddrs(2), ifa_data is struct if_data.
This in turn holds ifi_link_state which we can use to report
link status if the interface does not support media where it's normally
reported.

Based on OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.242 -r1.243 src/sbin/ifconfig/ifconfig.c
cvs rdiff -u -r1.9 -r1.10 src/sbin/ifconfig/media.c
cvs rdiff -u -r1.1 -r1.2 src/sbin/ifconfig/media.h
cvs rdiff -u -r1.284 -r1.285 src/sys/net/if.h

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

Modified files:

Index: src/sbin/ifconfig/ifconfig.c
diff -u src/sbin/ifconfig/ifconfig.c:1.242 src/sbin/ifconfig/ifconfig.c:1.243
--- src/sbin/ifconfig/ifconfig.c:1.242	Sun Jun  7 06:02:58 2020
+++ src/sbin/ifconfig/ifconfig.c	Tue Sep 22 14:14:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ifconfig.c,v 1.242 2020/06/07 06:02:58 thorpej Exp $	*/
+/*	$NetBSD: ifconfig.c,v 1.243 2020/09/22 14:14:17 roy Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1983, 1993\
  The Regents of the University of California.  All rights reserved.");
-__RCSID("$NetBSD: ifconfig.c,v 1.242 2020/06/07 06:02:58 thorpej Exp $");
+__RCSID("$NetBSD: ifconfig.c,v 1.243 2020/09/22 14:14:17 roy Exp $");
 #endif /* not lint */
 
 #include 
@@ -135,7 +135,7 @@ static int setlinkstr(prop_dictionary_t,
 static int unsetlinkstr(prop_dictionary_t, prop_dictionary_t);
 static int setifdescr(prop_dictionary_t, prop_dictionary_t);
 static int unsetifdescr(prop_dictionary_t, prop_dictionary_t);
-static void status(const struct sockaddr *, prop_dictionary_t,
+static void status(const struct sockaddr_dl *, prop_dictionary_t,
 prop_dictionary_t);
 __dead static void usage(void);
 
@@ -851,7 +851,7 @@ printall(const char *ifname, prop_dictio
 {
 	struct ifaddrs *ifap, *ifa;
 	struct ifreq ifr;
-	const struct sockaddr *sdl = NULL;
+	const struct sockaddr_dl *sdl = NULL;
 	prop_dictionary_t env, oenv;
 	int idx;
 	char *p;
@@ -881,7 +881,7 @@ printall(const char *ifname, prop_dictio
 		if (ifname != NULL && strcmp(ifname, ifa->ifa_name) != 0)
 			continue;
 		if (ifa->ifa_addr->sa_family == AF_LINK)
-			sdl = ifa->ifa_addr;
+			sdl = (const struct sockaddr_dl *)ifa->ifa_addr;
 		if (p && strcmp(p, ifa->ifa_name) == 0)
 			continue;
 		if (!prop_dictionary_set_string(env, "if", ifa->ifa_name))
@@ -1265,7 +1265,7 @@ print_human_bytes(bool humanize, uint64_
 #define MAX_PRINT_LEN 58	/* XXX need a better way to determine this! */
 
 void
-status(const struct sockaddr *sdl, prop_dictionary_t env,
+status(const struct sockaddr_dl *sdl, prop_dictionary_t env,
 prop_dictionary_t oenv)
 {
 	const struct if_data *ifi;
@@ -1360,11 +1360,6 @@ status(const struct sockaddr *sdl, prop_
 		free(p);
 	}
 
-	media_status(env, oenv);
-
-	if (!vflag && !zflag)
-		goto proto_status;
-
 	estrlcpy(ifdr.ifdr_name, ifname, sizeof(ifdr.ifdr_name));
 
 	if (prog_ioctl(s, zflag ? SIOCZIFDATA : SIOCGIFDATA, ) == -1)
@@ -1372,6 +1367,11 @@ status(const struct sockaddr *sdl, prop_
 
 	ifi = _data;
 
+	media_status(sdl->sdl_type, ifi->ifi_link_state, env, oenv);
+
+	if (!vflag && !zflag)
+		goto proto_status;
+
 	print_plural("\tinput: ", ifi->ifi_ipackets, "packet");
 	print_human_bytes(hflag, ifi->ifi_ibytes);
 	if (ifi->ifi_imcasts)

Index: src/sbin/ifconfig/media.c
diff -u src/sbin/ifconfig/media.c:1.9 src/sbin/ifconfig/media.c:1.10
--- src/sbin/ifconfig/media.c:1.9	Sun Jun  7 06:02:58 2020
+++ src/sbin/ifconfig/media.c	Tue Sep 22 14:14:17 2020
@@ -1,6 +1,6 @@
 #include 
 #ifndef lint
-__RCSID("$NetBSD: media.c,v 1.9 2020/06/07 06:02:58 thorpej Exp $");
+__RCSID("$NetBSD: media.c,v 1.10 2020/09/22 14:14:17 roy Exp $");
 #endif /* not lint */
 
 #include 
@@ -16,6 +16,7 @@ __RCSID("$NetBSD: media.c,v 1.9 2020/06/
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -52,6 +53,9 @@ static const int ifm_status_valid_list[]
 static const struct ifmedia_status_description ifm_status_descriptions[] =
 IFM_STATUS_DESCRIPTIONS;
 
+const struct if_status_description if_status_descriptions[] =
+	LINK_STATE_DESCRIPTIONS;
+
 static struct pstr mediamode = PSTR_INITIALIZER1(, "mediamode",
 setmediamode, "mediamode", false, _root.pb_parser);
 
@@ -344,8 +348,55 @@ print_media_word(int ifmw, const char *o
 		printf(" instance %d", IFM_INST(ifmw));
 }
 
+static void
+print_link_status(int media_type, int link_state)
+{
+	const struct if_status_description *p;
+
+	printf("\tstatus: ");
+	for (p = if_status_descriptions; p->ifs_string != NULL; p++) {
+		if (LINK_STATE_DESC_MATCH(p, media_type, link_state)) {
+			printf("%s\n", p->ifs_string);
+			return;
+		}
+	}

CVS commit: src/usr.sbin/sysinst

2020-09-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Sep 22 12:21:11 UTC 2020

Modified Files:
src/usr.sbin/sysinst: label.c

Log Message:
In the concrete partitions editor, after deleting the last partition move
the menu selection to the "add a partition" entry (instead of the sentinel
line which is not an active menu entry).


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/sysinst/label.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.sbin/sysinst/label.c
diff -u src/usr.sbin/sysinst/label.c:1.22 src/usr.sbin/sysinst/label.c:1.23
--- src/usr.sbin/sysinst/label.c:1.22	Tue Sep 22 11:44:44 2020
+++ src/usr.sbin/sysinst/label.c	Tue Sep 22 12:21:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: label.c,v 1.22 2020/09/22 11:44:44 martin Exp $	*/
+/*	$NetBSD: label.c,v 1.23 2020/09/22 12:21:11 martin Exp $	*/
 
 /*
  * Copyright 1997 Jonathan Stone
@@ -36,7 +36,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: label.c,v 1.22 2020/09/22 11:44:44 martin Exp $");
+__RCSID("$NetBSD: label.c,v 1.23 2020/09/22 12:21:11 martin Exp $");
 #endif
 
 #include 
@@ -892,6 +892,8 @@ edit_ptn(menudesc *menu, void *arg)
 		sizeof(*menu->opts)*(menu->numopts-edit.index));
 		menu->numopts--;
 		menu->cursel = 0;
+		if (pset->parts->num_part == 0)
+			menu->cursel = 1;	/* skip sentinel line */
 
 		/* things have changed, re-sort */
 		pset->num--;



CVS commit: src/sys/dev/ic

2020-09-22 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Tue Sep 22 11:53:10 UTC 2020

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

Log Message:
PR kern/55674:
move name space availability check from ld_nvme.c:ld_nvme_attach()
to nvme.c:nvme_rescan().
this avoids allocation of ld(4) instances for every possible
name space, even if it is not usable. it also reduces the device
node flood generated from that strategy.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/ic/ld_nvme.c
cvs rdiff -u -r1.49 -r1.50 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/ld_nvme.c
diff -u src/sys/dev/ic/ld_nvme.c:1.23 src/sys/dev/ic/ld_nvme.c:1.24
--- src/sys/dev/ic/ld_nvme.c:1.23	Tue Oct  1 10:59:49 2019
+++ src/sys/dev/ic/ld_nvme.c	Tue Sep 22 11:53:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_nvme.c,v 1.23 2019/10/01 10:59:49 mlelstv Exp $	*/
+/*	$NetBSD: ld_nvme.c,v 1.24 2020/09/22 11:53:10 kardel Exp $	*/
 
 /*-
  * Copyright (C) 2016 NONAKA Kimihiro 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.23 2019/10/01 10:59:49 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.24 2020/09/22 11:53:10 kardel Exp $");
 
 #include 
 #include 
@@ -86,7 +86,6 @@ ld_nvme_attach(device_t parent, device_t
 	struct nvme_attach_args *naa = aux;
 	struct nvme_namespace *ns;
 	struct nvm_namespace_format *f;
-	int error;
 
 	ld->sc_dv = self;
 	sc->sc_nvme = nsc;
@@ -95,28 +94,11 @@ ld_nvme_attach(device_t parent, device_t
 	aprint_naive("\n");
 	aprint_normal("\n");
 
-	error = nvme_ns_identify(sc->sc_nvme, sc->sc_nsid);
-	if (error) {
-		aprint_error_dev(self, "couldn't identify namespace\n");
-		return;
-	}
-
 	ns = nvme_ns_get(sc->sc_nvme, sc->sc_nsid);
 	KASSERT(ns);
-	f = >ident->lbaf[NVME_ID_NS_FLBAS(ns->ident->flbas)];
 
-	/*
-	 * NVME1.0e 6.11 Identify command
-	 *
-	 * LBADS values smaller than 9 are not supported, a value
-	 * of zero means that the format is not used.
-	 */
-	if (f->lbads < 9) {
-		if (f->lbads > 0)
-			aprint_error_dev(self,
-			"unsupported logical data size %u\n", f->lbads);
-		return;
-	}
+	f = >ident->lbaf[NVME_ID_NS_FLBAS(ns->ident->flbas)];
+	KASSERT(f->lbads >= 9); /* only valid LBS data sizes allowed here */
 
 	ld->sc_secsize = 1 << f->lbads;
 	ld->sc_secperunit = ns->ident->nsze;

Index: src/sys/dev/ic/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.49 src/sys/dev/ic/nvme.c:1.50
--- src/sys/dev/ic/nvme.c:1.49	Tue Jul 28 15:59:19 2020
+++ src/sys/dev/ic/nvme.c	Tue Sep 22 11:53:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.49 2020/07/28 15:59:19 jdolecek Exp $	*/
+/*	$NetBSD: nvme.c,v 1.50 2020/09/22 11:53:10 kardel 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.49 2020/07/28 15:59:19 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.50 2020/09/22 11:53:10 kardel Exp $");
 
 #include 
 #include 
@@ -471,23 +471,52 @@ nvme_rescan(device_t self, const char *a
 {
 	struct nvme_softc *sc = device_private(self);
 	struct nvme_attach_args naa;
+	struct nvm_namespace_format *f;
+	struct nvme_namespace *ns;
 	uint64_t cap;
 	int ioq_entries = nvme_ioq_size;
 	int i;
+	int error;
 
 	cap = nvme_read8(sc, NVME_CAP);
 	if (ioq_entries > NVME_CAP_MQES(cap))
 		ioq_entries = NVME_CAP_MQES(cap);
 
-	for (i = 0; i < sc->sc_nn; i++) {
-		if (sc->sc_namespaces[i].dev)
+	for (i = 1; i <= sc->sc_nn; i++) {
+		if (sc->sc_namespaces[i - 1].dev)
+			continue;
+
+		/* identify to check for availability */
+		error = nvme_ns_identify(sc, i);
+		if (error) {
+			aprint_error_dev(self, "couldn't identify namespace #%d\n", i);
+			continue;
+		}
+
+		ns = nvme_ns_get(sc, i);
+		KASSERT(ns);
+
+		f = >ident->lbaf[NVME_ID_NS_FLBAS(ns->ident->flbas)];
+
+		/*
+		 * NVME1.0e 6.11 Identify command
+		 *
+		 * LBADS values smaller than 9 are not supported, a value
+		 * of zero means that the format is not used.
+		 */
+		if (f->lbads < 9) {
+			if (f->lbads > 0)
+aprint_error_dev(self,
+		 "unsupported logical data size %u\n", f->lbads);
 			continue;
+		}
+
 		memset(, 0, sizeof(naa));
-		naa.naa_nsid = i + 1;
+		naa.naa_nsid = i;
 		naa.naa_qentries = (ioq_entries - 1) * sc->sc_nq;
 		naa.naa_maxphys = sc->sc_mdts;
 		naa.naa_typename = sc->sc_modelname;
-		sc->sc_namespaces[i].dev = config_found(sc->sc_dev, ,
+		sc->sc_namespaces[i - 1].dev = config_found(sc->sc_dev, ,
 		nvme_print);
 	}
 	return 0;



CVS commit: src/usr.sbin/sysinst

2020-09-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Sep 22 11:44:44 UTC 2020

Modified Files:
src/usr.sbin/sysinst: label.c

Log Message:
When adding a new partition in the concrete partition editor, make sure
to set a pointer to the partition table interface in the new entry.
Otherwise we may end up not writing back the partitions at all, leading
to further fallout later.
Receipe to reproduce the issue from Frederic Fauberteau, thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/sysinst/label.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.sbin/sysinst/label.c
diff -u src/usr.sbin/sysinst/label.c:1.21 src/usr.sbin/sysinst/label.c:1.22
--- src/usr.sbin/sysinst/label.c:1.21	Fri Aug 14 08:46:54 2020
+++ src/usr.sbin/sysinst/label.c	Tue Sep 22 11:44:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: label.c,v 1.21 2020/08/14 08:46:54 martin Exp $	*/
+/*	$NetBSD: label.c,v 1.22 2020/09/22 11:44:44 martin Exp $	*/
 
 /*
  * Copyright 1997 Jonathan Stone
@@ -36,7 +36,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: label.c,v 1.21 2020/08/14 08:46:54 martin Exp $");
+__RCSID("$NetBSD: label.c,v 1.22 2020/09/22 11:44:44 martin Exp $");
 #endif
 
 #include 
@@ -835,6 +835,7 @@ edit_ptn(menudesc *menu, void *arg)
 	if (edit.rv == 0) {	/* OK, set new data */
 		edit.info.last_mounted = edit.wanted->mount;
 		if (is_new_part) {
+			edit.wanted->parts = pset->parts;
 			edit.wanted->cur_part_id = pset->parts->pscheme->
 			add_partition(pset->parts, , );
 			if (edit.wanted->cur_part_id == NO_PART)



CVS commit: src/usr.bin/make

2020-09-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Sep 22 06:23:33 UTC 2020

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

Log Message:
make(1): remove remaining references to VAR_JUNK and VAR_KEEP


To generate a diff of this commit:
cvs rdiff -u -r1.527 -r1.528 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.527 src/usr.bin/make/var.c:1.528
--- src/usr.bin/make/var.c:1.527	Tue Sep 22 06:13:38 2020
+++ src/usr.bin/make/var.c	Tue Sep 22 06:23:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.527 2020/09/22 06:13:38 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.528 2020/09/22 06:23:33 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
 #include"metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.527 2020/09/22 06:13:38 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.528 2020/09/22 06:23:33 rillig Exp $");
 
 #define VAR_DEBUG_IF(cond, fmt, ...)	\
 if (!(DEBUG(VAR) && (cond)))	\
@@ -1880,8 +1880,8 @@ VarStrftime(const char *fmt, Boolean zul
  *
  * Housekeeping
  *
- * Some modifiers such as :D and :U turn undefined variables into useful
- * variables (VAR_JUNK, VAR_KEEP).
+ * Some modifiers such as :D and :U turn undefined expressions into defined
+ * expressions (see VEF_UNDEF, VEF_DEF).
  *
  * Some modifiers need to free some memory.
  */
@@ -3604,15 +3604,15 @@ Var_Parse(const char **pp, GNode *ctxt, 
 
 	/* The variable expression is based on an undefined variable.
 	 * Nevertheless it needs a Var, for modifiers that access the
-	 * variable name, such as :L or :?, and for modifiers that access
-	 * the variable flags (VAR_JUNK, VAR_KEEP).
+	 * variable name, such as :L or :?.
 	 *
 	 * Most modifiers leave this expression in the "undefined" state
-	 * (VAR_JUNK), only a few modifiers like :D, :U, :L, :P turn this
-	 * undefined expression into a defined expression (VAR_KEEP).
+	 * (VEF_UNDEF), only a few modifiers like :D, :U, :L, :P turn this
+	 * undefined expression into a defined expression (VEF_DEF).
 	 *
 	 * At the end, after applying all modifiers, if the expression
-	 * is still !VAR_KEEP, Var_Parse will return var_Error. */
+	 * is still undefined, Var_Parse will return an empty string
+	 * instead of the actually computed value. */
 	v = bmake_malloc(sizeof(Var));
 	v->name = varname;
 	Buf_Init(>val, 1);
@@ -3685,11 +3685,6 @@ Var_Parse(const char **pp, GNode *ctxt, 
 	(void)VarFreeEnv(v, !keepValue);
 
 } else if (exprFlags & VEF_UNDEF) {
-	/*
-	 * Perform any freeing needed and set *freePtr to NULL so the caller
-	 * doesn't try to free a static pointer.
-	 * If VAR_KEEP is also set then we want to keep str(?) as is.
-	 */
 	if (!(exprFlags & VEF_DEF)) {
 	if (*freePtr != NULL) {
 		free(*freePtr);
@@ -3699,6 +3694,8 @@ Var_Parse(const char **pp, GNode *ctxt, 
 		nstr = bmake_strsedup(start, p);
 		*freePtr = nstr;
 	} else {
+		/* The expression is still undefined, therefore discard the
+		 * actual value and return an empty string instead. */
 		nstr = (eflags & VARE_UNDEFERR) ? var_Error : varNoError;
 	}
 	}



CVS commit: src/usr.bin/make

2020-09-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Sep 22 06:13:39 UTC 2020

Modified Files:
src/usr.bin/make: enum.h var.c
src/usr.bin/make/unit-tests: counter.exp vardebug.exp
varname-dot-shell.exp

Log Message:
make(1): move VAR_JUNK and VAR_KEEP away from VarFlags

These two flags have nothing to do with a variable.  They are only used
while evaluating a variable expression.

While here, rename the flags and make their documentation more precise.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/enum.h
cvs rdiff -u -r1.526 -r1.527 src/usr.bin/make/var.c
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/counter.exp
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/vardebug.exp
cvs rdiff -u -r1.3 -r1.4 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.10 src/usr.bin/make/enum.h:1.11
--- src/usr.bin/make/enum.h:1.10	Sat Sep 12 14:41:00 2020
+++ src/usr.bin/make/enum.h	Tue Sep 22 06:13:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: enum.h,v 1.10 2020/09/12 14:41:00 rillig Exp $	*/
+/*	$NetBSD: enum.h,v 1.11 2020/09/22 06:13:38 rillig Exp $	*/
 
 /*
  Copyright (c) 2020 Roland Illig 
@@ -108,6 +108,17 @@ const char *Enum_ValueToString(int, cons
 	enum { typnam ## _ ## ToStringSize = sizeof joined }
 
 /* Declare the necessary data structures for calling Enum_FlagsToString
+ * for an enum with 2 flags. */
+#define ENUM_FLAGS_RTTI_2(typnam, v1, v2) \
+	ENUM__FLAGS_RTTI(typnam, \
+	ENUM__SPECS_2( \
+		ENUM__SPEC_1(v1), \
+		ENUM__SPEC_1(v2)), \
+	ENUM__JOIN_2( \
+		ENUM__JOIN_STR_1(v1), \
+		ENUM__JOIN_STR_1(v2)))
+
+/* Declare the necessary data structures for calling Enum_FlagsToString
  * for an enum with 3 flags. */
 #define ENUM_FLAGS_RTTI_3(typnam, v1, v2, v3) \
 	ENUM__FLAGS_RTTI(typnam, \
@@ -119,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 6 flags. */
+#define ENUM_FLAGS_RTTI_6(typnam, v1, v2, v3, v4, v5, v6) \
+	ENUM__FLAGS_RTTI(typnam, \
+	ENUM__SPECS_2( \
+		ENUM__SPEC_4(v1, v2, v3, v4), \
+		ENUM__SPEC_2(v5, v6)), \
+	ENUM__JOIN_2( \
+		ENUM__JOIN_STR_4(v1, v2, v3, v4), \
+		ENUM__JOIN_STR_2(v5, v6)))
+
+/* Declare the necessary data structures for calling Enum_FlagsToString
  * for an enum with 8 flags. */
 #define ENUM_FLAGS_RTTI_8(typnam, v1, v2, v3, v4, v5, v6, v7, v8) \
 	ENUM__FLAGS_RTTI(typnam, \

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.526 src/usr.bin/make/var.c:1.527
--- src/usr.bin/make/var.c:1.526	Tue Sep 22 06:06:18 2020
+++ src/usr.bin/make/var.c	Tue Sep 22 06:13:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.526 2020/09/22 06:06:18 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.527 2020/09/22 06:13:38 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
 #include"metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.526 2020/09/22 06:06:18 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.527 2020/09/22 06:13:38 rillig Exp $");
 
 #define VAR_DEBUG_IF(cond, fmt, ...)	\
 if (!(DEBUG(VAR) && (cond)))	\
@@ -199,12 +199,6 @@ typedef enum {
  * These variables are not registered in any GNode, therefore they must
  * be freed as soon as they are not used anymore. */
 VAR_FROM_ENV = 0x02,
-/* The variable is a junk variable that should be destroyed when done with
- * it.  Used by Var_Parse for undefined, modified variables. */
-VAR_JUNK = 0x04,
-/* Variable is VAR_JUNK, but we found a use for it in some modifier and
- * the value is therefore valid. */
-VAR_KEEP = 0x08,
 /* The variable is exported to the environment, to be used by child
  * processes. */
 VAR_EXPORTED = 0x10,
@@ -218,8 +212,8 @@ typedef enum {
 VAR_READONLY = 0x80
 } VarFlags;
 
-ENUM_FLAGS_RTTI_8(VarFlags,
-		  VAR_IN_USE, VAR_FROM_ENV, VAR_JUNK, VAR_KEEP,
+ENUM_FLAGS_RTTI_6(VarFlags,
+		  VAR_IN_USE, VAR_FROM_ENV,
 		  VAR_EXPORTED, VAR_REEXPORT, VAR_FROM_CMD, VAR_READONLY);
 
 typedef struct Var {
@@ -1892,6 +1886,19 @@ VarStrftime(const char *fmt, Boolean zul
  * Some modifiers need to free some memory.
  */
 
+typedef enum VarExprFlags {
+/* The variable expression is based on an undefined variable. */
+VEF_UNDEF = 0x01,
+/* The variable expression started as an undefined expression, but one
+ * of the modifiers (such as :D or :U) has turned the expression from
+ * undefined to defined. */
+VEF_DEF = 0x02
+} VarExprFlags;
+
+ENUM_FLAGS_RTTI_2(VarExprFlags,
+		  VEF_UNDEF, VEF_DEF);
+
+
 typedef struct {
 const char startc;		/* '\0' or '{' or '(' */
 const char endc;		/* '\0' or '}' or ')' */
@@ -1911,13 +1918,14 @@ typedef struct {
  * the 

CVS commit: src/usr.bin/make

2020-09-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Sep 22 06:06:18 UTC 2020

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

Log Message:
make(1): rename VarParseErrors to VarParseResult

The name VPE_OK was confusing since it was not an error at all.


To generate a diff of this commit:
cvs rdiff -u -r1.147 -r1.148 src/usr.bin/make/cond.c
cvs rdiff -u -r1.124 -r1.125 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.525 -r1.526 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.147 src/usr.bin/make/cond.c:1.148
--- src/usr.bin/make/cond.c:1.147	Mon Sep 14 23:09:34 2020
+++ src/usr.bin/make/cond.c	Tue Sep 22 06:06:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.147 2020/09/14 23:09:34 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.148 2020/09/22 06:06:18 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.147 2020/09/14 23:09:34 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.148 2020/09/22 06:06:18 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -417,7 +417,7 @@ CondParser_String(CondParser *par, Boole
 Boolean qt;
 const char *start;
 VarEvalFlags eflags;
-VarParseErrors errors;
+VarParseResult parseResult;
 
 Buf_Init(, 0);
 str = NULL;
@@ -461,10 +461,10 @@ CondParser_String(CondParser *par, Boole
 		 (doEval ? VARE_WANTRES : 0);
 	nested_p = par->p;
 	atStart = nested_p == start;
-	errors = Var_Parse(_p, VAR_CMD, eflags, , freeIt);
+	parseResult = Var_Parse(_p, VAR_CMD, eflags, , freeIt);
 	/* TODO: handle errors */
 	if (str == var_Error) {
-	if (errors & VPE_ANY_MSG)
+	if (parseResult & VPR_ANY_MSG)
 	par->printedError = TRUE;
 		if (*freeIt) {
 		free(*freeIt);

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.124 src/usr.bin/make/nonints.h:1.125
--- src/usr.bin/make/nonints.h:1.124	Tue Sep 22 04:05:41 2020
+++ src/usr.bin/make/nonints.h	Tue Sep 22 06:06:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.124 2020/09/22 04:05:41 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.125 2020/09/22 06:06:18 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -216,48 +216,48 @@ typedef enum {
 typedef enum {
 
 /* Both parsing and evaluation succeeded. */
-VPE_OK		= 0x,
+VPR_OK		= 0x,
 
 /* See if a message has already been printed for this error. */
-VPE_ANY_MSG		= 0x0001,
+VPR_ANY_MSG		= 0x0001,
 
 /* Parsing failed.
  * No error message has been printed yet.
- * Deprecated, migrate to VPE_PARSE_MSG instead. */
-VPE_PARSE_SILENT	= 0x0002,
+ * Deprecated, migrate to VPR_PARSE_MSG instead. */
+VPR_PARSE_SILENT	= 0x0002,
 
 /* Parsing failed.
  * An error message has already been printed. */
-VPE_PARSE_MSG	= VPE_PARSE_SILENT | VPE_ANY_MSG,
+VPR_PARSE_MSG	= VPR_PARSE_SILENT | VPR_ANY_MSG,
 
 /* Parsing succeeded.
  * During evaluation, VARE_UNDEFERR was set and there was an undefined
  * variable.
  * No error message has been printed yet.
- * Deprecated, migrate to VPE_UNDEF_MSG instead. */
-VPE_UNDEF_SILENT	= 0x0004,
+ * Deprecated, migrate to VPR_UNDEF_MSG instead. */
+VPR_UNDEF_SILENT	= 0x0004,
 
 /* Parsing succeeded.
  * During evaluation, VARE_UNDEFERR was set and there was an undefined
  * variable.
  * An error message has already been printed. */
-VPE_UNDEF_MSG	= VPE_UNDEF_SILENT | VPE_ANY_MSG,
+VPR_UNDEF_MSG	= VPR_UNDEF_SILENT | VPR_ANY_MSG,
 
 /* Parsing succeeded.
  * Evaluation failed.
  * No error message has been printed yet.
- * Deprecated, migrate to VPE_EVAL_MSG instead. */
-VPE_EVAL_SILENT	= 0x0006,
+ * Deprecated, migrate to VPR_EVAL_MSG instead. */
+VPR_EVAL_SILENT	= 0x0006,
 
 /* Parsing succeeded.
  * Evaluation failed.
  * An error message has already been printed. */
-VPE_EVAL_MSG	= VPE_EVAL_SILENT | VPE_ANY_MSG,
+VPR_EVAL_MSG	= VPR_EVAL_SILENT | VPR_ANY_MSG,
 
 /* The exact error handling status is not known yet.
- * Deprecated, migrate to VPE_OK or any VPE_*_MSG instead. */
-VPE_UNKNOWN		= 0x0008
-} VarParseErrors;
+ * Deprecated, migrate to VPR_OK or any VPE_*_MSG instead. */
+VPR_UNKNOWN		= 0x0008
+} VarParseResult;
 
 void Var_Delete(const char *, GNode *);
 void Var_Set(const char *, const char *, GNode *);
@@ -265,7 +265,7 @@ void Var_Set_with_flags(const char *, co
 void Var_Append(const char *, const char *, GNode *);
 Boolean Var_Exists(const char *, GNode *);
 const char *Var_Value(const char *, GNode *, char **);
-VarParseErrors Var_Parse(const char **, GNode *, VarEvalFlags,