CVS commit: [netbsd-10] src/doc

2023-06-22 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jun 23 05:42:34 UTC 2023

Modified Files:
src/doc [netbsd-10]: CHANGES-10.0

Log Message:
Ticket #210.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.72 -r1.1.2.73 src/doc/CHANGES-10.0

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-10.0
diff -u src/doc/CHANGES-10.0:1.1.2.72 src/doc/CHANGES-10.0:1.1.2.73
--- src/doc/CHANGES-10.0:1.1.2.72	Thu Jun 22 08:16:37 2023
+++ src/doc/CHANGES-10.0	Fri Jun 23 05:42:34 2023
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-10.0,v 1.1.2.72 2023/06/22 08:16:37 martin Exp $
+# $NetBSD: CHANGES-10.0,v 1.1.2.73 2023/06/23 05:42:34 msaitoh Exp $
 
 A complete list of changes from the initial NetBSD 10.0 branch on 2022-12-16
 until the 10.0 release:
@@ -2277,3 +2277,9 @@ sys/dev/pci/if_wmvar.h1.49
 	- Add comment.
 	[msaitoh, ticket #213]
 
+usr.sbin/sysinst/main.c1.31
+
+	If the install medium does not come with any openssl trusted root
+	certs, tell ftp(1) not to verify trust chains when doing https
+	downloads.
+	[martin, ticket #212]



CVS commit: [netbsd-10] src/doc

2023-06-22 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jun 23 05:42:34 UTC 2023

Modified Files:
src/doc [netbsd-10]: CHANGES-10.0

Log Message:
Ticket #210.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.72 -r1.1.2.73 src/doc/CHANGES-10.0

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



CVS commit: [netbsd-10] src/usr.sbin/sysinst

2023-06-22 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jun 23 05:40:02 UTC 2023

Modified Files:
src/usr.sbin/sysinst [netbsd-10]: main.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #212):
usr.sbin/sysinst/main.c: revision 1.31
If the install medium does not come with any openssl trusted root certs,
tell ftp(1) not to verify trust chains when doing https downloads.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.30.2.1 src/usr.sbin/sysinst/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.sbin/sysinst/main.c
diff -u src/usr.sbin/sysinst/main.c:1.30 src/usr.sbin/sysinst/main.c:1.30.2.1
--- src/usr.sbin/sysinst/main.c:1.30	Sun Jul 10 10:52:40 2022
+++ src/usr.sbin/sysinst/main.c	Fri Jun 23 05:40:02 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.30 2022/07/10 10:52:40 martin Exp $	*/
+/*	$NetBSD: main.c,v 1.30.2.1 2023/06/23 05:40:02 msaitoh Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -97,6 +97,7 @@ __dead static void miscsighandler(int);
 static void ttysighandler(int);
 static void cleanup(void);
 static void process_f_flag(char *);
+static bool no_openssl_trust_anchors_available(void);
 
 static int exit_cleanly = 0;	/* Did we finish nicely? */
 FILE *logfp;			/* log file */
@@ -264,6 +265,10 @@ main(int argc, char **argv)
 	/* Initialize the partitioning subsystem */
 	partitions_init();
 
+	/* do we need to tell ftp(1) to avoid checking certificate chains? */
+	if (no_openssl_trust_anchors_available())
+		setenv("FTPSSLNOVERIFY", "1", 1);
+
 	/* initialize message window */
 	if (menu_init()) {
 		__menu_initerror();
@@ -635,3 +640,46 @@ process_f_flag(char *f_name)
 
 	fclose(fp);
 }
+
+/*
+ * return true if we do not have any root certificates installed,
+ * so can not verify any trust chain.
+ * We rely on /etc/openssl being the OPENSSLDIR and test the
+ * "all in one" /etc/openssl/cert.pem first, if that is not found
+ * check if there are multiple regular files or symlinks in
+ * /etc/openssl/certs/.
+ */
+static bool
+no_openssl_trust_anchors_available(void)
+{
+	struct stat sb;
+	DIR *dir;
+	struct dirent *ent;
+	size_t cnt;
+
+	/* check the omnibus single file variant first */
+	if (stat("/etc/openssl/cert.pem", ) == 0 &&
+	S_ISREG(sb.st_mode) && sb.st_size > 0)
+		return false;	/* exists and is a non-empty file */
+
+	/* look for files/symlinks in the certs subdirectory */
+	dir = opendir("/etc/openssl/certs");
+	if (dir == NULL)
+		return true;
+	for (cnt = 0; cnt < 2; ) {
+		ent = readdir(dir);
+		if (ent == NULL)
+			break;
+		switch (ent->d_type) {
+		case DT_REG:
+		case DT_LNK:
+			cnt++;
+			break;
+		default:
+			break;
+		}
+	}
+	closedir(dir);
+
+	return cnt < 2;
+}



CVS commit: [netbsd-10] src/usr.sbin/sysinst

2023-06-22 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jun 23 05:40:02 UTC 2023

Modified Files:
src/usr.sbin/sysinst [netbsd-10]: main.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #212):
usr.sbin/sysinst/main.c: revision 1.31
If the install medium does not come with any openssl trusted root certs,
tell ftp(1) not to verify trust chains when doing https downloads.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.30.2.1 src/usr.sbin/sysinst/main.c

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



CVS commit: src/sys/dev/pci

2023-06-22 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jun 23 05:36:28 UTC 2023

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
Add missing read to count Circuit Breaker Rx Dropped Packet correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.781 -r1.782 src/sys/dev/pci/if_wm.c

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



CVS commit: src/sys/dev/pci

2023-06-22 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jun 23 05:36:28 UTC 2023

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
Add missing read to count Circuit Breaker Rx Dropped Packet correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.781 -r1.782 src/sys/dev/pci/if_wm.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/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.781 src/sys/dev/pci/if_wm.c:1.782
--- src/sys/dev/pci/if_wm.c:1.781	Thu May 11 07:47:14 2023
+++ src/sys/dev/pci/if_wm.c	Fri Jun 23 05:36:28 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.781 2023/05/11 07:47:14 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.782 2023/06/23 05:36:28 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.781 2023/05/11 07:47:14 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.782 2023/06/23 05:36:28 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_wm.h"
@@ -6588,6 +6588,8 @@ wm_update_stats(struct wm_softc *sc)
 			WM_EVCNT_ADD(>sc_ev_tsctfc,
 			CSR_READ(sc, WMREG_TSCTFC));
 		else {
+			WM_EVCNT_ADD(>sc_ev_cbrdpc,
+			CSR_READ(sc, WMREG_CBRDPC));
 			WM_EVCNT_ADD(>sc_ev_cbrmpc,
 			CSR_READ(sc, WMREG_CBRMPC));
 		}



CVS commit: src/usr.bin/make

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jun 23 05:21:10 UTC 2023

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

Log Message:
make: clean up variable and function names

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.352 -r1.353 src/usr.bin/make/cond.c
cvs rdiff -u -r1.1058 -r1.1059 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.352 src/usr.bin/make/cond.c:1.353
--- src/usr.bin/make/cond.c:1.352	Fri Jun 23 04:56:54 2023
+++ src/usr.bin/make/cond.c	Fri Jun 23 05:21:10 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.352 2023/06/23 04:56:54 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.353 2023/06/23 05:21:10 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -92,7 +92,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.352 2023/06/23 04:56:54 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.353 2023/06/23 05:21:10 rillig Exp $");
 
 /*
  * Conditional expressions conform to this grammar:
@@ -1265,7 +1265,7 @@ ParseVarnameGuard(const char **pp, const
 Guard *
 Cond_ExtractGuard(const char *line)
 {
-	const char *p, *name;
+	const char *p, *varname;
 	Substring dir;
 	enum GuardKind kind;
 	Guard *guard;
@@ -1281,16 +1281,14 @@ Cond_ExtractGuard(const char *line)
 
 	if (Substring_Equals(dir, "if")) {
 		if (skip_string(, "!defined(")) {
-			if (ParseVarnameGuard(, )
+			if (ParseVarnameGuard(, )
 			&& strcmp(p, ")") == 0)
 goto found_variable;
 		} else if (skip_string(, "!target(")) {
-			name = p;
+			const char *arg_p = p;
 			free(ParseWord(, false));
 			if (strcmp(p, ")") == 0) {
-char *target;
-p = name;
-target = ParseWord(, true);
+char *target = ParseWord(_p, true);
 guard = bmake_malloc(sizeof(*guard));
 guard->kind = GK_TARGET;
 guard->name = target;
@@ -1298,7 +1296,7 @@ Cond_ExtractGuard(const char *line)
 			}
 		}
 	} else if (Substring_Equals(dir, "ifndef")) {
-		if (ParseVarnameGuard(, ) && *p == '\0')
+		if (ParseVarnameGuard(, ) && *p == '\0')
 			goto found_variable;
 	}
 	return NULL;
@@ -1307,7 +1305,7 @@ found_variable:
 	kind = GK_VARIABLE;
 	guard = bmake_malloc(sizeof(*guard));
 	guard->kind = kind;
-	guard->name = bmake_strsedup(name, p);
+	guard->name = bmake_strsedup(varname, p);
 	return guard;
 }
 

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.1058 src/usr.bin/make/var.c:1.1059
--- src/usr.bin/make/var.c:1.1058	Fri Jun 23 04:56:54 2023
+++ src/usr.bin/make/var.c	Fri Jun 23 05:21:10 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1058 2023/06/23 04:56:54 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.1059 2023/06/23 05:21:10 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1058 2023/06/23 04:56:54 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1059 2023/06/23 05:21:10 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -1536,7 +1536,7 @@ nosub:
 #ifndef NO_REGEX
 /* Print the error caused by a regcomp or regexec call. */
 static void
-VarREError(int reerr, const regex_t *pat, const char *str)
+RegexError(int reerr, const regex_t *pat, const char *str)
 {
 	size_t errlen = regerror(reerr, pat, NULL, 0);
 	char *errbuf = bmake_malloc(errlen);
@@ -1621,7 +1621,7 @@ again:
 	if (xrv == 0)
 		goto ok;
 	if (xrv != REG_NOMATCH)
-		VarREError(xrv, >re, "Unexpected regex error");
+		RegexError(xrv, >re, "Unexpected regex error");
 no_match:
 	SepBuf_AddRange(buf, wp, word.end);
 	return;
@@ -1792,7 +1792,7 @@ SubstringWords_JoinFree(SubstringWords w
  * If quoteDollar is set, also quote and double any '$' characters.
  */
 static void
-VarQuote(const char *str, bool quoteDollar, LazyBuf *buf)
+QuoteShell(const char *str, bool quoteDollar, LazyBuf *buf)
 {
 	const char *p;
 
@@ -1818,7 +1818,7 @@ VarQuote(const char *str, bool quoteDoll
  * algorithm. Output is encoded as 8 hex digits, in Little Endian order.
  */
 static char *
-VarHash(const char *str)
+Hash(const char *str)
 {
 	static const char hexdigits[16] = "0123456789abcdef";
 	const unsigned char *ustr = (const unsigned char *)str;
@@ -1878,7 +1878,7 @@ VarHash(const char *str)
 }
 
 static char *
-VarStrftime(const char *fmt, time_t t, bool gmt)
+FormatTime(const char *fmt, time_t t, bool gmt)
 {
 	char buf[BUFSIZ];
 
@@ -2575,7 +2575,7 @@ ApplyModifier_Time(const char **pp, ModC
 
 	expr = ch->expr;
 	if (Expr_ShouldEval(expr))
-		Expr_SetValueOwn(expr, VarStrftime(Expr_Str(expr), t, gmt));
+		Expr_SetValueOwn(expr, FormatTime(Expr_Str(expr), t, gmt));
 
 	return AMR_OK;
 }
@@ -2589,7 +2589,7 @@ ApplyModifier_Hash(const char **pp, ModC
 	*pp += 4;
 
 	if (ModChain_ShouldEval(ch))
-		

CVS commit: src/usr.bin/make

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jun 23 05:21:10 UTC 2023

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

Log Message:
make: clean up variable and function names

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.352 -r1.353 src/usr.bin/make/cond.c
cvs rdiff -u -r1.1058 -r1.1059 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.



CVS commit: src/usr.bin/make

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jun 23 05:03:04 UTC 2023

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

Log Message:
make: reduce indentation in pattern matching code

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/usr.bin/make/str.c

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



CVS commit: src/usr.bin/make

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jun 23 05:03:04 UTC 2023

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

Log Message:
make: reduce indentation in pattern matching code

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/usr.bin/make/str.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/str.c
diff -u src/usr.bin/make/str.c:1.98 src/usr.bin/make/str.c:1.99
--- src/usr.bin/make/str.c:1.98	Fri Jun 23 04:56:54 2023
+++ src/usr.bin/make/str.c	Fri Jun 23 05:03:04 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: str.c,v 1.98 2023/06/23 04:56:54 rillig Exp $	*/
+/*	$NetBSD: str.c,v 1.99 2023/06/23 05:03:04 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -71,7 +71,7 @@
 #include "make.h"
 
 /*	"@(#)str.c	5.8 (Berkeley) 6/1/90"	*/
-MAKE_RCSID("$NetBSD: str.c,v 1.98 2023/06/23 04:56:54 rillig Exp $");
+MAKE_RCSID("$NetBSD: str.c,v 1.99 2023/06/23 05:03:04 rillig Exp $");
 
 
 static HashTable interned_strings;
@@ -344,31 +344,30 @@ match_fixed_length:
 			bool neg = pat[1] == '^';
 			pat += neg ? 2 : 1;
 
-			for (;;) {
-if (*pat == '\0')
-	res.error =
-	"Unfinished character list";
-if (*pat == ']' || *pat == '\0') {
-	if (neg)
-		break;
-	goto match_done;
-}
-if (*pat == *str)
-	break;
-if (pat[1] == '-') {
-	if (pat[2] == '\0') {
-		res.error =
-		"Unfinished character "
-		"range";
-		res.matched = neg;
-		return res;
-	}
-	if (in_range(pat[0], *str, pat[2]))
-		break;
-	pat += 2;
-}
-pat++;
+		next_char_in_list:
+			if (*pat == '\0')
+res.error = "Unfinished character list";
+			if (*pat == ']' || *pat == '\0') {
+if (neg)
+	goto end_of_char_list;
+goto match_done;
 			}
+			if (*pat == *str)
+goto end_of_char_list;
+			if (pat[1] == '-' && pat[2] == '\0') {
+res.error = "Unfinished character range";
+res.matched = neg;
+return res;
+			}
+			if (pat[1] == '-') {
+if (in_range(pat[0], *str, pat[2]))
+	goto end_of_char_list;
+pat += 2;
+			}
+			pat++;
+			goto next_char_in_list;
+
+		end_of_char_list:
 			if (neg && *pat != ']' && *pat != '\0')
 goto match_done;
 			while (*pat != ']' && *pat != '\0')



CVS commit: src/usr.bin/make

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jun 23 04:56:54 UTC 2023

Modified Files:
src/usr.bin/make: cond.c dir.c str.c str.h var.c
src/usr.bin/make/unit-tests: cond-func-make.exp cond-func-make.mk
varmod-match-escape.exp varmod-match-escape.mk varmod-match.exp
varmod-match.mk

Log Message:
make: warn about malformed patterns in ':M', ':N' and '.if make(...)'

These patterns shouldn't occur in practice, as their results are tricky
to predict.  Generate a warning for now, and maybe an error later.

Reviewed by sjg@.


To generate a diff of this commit:
cvs rdiff -u -r1.351 -r1.352 src/usr.bin/make/cond.c
cvs rdiff -u -r1.281 -r1.282 src/usr.bin/make/dir.c
cvs rdiff -u -r1.97 -r1.98 src/usr.bin/make/str.c
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/str.h
cvs rdiff -u -r1.1057 -r1.1058 src/usr.bin/make/var.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cond-func-make.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cond-func-make.mk
cvs rdiff -u -r1.17 -r1.18 \
src/usr.bin/make/unit-tests/varmod-match-escape.exp
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod-match-escape.mk \
src/usr.bin/make/unit-tests/varmod-match.exp
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/varmod-match.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/cond.c
diff -u src/usr.bin/make/cond.c:1.351 src/usr.bin/make/cond.c:1.352
--- src/usr.bin/make/cond.c:1.351	Wed Jun 21 04:20:20 2023
+++ src/usr.bin/make/cond.c	Fri Jun 23 04:56:54 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.351 2023/06/21 04:20:20 sjg Exp $	*/
+/*	$NetBSD: cond.c,v 1.352 2023/06/23 04:56:54 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -92,7 +92,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.351 2023/06/21 04:20:20 sjg Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.352 2023/06/23 04:56:54 rillig Exp $");
 
 /*
  * Conditional expressions conform to this grammar:
@@ -295,10 +295,19 @@ static bool
 FuncMake(const char *targetPattern)
 {
 	StringListNode *ln;
+	bool warned = false;
 
-	for (ln = opts.create.first; ln != NULL; ln = ln->next)
-		if (Str_Match(ln->datum, targetPattern))
+	for (ln = opts.create.first; ln != NULL; ln = ln->next) {
+		StrMatchResult res = Str_Match(ln->datum, targetPattern);
+		if (res.error != NULL && !warned) {
+			warned = true;
+			Parse_Error(PARSE_WARNING,
+			"%s in pattern argument '%s' to function 'make'",
+			res.error, targetPattern);
+		}
+		if (res.matched)
 			return true;
+	}
 	return false;
 }
 

Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.281 src/usr.bin/make/dir.c:1.282
--- src/usr.bin/make/dir.c:1.281	Thu Jun 22 09:09:08 2023
+++ src/usr.bin/make/dir.c	Fri Jun 23 04:56:54 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.281 2023/06/22 09:09:08 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.282 2023/06/23 04:56:54 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -138,7 +138,7 @@
 #include "job.h"
 
 /*	"@(#)dir.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: dir.c,v 1.281 2023/06/22 09:09:08 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.282 2023/06/23 04:56:54 rillig Exp $");
 
 /*
  * A search path is a list of CachedDir structures. A CachedDir has in it the
@@ -668,8 +668,10 @@ DirMatchFiles(const char *pattern, Cache
 	HashIter_InitSet(, >files);
 	while (HashIter_Next() != NULL) {
 		const char *base = hi.entry->key;
+		StrMatchResult res = Str_Match(base, pattern);
+		/* TODO: handle errors from res.error */
 
-		if (!Str_Match(base, pattern))
+		if (!res.matched)
 			continue;
 
 		/*

Index: src/usr.bin/make/str.c
diff -u src/usr.bin/make/str.c:1.97 src/usr.bin/make/str.c:1.98
--- src/usr.bin/make/str.c:1.97	Thu Jun 22 16:59:17 2023
+++ src/usr.bin/make/str.c	Fri Jun 23 04:56:54 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: str.c,v 1.97 2023/06/22 16:59:17 rillig Exp $	*/
+/*	$NetBSD: str.c,v 1.98 2023/06/23 04:56:54 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -71,7 +71,7 @@
 #include "make.h"
 
 /*	"@(#)str.c	5.8 (Berkeley) 6/1/90"	*/
-MAKE_RCSID("$NetBSD: str.c,v 1.97 2023/06/22 16:59:17 rillig Exp $");
+MAKE_RCSID("$NetBSD: str.c,v 1.98 2023/06/23 04:56:54 rillig Exp $");
 
 
 static HashTable interned_strings;
@@ -316,13 +316,12 @@ in_range(char e1, char c, char e2)
  * Test if a string matches a pattern like "*.[ch]". The pattern matching
  * characters are '*', '?' and '[]', as in fnmatch(3).
  *
- * XXX: this function does not detect or report malformed patterns.
- *
  * See varmod-match.mk for examples and edge cases.
  */
-bool
+StrMatchResult
 Str_Match(const char *str, const char *pat)
 {
+	StrMatchResult res = { NULL, false };
 	const char *fixed_str, *fixed_pat;
 	bool asterisk, matched;
 
@@ -336,7 

CVS commit: src/usr.bin/make

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jun 23 04:56:54 UTC 2023

Modified Files:
src/usr.bin/make: cond.c dir.c str.c str.h var.c
src/usr.bin/make/unit-tests: cond-func-make.exp cond-func-make.mk
varmod-match-escape.exp varmod-match-escape.mk varmod-match.exp
varmod-match.mk

Log Message:
make: warn about malformed patterns in ':M', ':N' and '.if make(...)'

These patterns shouldn't occur in practice, as their results are tricky
to predict.  Generate a warning for now, and maybe an error later.

Reviewed by sjg@.


To generate a diff of this commit:
cvs rdiff -u -r1.351 -r1.352 src/usr.bin/make/cond.c
cvs rdiff -u -r1.281 -r1.282 src/usr.bin/make/dir.c
cvs rdiff -u -r1.97 -r1.98 src/usr.bin/make/str.c
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/str.h
cvs rdiff -u -r1.1057 -r1.1058 src/usr.bin/make/var.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cond-func-make.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cond-func-make.mk
cvs rdiff -u -r1.17 -r1.18 \
src/usr.bin/make/unit-tests/varmod-match-escape.exp
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod-match-escape.mk \
src/usr.bin/make/unit-tests/varmod-match.exp
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/varmod-match.mk

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



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

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jun 23 04:41:24 UTC 2023

Modified Files:
src/usr.bin/make/unit-tests: check-expect.lua

Log Message:
tests/make: sort missing 'expect' comments by their location


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/check-expect.lua

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



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

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jun 23 04:41:24 UTC 2023

Modified Files:
src/usr.bin/make/unit-tests: check-expect.lua

Log Message:
tests/make: sort missing 'expect' comments by their location


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/check-expect.lua

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/check-expect.lua
diff -u src/usr.bin/make/unit-tests/check-expect.lua:1.6 src/usr.bin/make/unit-tests/check-expect.lua:1.7
--- src/usr.bin/make/unit-tests/check-expect.lua:1.6	Thu Jun  1 20:56:35 2023
+++ src/usr.bin/make/unit-tests/check-expect.lua	Fri Jun 23 04:41:24 2023
@@ -1,5 +1,5 @@
 #!  /usr/bin/lua
--- $NetBSD: check-expect.lua,v 1.6 2023/06/01 20:56:35 rillig Exp $
+-- $NetBSD: check-expect.lua,v 1.7 2023/06/23 04:41:24 rillig Exp $
 
 --[[
 
@@ -68,6 +68,33 @@ local function collect_lineno_diagnostic
 end
 
 
+local function missing(by_location)
+  ---@type {filename: string, lineno: number, location: string, message: string}[]
+  local missing_expectations = {}
+
+  for location, messages in pairs(by_location) do
+for _, message in ipairs(messages) do
+  if message ~= "" and location:find(".mk:") then
+local filename, lineno = location:match("^(%S+):(%d+)$")
+table.insert(missing_expectations, {
+  filename = filename,
+  lineno = tonumber(lineno),
+  location = location,
+  message = message
+})
+  end
+end
+  end
+  table.sort(missing_expectations, function(a, b)
+if a.filename ~= b.filename then
+  return a.filename < b.filename
+end
+return a.lineno < b.lineno
+  end)
+  return missing_expectations
+end
+
+
 local function check_mk(mk_fname)
   local exp_fname = mk_fname:gsub("%.mk$", ".exp")
   local mk_lines = load_lines(mk_fname)
@@ -119,13 +146,8 @@ local function check_mk(mk_fname)
 end
   end
 
-  -- XXX: The messages are not sorted in any meaningful way.
-  for location, messages in pairs(by_location) do
-for _, message in ipairs(messages) do
-  if message ~= "" and location:find(".mk:") then
-print_error("missing: %s: # expect+1: %s", location, message)
-  end
-end
+  for _, m in ipairs(missing(by_location)) do
+print_error("missing: %s: # expect+1: %s", m.location, m.message)
   end
 end
 



CVS commit: src/usr.bin/crunch/crunchgen

2023-06-22 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Jun 23 02:13:03 UTC 2023

Modified Files:
src/usr.bin/crunch/crunchgen: crunchgen.c

Log Message:
crunchgen(1): Clear PaX flags instead of removing its ELF note section.

The latter results in zero-filled hole in ELF note segment for EARM,
where PaX section is not located the bottom of that segment (see
src/lib/csu/sysident.S). Fortunately, this hole does not cause real
harms for our in-kernel ELF note parser, except for noisy warnings on
DIAGNOSTIC kernels.

Bump CRUNCH_VERSION.

PR toolchain/52675


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/usr.bin/crunch/crunchgen/crunchgen.c

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



CVS commit: src/usr.bin/crunch/crunchgen

2023-06-22 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Jun 23 02:13:03 UTC 2023

Modified Files:
src/usr.bin/crunch/crunchgen: crunchgen.c

Log Message:
crunchgen(1): Clear PaX flags instead of removing its ELF note section.

The latter results in zero-filled hole in ELF note segment for EARM,
where PaX section is not located the bottom of that segment (see
src/lib/csu/sysident.S). Fortunately, this hole does not cause real
harms for our in-kernel ELF note parser, except for noisy warnings on
DIAGNOSTIC kernels.

Bump CRUNCH_VERSION.

PR toolchain/52675


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/usr.bin/crunch/crunchgen/crunchgen.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/crunch/crunchgen/crunchgen.c
diff -u src/usr.bin/crunch/crunchgen/crunchgen.c:1.94 src/usr.bin/crunch/crunchgen/crunchgen.c:1.95
--- src/usr.bin/crunch/crunchgen/crunchgen.c:1.94	Sun Dec 29 18:26:16 2019
+++ src/usr.bin/crunch/crunchgen/crunchgen.c	Fri Jun 23 02:13:03 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: crunchgen.c,v 1.94 2019/12/29 18:26:16 christos Exp $	*/
+/*	$NetBSD: crunchgen.c,v 1.95 2023/06/23 02:13:03 rin Exp $	*/
 /*
  * Copyright (c) 1994 University of Maryland
  * All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if !defined(lint)
-__RCSID("$NetBSD: crunchgen.c,v 1.94 2019/12/29 18:26:16 christos Exp $");
+__RCSID("$NetBSD: crunchgen.c,v 1.95 2023/06/23 02:13:03 rin Exp $");
 #endif
 
 #include 
@@ -55,7 +55,7 @@ __RCSID("$NetBSD: crunchgen.c,v 1.94 201
 #include 
 #include 
 
-#define CRUNCH_VERSION	"20191223"
+#define CRUNCH_VERSION	"20230623"
 
 #define MAXLINELEN	16384
 #define MAXFIELDS 	 2048
@@ -991,7 +991,7 @@ top_makefile_rules(FILE *outmk)
 
 fprintf(outmk, "PROG=%s\n\n", execfname);
 
-fprintf(outmk, "OBJCOPY_REMOVE_FLAGS=-R .eh_frame_hdr -R .note -R .note.netbsd.pax -R .ident -R .comment -R .copyright\n\n");
+fprintf(outmk, "OBJCOPY_REMOVE_FLAGS=-R .eh_frame_hdr -R .note -R .ident -R .comment -R .copyright\n\n");
 
 fprintf(outmk, "OBJCOPY_REMOVE_FLAGS+=-R .eh_frame\n");
 fprintf(outmk, ".if ${MACHINE} != \"sparc64\"\n");
@@ -1003,9 +1003,10 @@ top_makefile_rules(FILE *outmk)
 fprintf(outmk, "${PROG}.strip:\n");
 fprintf(outmk, "\t${MAKE} -f ${PROG}.mk ${PROG}\n");
 fprintf(outmk, "\t@[ -f ${PROG}.unstripped -a ! ${PROG} -nt ${PROG}.unstripped ] || { \\\n");
-fprintf(outmk, "\t\t${_MKSHMSG:Uecho} \"  strip \" ${PROG}; \\\n");
+fprintf(outmk, "\t\t${_MKSHMSG:Uecho} \"  strip and clear PaX flags \" ${PROG}; \\\n");
 fprintf(outmk, "\t\tcp ${PROG} ${PROG}.unstripped && \\\n");
 fprintf(outmk, "\t\t${OBJCOPY} -S ${OBJCOPY_REMOVE_FLAGS} ${PROG} && \\\n");
+fprintf(outmk, "\t\t${PAXCTL} -0 ${PROG} && \\\n");
 fprintf(outmk, "\t\ttouch ${PROG}.unstripped; \\\n");
 fprintf(outmk, "\t}\n");
 fprintf(outmk, "objs: $(SUBMAKE_TARGETS)\n");



CVS commit: src/usr.sbin/paxctl

2023-06-22 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Jun 23 01:56:21 UTC 2023

Modified Files:
src/usr.sbin/paxctl: paxctl.8 paxctl.c

Log Message:
paxctl(8): Introduce -0 option to clear all PaX flag bits in ELF note.
Part of PR toolchain/52675


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/paxctl/paxctl.8
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/paxctl/paxctl.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/paxctl/paxctl.8
diff -u src/usr.sbin/paxctl/paxctl.8:1.16 src/usr.sbin/paxctl/paxctl.8:1.17
--- src/usr.sbin/paxctl/paxctl.8:1.16	Tue Nov  8 08:21:52 2016
+++ src/usr.sbin/paxctl/paxctl.8	Fri Jun 23 01:56:21 2023
@@ -1,4 +1,4 @@
-.\"	$NetBSD: paxctl.8,v 1.16 2016/11/08 08:21:52 wiz Exp $
+.\"	$NetBSD: paxctl.8,v 1.17 2023/06/23 01:56:21 rin Exp $
 .\"
 .\" Copyright 2006 Elad Efrat 
 .\" Copyright 2008 Christos Zoulas 
@@ -23,7 +23,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd November 7, 2016
+.Dd June 23, 2023
 .Dt PAXCTL 8
 .Os
 .Sh NAME
@@ -31,7 +31,7 @@
 .Nd list and modify PaX flags associated with an ELF program
 .Sh SYNOPSIS
 .Nm
-.Ar flags
+.Op -0 | flags
 .Ar program ...
 .Sh DESCRIPTION
 The
@@ -44,7 +44,10 @@ can be found in the
 .Xr security 7
 manpage.
 .Pp
-Each flag can be prefixed either with a
+If
+.Fl 0
+option is specified, all PaX flags (including reserved bits) are cleared.
+Otherwise, each flag can be prefixed either with a
 .Dq +
 or a
 .Dq -

Index: src/usr.sbin/paxctl/paxctl.c
diff -u src/usr.sbin/paxctl/paxctl.c:1.12 src/usr.sbin/paxctl/paxctl.c:1.13
--- src/usr.sbin/paxctl/paxctl.c:1.12	Tue Oct 27 16:27:47 2009
+++ src/usr.sbin/paxctl/paxctl.c	Fri Jun 23 01:56:21 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: paxctl.c,v 1.12 2009/10/27 16:27:47 christos Exp $ */
+/* $NetBSD: paxctl.c,v 1.13 2023/06/23 01:56:21 rin Exp $ */
 
 /*-
  * Copyright (c) 2006 Elad Efrat 
@@ -34,7 +34,7 @@
 #include 
 #ifndef lint
 #ifdef __RCSID
-__RCSID("$NetBSD: paxctl.c,v 1.12 2009/10/27 16:27:47 christos Exp $");
+__RCSID("$NetBSD: paxctl.c,v 1.13 2023/06/23 01:56:21 rin Exp $");
 #endif
 #endif /* not lint */
 
@@ -98,7 +98,8 @@ static const struct paxflag {
 static void
 usage(void)
 {
-	(void)fprintf(stderr, "Usage: %s [ <-|+> ]  ...\n",
+	(void)fprintf(stderr,
+	"Usage: %s [ -0 | <-|+> ]  ...\n",
 #if HAVE_NBTOOL_CONFIG_H
 	"paxctl"
 #else
@@ -165,7 +166,7 @@ pax_printflags(const char *name, int man
 
 static int
 process_one(const char *name, uint32_t add_flags, uint32_t del_flags,
-int list, int many)
+int clear, int list, int many)
 {
 	union {
 	Elf32_Ehdr h32;
@@ -279,8 +280,12 @@ process_one(const char *name, uint32_t a
 			break;
 		}
 
-		pax_tag.flags |= SWAP(add_flags);
-		pax_tag.flags &= SWAP(~del_flags);
+		if (clear) {
+			pax_tag.flags = 0;
+		} else {
+			pax_tag.flags |= SWAP(add_flags);
+			pax_tag.flags &= SWAP(~del_flags);
+		}
 
 		if (!pax_flags_sane(SWAP(pax_tag.flags))) {
 			warnx("New flags 0x%x don't make sense",
@@ -315,7 +320,7 @@ int
 main(int argc, char **argv)
 {
 	char *opt;
-	int i, list = 0, bad = 0, many, minus;
+	int i, clear = 0, list = 0, bad = 0, many, minus;
 	uint32_t add_flags = 0, del_flags = 0;
 
 	setprogname(argv[0]);
@@ -326,6 +331,11 @@ main(int argc, char **argv)
 	for (i = 1; i < argc; i++) {
 		opt = argv[i];
 
+		if (strcmp(opt, "-0") == 0) {
+			clear = 1;
+			continue;
+		}
+
 		if (*opt == '-' || *opt == '+') {
 			uint32_t t;
 			minus = 0;
@@ -361,15 +371,21 @@ main(int argc, char **argv)
 	if (i == argc)
 		usage();
 
-	if (add_flags || del_flags) {
-		if (list)
-			usage();
-	} else
+	switch ((add_flags != 0 || del_flags != 0) + clear) {
+	case 0:
 		list = 1;
+		break;
+	case 1:
+		break;
+	default:
+		usage();
+	}
 
 	many = i != argc - 1;
-	for (; i < argc; i++)
-		bad |= process_one(argv[i], add_flags, del_flags, list, many);
+	for (; i < argc; i++) {
+		bad |= process_one(argv[i], add_flags, del_flags,
+		clear, list, many);
+	}
 
 	return bad ? EXIT_FAILURE : 0;
 }



CVS commit: src/usr.sbin/paxctl

2023-06-22 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Jun 23 01:56:21 UTC 2023

Modified Files:
src/usr.sbin/paxctl: paxctl.8 paxctl.c

Log Message:
paxctl(8): Introduce -0 option to clear all PaX flag bits in ELF note.
Part of PR toolchain/52675


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/paxctl/paxctl.8
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/paxctl/paxctl.c

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



CVS commit: othersrc/external/bsd/elex/dist

2023-06-22 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Thu Jun 22 23:16:47 UTC 2023

Modified Files:
othersrc/external/bsd/elex/dist: agcre.c elex.c elex.h main.c
othersrc/external/bsd/elex/dist/tests: 28.expected

Log Message:
elex-20230622

+ restore bug fix lost in previous - reset yyleng to 0 when deleting input
  from the parser
+ API change to make function name more descriptive in API
+ bring license up to date
+ bump version number for header file


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 othersrc/external/bsd/elex/dist/agcre.c \
othersrc/external/bsd/elex/dist/elex.c \
othersrc/external/bsd/elex/dist/elex.h \
othersrc/external/bsd/elex/dist/main.c
cvs rdiff -u -r1.4 -r1.5 othersrc/external/bsd/elex/dist/tests/28.expected

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

Modified files:

Index: othersrc/external/bsd/elex/dist/agcre.c
diff -u othersrc/external/bsd/elex/dist/agcre.c:1.4 othersrc/external/bsd/elex/dist/agcre.c:1.5
--- othersrc/external/bsd/elex/dist/agcre.c:1.4	Wed Jun 21 23:36:17 2023
+++ othersrc/external/bsd/elex/dist/agcre.c	Thu Jun 22 23:16:46 2023
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2013,2017 Alistair Crooks. All Rights reserved.
+ * Copyright (c) 2013,2017,2023 Alistair Crooks. All Rights reserved.
  * All rights reserved.
  *
  * Parts of this are:
Index: othersrc/external/bsd/elex/dist/elex.c
diff -u othersrc/external/bsd/elex/dist/elex.c:1.4 othersrc/external/bsd/elex/dist/elex.c:1.5
--- othersrc/external/bsd/elex/dist/elex.c:1.4	Wed Jun 21 23:36:17 2023
+++ othersrc/external/bsd/elex/dist/elex.c	Thu Jun 22 23:16:46 2023
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2018,2021 Alistair Crooks 
+ * Copyright (c) 2018,2021,2023 Alistair Crooks 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -252,6 +252,7 @@ static int
 delete_input(elex_t *elex, size_t n)
 {
 	memmove(>s[elex->cc], >s[elex->cc + n], elex->len - elex->cc - n);
+	elex->yyleng = 0;
 	elex->len -= n;
 	elex->s[elex->len] = 0x0;
 	return 1;
@@ -696,7 +697,7 @@ elex_exec(elex_t *elex, const char *info
 
 /* one function to access string values */
 void *
-elex_exec_str(elex_t *elex, const char *info, uint64_t n, uint64_t *size)
+elex_exec_mem(elex_t *elex, const char *info, uint64_t n, uint64_t *size)
 {
 	uint64_t	 len;
 
Index: othersrc/external/bsd/elex/dist/elex.h
diff -u othersrc/external/bsd/elex/dist/elex.h:1.4 othersrc/external/bsd/elex/dist/elex.h:1.5
--- othersrc/external/bsd/elex/dist/elex.h:1.4	Wed Jun 21 23:36:17 2023
+++ othersrc/external/bsd/elex/dist/elex.h	Thu Jun 22 23:16:46 2023
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2018,2021 Alistair Crooks 
+ * Copyright (c) 2018,2021,2023 Alistair Crooks 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -23,7 +23,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #ifndef ELEX_H_
-#define ELEX_H_	20230621
+#define ELEX_H_	20230622
 
 #include 
 
@@ -34,7 +34,7 @@
 #define elex_new		ELEX_NAMESPACE(LIB_NAMESPACE, elex_new)
 #define elex_dispose		ELEX_NAMESPACE(LIB_NAMESPACE, elex_dispose)
 #define elex_exec		ELEX_NAMESPACE(LIB_NAMESPACE, elex_exec)
-#define elex_exec_str		ELEX_NAMESPACE(LIB_NAMESPACE, elex_exec_str)
+#define elex_exec_mem		ELEX_NAMESPACE(LIB_NAMESPACE, elex_exec_mem)
 #define elex_make_new_rule	ELEX_NAMESPACE(LIB_NAMESPACE, elex_make_new_rule)
 #endif
 
@@ -59,7 +59,7 @@ int elex_dispose(elex_t **/*elex*/);
 
 /* these functions do ALL the work */
 int64_t elex_exec(elex_t */*elex*/, const char */*info*/, uint64_t /*num*/, const char */*s*/, int64_t /*cc*/);
-void *elex_exec_str(elex_t */*elex*/, const char */*info*/, uint64_t /*n*/, uint64_t */*size*/);
+void *elex_exec_mem(elex_t */*elex*/, const char */*info*/, uint64_t /*n*/, uint64_t */*size*/);
 
 /* with one exeception - deal with states */
 int elex_make_new_rule(elex_t */*elex*/, const char */*startstate*/,
Index: othersrc/external/bsd/elex/dist/main.c
diff -u othersrc/external/bsd/elex/dist/main.c:1.4 othersrc/external/bsd/elex/dist/main.c:1.5
--- othersrc/external/bsd/elex/dist/main.c:1.4	Wed Jun 21 23:36:17 2023
+++ othersrc/external/bsd/elex/dist/main.c	Thu Jun 22 23:16:46 2023
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2018,2021 Alistair Crooks 
+ * Copyright (c) 2018,2021,2023 Alistair Crooks 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -138,7 +138,7 @@ main(int argc, char **argv)
 	}
 	while (elex_exec(elex, "next-token", 0, NULL, 0) != 0) {
 		type = elex_exec(elex, "get-yytype", 0, NULL, 0);
-		text = elex_exec_str(elex, "get-yytext", 0, );
+		text = elex_exec_mem(elex, "get-yytext", 0, );
 		if (graphic) {
 			switch(type) {
 			case /* "IDENT" */ 0xdb8ea4d:

Index: othersrc/external/bsd/elex/dist

CVS commit: othersrc/external/bsd/elex/dist

2023-06-22 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Thu Jun 22 23:16:47 UTC 2023

Modified Files:
othersrc/external/bsd/elex/dist: agcre.c elex.c elex.h main.c
othersrc/external/bsd/elex/dist/tests: 28.expected

Log Message:
elex-20230622

+ restore bug fix lost in previous - reset yyleng to 0 when deleting input
  from the parser
+ API change to make function name more descriptive in API
+ bring license up to date
+ bump version number for header file


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 othersrc/external/bsd/elex/dist/agcre.c \
othersrc/external/bsd/elex/dist/elex.c \
othersrc/external/bsd/elex/dist/elex.h \
othersrc/external/bsd/elex/dist/main.c
cvs rdiff -u -r1.4 -r1.5 othersrc/external/bsd/elex/dist/tests/28.expected

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



CVS commit: src/crypto/external/bsd/heimdal

2023-06-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 22 22:39:39 UTC 2023

Modified Files:
src/crypto/external/bsd/heimdal: Makefile.inc
src/crypto/external/bsd/heimdal/libexec: Makefile.inc
src/crypto/external/bsd/heimdal/libexec/digest-service: Makefile
src/crypto/external/bsd/heimdal/libexec/hpropd: Makefile
src/crypto/external/bsd/heimdal/libexec/ipropd-master: Makefile
src/crypto/external/bsd/heimdal/libexec/ipropd-slave: Makefile
src/crypto/external/bsd/heimdal/libexec/kadmind: Makefile
src/crypto/external/bsd/heimdal/libexec/kpasswdd: Makefile
src/crypto/external/bsd/heimdal/sbin: Makefile.inc
src/crypto/external/bsd/heimdal/sbin/hprop: Makefile
src/crypto/external/bsd/heimdal/sbin/iprop-log: Makefile
src/crypto/external/bsd/heimdal/sbin/kadmin: Makefile
src/crypto/external/bsd/heimdal/sbin/kcm: Makefile
src/crypto/external/bsd/heimdal/sbin/kdc: Makefile
src/crypto/external/bsd/heimdal/sbin/kdigest: Makefile
src/crypto/external/bsd/heimdal/sbin/kimpersonate: Makefile
src/crypto/external/bsd/heimdal/sbin/kstash: Makefile
src/crypto/external/bsd/heimdal/sbin/ktutil: Makefile

Log Message:
fix sun2


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/crypto/external/bsd/heimdal/Makefile.inc
cvs rdiff -u -r1.7 -r1.8 src/crypto/external/bsd/heimdal/libexec/Makefile.inc
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/heimdal/libexec/digest-service/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/heimdal/libexec/hpropd/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/heimdal/libexec/ipropd-master/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/heimdal/libexec/ipropd-slave/Makefile
cvs rdiff -u -r1.6 -r1.7 \
src/crypto/external/bsd/heimdal/libexec/kadmind/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/heimdal/libexec/kpasswdd/Makefile
cvs rdiff -u -r1.6 -r1.7 src/crypto/external/bsd/heimdal/sbin/Makefile.inc
cvs rdiff -u -r1.4 -r1.5 src/crypto/external/bsd/heimdal/sbin/hprop/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/heimdal/sbin/iprop-log/Makefile
cvs rdiff -u -r1.5 -r1.6 src/crypto/external/bsd/heimdal/sbin/kadmin/Makefile
cvs rdiff -u -r1.4 -r1.5 src/crypto/external/bsd/heimdal/sbin/kcm/Makefile
cvs rdiff -u -r1.4 -r1.5 src/crypto/external/bsd/heimdal/sbin/kdc/Makefile
cvs rdiff -u -r1.5 -r1.6 \
src/crypto/external/bsd/heimdal/sbin/kdigest/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/heimdal/sbin/kimpersonate/Makefile
cvs rdiff -u -r1.4 -r1.5 src/crypto/external/bsd/heimdal/sbin/kstash/Makefile
cvs rdiff -u -r1.5 -r1.6 src/crypto/external/bsd/heimdal/sbin/ktutil/Makefile

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



CVS commit: src/crypto/external/bsd/heimdal

2023-06-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 22 22:39:39 UTC 2023

Modified Files:
src/crypto/external/bsd/heimdal: Makefile.inc
src/crypto/external/bsd/heimdal/libexec: Makefile.inc
src/crypto/external/bsd/heimdal/libexec/digest-service: Makefile
src/crypto/external/bsd/heimdal/libexec/hpropd: Makefile
src/crypto/external/bsd/heimdal/libexec/ipropd-master: Makefile
src/crypto/external/bsd/heimdal/libexec/ipropd-slave: Makefile
src/crypto/external/bsd/heimdal/libexec/kadmind: Makefile
src/crypto/external/bsd/heimdal/libexec/kpasswdd: Makefile
src/crypto/external/bsd/heimdal/sbin: Makefile.inc
src/crypto/external/bsd/heimdal/sbin/hprop: Makefile
src/crypto/external/bsd/heimdal/sbin/iprop-log: Makefile
src/crypto/external/bsd/heimdal/sbin/kadmin: Makefile
src/crypto/external/bsd/heimdal/sbin/kcm: Makefile
src/crypto/external/bsd/heimdal/sbin/kdc: Makefile
src/crypto/external/bsd/heimdal/sbin/kdigest: Makefile
src/crypto/external/bsd/heimdal/sbin/kimpersonate: Makefile
src/crypto/external/bsd/heimdal/sbin/kstash: Makefile
src/crypto/external/bsd/heimdal/sbin/ktutil: Makefile

Log Message:
fix sun2


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/crypto/external/bsd/heimdal/Makefile.inc
cvs rdiff -u -r1.7 -r1.8 src/crypto/external/bsd/heimdal/libexec/Makefile.inc
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/heimdal/libexec/digest-service/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/heimdal/libexec/hpropd/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/heimdal/libexec/ipropd-master/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/heimdal/libexec/ipropd-slave/Makefile
cvs rdiff -u -r1.6 -r1.7 \
src/crypto/external/bsd/heimdal/libexec/kadmind/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/heimdal/libexec/kpasswdd/Makefile
cvs rdiff -u -r1.6 -r1.7 src/crypto/external/bsd/heimdal/sbin/Makefile.inc
cvs rdiff -u -r1.4 -r1.5 src/crypto/external/bsd/heimdal/sbin/hprop/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/heimdal/sbin/iprop-log/Makefile
cvs rdiff -u -r1.5 -r1.6 src/crypto/external/bsd/heimdal/sbin/kadmin/Makefile
cvs rdiff -u -r1.4 -r1.5 src/crypto/external/bsd/heimdal/sbin/kcm/Makefile
cvs rdiff -u -r1.4 -r1.5 src/crypto/external/bsd/heimdal/sbin/kdc/Makefile
cvs rdiff -u -r1.5 -r1.6 \
src/crypto/external/bsd/heimdal/sbin/kdigest/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/heimdal/sbin/kimpersonate/Makefile
cvs rdiff -u -r1.4 -r1.5 src/crypto/external/bsd/heimdal/sbin/kstash/Makefile
cvs rdiff -u -r1.5 -r1.6 src/crypto/external/bsd/heimdal/sbin/ktutil/Makefile

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

Modified files:

Index: src/crypto/external/bsd/heimdal/Makefile.inc
diff -u src/crypto/external/bsd/heimdal/Makefile.inc:1.7 src/crypto/external/bsd/heimdal/Makefile.inc:1.8
--- src/crypto/external/bsd/heimdal/Makefile.inc:1.7	Tue Jun 20 13:23:01 2023
+++ src/crypto/external/bsd/heimdal/Makefile.inc	Thu Jun 22 18:39:37 2023
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.7 2023/06/20 17:23:01 christos Exp $
+# $NetBSD: Makefile.inc,v 1.8 2023/06/22 22:39:37 christos Exp $
 
 HEIMBASE?=	${NETBSDSRCDIR}/crypto/external/bsd/heimdal
 HEIMDIST=	${HEIMBASE}/dist
@@ -22,6 +22,8 @@ DPLIBROKEN=	roken ${HEIMBASE}/lib/librok
 DPLIBSL=	sl ${HEIMBASE}/lib/libsl
 DPLIBVERS=	vers ${HEIMBASE}/lib/libvers
 DPLIBWIND=	wind ${HEIMBASE}/lib/libwind
+KRB5LDADD=	-lsqlite3 -lcrypto -lcrypt -lm
+KRB5DPADD=	${LIBSQLITE3} ${LIBCRYPTO} ${LIBCRYPT} ${LIBM}
 
 .if ${USETOOLS} != "yes"
 COMPILEETOBJ!= cd ${HEIMBASE}/lib/libcom_err/compile_et && ${PRINTOBJDIR}

Index: src/crypto/external/bsd/heimdal/libexec/Makefile.inc
diff -u src/crypto/external/bsd/heimdal/libexec/Makefile.inc:1.7 src/crypto/external/bsd/heimdal/libexec/Makefile.inc:1.8
--- src/crypto/external/bsd/heimdal/libexec/Makefile.inc:1.7	Tue Jun 20 13:23:03 2023
+++ src/crypto/external/bsd/heimdal/libexec/Makefile.inc	Thu Jun 22 18:39:37 2023
@@ -1,5 +1,6 @@
-# $NetBSD: Makefile.inc,v 1.7 2023/06/20 17:23:03 christos Exp $
+# $NetBSD: Makefile.inc,v 1.8 2023/06/22 22:39:37 christos Exp $
 
 BINDIR=/usr/libexec
 
-PROGDPLIBS+= ${DPLIBKRB5} ${DPLIBHEIMNTLM} ${DPLIBROKEN} ${DPLIBVERS}
+PROGDPLIBS += ${DPLIBKRB5} ${DPLIBHX509} ${DPLIBASN1} ${DPLIBCOM_ERR}
+PROGDPLIBS += ${DPLIBWIND} ${DPLIBHEIMBASE} ${DPLIBROKEN} ${DPLIBVERS}

Index: src/crypto/external/bsd/heimdal/libexec/digest-service/Makefile
diff -u src/crypto/external/bsd/heimdal/libexec/digest-service/Makefile:1.4 src/crypto/external/bsd/heimdal/libexec/digest-service/Makefile:1.5
--- src/crypto/external/bsd/heimdal/libexec/digest-service/Makefile:1.4	Tue Jun 20 13:23:03 2023
+++ src/crypto/external/bsd/heimdal/libexec/digest-service/Makefile	Thu Jun 22 

CVS commit: src/crypto/external/bsd/heimdal/bin

2023-06-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 22 22:39:23 UTC 2023

Modified Files:
src/crypto/external/bsd/heimdal/bin: Makefile.inc
src/crypto/external/bsd/heimdal/bin/gsstool: Makefile
src/crypto/external/bsd/heimdal/bin/hxtool: Makefile
src/crypto/external/bsd/heimdal/bin/kcc: Makefile
src/crypto/external/bsd/heimdal/bin/kdestroy: Makefile
src/crypto/external/bsd/heimdal/bin/kgetcred: Makefile
src/crypto/external/bsd/heimdal/bin/kinit: Makefile
src/crypto/external/bsd/heimdal/bin/kpasswd: Makefile
src/crypto/external/bsd/heimdal/bin/kvno: Makefile
src/crypto/external/bsd/heimdal/bin/string2key: Makefile
src/crypto/external/bsd/heimdal/bin/verify_krb5_conf: Makefile

Log Message:
fix sun2


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/crypto/external/bsd/heimdal/bin/Makefile.inc
cvs rdiff -u -r1.3 -r1.4 src/crypto/external/bsd/heimdal/bin/gsstool/Makefile
cvs rdiff -u -r1.5 -r1.6 src/crypto/external/bsd/heimdal/bin/hxtool/Makefile
cvs rdiff -u -r1.5 -r1.6 src/crypto/external/bsd/heimdal/bin/kcc/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/heimdal/bin/kdestroy/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/heimdal/bin/kgetcred/Makefile
cvs rdiff -u -r1.4 -r1.5 src/crypto/external/bsd/heimdal/bin/kinit/Makefile
cvs rdiff -u -r1.4 -r1.5 src/crypto/external/bsd/heimdal/bin/kpasswd/Makefile
cvs rdiff -u -r1.3 -r1.4 src/crypto/external/bsd/heimdal/bin/kvno/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/heimdal/bin/string2key/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/heimdal/bin/verify_krb5_conf/Makefile

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

Modified files:

Index: src/crypto/external/bsd/heimdal/bin/Makefile.inc
diff -u src/crypto/external/bsd/heimdal/bin/Makefile.inc:1.5 src/crypto/external/bsd/heimdal/bin/Makefile.inc:1.6
--- src/crypto/external/bsd/heimdal/bin/Makefile.inc:1.5	Tue Jun 20 13:23:01 2023
+++ src/crypto/external/bsd/heimdal/bin/Makefile.inc	Thu Jun 22 18:39:22 2023
@@ -1,5 +1,6 @@
-# $NetBSD: Makefile.inc,v 1.5 2023/06/20 17:23:01 christos Exp $
+# $NetBSD: Makefile.inc,v 1.6 2023/06/22 22:39:22 christos Exp $
 
 BINDIR=/usr/bin
 
-PROGDPLIBS += ${DPLIBKRB5} ${DPLIBHEIMBASE} ${DPLIBROKEN} ${DPLIBVERS}
+PROGDPLIBS += ${DPLIBKRB5} ${DPLIBHX509} ${DPLIBASN1} ${DPLIBCOM_ERR}
+PROGDPLIBS += ${DPLIBWIND} ${DPLIBHEIMBASE} ${DPLIBROKEN} ${DPLIBVERS}

Index: src/crypto/external/bsd/heimdal/bin/gsstool/Makefile
diff -u src/crypto/external/bsd/heimdal/bin/gsstool/Makefile:1.3 src/crypto/external/bsd/heimdal/bin/gsstool/Makefile:1.4
--- src/crypto/external/bsd/heimdal/bin/gsstool/Makefile:1.3	Tue Jun 20 13:23:01 2023
+++ src/crypto/external/bsd/heimdal/bin/gsstool/Makefile	Thu Jun 22 18:39:22 2023
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2023/06/20 17:23:01 christos Exp $
+# $NetBSD: Makefile,v 1.4 2023/06/22 22:39:22 christos Exp $
 
 .include 
 .include <${.CURDIR}/../../Makefile.inc>
@@ -13,10 +13,10 @@ HEIMSRCS=	gsstool.c gss-commands.in
 
 MAN=
 
-PROGDPLIBS += ${DPLIBGSSAPI} ${DPLIBSL}
-
-LDADD+= -ledit -lterminfo
-DPADD+= ${LIBEDIT} ${LIBTERMINFO}
+PROGDPLIBS += ${DPLIBGSSAPI} ${DPLIBHEIMNTLM} ${DPLIBSL}
 
 .include <${HEIMBASE}/Makefile.rules.inc>
 .include 
+
+LDADD+= -ledit -lterminfo ${KRB5LDADD}
+DPADD+= ${LIBEDIT} ${LIBTERMINFO} ${KRB5DPADD}

Index: src/crypto/external/bsd/heimdal/bin/hxtool/Makefile
diff -u src/crypto/external/bsd/heimdal/bin/hxtool/Makefile:1.5 src/crypto/external/bsd/heimdal/bin/hxtool/Makefile:1.6
--- src/crypto/external/bsd/heimdal/bin/hxtool/Makefile:1.5	Tue Jun 20 13:23:01 2023
+++ src/crypto/external/bsd/heimdal/bin/hxtool/Makefile	Thu Jun 22 18:39:22 2023
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.5 2023/06/20 17:23:01 christos Exp $
+# $NetBSD: Makefile,v 1.6 2023/06/22 22:39:22 christos Exp $
 
 .include 
 .include <${.CURDIR}/../../Makefile.inc>
@@ -13,11 +13,12 @@ HEIMSRCS= hxtool.c hxtool-commands.in
 
 MAN=
 
-PROGDPLIBS+= ${DPLIBASN1} ${DPLIBGSSAPI} ${DPLIBHX509} ${DPLIBSL}
-LDADD+= -lcrypto -ledit -lterminfo
-DPADD+= ${LIBCRYPTO} ${LIBEDIT} ${LIBTERMINFO}
+PROGDPLIBS+= ${DPLIBGSSAPI} ${DPLIBSL}
 
 COPTS.hxtool.c+= -Wno-error=deprecated-declarations
 
 .include <${HEIMBASE}/Makefile.rules.inc>
 .include 
+
+LDADD+= -lcrypto -ledit -lterminfo
+DPADD+= ${LIBCRYPTO} ${LIBEDIT} ${LIBTERMINFO}

Index: src/crypto/external/bsd/heimdal/bin/kcc/Makefile
diff -u src/crypto/external/bsd/heimdal/bin/kcc/Makefile:1.5 src/crypto/external/bsd/heimdal/bin/kcc/Makefile:1.6
--- src/crypto/external/bsd/heimdal/bin/kcc/Makefile:1.5	Tue Jun 20 13:23:01 2023
+++ src/crypto/external/bsd/heimdal/bin/kcc/Makefile	Thu Jun 22 18:39:22 2023
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.5 2023/06/20 17:23:01 christos Exp $
+# $NetBSD: Makefile,v 1.6 2023/06/22 22:39:22 christos Exp $
 
 .include 
 .include 

CVS commit: src/crypto/external/bsd/heimdal/bin

2023-06-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 22 22:39:23 UTC 2023

Modified Files:
src/crypto/external/bsd/heimdal/bin: Makefile.inc
src/crypto/external/bsd/heimdal/bin/gsstool: Makefile
src/crypto/external/bsd/heimdal/bin/hxtool: Makefile
src/crypto/external/bsd/heimdal/bin/kcc: Makefile
src/crypto/external/bsd/heimdal/bin/kdestroy: Makefile
src/crypto/external/bsd/heimdal/bin/kgetcred: Makefile
src/crypto/external/bsd/heimdal/bin/kinit: Makefile
src/crypto/external/bsd/heimdal/bin/kpasswd: Makefile
src/crypto/external/bsd/heimdal/bin/kvno: Makefile
src/crypto/external/bsd/heimdal/bin/string2key: Makefile
src/crypto/external/bsd/heimdal/bin/verify_krb5_conf: Makefile

Log Message:
fix sun2


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/crypto/external/bsd/heimdal/bin/Makefile.inc
cvs rdiff -u -r1.3 -r1.4 src/crypto/external/bsd/heimdal/bin/gsstool/Makefile
cvs rdiff -u -r1.5 -r1.6 src/crypto/external/bsd/heimdal/bin/hxtool/Makefile
cvs rdiff -u -r1.5 -r1.6 src/crypto/external/bsd/heimdal/bin/kcc/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/heimdal/bin/kdestroy/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/heimdal/bin/kgetcred/Makefile
cvs rdiff -u -r1.4 -r1.5 src/crypto/external/bsd/heimdal/bin/kinit/Makefile
cvs rdiff -u -r1.4 -r1.5 src/crypto/external/bsd/heimdal/bin/kpasswd/Makefile
cvs rdiff -u -r1.3 -r1.4 src/crypto/external/bsd/heimdal/bin/kvno/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/heimdal/bin/string2key/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/heimdal/bin/verify_krb5_conf/Makefile

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



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

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jun 22 20:36:24 UTC 2023

Modified Files:
src/usr.bin/make/unit-tests: varmod-match-escape.mk

Log Message:
tests/make: demonstrate inconsistency in pattern matching with ranges


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

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

Modified files:

Index: src/usr.bin/make/unit-tests/varmod-match-escape.mk
diff -u src/usr.bin/make/unit-tests/varmod-match-escape.mk:1.8 src/usr.bin/make/unit-tests/varmod-match-escape.mk:1.9
--- src/usr.bin/make/unit-tests/varmod-match-escape.mk:1.8	Thu Jun  1 20:56:35 2023
+++ src/usr.bin/make/unit-tests/varmod-match-escape.mk	Thu Jun 22 20:36:24 2023
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-match-escape.mk,v 1.8 2023/06/01 20:56:35 rillig Exp $
+# $NetBSD: varmod-match-escape.mk,v 1.9 2023/06/22 20:36:24 rillig Exp $
 #
 # As of 2020-08-01, the :M and :N modifiers interpret backslashes differently,
 # depending on whether there was a variable expression somewhere before the
@@ -77,12 +77,39 @@ VALUES=		: :: :\:
 #
 # TODO: Str_Match("a-z]", "[a-z]")
 # TODO: Str_Match("012", "[0-]]")
-# TODO: Str_Match("0]", "[0-]]")
-# TODO: Str_Match("1]", "[0-]]")
 # TODO: Str_Match("[", "[[]")
 # TODO: Str_Match("]", "[]")
 # TODO: Str_Match("]", "[[-]]")
 
+# Demonstrate an inconsistency between positive and negative character lists
+# when the range ends with the character ']'.
+#
+# 'A' begins the range, 'B' is in the middle of the range, ']' ends the range,
+# 'a' is outside the range.
+WORDS=		A A] A]] B B] B]] ] ]] ]]] a a] a]]
+# The ']' is part of the character range and at the same time ends the
+# character list.
+EXP.[A-]=	A B ]
+# The first ']' is part of the character range and at the same time ends the
+# character list.
+EXP.[A-]]=	A] B] ]]
+# The first ']' is part of the character range and at the same time ends the
+# character list.
+EXP.[A-]]]=	A]] B]] ]]]
+# For negative character lists, the ']' ends the character range but does not
+# end the character list.
+# XXX: This is unnecessarily inconsistent but irrelevant in practice as there
+# is no practical need for a character range that ends at ']'.
+EXP.[^A-]=	a
+EXP.[^A-]]=	a
+EXP.[^A-]]]=	a]
+
+.for pattern in [A-] [A-]] [A-]]] [^A-] [^A-]] [^A-]]]
+.  if ${WORDS:M${pattern}} != ${EXP.${pattern}}
+.warning ${pattern}: ${WORDS:M${pattern}} != ${EXP.${pattern}}
+.  endif
+.endfor
+
 # In brackets, the backslash is just an ordinary character.
 # Outside brackets, it is an escape character for a few special characters.
 # TODO: Str_Match("\\", "[\\-]]")



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

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jun 22 20:36:24 UTC 2023

Modified Files:
src/usr.bin/make/unit-tests: varmod-match-escape.mk

Log Message:
tests/make: demonstrate inconsistency in pattern matching with ranges


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

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



CVS commit: src/usr.bin/make

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jun 22 16:59:17 UTC 2023

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

Log Message:
make: unclutter string matching code


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/usr.bin/make/str.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/str.c
diff -u src/usr.bin/make/str.c:1.96 src/usr.bin/make/str.c:1.97
--- src/usr.bin/make/str.c:1.96	Thu Jun 22 16:32:09 2023
+++ src/usr.bin/make/str.c	Thu Jun 22 16:59:17 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: str.c,v 1.96 2023/06/22 16:32:09 rillig Exp $	*/
+/*	$NetBSD: str.c,v 1.97 2023/06/22 16:59:17 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -71,7 +71,7 @@
 #include "make.h"
 
 /*	"@(#)str.c	5.8 (Berkeley) 6/1/90"	*/
-MAKE_RCSID("$NetBSD: str.c,v 1.96 2023/06/22 16:32:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: str.c,v 1.97 2023/06/22 16:59:17 rillig Exp $");
 
 
 static HashTable interned_strings;
@@ -323,11 +323,10 @@ in_range(char e1, char c, char e2)
 bool
 Str_Match(const char *str, const char *pat)
 {
-	enum { START, SEEN_ASTERISK, END } state;
 	const char *fixed_str, *fixed_pat;
-	bool matched;
+	bool asterisk, matched;
 
-	state = START;
+	asterisk = false;
 	fixed_str = str;
 	fixed_pat = pat;
 
@@ -380,28 +379,23 @@ match_fixed_length:
 	matched = true;
 
 match_done:
-	switch (state) {
-	case START:
+	if (!asterisk) {
 		if (!matched)
 			return false;
 		if (*pat == '\0')
 			return *str == '\0';
-		state = SEEN_ASTERISK;
-		break;
-	default:
+		asterisk = true;
+	} else {
 		if (!matched) {
 			fixed_str++;
 			goto match_fixed_length;
 		}
 		if (*pat == '\0') {
-			size_t match_len = (size_t)(str - fixed_str);
-			fixed_str = str + strlen(str) - match_len;
-			state = END;
+			if (*str == '\0')
+return true;
+			fixed_str += strlen(str);
 			goto match_fixed_length;
 		}
-		break;
-	case END:
-		return matched;
 	}
 
 	while (*pat == '*')



CVS commit: src/usr.bin/make

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jun 22 16:59:17 UTC 2023

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

Log Message:
make: unclutter string matching code


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/usr.bin/make/str.c

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



CVS commit: src/usr.bin/make

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jun 22 16:32:09 UTC 2023

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

Log Message:
make: rename variables in string matching, remove redundant code

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/usr.bin/make/str.c

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



CVS commit: src/usr.bin/make

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jun 22 16:32:09 UTC 2023

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

Log Message:
make: rename variables in string matching, remove redundant code

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/usr.bin/make/str.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/str.c
diff -u src/usr.bin/make/str.c:1.95 src/usr.bin/make/str.c:1.96
--- src/usr.bin/make/str.c:1.95	Thu Jun 22 12:59:54 2023
+++ src/usr.bin/make/str.c	Thu Jun 22 16:32:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: str.c,v 1.95 2023/06/22 12:59:54 rillig Exp $	*/
+/*	$NetBSD: str.c,v 1.96 2023/06/22 16:32:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -71,7 +71,7 @@
 #include "make.h"
 
 /*	"@(#)str.c	5.8 (Berkeley) 6/1/90"	*/
-MAKE_RCSID("$NetBSD: str.c,v 1.95 2023/06/22 12:59:54 rillig Exp $");
+MAKE_RCSID("$NetBSD: str.c,v 1.96 2023/06/22 16:32:09 rillig Exp $");
 
 
 static HashTable interned_strings;
@@ -323,16 +323,17 @@ in_range(char e1, char c, char e2)
 bool
 Str_Match(const char *str, const char *pat)
 {
-	enum { MFL_START, MFL_MIDDLE, MFL_END } mfl;
-	const char *str1, *pat1;
+	enum { START, SEEN_ASTERISK, END } state;
+	const char *fixed_str, *fixed_pat;
 	bool matched;
 
-	mfl = MFL_START;
-	str1 = str;
-	pat1 = pat;
+	state = START;
+	fixed_str = str;
+	fixed_pat = pat;
+
 match_fixed_length:
-	str = str1;
-	pat = pat1;
+	str = fixed_str;
+	pat = fixed_pat;
 	matched = false;
 	for (; *pat != '\0' && *pat != '*'; str++, pat++) {
 		if (*str == '\0')
@@ -379,26 +380,27 @@ match_fixed_length:
 	matched = true;
 
 match_done:
-	switch (mfl) {
-	case MFL_START:
+	switch (state) {
+	case START:
 		if (!matched)
 			return false;
 		if (*pat == '\0')
 			return *str == '\0';
-		mfl = MFL_MIDDLE;
+		state = SEEN_ASTERISK;
 		break;
 	default:
 		if (!matched) {
-			str1++;
+			fixed_str++;
 			goto match_fixed_length;
 		}
 		if (*pat == '\0') {
-			mfl = MFL_END;
-			str1 = str + strlen(str) - (str - str1);
+			size_t match_len = (size_t)(str - fixed_str);
+			fixed_str = str + strlen(str) - match_len;
+			state = END;
 			goto match_fixed_length;
 		}
 		break;
-	case MFL_END:
+	case END:
 		return matched;
 	}
 
@@ -406,9 +408,8 @@ match_done:
 		pat++;
 	if (*pat == '\0')
 		return true;
-	if (*str == '\0')
-		return false;
-	str1 = str, pat1 = pat;
+	fixed_str = str;
+	fixed_pat = pat;
 	goto match_fixed_length;
 }
 



CVS commit: src

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jun 22 13:57:44 UTC 2023

Modified Files:
src/tests/usr.bin/xlint/lint1: queries.c t_usage.sh
src/usr.bin/xlint/lint1: err.c tree.c

Log Message:
lint: add query for comma operator


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/usr.bin/xlint/lint1/queries.c
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/t_usage.sh
cvs rdiff -u -r1.199 -r1.200 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.527 -r1.528 src/usr.bin/xlint/lint1/tree.c

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



CVS commit: src

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jun 22 13:57:44 UTC 2023

Modified Files:
src/tests/usr.bin/xlint/lint1: queries.c t_usage.sh
src/usr.bin/xlint/lint1: err.c tree.c

Log Message:
lint: add query for comma operator


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/usr.bin/xlint/lint1/queries.c
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/t_usage.sh
cvs rdiff -u -r1.199 -r1.200 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.527 -r1.528 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/queries.c
diff -u src/tests/usr.bin/xlint/lint1/queries.c:1.14 src/tests/usr.bin/xlint/lint1/queries.c:1.15
--- src/tests/usr.bin/xlint/lint1/queries.c:1.14	Sat Jun  3 21:08:06 2023
+++ src/tests/usr.bin/xlint/lint1/queries.c	Thu Jun 22 13:57:44 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: queries.c,v 1.14 2023/06/03 21:08:06 rillig Exp $	*/
+/*	$NetBSD: queries.c,v 1.15 2023/06/22 13:57:44 rillig Exp $	*/
 # 3 "queries.c"
 
 /*
@@ -15,7 +15,7 @@
  * 	such as casts between arithmetic types.
  */
 
-/* lint1-extra-flags: -q 1,2,3,4,5,6,7,8,9,10,11 -X 351 */
+/* lint1-extra-flags: -q 1,2,3,4,5,6,7,8,9,10,11,12 -X 351 */
 
 typedef unsigned char u8_t;
 typedef unsigned short u16_t;
@@ -324,12 +324,15 @@ Q9(int x)
 	case 3:
 		return -(13);
 	case 4:
+		/* expect+2: comma operator with types 'int' and 'int' [Q12] */
 		/* expect+1: parenthesized return value [Q9] */
 		return (0), (1);
 	case 5:
+		/* expect+2: comma operator with types 'int' and 'int' [Q12] */
 		/* expect+1: parenthesized return value [Q9] */
 		return (0, 1);
 	case 6:
+		/* expect+1: comma operator with types 'int' and 'int' [Q12] */
 		return 0, 1;
 	case 7:
 		/* expect+1: implicit conversion from floating point 'double' to integer 'int' [Q1] */
@@ -340,9 +343,9 @@ Q9(int x)
 		return (0.0);
 	case 9:
 		return
-# 344 "queries.c" 3 4
+# 347 "queries.c" 3 4
 		((void *)0)
-# 346 "queries.c"
+# 349 "queries.c"
 		/* expect+1: warning: illegal combination of integer 'int' and pointer 'pointer to void' [183] */
 		;
 	case 10:
@@ -379,6 +382,21 @@ Q11(void)
 	static_var_init++;
 }
 
+void
+Q12(void)
+{
+	/* expect+1: comma operator with types 'void' and '_Bool' [Q12] */
+	if (Q11(), cond)
+		return;
+
+	/* expect+5: implicit conversion changes sign from 'unsigned char' to 'int' [Q3] */
+	/* expect+4: implicit conversion changes sign from 'int' to 'unsigned short' [Q3] */
+	/* expect+3: implicit conversion changes sign from 'unsigned short' to 'int' [Q3] */
+	/* expect+2: implicit conversion changes sign from 'int' to 'unsigned int' [Q3] */
+	/* expect+1: comma operator with types 'unsigned short' and 'unsigned int' [Q12] */
+	u16 += u8, u32 += u16;
+}
+
 /*
  * Since queries do not affect the exit status, force a warning to make this
  * test conform to the general expectation that a test that produces output

Index: src/tests/usr.bin/xlint/lint1/t_usage.sh
diff -u src/tests/usr.bin/xlint/lint1/t_usage.sh:1.4 src/tests/usr.bin/xlint/lint1/t_usage.sh:1.5
--- src/tests/usr.bin/xlint/lint1/t_usage.sh:1.4	Sat Jun  3 21:08:06 2023
+++ src/tests/usr.bin/xlint/lint1/t_usage.sh	Thu Jun 22 13:57:44 2023
@@ -1,4 +1,4 @@
-# $NetBSD: t_usage.sh,v 1.4 2023/06/03 21:08:06 rillig Exp $
+# $NetBSD: t_usage.sh,v 1.5 2023/06/22 13:57:44 rillig Exp $
 #
 # Copyright (c) 2023 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -97,13 +97,13 @@ enable_queries_body()
 
 	# The largest known query.
 	atf_check \
-	"$lint1" -q 11 code.c /dev/null
+	"$lint1" -q 12 code.c /dev/null
 
 	# Larger than the largest known query.
 	atf_check \
 	-s 'exit:1' \
-	-e "inline:lint1: invalid query ID '12'\n" \
-	"$lint1" -q 12 code.c /dev/null
+	-e "inline:lint1: invalid query ID '13'\n" \
+	"$lint1" -q 13 code.c /dev/null
 
 	# Whitespace is not allowed before a query ID.
 	atf_check \

Index: src/usr.bin/xlint/lint1/err.c
diff -u src/usr.bin/xlint/lint1/err.c:1.199 src/usr.bin/xlint/lint1/err.c:1.200
--- src/usr.bin/xlint/lint1/err.c:1.199	Fri Jun  9 15:36:31 2023
+++ src/usr.bin/xlint/lint1/err.c	Thu Jun 22 13:57:44 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: err.c,v 1.199 2023/06/09 15:36:31 rillig Exp $	*/
+/*	$NetBSD: err.c,v 1.200 2023/06/22 13:57:44 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: err.c,v 1.199 2023/06/09 15:36:31 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.200 2023/06/22 13:57:44 rillig Exp $");
 #endif
 
 #include 
@@ -707,6 +707,7 @@ static const char *queries[] = {
 	"parenthesized return value",  /* Q9 */
 	"chained assignment with '%s' and '%s'",		  /* Q10 */
 	"static variable '%s' in function",			  /* Q11 */
+	"comma operator with types '%s' and '%s'",		  /* Q12 */
 };
 
 bool any_query_enabled;		/* for optimizing non-query 

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

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jun 22 13:02:42 UTC 2023

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

Log Message:
tests/make: fix line numbers in test result, since the previous commit


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/varmod-match.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/unit-tests/varmod-match.exp
diff -u src/usr.bin/make/unit-tests/varmod-match.exp:1.8 src/usr.bin/make/unit-tests/varmod-match.exp:1.9
--- src/usr.bin/make/unit-tests/varmod-match.exp:1.8	Thu Jun 22 09:09:08 2023
+++ src/usr.bin/make/unit-tests/varmod-match.exp	Thu Jun 22 13:02:42 2023
@@ -10,8 +10,8 @@ CondParser_Eval: ${:Ua \$ sign:M*$$*} !=
 Comparing "$" != "$"
 CondParser_Eval: ${:Ua \$ sign any-asterisk:M*\$*} != "any-asterisk"
 Comparing "any-asterisk" != "any-asterisk"
-make: "varmod-match.mk" line 160: Unknown modifier "]"
-make: "varmod-match.mk" line 160: Malformed conditional (${ ${:U\:} ${:U\:\:} :L:M[:]} != ":")
+make: "varmod-match.mk" line 161: Unknown modifier "]"
+make: "varmod-match.mk" line 161: Malformed conditional (${ ${:U\:} ${:U\:\:} :L:M[:]} != ":")
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1



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

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jun 22 13:02:42 UTC 2023

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

Log Message:
tests/make: fix line numbers in test result, since the previous commit


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/varmod-match.exp

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



CVS commit: src/usr.bin/make

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jun 22 12:59:54 UTC 2023

Modified Files:
src/usr.bin/make: str.c
src/usr.bin/make/unit-tests: varmod-match.mk

Log Message:
make: speed up pattern matching in the ':M' and ':N' modifiers

In the code coverage report, the highest count for Str_Match goes from
5,298,924 down to 79,646.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/usr.bin/make/str.c
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/varmod-match.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/str.c
diff -u src/usr.bin/make/str.c:1.94 src/usr.bin/make/str.c:1.95
--- src/usr.bin/make/str.c:1.94	Wed Dec  7 10:28:48 2022
+++ src/usr.bin/make/str.c	Thu Jun 22 12:59:54 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: str.c,v 1.94 2022/12/07 10:28:48 rillig Exp $	*/
+/*	$NetBSD: str.c,v 1.95 2023/06/22 12:59:54 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -71,7 +71,7 @@
 #include "make.h"
 
 /*	"@(#)str.c	5.8 (Berkeley) 6/1/90"	*/
-MAKE_RCSID("$NetBSD: str.c,v 1.94 2022/12/07 10:28:48 rillig Exp $");
+MAKE_RCSID("$NetBSD: str.c,v 1.95 2023/06/22 12:59:54 rillig Exp $");
 
 
 static HashTable interned_strings;
@@ -323,19 +323,18 @@ in_range(char e1, char c, char e2)
 bool
 Str_Match(const char *str, const char *pat)
 {
-	for (; *pat != '\0'; pat++, str++) {
-		if (*pat == '*') {	/* match any substring */
-			pat++;
-			while (*pat == '*')
-pat++;
-			if (*pat == '\0')
-return true;
-			for (; *str != '\0'; str++)
-if (Str_Match(str, pat))
-	return true;
-			return false;
-		}
-
+	enum { MFL_START, MFL_MIDDLE, MFL_END } mfl;
+	const char *str1, *pat1;
+	bool matched;
+
+	mfl = MFL_START;
+	str1 = str;
+	pat1 = pat;
+match_fixed_length:
+	str = str1;
+	pat = pat1;
+	matched = false;
+	for (; *pat != '\0' && *pat != '*'; str++, pat++) {
 		if (*str == '\0')
 			return false;
 
@@ -350,7 +349,7 @@ Str_Match(const char *str, const char *p
 if (*pat == ']' || *pat == '\0') {
 	if (neg)
 		break;
-	return false;
+	goto match_done;
 }
 if (*pat == *str)
 	break;
@@ -364,7 +363,7 @@ Str_Match(const char *str, const char *p
 pat++;
 			}
 			if (neg && *pat != ']' && *pat != '\0')
-return false;
+goto match_done;
 			while (*pat != ']' && *pat != '\0')
 pat++;
 			if (*pat == '\0')
@@ -374,11 +373,43 @@ Str_Match(const char *str, const char *p
 
 		if (*pat == '\\')	/* match the next character exactly */
 			pat++;
-
 		if (*pat != *str)
+			goto match_done;
+	}
+	matched = true;
+
+match_done:
+	switch (mfl) {
+	case MFL_START:
+		if (!matched)
 			return false;
+		if (*pat == '\0')
+			return *str == '\0';
+		mfl = MFL_MIDDLE;
+		break;
+	default:
+		if (!matched) {
+			str1++;
+			goto match_fixed_length;
+		}
+		if (*pat == '\0') {
+			mfl = MFL_END;
+			str1 = str + strlen(str) - (str - str1);
+			goto match_fixed_length;
+		}
+		break;
+	case MFL_END:
+		return matched;
 	}
-	return *str == '\0';
+
+	while (*pat == '*')
+		pat++;
+	if (*pat == '\0')
+		return true;
+	if (*str == '\0')
+		return false;
+	str1 = str, pat1 = pat;
+	goto match_fixed_length;
 }
 
 void

Index: src/usr.bin/make/unit-tests/varmod-match.mk
diff -u src/usr.bin/make/unit-tests/varmod-match.mk:1.13 src/usr.bin/make/unit-tests/varmod-match.mk:1.14
--- src/usr.bin/make/unit-tests/varmod-match.mk:1.13	Thu Jun 22 09:09:08 2023
+++ src/usr.bin/make/unit-tests/varmod-match.mk	Thu Jun 22 12:59:54 2023
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-match.mk,v 1.13 2023/06/22 09:09:08 rillig Exp $
+# $NetBSD: varmod-match.mk,v 1.14 2023/06/22 12:59:54 rillig Exp $
 #
 # Tests for the :M variable modifier, which filters words that match the
 # given pattern.
@@ -33,11 +33,12 @@ NUMBERS=	One Two Three Four five six sev
 .if ${:U:Mb}
 .endif
 
-# As of 2023-06-22, this expression calls Str_Match 2,621,112 times.
-# Adding another '*?' to the pattern calls Str_Match 20,630,572 times.
-# Adding another '*?' to the pattern calls Str_Match 136,405,672 times.
-# Adding another '*?' to the pattern calls Str_Match 773,168,722 times.
-# Adding another '*?' to the pattern calls Str_Match 3,815,481,072 times.
+# Before 2023-06-22, this expression called Str_Match 2,621,112 times.
+# Adding another '*?' to the pattern called Str_Match 20,630,572 times.
+# Adding another '*?' to the pattern called Str_Match 136,405,672 times.
+# Adding another '*?' to the pattern called Str_Match 773,168,722 times.
+# Adding another '*?' to the pattern called Str_Match 3,815,481,072 times.
+# Since 2023-06-22, Str_Match no longer backtracks.
 .if ${:U..b:M*?*?*?*?*?a}
 .endif
 
@@ -217,6 +218,13 @@ WORDS=		- + x xx 0 1 2 3 4 [x1-3
 .  error
 .endif
 
+#	*[-x1-3	Incomplete character list after a wildcard, matches those
+#		words that end with one of the characters from the 

CVS commit: src/usr.bin/make

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jun 22 12:59:54 UTC 2023

Modified Files:
src/usr.bin/make: str.c
src/usr.bin/make/unit-tests: varmod-match.mk

Log Message:
make: speed up pattern matching in the ':M' and ':N' modifiers

In the code coverage report, the highest count for Str_Match goes from
5,298,924 down to 79,646.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/usr.bin/make/str.c
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/varmod-match.mk

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



CVS commit: src/usr.bin/make

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jun 22 09:09:08 UTC 2023

Modified Files:
src/usr.bin/make: dir.c
src/usr.bin/make/unit-tests: cond-func-make.mk varmod-match.exp
varmod-match.mk

Log Message:
make: clean up comments related to pattern matching


To generate a diff of this commit:
cvs rdiff -u -r1.280 -r1.281 src/usr.bin/make/dir.c
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cond-func-make.mk
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod-match.exp
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/varmod-match.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/dir.c
diff -u src/usr.bin/make/dir.c:1.280 src/usr.bin/make/dir.c:1.281
--- src/usr.bin/make/dir.c:1.280	Tue Jan 24 00:24:02 2023
+++ src/usr.bin/make/dir.c	Thu Jun 22 09:09:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.280 2023/01/24 00:24:02 sjg Exp $	*/
+/*	$NetBSD: dir.c,v 1.281 2023/06/22 09:09:08 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -138,7 +138,7 @@
 #include "job.h"
 
 /*	"@(#)dir.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: dir.c,v 1.280 2023/01/24 00:24:02 sjg Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.281 2023/06/22 09:09:08 rillig Exp $");
 
 /*
  * A search path is a list of CachedDir structures. A CachedDir has in it the
@@ -822,14 +822,14 @@ DirExpandCurly(const char *word, const c
 }
 
 
-/* Expand the word in each of the directories from the path. */
+/* Expand the pattern in each of the directories from the path. */
 static void
-DirExpandPath(const char *word, SearchPath *path, StringList *expansions)
+DirExpandPath(const char *pattern, SearchPath *path, StringList *expansions)
 {
 	SearchPathNode *ln;
 	for (ln = path->dirs.first; ln != NULL; ln = ln->next) {
 		CachedDir *dir = ln->datum;
-		DirMatchFiles(word, dir, expansions);
+		DirMatchFiles(pattern, dir, expansions);
 	}
 }
 

Index: src/usr.bin/make/unit-tests/cond-func-make.mk
diff -u src/usr.bin/make/unit-tests/cond-func-make.mk:1.3 src/usr.bin/make/unit-tests/cond-func-make.mk:1.4
--- src/usr.bin/make/unit-tests/cond-func-make.mk:1.3	Fri Sep 25 20:11:06 2020
+++ src/usr.bin/make/unit-tests/cond-func-make.mk	Thu Jun 22 09:09:08 2023
@@ -1,4 +1,4 @@
-# $NetBSD: cond-func-make.mk,v 1.3 2020/09/25 20:11:06 rillig Exp $
+# $NetBSD: cond-func-make.mk,v 1.4 2023/06/22 09:09:08 rillig Exp $
 #
 # Tests for the make() function in .if conditions, which tests whether
 # the argument has been passed as a target via the command line or later
@@ -20,5 +20,10 @@
 .  error
 .endif
 
+# TODO: warn about the malformed pattern
+.if make([)
+.  error
+.endif
+
 via-cmdline via-dot-makeflags:
 	: $@

Index: src/usr.bin/make/unit-tests/varmod-match.exp
diff -u src/usr.bin/make/unit-tests/varmod-match.exp:1.7 src/usr.bin/make/unit-tests/varmod-match.exp:1.8
--- src/usr.bin/make/unit-tests/varmod-match.exp:1.7	Sat Jun 11 09:15:49 2022
+++ src/usr.bin/make/unit-tests/varmod-match.exp	Thu Jun 22 09:09:08 2023
@@ -10,8 +10,8 @@ CondParser_Eval: ${:Ua \$ sign:M*$$*} !=
 Comparing "$" != "$"
 CondParser_Eval: ${:Ua \$ sign any-asterisk:M*\$*} != "any-asterisk"
 Comparing "any-asterisk" != "any-asterisk"
-make: "varmod-match.mk" line 157: Unknown modifier "]"
-make: "varmod-match.mk" line 157: Malformed conditional (${ ${:U\:} ${:U\:\:} :L:M[:]} != ":")
+make: "varmod-match.mk" line 160: Unknown modifier "]"
+make: "varmod-match.mk" line 160: Malformed conditional (${ ${:U\:} ${:U\:\:} :L:M[:]} != ":")
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/varmod-match.mk
diff -u src/usr.bin/make/unit-tests/varmod-match.mk:1.12 src/usr.bin/make/unit-tests/varmod-match.mk:1.13
--- src/usr.bin/make/unit-tests/varmod-match.mk:1.12	Wed Aug 24 21:03:57 2022
+++ src/usr.bin/make/unit-tests/varmod-match.mk	Thu Jun 22 09:09:08 2023
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-match.mk,v 1.12 2022/08/24 21:03:57 rillig Exp $
+# $NetBSD: varmod-match.mk,v 1.13 2023/06/22 09:09:08 rillig Exp $
 #
 # Tests for the :M variable modifier, which filters words that match the
 # given pattern.
@@ -33,8 +33,11 @@ NUMBERS=	One Two Three Four five six sev
 .if ${:U:Mb}
 .endif
 
-# As of 2022-06-11, this expression calls Str_Match 5,242,223 times.
-# Adding another '*?' to the pattern calls Str_Match 41,261,143 times.
+# As of 2023-06-22, this expression calls Str_Match 2,621,112 times.
+# Adding another '*?' to the pattern calls Str_Match 20,630,572 times.
+# Adding another '*?' to the pattern calls Str_Match 136,405,672 times.
+# Adding another '*?' to the pattern calls Str_Match 773,168,722 times.
+# Adding another '*?' to the pattern calls Str_Match 3,815,481,072 times.
 .if ${:U..b:M*?*?*?*?*?a}
 .endif
 



CVS commit: src/usr.bin/make

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jun 22 09:09:08 UTC 2023

Modified Files:
src/usr.bin/make: dir.c
src/usr.bin/make/unit-tests: cond-func-make.mk varmod-match.exp
varmod-match.mk

Log Message:
make: clean up comments related to pattern matching


To generate a diff of this commit:
cvs rdiff -u -r1.280 -r1.281 src/usr.bin/make/dir.c
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cond-func-make.mk
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod-match.exp
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/varmod-match.mk

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



CVS commit: src/usr.bin/make

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jun 22 08:55:33 UTC 2023

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

Log Message:
make: merge common code for handling the ':M' and ':N' modifiers

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.1056 -r1.1057 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.



CVS commit: src/usr.bin/make

2023-06-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jun 22 08:55:33 UTC 2023

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

Log Message:
make: merge common code for handling the ':M' and ':N' modifiers

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.1056 -r1.1057 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.1056 src/usr.bin/make/var.c:1.1057
--- src/usr.bin/make/var.c:1.1056	Fri Jun 16 22:30:35 2023
+++ src/usr.bin/make/var.c	Thu Jun 22 08:55:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1056 2023/06/16 22:30:35 sjg Exp $	*/
+/*	$NetBSD: var.c,v 1.1057 2023/06/22 08:55:33 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1056 2023/06/16 22:30:35 sjg Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1057 2023/06/22 08:55:33 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -1408,34 +1408,6 @@ ModifyWord_Root(Substring word, SepBuf *
 	SepBuf_AddRange(buf, word.start, end);
 }
 
-/*
- * Callback for ModifyWords to implement the :M modifier.
- * Place the word in the buffer if it matches the given pattern.
- */
-static void
-ModifyWord_Match(Substring word, SepBuf *buf, void *data)
-{
-	const char *pattern = data;
-
-	assert(word.end[0] == '\0');	/* assume null-terminated word */
-	if (Str_Match(word.start, pattern))
-		SepBuf_AddSubstring(buf, word);
-}
-
-/*
- * Callback for ModifyWords to implement the :N modifier.
- * Place the word in the buffer if it doesn't match the given pattern.
- */
-static void
-ModifyWord_NoMatch(Substring word, SepBuf *buf, void *data)
-{
-	const char *pattern = data;
-
-	assert(word.end[0] == '\0');	/* assume null-terminated word */
-	if (!Str_Match(word.start, pattern))
-		SepBuf_AddSubstring(buf, word);
-}
-
 #ifdef SYSVVARSUB
 struct ModifyWord_SysVSubstArgs {
 	GNode *scope;
@@ -2818,6 +2790,20 @@ ParseModifier_Match(const char **pp, con
 	return pattern;
 }
 
+struct ModifyWord_MatchArgs {
+	const char *pattern;
+	bool neg;
+};
+
+static void
+ModifyWord_Match(Substring word, SepBuf *buf, void *data)
+{
+	struct ModifyWord_MatchArgs *args = data;
+	assert(word.end[0] == '\0');	/* assume null-terminated word */
+	if (Str_Match(word.start, args->pattern) != args->neg)
+		SepBuf_AddSubstring(buf, word);
+}
+
 /* :Mpattern or :Npattern */
 static ApplyModifierResult
 ApplyModifier_Match(const char **pp, ModChain *ch)
@@ -2828,9 +2814,10 @@ ApplyModifier_Match(const char **pp, Mod
 	pattern = ParseModifier_Match(pp, ch);
 
 	if (ModChain_ShouldEval(ch)) {
-		ModifyWordProc modifyWord =
-		mod == 'M' ? ModifyWord_Match : ModifyWord_NoMatch;
-		ModifyWords(ch, modifyWord, pattern, ch->oneBigWord);
+		struct ModifyWord_MatchArgs args;
+		args.pattern = pattern;
+		args.neg = mod == 'N';
+		ModifyWords(ch, ModifyWord_Match, , ch->oneBigWord);
 	}
 
 	free(pattern);



CVS commit: [netbsd-10] src/doc

2023-06-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 22 08:16:37 UTC 2023

Modified Files:
src/doc [netbsd-10]: CHANGES-10.0

Log Message:
Ticket #213


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.71 -r1.1.2.72 src/doc/CHANGES-10.0

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



CVS commit: [netbsd-10] src/doc

2023-06-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 22 08:16:37 UTC 2023

Modified Files:
src/doc [netbsd-10]: CHANGES-10.0

Log Message:
Ticket #213


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.71 -r1.1.2.72 src/doc/CHANGES-10.0

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-10.0
diff -u src/doc/CHANGES-10.0:1.1.2.71 src/doc/CHANGES-10.0:1.1.2.72
--- src/doc/CHANGES-10.0:1.1.2.71	Wed Jun 21 22:39:15 2023
+++ src/doc/CHANGES-10.0	Thu Jun 22 08:16:37 2023
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-10.0,v 1.1.2.71 2023/06/21 22:39:15 martin Exp $
+# $NetBSD: CHANGES-10.0,v 1.1.2.72 2023/06/22 08:16:37 martin Exp $
 
 A complete list of changes from the initial NetBSD 10.0 branch on 2022-12-16
 until the 10.0 release:
@@ -2242,3 +2242,38 @@ sys/dev/mii/mii_physubr.c			1.103
 	work correctly on a interface which has no MIIF_DOPAUSE flag.
 	[msaitoh, ticket #211]
 
+sys/dev/pci/if_wm.c1.768-1.781
+sys/dev/pci/if_wmreg.h1.129,1.130
+sys/dev/pci/if_wmvar.h1.49
+
+	wm(4):
+	- Rework for event counters:
+	  - Fix calculation of GORC, GOTC, TOR and TOT counters correctly.
+	  - Rearrange the order of the registers so that they are roughly
+	in ascending order.
+	  - Reorder evcnt_attach_dynamic(), WM_EVCNT_ADD() and evcnt_detach()
+	to match.
+	  - IC{TX,RX}*C registers are for older than 82575.
+	  - Fix a bug that the transmit underrun counter is incorrectly
+	counted.
+	  - Don't add "Count" for event counter's description.
+	  - Some statistics registers were replaced with new counters on newer
+	chips. Treat 0x403c(CEXTERR->HTDPMC), 0x40fc(TSCTFC->CBRMPC),
+	0x4124(ICRXOC->HTCBDPC) and from 0x4104 to 0x4124.
+	  - Add some new counters:
+	- Circuit Breaker TX Manageability Packet
+	- Circuit Breaker RX Dropped Packet
+	- Host Good Octets RX
+	- Host Good Octets TX 
+	- Length Errors
+	- SerDes/SGMII Code Violation Packet
+	- Header Redirection Missed Packet
+	- EEE TX LPI
+	- EEE RX LPI
+	  - Fix prc511's comment and description.
+	- Add SOICZIFDATA (ifconfig -z) support for evcnt(9).
+	- Use WM_IS_ICHPCH(). No functional change.
+	- Fix typo. s/ictxact/ictxatc/. No functional change.
+	- Add comment.
+	[msaitoh, ticket #213]
+



CVS commit: [netbsd-10] src/sys/dev/pci

2023-06-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 22 08:14:35 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-10]: if_wm.c if_wmreg.h if_wmvar.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #213):

sys/dev/pci/if_wm.c: revision 1.770
sys/dev/pci/if_wm.c: revision 1.771
sys/dev/pci/if_wm.c: revision 1.772
sys/dev/pci/if_wm.c: revision 1.773
sys/dev/pci/if_wm.c: revision 1.774
sys/dev/pci/if_wm.c: revision 1.775
sys/dev/pci/if_wm.c: revision 1.776
sys/dev/pci/if_wmreg.h: revision 1.129
sys/dev/pci/if_wm.c: revision 1.777
sys/dev/pci/if_wm.c: revision 1.778
sys/dev/pci/if_wmvar.h: revision 1.49
sys/dev/pci/if_wm.c: revision 1.779
sys/dev/pci/if_wm.c: revision 1.768
sys/dev/pci/if_wm.c: revision 1.769
sys/dev/pci/if_wmreg.h: revision 1.130
sys/dev/pci/if_wm.c: revision 1.780
sys/dev/pci/if_wm.c: revision 1.781

Count some 64bit counters correctly.
 - Fix calculation of GORC, GOTC, TOR and TOT counters correctly.
 - Found by knakahara.

Add note for the TORL register.

The TOR register includes error, flow control and broadcast rejected.

Sort lines. No functional change.

 Rearrange the order of the registers so that they are roughly in ascending
order.

Sort lines. No functional change.

Reorder evcnt_attach_dynamic(), WM_EVCNT_ADD() and evcnt_detach() to match.
IC{TX,RX}*C registers are for older than 82575.

Fix a bug that the transmit underrun counter is incorrectly counted.
 The transmit underrun bit in the transmit status filed is only for 82544
(and older?), so don't use the counter for newer chips. The bit is reserved
for newer chips, but the bit sometimes set on 82575 at least.

Don't add "Count" for event counter's description.

 Some statistics registers were replaced with new counters.
 - 0x403c was CEXTERR(Carrier Extension Error). 82575 and newer except 80003,
   ICHs and PCHs have HTDPMC(Host Tx Discarded Packets by MAC). I don't really
   know for 82575. The 82575 datasheet say nothing about it.
 - The following two are changed for circuit breaker. Only 82576's datasheet
   describes abut it, so the registers might be only for 82576.
   Use those registers for 82575 and newer except 80003, ICHs and PCHs just in
   case.
   - 0x40fc was TSCTFC(TCP Segmentation Context Tx Fail). It was replaced by
 the CBRMPC(Circuit Breaker Rx Manageability Packet) register.
   - 0x4124 was ICRXOC(Interrupt Cause Receiver Overrun). It was replaced by
 the HTCBDPC(Host Tx Circuit Breaker Dropped Packet) register.
 - From 0x4104 to 0x4124:
   - For 0x4124, 82575's datasheet says it's not changed(ICRXOC).
 I don't know if it's correct. We use new HTCBDPC register for 82575.
   - 82576 and newer changed the meaning.
   - I don't know for 80003, ICHs and PCHs. Don't count those registers.
 At least, those registers in PCH2 and PCH_CNP are all zero.

Add some new event counters.

Add the following counters for 82575 and newer except 80003, ICHs and PCHs:
- Only 82576 document describes about the circuit breaker,
  so the following two might be only for 82575:
- Circuit Breaker TX Manageability Packet
- Circuit Breaker RX Dropped Packet
- 82575's document doesn't describe the following two, but we can see
  the same value as GO{T,R}C have:
- Host Good Octets RX
- Host Good Octets TX
- 82575's document doesn't describe the LENERRS (Length Errors) counter.
  I don't know if it has.
- Perhaps Non-SerDes/SGMII devices don't have SCVPC
  (SerDes/SGMII Code Violation Packet) register. We don't care if
  it's SerDes/SGMII or not for now.
- HRMPC (Header Redirection Missed Packet) appears only once
  in 8257[56]'s datasheet. FreeBSD's igb counts it, so we do, too.
- Count the following two for I350 and newer. I don't know if PCHs have:
- EEE TX LPI
- EEE RX LPI

 Move statistics updating code from wm_tick() to new wm_update_stats().
 - To reuse.
 - No functional change.

Add SOICZIFDATA (ifconfig -z) support for evcnt(9).

 First update the statistics data, then clear the event counters,
and finally copy and clear if_data via ether_ioctl().

Fix prc511's comment and description.

 Use WM_IS_ICHPCH(). No functional change.

Fix typo. s/ictxact/ictxatc/. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.767 -r1.767.2.1 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.128 -r1.128.2.1 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.48 -r1.48.4.1 src/sys/dev/pci/if_wmvar.h

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.767 src/sys/dev/pci/if_wm.c:1.767.2.1
--- src/sys/dev/pci/if_wm.c:1.767	Thu Dec  8 08:14:28 2022
+++ src/sys/dev/pci/if_wm.c	Thu Jun 22 08:14:35 2023
@@ 

CVS commit: [netbsd-10] src/sys/dev/pci

2023-06-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 22 08:14:35 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-10]: if_wm.c if_wmreg.h if_wmvar.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #213):

sys/dev/pci/if_wm.c: revision 1.770
sys/dev/pci/if_wm.c: revision 1.771
sys/dev/pci/if_wm.c: revision 1.772
sys/dev/pci/if_wm.c: revision 1.773
sys/dev/pci/if_wm.c: revision 1.774
sys/dev/pci/if_wm.c: revision 1.775
sys/dev/pci/if_wm.c: revision 1.776
sys/dev/pci/if_wmreg.h: revision 1.129
sys/dev/pci/if_wm.c: revision 1.777
sys/dev/pci/if_wm.c: revision 1.778
sys/dev/pci/if_wmvar.h: revision 1.49
sys/dev/pci/if_wm.c: revision 1.779
sys/dev/pci/if_wm.c: revision 1.768
sys/dev/pci/if_wm.c: revision 1.769
sys/dev/pci/if_wmreg.h: revision 1.130
sys/dev/pci/if_wm.c: revision 1.780
sys/dev/pci/if_wm.c: revision 1.781

Count some 64bit counters correctly.
 - Fix calculation of GORC, GOTC, TOR and TOT counters correctly.
 - Found by knakahara.

Add note for the TORL register.

The TOR register includes error, flow control and broadcast rejected.

Sort lines. No functional change.

 Rearrange the order of the registers so that they are roughly in ascending
order.

Sort lines. No functional change.

Reorder evcnt_attach_dynamic(), WM_EVCNT_ADD() and evcnt_detach() to match.
IC{TX,RX}*C registers are for older than 82575.

Fix a bug that the transmit underrun counter is incorrectly counted.
 The transmit underrun bit in the transmit status filed is only for 82544
(and older?), so don't use the counter for newer chips. The bit is reserved
for newer chips, but the bit sometimes set on 82575 at least.

Don't add "Count" for event counter's description.

 Some statistics registers were replaced with new counters.
 - 0x403c was CEXTERR(Carrier Extension Error). 82575 and newer except 80003,
   ICHs and PCHs have HTDPMC(Host Tx Discarded Packets by MAC). I don't really
   know for 82575. The 82575 datasheet say nothing about it.
 - The following two are changed for circuit breaker. Only 82576's datasheet
   describes abut it, so the registers might be only for 82576.
   Use those registers for 82575 and newer except 80003, ICHs and PCHs just in
   case.
   - 0x40fc was TSCTFC(TCP Segmentation Context Tx Fail). It was replaced by
 the CBRMPC(Circuit Breaker Rx Manageability Packet) register.
   - 0x4124 was ICRXOC(Interrupt Cause Receiver Overrun). It was replaced by
 the HTCBDPC(Host Tx Circuit Breaker Dropped Packet) register.
 - From 0x4104 to 0x4124:
   - For 0x4124, 82575's datasheet says it's not changed(ICRXOC).
 I don't know if it's correct. We use new HTCBDPC register for 82575.
   - 82576 and newer changed the meaning.
   - I don't know for 80003, ICHs and PCHs. Don't count those registers.
 At least, those registers in PCH2 and PCH_CNP are all zero.

Add some new event counters.

Add the following counters for 82575 and newer except 80003, ICHs and PCHs:
- Only 82576 document describes about the circuit breaker,
  so the following two might be only for 82575:
- Circuit Breaker TX Manageability Packet
- Circuit Breaker RX Dropped Packet
- 82575's document doesn't describe the following two, but we can see
  the same value as GO{T,R}C have:
- Host Good Octets RX
- Host Good Octets TX
- 82575's document doesn't describe the LENERRS (Length Errors) counter.
  I don't know if it has.
- Perhaps Non-SerDes/SGMII devices don't have SCVPC
  (SerDes/SGMII Code Violation Packet) register. We don't care if
  it's SerDes/SGMII or not for now.
- HRMPC (Header Redirection Missed Packet) appears only once
  in 8257[56]'s datasheet. FreeBSD's igb counts it, so we do, too.
- Count the following two for I350 and newer. I don't know if PCHs have:
- EEE TX LPI
- EEE RX LPI

 Move statistics updating code from wm_tick() to new wm_update_stats().
 - To reuse.
 - No functional change.

Add SOICZIFDATA (ifconfig -z) support for evcnt(9).

 First update the statistics data, then clear the event counters,
and finally copy and clear if_data via ether_ioctl().

Fix prc511's comment and description.

 Use WM_IS_ICHPCH(). No functional change.

Fix typo. s/ictxact/ictxatc/. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.767 -r1.767.2.1 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.128 -r1.128.2.1 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.48 -r1.48.4.1 src/sys/dev/pci/if_wmvar.h

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



CVS commit: [netbsd-8] src/doc

2023-06-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 22 06:32:31 UTC 2023

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

Log Message:
Ammend #1836 for file missed in original pullup


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

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

Modified files:

Index: src/doc/CHANGES-8.3
diff -u src/doc/CHANGES-8.3:1.1.2.178 src/doc/CHANGES-8.3:1.1.2.179
--- src/doc/CHANGES-8.3:1.1.2.178	Wed Jun 21 22:30:39 2023
+++ src/doc/CHANGES-8.3	Thu Jun 22 06:32:31 2023
@@ -1,4 +1,4 @@
- $NetBSD: CHANGES-8.3,v 1.1.2.178 2023/06/21 22:30:39 martin Exp $
+ $NetBSD: CHANGES-8.3,v 1.1.2.179 2023/06/22 06:32:31 martin Exp $
 
 A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3
 release:
@@ -3402,6 +3402,7 @@ sys/compat/common/kern_time_50.c		1.37
 sys/compat/common/vfs_syscalls_12.c		1.38
 sys/compat/common/vfs_syscalls_30.c		1.43
 sys/compat/common/vfs_syscalls_43.c		1.68
+sys/compat/freebsd/freebsd_machdep.c		1.5
 sys/compat/freebsd/freebsd_misc.c		1.34
 sys/compat/freebsd/freebsd_sched.c		1.23
 sys/compat/linux/arch/alpha/linux_machdep.c	1.52



CVS commit: [netbsd-8] src/doc

2023-06-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 22 06:32:31 UTC 2023

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

Log Message:
Ammend #1836 for file missed in original pullup


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

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



CVS commit: [netbsd-8] src/sys/arch/i386/i386

2023-06-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 22 06:30:48 UTC 2023

Modified Files:
src/sys/arch/i386/i386 [netbsd-8]: freebsd_machdep.c

Log Message:
Pull up the following revision, requested by riastradh in ticket #1836

sys/compat/freebsd/freebsd_machdep.c1.5

Memset before copyout


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.60.22.1 src/sys/arch/i386/i386/freebsd_machdep.c

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



CVS commit: [netbsd-8] src/sys/arch/i386/i386

2023-06-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 22 06:30:48 UTC 2023

Modified Files:
src/sys/arch/i386/i386 [netbsd-8]: freebsd_machdep.c

Log Message:
Pull up the following revision, requested by riastradh in ticket #1836

sys/compat/freebsd/freebsd_machdep.c1.5

Memset before copyout


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.60.22.1 src/sys/arch/i386/i386/freebsd_machdep.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/i386/i386/freebsd_machdep.c
diff -u src/sys/arch/i386/i386/freebsd_machdep.c:1.60 src/sys/arch/i386/i386/freebsd_machdep.c:1.60.22.1
--- src/sys/arch/i386/i386/freebsd_machdep.c:1.60	Sun Feb 23 22:35:27 2014
+++ src/sys/arch/i386/i386/freebsd_machdep.c	Thu Jun 22 06:30:48 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: freebsd_machdep.c,v 1.60 2014/02/23 22:35:27 dsl Exp $	*/
+/*	$NetBSD: freebsd_machdep.c,v 1.60.22.1 2023/06/22 06:30:48 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: freebsd_machdep.c,v 1.60 2014/02/23 22:35:27 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: freebsd_machdep.c,v 1.60.22.1 2023/06/22 06:30:48 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vm86.h"
@@ -93,6 +93,8 @@ freebsd_sendsig(const ksiginfo_t *ksi, c
 
 	fp--;
 
+	memset(, 0, sizeof(frame));
+
 	/* Build stack frame for signal trampoline. */
 	frame.sf_signum = sig;
 	frame.sf_code = code;



CVS commit: [netbsd-9] src/doc

2023-06-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 22 06:06:52 UTC 2023

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

Log Message:
Add (accidently) missing entry for ticket #1645


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.70 -r1.1.2.71 src/doc/CHANGES-9.4

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



CVS commit: [netbsd-9] src/doc

2023-06-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 22 06:06:52 UTC 2023

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

Log Message:
Add (accidently) missing entry for ticket #1645


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.70 -r1.1.2.71 src/doc/CHANGES-9.4

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.4
diff -u src/doc/CHANGES-9.4:1.1.2.70 src/doc/CHANGES-9.4:1.1.2.71
--- src/doc/CHANGES-9.4:1.1.2.70	Wed Jun 21 22:24:25 2023
+++ src/doc/CHANGES-9.4	Thu Jun 22 06:06:52 2023
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.4,v 1.1.2.70 2023/06/21 22:24:25 martin Exp $
+# $NetBSD: CHANGES-9.4,v 1.1.2.71 2023/06/22 06:06:52 martin Exp $
 
 A complete list of changes from the NetBSD 9.3 release to the NetBSD 9.4
 release:
@@ -6,7 +6,7 @@ release:
 external/gpl2/groff/tmac/mdoc.local		patched by hand
 sys/sys/param.h patched by hand
 doc/README.filespatched by hand
-doc/CHANGES-9.4	added
+doc/CHANGES-9.4 added
 
 	Welcome to 9.3_STABLE.
 	[martin]
@@ -68,7 +68,7 @@ sys/dev/raidframe/rf_netbsdkintf.c		1.40
 	ioctls when RAIDframe is not initialized.
 	[oster, ticket #1506]
 
-bin/test/test.c	1.45
+bin/test/test.c 1.45
 
 	PR 56983: fix confusing message in test(1).
 	[dholland, ticket #1507]
@@ -113,7 +113,7 @@ distrib/amiga/floppies/inst-common/dot.c
 distrib/amiga/miniroot/dot.profile		1.11
 distrib/atari/floppies/common/dot.profile	1.9
 distrib/utils/script-installer/dot.commonutils	1.8
-distrib/vax/inst-common/dot.commonutils		1.6
+distrib/vax/inst-common/dot.commonutils 	1.6
 
 	PRs 54835, 54835, 56983: adapt install scripts to the shell
 	being compiled without support for depracated test expressions.
@@ -158,7 +158,7 @@ sys/arch/atari/dev/itevar.h			1.15
 
 sys/arch/atari/atari/atari_init.c		1.105
 sys/arch/atari/conf/GENERIC.in			1.123
-sys/arch/atari/conf/files.atari			1.124
+sys/arch/atari/conf/files.atari 		1.124
 sys/arch/atari/conf/ATARITT			(regen)
 sys/arch/atari/conf/FALCON			(regen)
 sys/arch/atari/conf/HADES			(regen)
@@ -188,20 +188,20 @@ sys/arch/atari/conf/SMALL030			(regen)
 	Improve VGA console settings for Milan, especially for sysinst.
 	[tsutsui, ticket #1521]
 
-usr.bin/netstat/atalk.c		1.18,1.20-1.21
+usr.bin/netstat/atalk.c 	1.18,1.20-1.21
 usr.bin/netstat/bpf.c		1.16 via patch
 usr.bin/netstat/fast_ipsec.c	1.24
 usr.bin/netstat/if.c		1.97-1.99,1.101-1.104 via patch
 usr.bin/netstat/inet.c		1.111,1.115-1.116 via patch
-usr.bin/netstat/inet6.c		1.74-1.75,1.80-1.81 via patch
+usr.bin/netstat/inet6.c 	1.74-1.75,1.80-1.81 via patch
 usr.bin/netstat/main.c		1.100-1.103
 usr.bin/netstat/mbuf.c		1.35
 usr.bin/netstat/mroute.c	1.26-1.27
 usr.bin/netstat/mroute6.c	1.16
 usr.bin/netstat/netstat.h	1.52-1.53
-usr.bin/netstat/pfkey.c		1.4-1.5 via patch
+usr.bin/netstat/pfkey.c 	1.4-1.5 via patch
 usr.bin/netstat/pfsync.c	1.4-1.5 via patch
-usr.bin/netstat/route.c		1.86-1.88
+usr.bin/netstat/route.c 	1.86-1.88
 usr.bin/netstat/unix.c		1.36-1.37
 usr.bin/netstat/vtw.c		1.11,1.13
 
@@ -218,14 +218,14 @@ usr.bin/netstat/vtw.c		1.11,1.13
 	- KNF. Style fixes.
 	[msaitoh, ticket #1522]
 
-usr.bin/ftp/Makefileup to 1.39
-usr.bin/ftp/fetch.c up to 1.235
-usr.bin/ftp/ftp.1   up to 1.147
-usr.bin/ftp/ftp_var.h   up to 1.86
-usr.bin/ftp/main.c  up to 1.128
-usr.bin/ftp/ssl.c   up to 1.12
-usr.bin/ftp/util.c  up to 1.164
-usr.bin/ftp/version.h   up to 1.94
+usr.bin/ftp/Makefileup to 1.39
+usr.bin/ftp/fetch.cup to 1.235
+usr.bin/ftp/ftp.1up to 1.147
+usr.bin/ftp/ftp_var.hup to 1.86
+usr.bin/ftp/main.cup to 1.128
+usr.bin/ftp/ssl.cup to 1.12
+usr.bin/ftp/util.cup to 1.164
+usr.bin/ftp/version.hup to 1.94
 
 	ftp(1): PR 57003: Support relative redirects.
 	[christos, #1523]
@@ -385,32 +385,32 @@ sys/dev/pci/ichsmb.c1.76-1.77 (via p
 	Add Intel 600 Series PCH support.
 	[msaitoh, ticket #1544]
 
-external/public-domain/tz/dist/SECURITY up to 1.1.1.1
-external/public-domain/tz/dist/CONTRIBUTING up to 1.1.1.7
-external/public-domain/tz/dist/Makefile up to 1.1.1.33
-external/public-domain/tz/dist/NEWS up to 1.1.1.38
-external/public-domain/tz/dist/README   up to 1.1.1.10
-external/public-domain/tz/dist/TZDATA_VERSION   up to 1.30
-external/public-domain/tz/dist/africa   up to 1.1.1.28
-external/public-domain/tz/dist/antarctica   up to 1.1.1.15
-external/public-domain/tz/dist/asia up to 1.5
-external/public-domain/tz/dist/australasia  up to 1.5
-external/public-domain/tz/dist/backward up to 1.5
-external/public-domain/tz/dist/backzone up to 1.1.1.23
-external/public-domain/tz/dist/calendarsup to 1.1.1.2