CVS commit: src/usr.bin/skey

2023-12-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 11 02:08:26 UTC 2023

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

Log Message:
skey(1): Fix documentation of `-x' to match implementation.

PR bin/28495


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/skey/skey.1

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

Modified files:

Index: src/usr.bin/skey/skey.1
diff -u src/usr.bin/skey/skey.1:1.23 src/usr.bin/skey/skey.1:1.24
--- src/usr.bin/skey/skey.1:1.23	Mon Jul  3 21:34:21 2017
+++ src/usr.bin/skey/skey.1	Mon Dec 11 02:08:26 2023
@@ -1,4 +1,4 @@
-.\"	$NetBSD: skey.1,v 1.23 2017/07/03 21:34:21 wiz Exp $
+.\"	$NetBSD: skey.1,v 1.24 2023/12/11 02:08:26 riastradh Exp $
 .\"
 .\"	from: @(#)skey.1	1.1 	10/28/93
 .\"
@@ -105,7 +105,7 @@ allows the user to specify the
 .Em S/Key
 password on the command line.
 .Pp
-To output the S/Key list in hexadecimal instead of words,
+To output the S/Key list in hexadecimal in addition to words,
 use the
 .Fl x
 option.



CVS commit: src/usr.bin/skey

2023-12-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 11 02:08:26 UTC 2023

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

Log Message:
skey(1): Fix documentation of `-x' to match implementation.

PR bin/28495


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/skey/skey.1

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



CVS commit: src/sys/arch/shark/ofw

2023-12-10 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Dec 10 23:19:12 UTC 2023

Modified Files:
src/sys/arch/shark/ofw: ofw.c

Log Message:
fix format specifiers for OLDPRINTFS build option.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/shark/ofw/ofw.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/shark/ofw/ofw.c
diff -u src/sys/arch/shark/ofw/ofw.c:1.68 src/sys/arch/shark/ofw/ofw.c:1.69
--- src/sys/arch/shark/ofw/ofw.c:1.68	Mon Sep  3 16:29:27 2018
+++ src/sys/arch/shark/ofw/ofw.c	Sun Dec 10 23:19:12 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw.c,v 1.68 2018/09/03 16:29:27 riastradh Exp $	*/
+/*	$NetBSD: ofw.c,v 1.69 2023/12/10 23:19:12 andvar Exp $	*/
 
 /*
  * Copyright 1997
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw.c,v 1.68 2018/09/03 16:29:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw.c,v 1.69 2023/12/10 23:19:12 andvar Exp $");
 
 #include 
 #include 
@@ -798,7 +798,7 @@ ofw_configmem(void)
 		for (totalcnt = 0, mp = OFphysmem; totalcnt < nOFphysmem;
 		totalcnt++, mp++) {
 #ifdef	OLDPRINTFS
-			printf("physmem: %x, %x\n", mp->start, mp->size);
+			printf("physmem: %lx, %lx\n", mp->start, mp->size);
 #endif
 			physmem += btoc(mp->size);
 		}
@@ -811,7 +811,7 @@ ofw_configmem(void)
 		for (availcnt = 0, mp = OFphysavail; availcnt < nOFphysavail;
 		availcnt++, mp++) {
 #ifdef	OLDPRINTFS
-			printf("physavail: %x, %x\n", mp->start, mp->size);
+			printf("physavail: %lx, %lx\n", mp->start, mp->size);
 #endif
 			free_pages += btoc(mp->size);
 		}
@@ -819,7 +819,7 @@ ofw_configmem(void)
 		mp--;
 		physical_freeend = mp->start + mp->size;
 #ifdef	OLDPRINTFS
-		printf("pmap_bootstrap:  physmem = %x, free_pages = %x\n",
+		printf("pmap_bootstrap:  physmem = %lx, free_pages = %x\n",
 		physmem, free_pages);
 #endif
 
@@ -1533,7 +1533,7 @@ ofw_getphysmeminfo(void)
 
 #ifdef	OLDPRINTFS
 		for (mp = tmp; mp->size; mp++) {
-			printf("%x, %x\n", mp->start, mp->size);
+			printf("%lx, %lx\n", mp->start, mp->size);
 		}
 #endif
 	}



CVS commit: src/sys/arch/shark/ofw

2023-12-10 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Dec 10 23:19:12 UTC 2023

Modified Files:
src/sys/arch/shark/ofw: ofw.c

Log Message:
fix format specifiers for OLDPRINTFS build option.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/shark/ofw/ofw.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-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 20:17:24 UTC 2023

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

Log Message:
make: explain in the debug log why a variable assignment is ignored


To generate a diff of this commit:
cvs rdiff -u -r1.1081 -r1.1082 src/usr.bin/make/var.c
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/make/unit-tests/vardebug.exp
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/varname-dot-shell.exp

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

Modified files:

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.1081 src/usr.bin/make/var.c:1.1082
--- src/usr.bin/make/var.c:1.1081	Sun Dec 10 20:12:28 2023
+++ src/usr.bin/make/var.c	Sun Dec 10 20:17:23 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1081 2023/12/10 20:12:28 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.1082 2023/12/10 20:17:23 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.1081 2023/12/10 20:12:28 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1082 2023/12/10 20:17:23 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -937,7 +937,9 @@ Var_SetWithFlags(GNode *scope, const cha
 	}
 
 	if (scope == SCOPE_GLOBAL && ExistsInCmdline(name)) {
-		DEBUG3(VAR, "%s: %s = %s ignored!\n",
+		DEBUG3(VAR,
+		"%s: ignoring '%s' = '%s' "
+		"due to a command line variable of the same name\n",
 		SCOPE_GLOBAL->name, name, val);
 		return;
 	}

Index: src/usr.bin/make/unit-tests/vardebug.exp
diff -u src/usr.bin/make/unit-tests/vardebug.exp:1.30 src/usr.bin/make/unit-tests/vardebug.exp:1.31
--- src/usr.bin/make/unit-tests/vardebug.exp:1.30	Thu Jun  1 20:56:35 2023
+++ src/usr.bin/make/unit-tests/vardebug.exp	Sun Dec 10 20:17:23 2023
@@ -7,7 +7,7 @@ Global: delete VAR
 Global: delete VAR (not found)
 Var_SetExpand: variable name "${:U}" expands to empty string, with value "empty name" - ignored
 Var_AppendExpand: variable name "${:U}" expands to empty string, with value "empty name" - ignored
-Global: FROM_CMDLINE = overwritten ignored!
+Global: ignoring 'FROM_CMDLINE' = 'overwritten' due to a command line variable of the same name
 Global: VAR = 1
 Global: VAR = 1 2
 Global: VAR = 1 2 3

Index: src/usr.bin/make/unit-tests/varname-dot-shell.exp
diff -u src/usr.bin/make/unit-tests/varname-dot-shell.exp:1.17 src/usr.bin/make/unit-tests/varname-dot-shell.exp:1.18
--- src/usr.bin/make/unit-tests/varname-dot-shell.exp:1.17	Sat Dec  9 00:13:38 2023
+++ src/usr.bin/make/unit-tests/varname-dot-shell.exp	Sun Dec 10 20:17:23 2023
@@ -5,7 +5,7 @@ Global: delete .SHELL (not found)
 Command: .SHELL = (details omitted)
 Global: ORIG_SHELL = (details omitted)
 Parsing line 12: .SHELL=		overwritten
-Global: .SHELL = overwritten ignored!
+Global: ignoring '.SHELL' = 'overwritten' due to a command line variable of the same name
 CondParser_Eval: ${.SHELL} != ${ORIG_SHELL}
 Var_Parse: ${.SHELL} != ${ORIG_SHELL} (eval-defined)
 Var_Parse: ${ORIG_SHELL} (eval-defined)
@@ -20,7 +20,7 @@ Comparing "(details omitted)" != "(detai
 Parsing line 27: .undef .SHELL
 Global: delete .SHELL (not found)
 Parsing line 28: .SHELL=		newly overwritten
-Global: .SHELL = newly overwritten ignored!
+Global: ignoring '.SHELL' = 'newly overwritten' due to a command line variable of the same name
 CondParser_Eval: ${.SHELL} != ${ORIG_SHELL}
 Var_Parse: ${.SHELL} != ${ORIG_SHELL} (eval-defined)
 Var_Parse: ${ORIG_SHELL} (eval-defined)



CVS commit: src/usr.bin/make

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 20:17:24 UTC 2023

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

Log Message:
make: explain in the debug log why a variable assignment is ignored


To generate a diff of this commit:
cvs rdiff -u -r1.1081 -r1.1082 src/usr.bin/make/var.c
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/make/unit-tests/vardebug.exp
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/varname-dot-shell.exp

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



CVS commit: src/usr.bin/make

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 20:12:28 UTC 2023

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

Log Message:
make: remove redundant text from diagnostic about bad '?:' modifier


To generate a diff of this commit:
cvs rdiff -u -r1.1080 -r1.1081 src/usr.bin/make/var.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cond-late.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-late.mk
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/make/unit-tests/varmod-ifelse.exp
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/make/unit-tests/varmod-ifelse.mk

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

Modified files:

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.1080 src/usr.bin/make/var.c:1.1081
--- src/usr.bin/make/var.c:1.1080	Sun Dec 10 20:03:30 2023
+++ src/usr.bin/make/var.c	Sun Dec 10 20:12:28 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1080 2023/12/10 20:03:30 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.1081 2023/12/10 20:12:28 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.1080 2023/12/10 20:03:30 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1081 2023/12/10 20:12:28 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -3476,8 +3476,8 @@ ApplyModifier_IfElse(const char **pp, Mo
 	if (cond_rc == CR_ERROR) {
 		Substring thenExpr = LazyBuf_Get();
 		Substring elseExpr = LazyBuf_Get();
-		Error("Bad conditional expression '%s' in '%s?%.*s:%.*s'",
-		expr->name, expr->name,
+		Error("Bad conditional expression '%s' before '?%.*s:%.*s'",
+		expr->name,
 		(int)Substring_Length(thenExpr), thenExpr.start,
 		(int)Substring_Length(elseExpr), elseExpr.start);
 		LazyBuf_Done();

Index: src/usr.bin/make/unit-tests/cond-late.exp
diff -u src/usr.bin/make/unit-tests/cond-late.exp:1.4 src/usr.bin/make/unit-tests/cond-late.exp:1.5
--- src/usr.bin/make/unit-tests/cond-late.exp:1.4	Mon Apr 19 22:22:27 2021
+++ src/usr.bin/make/unit-tests/cond-late.exp	Sun Dec 10 20:12:28 2023
@@ -1,4 +1,4 @@
-make: Bad conditional expression ' != "no"' in ' != "no"?:'
+make: Bad conditional expression ' != "no"' before '?:'
 yes
 no
 exit status 0

Index: src/usr.bin/make/unit-tests/cond-late.mk
diff -u src/usr.bin/make/unit-tests/cond-late.mk:1.5 src/usr.bin/make/unit-tests/cond-late.mk:1.6
--- src/usr.bin/make/unit-tests/cond-late.mk:1.5	Sun Nov 19 21:47:52 2023
+++ src/usr.bin/make/unit-tests/cond-late.mk	Sun Dec 10 20:12:28 2023
@@ -1,4 +1,4 @@
-# $NetBSD: cond-late.mk,v 1.5 2023/11/19 21:47:52 rillig Exp $
+# $NetBSD: cond-late.mk,v 1.6 2023/12/10 20:12:28 rillig Exp $
 #
 # Using the :? modifier, expressions can contain conditional
 # expressions that are evaluated late, at expansion time.
@@ -31,6 +31,6 @@ cond-literal:
 
 VAR=	${${UNDEF} != "no":?:}
 # expect-reset
-# expect: make: Bad conditional expression ' != "no"' in ' != "no"?:'
+# expect: make: Bad conditional expression ' != "no"' before '?:'
 .if empty(VAR:Mpattern)
 .endif

Index: src/usr.bin/make/unit-tests/varmod-ifelse.exp
diff -u src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.18 src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.19
--- src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.18	Sun Nov 19 21:47:52 2023
+++ src/usr.bin/make/unit-tests/varmod-ifelse.exp	Sun Dec 10 20:12:28 2023
@@ -1,14 +1,14 @@
-make: Bad conditional expression 'bare words == "literal"' in 'bare words == "literal"?bad:bad'
+make: Bad conditional expression 'bare words == "literal"' before '?bad:bad'
 make: "varmod-ifelse.mk" line 28: Malformed conditional (${${:Ubare words} == "literal":?bad:bad})
-make: Bad conditional expression ' == ""' in ' == ""?bad-assign:bad-assign'
-make: Bad conditional expression ' == ""' in ' == ""?bad-cond:bad-cond'
+make: Bad conditional expression ' == ""' before '?bad-assign:bad-assign'
+make: Bad conditional expression ' == ""' before '?bad-cond:bad-cond'
 make: "varmod-ifelse.mk" line 46: Malformed conditional (${${UNDEF} == "":?bad-cond:bad-cond})
-make: Bad conditional expression '1 == == 2' in '1 == == 2?yes:no'
+make: Bad conditional expression '1 == == 2' before '?yes:no'
 make: "varmod-ifelse.mk" line 69: Malformed conditional (${1 == == 2:?yes:no} != "")
 CondParser_Eval: "${1 == == 2:?yes:no}" != ""
 CondParser_Eval: 1 == == 2
 Comparing 1.00 == 0.00
-make: Bad conditional expression '1 == == 2' in '1 == == 2?yes:no'
+make: Bad conditional expression '1 == == 2' before '?yes:no'
 Comparing "" != ""
 make: "varmod-ifelse.mk" line 96: warning: Oops, the parse error should have been propagated.
 CondParser_Eval: ${ ${:U\$}{VAR} == value:?ok:bad} != "ok"
@@ -17,15 +17,15 @@ Comparing "value" == "value"
 Comparing "ok" != "ok"
 make: 

CVS commit: src/usr.bin/make

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 20:12:28 UTC 2023

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

Log Message:
make: remove redundant text from diagnostic about bad '?:' modifier


To generate a diff of this commit:
cvs rdiff -u -r1.1080 -r1.1081 src/usr.bin/make/var.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cond-late.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-late.mk
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/make/unit-tests/varmod-ifelse.exp
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/make/unit-tests/varmod-ifelse.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-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 20:03:30 UTC 2023

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

Log Message:
make: clean up the check for command line variables

It looked suspicious that to check whether a variable was set via the
command line, the variable value would be needed.  Moving the debug
diagnostic to the calling function resolved this smell.

A variable from the command line scope is never short-lived, so there's
no need to clean up after accessing the variable.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.1079 -r1.1080 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.1079 src/usr.bin/make/var.c:1.1080
--- src/usr.bin/make/var.c:1.1079	Sun Dec 10 19:56:53 2023
+++ src/usr.bin/make/var.c	Sun Dec 10 20:03:30 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1079 2023/12/10 19:56:53 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.1080 2023/12/10 20:03:30 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.1079 2023/12/10 19:56:53 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1080 2023/12/10 20:03:30 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -917,22 +917,10 @@ Var_UnExport(bool isEnv, const char *arg
  * See 'scope == SCOPE_CMDLINE' in Var_SetWithFlags.
  */
 static bool
-ExistsInCmdline(const char *name, const char *val)
+ExistsInCmdline(const char *name)
 {
-	Var *v;
-
-	v = VarFind(name, SCOPE_CMDLINE, false);
-	if (v == NULL)
-		return false;
-
-	if (v->fromCmd) {
-		DEBUG3(VAR, "%s: %s = %s ignored!\n",
-		SCOPE_GLOBAL->name, name, val);
-		return true;
-	}
-
-	VarFreeShortLived(v);
-	return false;
+	Var *v = VarFind(name, SCOPE_CMDLINE, false);
+	return v != NULL && v->fromCmd;
 }
 
 /* Set the variable to the value; the name is not expanded. */
@@ -948,8 +936,11 @@ Var_SetWithFlags(GNode *scope, const cha
 		return;
 	}
 
-	if (scope == SCOPE_GLOBAL && ExistsInCmdline(name, val))
+	if (scope == SCOPE_GLOBAL && ExistsInCmdline(name)) {
+		DEBUG3(VAR, "%s: %s = %s ignored!\n",
+		SCOPE_GLOBAL->name, name, val);
 		return;
+	}
 
 	/*
 	 * Only look for a variable in the given scope since anything set



CVS commit: src/usr.bin/make

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 20:03:30 UTC 2023

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

Log Message:
make: clean up the check for command line variables

It looked suspicious that to check whether a variable was set via the
command line, the variable value would be needed.  Moving the debug
diagnostic to the calling function resolved this smell.

A variable from the command line scope is never short-lived, so there's
no need to clean up after accessing the variable.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.1079 -r1.1080 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-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 19:56:53 UTC 2023

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

Log Message:
make: clean up comments and local identifiers

No binary change, except for line numbers in assertions.


To generate a diff of this commit:
cvs rdiff -u -r1.1078 -r1.1079 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-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 19:56:53 UTC 2023

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

Log Message:
make: clean up comments and local identifiers

No binary change, except for line numbers in assertions.


To generate a diff of this commit:
cvs rdiff -u -r1.1078 -r1.1079 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.1078 src/usr.bin/make/var.c:1.1079
--- src/usr.bin/make/var.c:1.1078	Sun Dec 10 18:59:50 2023
+++ src/usr.bin/make/var.c	Sun Dec 10 19:56:53 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1078 2023/12/10 18:59:50 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.1079 2023/12/10 19:56:53 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.1078 2023/12/10 18:59:50 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1079 2023/12/10 19:56:53 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -378,11 +378,11 @@ CanonicalVarname(Substring name)
 	if (Substring_Equals(name, ".TARGET"))
 		return Substring_InitStr(TARGET);
 
+	/* GNU make has an additional alias $^ == ${.ALLSRC}. */
+
 	if (Substring_Equals(name, ".SHELL") && shellPath == NULL)
 		Shell_Init();
 
-	/* GNU make has an additional alias $^ == ${.ALLSRC}. */
-
 	return name;
 }
 
@@ -911,7 +911,7 @@ Var_UnExport(bool isEnv, const char *arg
 
 /*
  * When there is a variable of the same name in the command line scope, the
- * global variable would not be visible anywhere.  Therefore there is no
+ * global variable would not be visible anywhere.  Therefore, there is no
  * point in setting it at all.
  *
  * See 'scope == SCOPE_CMDLINE' in Var_SetWithFlags.
@@ -969,7 +969,7 @@ Var_SetWithFlags(GNode *scope, const cha
 			Var_Delete(SCOPE_GLOBAL, name);
 		}
 		if (strcmp(name, ".SUFFIXES") == 0) {
-			/* special: treat as readOnly */
+			/* special: treat as read-only */
 			DEBUG3(VAR, "%s: %s = %s ignored (read-only)\n",
 			scope->name, name, val);
 			return;
@@ -990,12 +990,14 @@ Var_SetWithFlags(GNode *scope, const cha
 			ExportVar(name, VEM_PLAIN);
 	}
 
-	/*
-	 * Any variables given on the command line are automatically exported
-	 * to the environment (as per POSIX standard), except for internals.
-	 */
 	if (scope == SCOPE_CMDLINE) {
 		v->fromCmd = true;
+
+		/*
+		 * Any variables given on the command line are automatically
+		 * exported to the environment (as per POSIX standard), except
+		 * for internals.
+		 */
 		if (!(flags & VAR_SET_NO_EXPORT) && name[0] != '.') {
 
 			/*
@@ -1030,15 +1032,8 @@ Var_Set(GNode *scope, const char *name, 
 }
 
 /*
- * Set the variable name to the value val in the given scope.
- *
- * If the variable doesn't yet exist, it is created.
- * Otherwise the new value overwrites and replaces the old value.
- *
- * Input:
- *	scope		scope in which to set it
- *	name		name of the variable to set, is expanded once
- *	val		value to give to the variable
+ * In the scope, expand the variable name once, then create the variable or
+ * replace its value.
  */
 void
 Var_SetExpand(GNode *scope, const char *name, const char *val)
@@ -1445,14 +1440,6 @@ ModifyWord_SysVSubst(Substring word, Sep
 }
 #endif
 
-
-struct ModifyWord_SubstArgs {
-	Substring lhs;
-	Substring rhs;
-	PatternFlags pflags;
-	bool matched;
-};
-
 static const char *
 Substring_Find(Substring haystack, Substring needle)
 {
@@ -1466,6 +1453,13 @@ Substring_Find(Substring haystack, Subst
 	return NULL;
 }
 
+struct ModifyWord_SubstArgs {
+	Substring lhs;
+	Substring rhs;
+	PatternFlags pflags;
+	bool matched;
+};
+
 /*
  * Callback for ModifyWords to implement the :S,from,to, modifier.
  * Perform a string substitution on the given word.
@@ -1915,8 +1909,8 @@ FormatTime(const char *fmt, time_t t, bo
  * XXX: As of 2020-11-15, some modifiers such as :S, :C, :P, :L do not
  * need to be followed by a ':' or endc; this was an unintended mistake.
  *
- * If parsing fails because of a missing delimiter (as in the :S, :C or :@
- * modifiers), return AMR_CLEANUP.
+ * If parsing fails because of a missing delimiter after a modifier part (as
+ * in the :S, :C or :@ modifiers), return AMR_CLEANUP.
  *
  * If parsing fails because the modifier is unknown, return AMR_UNKNOWN to
  * try the SysV modifier ${VAR:from=to} as fallback.  This should only be
@@ -3078,8 +3072,8 @@ ApplyModifier_ToSep(const char **pp, Mod
 	const char *sep = *pp + 2;
 
 	/*
-	 * Even in parse-only mode, proceed as normal since there is
-	 * neither any observable side effect nor a performance penalty.
+	 * Even in parse-only mode, apply the side effects, since the side
+	 * effects are neither observable nor is there a performance penalty.
 	 * Checking for wantRes for every single piece of code in 

CVS commit: src/usr.bin/make

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 18:59:50 UTC 2023

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

Log Message:
make: document how to trigger a use-after-free bug

Since 2017-02-01.


To generate a diff of this commit:
cvs rdiff -u -r1.1077 -r1.1078 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.1077 src/usr.bin/make/var.c:1.1078
--- src/usr.bin/make/var.c:1.1077	Sun Dec 10 14:30:50 2023
+++ src/usr.bin/make/var.c	Sun Dec 10 18:59:50 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1077 2023/12/10 14:30:50 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.1078 2023/12/10 18:59:50 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.1077 2023/12/10 14:30:50 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1078 2023/12/10 18:59:50 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -4598,11 +4598,18 @@ Var_Parse(const char **pp, GNode *scope,
 	}
 
 	/*
-	 * XXX: This assignment creates an alias to the current value of the
+	 * FIXME: This assignment creates an alias to the current value of the
 	 * variable.  This means that as long as the value of the expression
-	 * stays the same, the value of the variable must not change.
-	 * Using the '::=' modifier, it could be possible to trigger exactly
-	 * this situation.
+	 * stays the same, the value of the variable must not change, and the
+	 * variable must not be deleted.  Using the ':@' modifier, it is
+	 * possible (since var.c 1.212 from 2017/02/01) to delete the variable
+	 * while its value is still being used:
+	 *
+	 *	VAR=	value
+	 *	_:=	${VAR:${:U@VAR@loop@}:S,^,prefix,}
+	 *
+	 * The same effect might be achievable using the '::=' or the ':_'
+	 * modifiers.
 	 *
 	 * At the bottom of this function, the resulting value is compared to
 	 * the then-current value of the variable.  This might also invoke



CVS commit: src/usr.bin/make

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 18:59:50 UTC 2023

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

Log Message:
make: document how to trigger a use-after-free bug

Since 2017-02-01.


To generate a diff of this commit:
cvs rdiff -u -r1.1077 -r1.1078 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/sys/nfs

2023-12-10 Thread Amitai Schleier
Module Name:src
Committed By:   schmonz
Date:   Sun Dec 10 18:16:08 UTC 2023

Modified Files:
src/sys/nfs: nfs_vnops.c

Log Message:
NFS client: fix interop with macOS 14 servers.

Symptom: a bunch of "Cannot open `.' (Invalid argument)".

thorpej@ analysis and fix: on the first request to read a given
directory, make sure READDIR and READDIRPLUS cookie verifiers are
being set to 0. This is in RFC1813 and macOS must have gotten
stricter about it.

Verified on 10.0_RC1/aarch64 to fix the reproducers in PR kern/57691 as
well as the original use case in which I met the bug: pkg_rr once again
runs to completion.


To generate a diff of this commit:
cvs rdiff -u -r1.324 -r1.325 src/sys/nfs/nfs_vnops.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/nfs/nfs_vnops.c
diff -u src/sys/nfs/nfs_vnops.c:1.324 src/sys/nfs/nfs_vnops.c:1.325
--- src/sys/nfs/nfs_vnops.c:1.324	Tue May 24 06:28:02 2022
+++ src/sys/nfs/nfs_vnops.c	Sun Dec 10 18:16:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_vnops.c,v 1.324 2022/05/24 06:28:02 andvar Exp $	*/
+/*	$NetBSD: nfs_vnops.c,v 1.325 2023/12/10 18:16:08 schmonz Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.324 2022/05/24 06:28:02 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.325 2023/12/10 18:16:08 schmonz Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_nfs.h"
@@ -2422,8 +2422,13 @@ nfs_readdirrpc(struct vnode *vp, struct 
 txdr_cookie3(uiop->uio_offset, tl);
 			}
 			tl += 2;
-			*tl++ = dnp->n_cookieverf.nfsuquad[0];
-			*tl++ = dnp->n_cookieverf.nfsuquad[1];
+			if (uiop->uio_offset == 0) {
+*tl++ = 0;
+*tl++ = 0;
+			} else {
+*tl++ = dnp->n_cookieverf.nfsuquad[0];
+*tl++ = dnp->n_cookieverf.nfsuquad[1];
+			}
 		} else
 #endif
 		{
@@ -2632,8 +2637,13 @@ nfs_readdirplusrpc(struct vnode *vp, str
 			txdr_cookie3(uiop->uio_offset, tl);
 		}
 		tl += 2;
-		*tl++ = dnp->n_cookieverf.nfsuquad[0];
-		*tl++ = dnp->n_cookieverf.nfsuquad[1];
+		if (uiop->uio_offset == 0) {
+			*tl++ = 0;
+			*tl++ = 0;
+		} else {
+			*tl++ = dnp->n_cookieverf.nfsuquad[0];
+			*tl++ = dnp->n_cookieverf.nfsuquad[1];
+		}
 		*tl++ = txdr_unsigned(nmp->nm_readdirsize);
 		*tl = txdr_unsigned(nmp->nm_rsize);
 		nfsm_request(dnp, NFSPROC_READDIRPLUS, curlwp, cred);



CVS commit: src/sys/nfs

2023-12-10 Thread Amitai Schleier
Module Name:src
Committed By:   schmonz
Date:   Sun Dec 10 18:16:08 UTC 2023

Modified Files:
src/sys/nfs: nfs_vnops.c

Log Message:
NFS client: fix interop with macOS 14 servers.

Symptom: a bunch of "Cannot open `.' (Invalid argument)".

thorpej@ analysis and fix: on the first request to read a given
directory, make sure READDIR and READDIRPLUS cookie verifiers are
being set to 0. This is in RFC1813 and macOS must have gotten
stricter about it.

Verified on 10.0_RC1/aarch64 to fix the reproducers in PR kern/57691 as
well as the original use case in which I met the bug: pkg_rr once again
runs to completion.


To generate a diff of this commit:
cvs rdiff -u -r1.324 -r1.325 src/sys/nfs/nfs_vnops.c

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



CVS commit: src/tests/lib/libcurses/director

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 18:04:55 UTC 2023

Modified Files:
src/tests/lib/libcurses/director: testlang_conf.l

Log Message:
tests/libcurses: require 3 digits in octal character escapes

Previously, the string literal "\0" had been interpreted as "0", which
would have made the backslash redundant.  The tests don't use this form.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/tests/lib/libcurses/director/testlang_conf.l

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



CVS commit: src/tests/lib/libcurses/director

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 18:04:55 UTC 2023

Modified Files:
src/tests/lib/libcurses/director: testlang_conf.l

Log Message:
tests/libcurses: require 3 digits in octal character escapes

Previously, the string literal "\0" had been interpreted as "0", which
would have made the backslash redundant.  The tests don't use this form.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/tests/lib/libcurses/director/testlang_conf.l

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

Modified files:

Index: src/tests/lib/libcurses/director/testlang_conf.l
diff -u src/tests/lib/libcurses/director/testlang_conf.l:1.26 src/tests/lib/libcurses/director/testlang_conf.l:1.27
--- src/tests/lib/libcurses/director/testlang_conf.l:1.26	Mon Nov 15 21:45:46 2021
+++ src/tests/lib/libcurses/director/testlang_conf.l	Sun Dec 10 18:04:55 2023
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_conf.l,v 1.26 2021/11/15 21:45:46 blymn Exp $ 	*/
+/*	$NetBSD: testlang_conf.l,v 1.27 2023/12/10 18:04:55 rillig Exp $ 	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -86,7 +86,11 @@ dequote(const char *s, size_t *len)
 	(p[2] - '0');
 	p += 3;
 } else {
-	*q++ = *p++;
+	errx(2,
+	"%s:%zu: Invalid escape sequence "
+	"'\\%c' in string literal; octal "
+	"numbers must be 3 digits wide",
+	cur_file, line, *p);
 }
 continue;
 			}



CVS commit: src

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 17:45:35 UTC 2023

Modified Files:
src/tests/usr.bin/indent: t_misc.sh
src/usr.bin/indent: args.c

Log Message:
indent: be strict about options from profile files

Previously, the "option" 'xdi0' was treated the same as '-xdi0'.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/tests/usr.bin/indent/t_misc.sh
cvs rdiff -u -r1.86 -r1.87 src/usr.bin/indent/args.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/indent/t_misc.sh
diff -u src/tests/usr.bin/indent/t_misc.sh:1.27 src/tests/usr.bin/indent/t_misc.sh:1.28
--- src/tests/usr.bin/indent/t_misc.sh:1.27	Mon Jun  5 10:12:21 2023
+++ src/tests/usr.bin/indent/t_misc.sh	Sun Dec 10 17:45:35 2023
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: t_misc.sh,v 1.27 2023/06/05 10:12:21 rillig Exp $
+# $NetBSD: t_misc.sh,v 1.28 2023/12/10 17:45:35 rillig Exp $
 #
 # Copyright (c) 2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -88,12 +88,12 @@ verbose_profile_body()
 		profile: -fc1
 	EOF
 
-	# The code in args.c function set_profile suggests that options from
-	# profile files are echoed to stdout during startup. But since the
+	# The code in args.c function load_profile suggests that options from
+	# profile files are echoed to stderr during startup. But since the
 	# command line options are handled after the profile files, a '-v' in
 	# the command line has no effect. That's why '-bacc' is not listed
-	# in stdout, but '-fc1' is. The second round of '-bacc', '-v', '-fc1'
-	# is listed because when running ATF, $HOME equals $PWD.
+	# on stderr, but '-fc1' is. The second round of '-bacc', '-v', '-fc1'
+	# is listed because when running the test via ATF, $HOME equals $PWD.
 
 	atf_check \
 	-e 'file:stderr.exp' \
@@ -205,15 +205,17 @@ option_P_in_profile_file_body()
 atf_test_case 'option_without_hyphen'
 option_without_hyphen_body()
 {
-	# TODO: Options in profile files should be required to start with
-	#  '-', just like in the command line arguments.
+	# Ensure that options in profile files start with '-', just like
+	# command line options.
 
 	printf ' -i3 xi5 +di0\n' > .indent.pro
 
 	printf '%s\n' 'int var[] = {' '1,' '}' > code.c
 	printf '%s\n' 'int var[] = {' ' 1,' '}' > code.exp
 
-	atf_check -o 'file:code.exp' \
+	atf_check \
+	-s 'exit:1' \
+	-e "match:/.indent.pro: option \"xi5\" must start with '-'" \
 	"$indent" < code.c
 }
 

Index: src/usr.bin/indent/args.c
diff -u src/usr.bin/indent/args.c:1.86 src/usr.bin/indent/args.c:1.87
--- src/usr.bin/indent/args.c:1.86	Sun Dec  3 21:44:42 2023
+++ src/usr.bin/indent/args.c	Sun Dec 10 17:45:35 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: args.c,v 1.86 2023/12/03 21:44:42 rillig Exp $	*/
+/*	$NetBSD: args.c,v 1.87 2023/12/10 17:45:35 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: args.c,v 1.86 2023/12/03 21:44:42 rillig Exp $");
+__RCSID("$NetBSD: args.c,v 1.87 2023/12/10 17:45:35 rillig Exp $");
 
 /* Read options from profile files and from the command line. */
 
@@ -293,8 +293,13 @@ load_profile(const char *fname, bool mus
 			buf[n] = '\0';
 			if (opt.verbose)
 fprintf(stderr, "profile: %s\n", buf);
+			if (buf[0] != '-')
+errx(1,
+"%s: option \"%s\" must start with '-'",
+fname, buf);
 			set_option(buf, fname);
-		} else if (ch == EOF)
+		}
+		if (ch == EOF)
 			break;
 	}
 	(void)fclose(f);



CVS commit: src

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 17:45:35 UTC 2023

Modified Files:
src/tests/usr.bin/indent: t_misc.sh
src/usr.bin/indent: args.c

Log Message:
indent: be strict about options from profile files

Previously, the "option" 'xdi0' was treated the same as '-xdi0'.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/tests/usr.bin/indent/t_misc.sh
cvs rdiff -u -r1.86 -r1.87 src/usr.bin/indent/args.c

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-12-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 10 17:26:18 UTC 2023

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

Log Message:
Ticket #489


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.168 -r1.1.2.169 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.168 src/doc/CHANGES-10.0:1.1.2.169
--- src/doc/CHANGES-10.0:1.1.2.168	Sun Dec 10 13:09:22 2023
+++ src/doc/CHANGES-10.0	Sun Dec 10 17:26:18 2023
@@ -1,5 +1,5 @@
 
-# $NetBSD: CHANGES-10.0,v 1.1.2.168 2023/12/10 13:09:22 martin Exp $
+# $NetBSD: CHANGES-10.0,v 1.1.2.169 2023/12/10 17:26:18 martin Exp $
 
 A complete list of changes from the initial NetBSD 10.0 branch on 2022-12-16
 until the 10.0 release:
@@ -14284,3 +14284,8 @@ lib/libc/net/sethostent.c			1.21
 	sethostent(3): fix a couple of (not very likely) memory leaks.
 	[kre, ticket #488]
 
+usr.bin/systat/vmstat.c1.92
+
+	systat(1): PR 56014: fix redraw handling.
+	[kre, ticket #489]
+



CVS commit: [netbsd-10] src/doc

2023-12-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 10 17:26:18 UTC 2023

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

Log Message:
Ticket #489


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.168 -r1.1.2.169 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.bin/systat

2023-12-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 10 17:25:30 UTC 2023

Modified Files:
src/usr.bin/systat [netbsd-10]: vmstat.c

Log Message:
Pull up following revision(s) (requested by kre in ticket #489):

usr.bin/systat/vmstat.c: revision 1.92

PR bin/56014 from Kouichi Hashikawa

Don't try to optimise away placing the "s" or " " after "N user"
(" " where N==1, "s" otherwise) when it seems unnecessary, as that
fails when the number of users hasn't changed, but the screen is
being redrawn from nothing (as in after being resumed from a ^Z,
as in the PR, but just doing a ^L would make the same thing happen).


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.91.2.1 src/usr.bin/systat/vmstat.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/systat/vmstat.c
diff -u src/usr.bin/systat/vmstat.c:1.91 src/usr.bin/systat/vmstat.c:1.91.2.1
--- src/usr.bin/systat/vmstat.c:1.91	Tue Nov  9 09:19:01 2021
+++ src/usr.bin/systat/vmstat.c	Sun Dec 10 17:25:29 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmstat.c,v 1.91 2021/11/09 09:19:01 nia Exp $	*/
+/*	$NetBSD: vmstat.c,v 1.91.2.1 2023/12/10 17:25:29 martin Exp $	*/
 
 /*-
  * Copyright (c) 1983, 1989, 1992, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)vmstat.c	8.2 (Berkeley) 1/12/94";
 #endif
-__RCSID("$NetBSD: vmstat.c,v 1.91 2021/11/09 09:19:01 nia Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.91.2.1 2023/12/10 17:25:29 martin Exp $");
 #endif /* not lint */
 
 /*
@@ -703,19 +703,16 @@ vmstat_zero(char *args)
 static int
 ucount(void)
 {
-	static int onusers = -1;
 	int nusers = 0;
 	struct utmpentry *ehead;
 
 	nusers = getutentries(NULL, );
 
-	if (nusers != onusers) {
-		if (nusers == 1)
-			mvprintw(STATROW, STATCOL + 8, " ");
-		else
-			mvprintw(STATROW, STATCOL + 8, "s");
-	}
-	onusers = nusers;
+	if (nusers == 1)
+		mvprintw(STATROW, STATCOL + 8, " ");
+	else
+		mvprintw(STATROW, STATCOL + 8, "s");
+
 	return (nusers);
 }
 



CVS commit: [netbsd-10] src/usr.bin/systat

2023-12-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 10 17:25:30 UTC 2023

Modified Files:
src/usr.bin/systat [netbsd-10]: vmstat.c

Log Message:
Pull up following revision(s) (requested by kre in ticket #489):

usr.bin/systat/vmstat.c: revision 1.92

PR bin/56014 from Kouichi Hashikawa

Don't try to optimise away placing the "s" or " " after "N user"
(" " where N==1, "s" otherwise) when it seems unnecessary, as that
fails when the number of users hasn't changed, but the screen is
being redrawn from nothing (as in after being resumed from a ^Z,
as in the PR, but just doing a ^L would make the same thing happen).


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.91.2.1 src/usr.bin/systat/vmstat.c

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



CVS commit: src/tests/lib/libcurses/director

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 15:51:13 UTC 2023

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: constify


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/tests/lib/libcurses/director/testlang_parse.y

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



CVS commit: src/tests/lib/libcurses/director

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 15:51:13 UTC 2023

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: constify


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/tests/lib/libcurses/director/testlang_parse.y

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

Modified files:

Index: src/tests/lib/libcurses/director/testlang_parse.y
diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.53 src/tests/lib/libcurses/director/testlang_parse.y:1.54
--- src/tests/lib/libcurses/director/testlang_parse.y:1.53	Sun Jun 13 11:06:20 2021
+++ src/tests/lib/libcurses/director/testlang_parse.y	Sun Dec 10 15:51:13 2023
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_parse.y,v 1.53 2021/06/13 11:06:20 rillig Exp $	*/
+/*	$NetBSD: testlang_parse.y,v 1.54 2023/12/10 15:51:13 rillig Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -141,7 +141,7 @@ static void	save_slave_output(bool);
 static void	validate_type(data_enum_t, ct_data_t *, int);
 static void	set_var(data_enum_t, const char *, void *);
 static void	validate_reference(int, void *);
-static char *	numeric_or(char *, char *);
+static char *	numeric_or(const char *, const char *);
 static char *	get_numeric_var(const char *);
 static void	perform_delay(struct timespec *);
 static void	set_cchar(char *, void *);
@@ -517,7 +517,7 @@ get_numeric_var(const char *var)
  * Perform a bitwise OR on two numbers and return the result.
  */
 static char *
-numeric_or(char *n1, char *n2)
+numeric_or(const char *n1, const char *n2)
 {
 	unsigned long i1, i2, result;
 	char *ret;



CVS commit: src/tests/lib/libcurses/slave

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 15:42:29 UTC 2023

Modified Files:
src/tests/lib/libcurses/slave: commands.c

Log Message:
tests/libcurses: fix typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/lib/libcurses/slave/commands.c

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



CVS commit: src/tests/lib/libcurses/slave

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 15:42:29 UTC 2023

Modified Files:
src/tests/lib/libcurses/slave: commands.c

Log Message:
tests/libcurses: fix typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/lib/libcurses/slave/commands.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/lib/libcurses/slave/commands.c
diff -u src/tests/lib/libcurses/slave/commands.c:1.17 src/tests/lib/libcurses/slave/commands.c:1.18
--- src/tests/lib/libcurses/slave/commands.c:1.17	Mon Dec  6 22:45:42 2021
+++ src/tests/lib/libcurses/slave/commands.c	Sun Dec 10 15:42:29 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: commands.c,v 1.17 2021/12/06 22:45:42 rillig Exp $	*/
+/*	$NetBSD: commands.c,v 1.18 2023/12/10 15:42:29 rillig Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -194,7 +194,7 @@ report_message(data_enum_t type, const c
 }
 
 /*
- * Report a string of chtype back to the director via the command pipe.
+ * Report a single chtype back to the director via the command pipe.
  */
 void
 report_byte(chtype c)



CVS commit: src/tests/usr.bin/indent

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 15:39:25 UTC 2023

Modified Files:
src/tests/usr.bin/indent: t_errors.sh

Log Message:
tests/indent: fix name of test case


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/tests/usr.bin/indent/t_errors.sh

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

Modified files:

Index: src/tests/usr.bin/indent/t_errors.sh
diff -u src/tests/usr.bin/indent/t_errors.sh:1.37 src/tests/usr.bin/indent/t_errors.sh:1.38
--- src/tests/usr.bin/indent/t_errors.sh:1.37	Wed Jun 14 19:05:40 2023
+++ src/tests/usr.bin/indent/t_errors.sh	Sun Dec 10 15:39:25 2023
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: t_errors.sh,v 1.37 2023/06/14 19:05:40 rillig Exp $
+# $NetBSD: t_errors.sh,v 1.38 2023/12/10 15:39:25 rillig Exp $
 #
 # Copyright (c) 2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -57,8 +57,8 @@ option_bool_trailing_garbage_body()
 	-bacchus
 }
 
-atf_test_case 'option_int_missing_argument'
-option_int_missing_argument_body()
+atf_test_case 'option_int_wrong_argument'
+option_int_wrong_argument_body()
 {
 	expect_error \
 	'indent: Command line: argument "x" to option "-ts" must be an integer' \
@@ -468,7 +468,7 @@ atf_init_test_cases()
 {
 	atf_add_test_case 'option_unknown'
 	atf_add_test_case 'option_bool_trailing_garbage'
-	atf_add_test_case 'option_int_missing_argument'
+	atf_add_test_case 'option_int_wrong_argument'
 	atf_add_test_case 'option_profile_not_found'
 	atf_add_test_case 'option_buffer_overflow'
 	atf_add_test_case 'option_typedefs_not_found'



CVS commit: src/tests/usr.bin/indent

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 15:39:25 UTC 2023

Modified Files:
src/tests/usr.bin/indent: t_errors.sh

Log Message:
tests/indent: fix name of test case


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/tests/usr.bin/indent/t_errors.sh

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



CVS commit: src/bin/cat

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 15:31:53 UTC 2023

Modified Files:
src/bin/cat: cat.c

Log Message:
cat: repeat storage class 'static' for local functions

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/bin/cat/cat.c

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

Modified files:

Index: src/bin/cat/cat.c
diff -u src/bin/cat/cat.c:1.59 src/bin/cat/cat.c:1.60
--- src/bin/cat/cat.c:1.59	Thu Dec  7 20:02:07 2023
+++ src/bin/cat/cat.c	Sun Dec 10 15:31:53 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: cat.c,v 1.59 2023/12/07 20:02:07 rillig Exp $	*/
+/* $NetBSD: cat.c,v 1.60 2023/12/10 15:31:53 rillig Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -44,7 +44,7 @@ __COPYRIGHT(
 #if 0
 static char sccsid[] = "@(#)cat.c	8.2 (Berkeley) 4/27/95";
 #else
-__RCSID("$NetBSD: cat.c,v 1.59 2023/12/07 20:02:07 rillig Exp $");
+__RCSID("$NetBSD: cat.c,v 1.60 2023/12/10 15:31:53 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -139,7 +139,7 @@ main(int argc, char *argv[])
 	return rval;
 }
 
-void
+static void
 cook_args(char **argv)
 {
 	FILE *fp;
@@ -167,7 +167,7 @@ cook_args(char **argv)
 	} while (*argv);
 }
 
-void
+static void
 cook_buf(FILE *fp)
 {
 	int ch, gobble, line, prev;
@@ -231,7 +231,7 @@ cook_buf(FILE *fp)
 		err(EXIT_FAILURE, "stdout");
 }
 
-void
+static void
 raw_args(char **argv)
 {
 	int fd;
@@ -278,7 +278,7 @@ skipnomsg:
 	} while (*argv);
 }
 
-void
+static void
 raw_cat(int rfd)
 {
 	static char *buf;



CVS commit: src/bin/cat

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 15:31:53 UTC 2023

Modified Files:
src/bin/cat: cat.c

Log Message:
cat: repeat storage class 'static' for local functions

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/bin/cat/cat.c

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



CVS commit: src

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 15:29:38 UTC 2023

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

Log Message:
lint: allow querying for 'static' followed by non-'static' declaration


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/tests/usr.bin/xlint/lint1/queries.c
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/xlint/lint1/t_usage.sh
cvs rdiff -u -r1.384 -r1.385 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.220 -r1.221 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.208 -r1.209 src/usr.bin/xlint/lint1/externs1.h

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.19 src/tests/usr.bin/xlint/lint1/queries.c:1.20
--- src/tests/usr.bin/xlint/lint1/queries.c:1.19	Mon Jul  3 15:29:42 2023
+++ src/tests/usr.bin/xlint/lint1/queries.c	Sun Dec 10 15:29:38 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: queries.c,v 1.19 2023/07/03 15:29:42 rillig Exp $	*/
+/*	$NetBSD: queries.c,v 1.20 2023/12/10 15:29:38 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,12,13,14,15 -X 351 */
+/* lint1-extra-flags: -q 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 -X 351 */
 
 typedef unsigned char u8_t;
 typedef unsigned short u16_t;
@@ -448,6 +448,17 @@ Q15(void)
 }
 
 /*
+ * Even though C99 6.2.2p4 allows a 'static' declaration followed by a
+ * non-'static' declaration, it may look confusing.
+ */
+static void Q16(void);
+/* expect+2: 'Q16' was declared 'static', now non-'static' [Q16] */
+/* expect+1: warning: static function 'Q16' unused [236] */
+void Q16(void)
+{
+}
+
+/*
  * 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
  * exits non-successfully.

Index: src/tests/usr.bin/xlint/lint1/t_usage.sh
diff -u src/tests/usr.bin/xlint/lint1/t_usage.sh:1.11 src/tests/usr.bin/xlint/lint1/t_usage.sh:1.12
--- src/tests/usr.bin/xlint/lint1/t_usage.sh:1.11	Thu Aug  3 18:48:42 2023
+++ src/tests/usr.bin/xlint/lint1/t_usage.sh	Sun Dec 10 15:29:38 2023
@@ -1,4 +1,4 @@
-# $NetBSD: t_usage.sh,v 1.11 2023/08/03 18:48:42 rillig Exp $
+# $NetBSD: t_usage.sh,v 1.12 2023/12/10 15:29:38 rillig Exp $
 #
 # Copyright (c) 2023 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -89,13 +89,13 @@ enable_queries_body()
 
 	# The largest known query.
 	atf_check \
-	"$lint1" -q 15 code.c /dev/null
+	"$lint1" -q 16 code.c /dev/null
 
 	# Larger than the largest known query.
 	atf_check \
 	-s 'exit:1' \
-	-e "inline:lint1: invalid query ID '16'\n" \
-	"$lint1" -q 16 code.c /dev/null
+	-e "inline:lint1: invalid query ID '17'\n" \
+	"$lint1" -q 17 code.c /dev/null
 
 	# Whitespace is not allowed before a query ID.
 	atf_check \

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.384 src/usr.bin/xlint/lint1/decl.c:1.385
--- src/usr.bin/xlint/lint1/decl.c:1.384	Sun Dec 10 14:59:47 2023
+++ src/usr.bin/xlint/lint1/decl.c	Sun Dec 10 15:29:38 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.384 2023/12/10 14:59:47 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.385 2023/12/10 15:29:38 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: decl.c,v 1.384 2023/12/10 14:59:47 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.385 2023/12/10 15:29:38 rillig Exp $");
 #endif
 
 #include 
@@ -1430,6 +1430,12 @@ declarator_name(sym_t *sym)
 		dcs->d_redeclared_symbol = NULL;
 	} else {
 		dcs->d_redeclared_symbol = sym;
+		if (is_query_enabled[16]
+		&& sym->s_scl == STATIC && dcs->d_scl != STATIC) {
+			/* '%s' was declared 'static', now non-'static' */
+			query_message(16, sym->s_name);
+			print_previous_declaration(sym);
+		}
 		sym = pushdown(sym);
 	}
 

Index: src/usr.bin/xlint/lint1/err.c
diff -u src/usr.bin/xlint/lint1/err.c:1.220 src/usr.bin/xlint/lint1/err.c:1.221
--- src/usr.bin/xlint/lint1/err.c:1.220	Sun Dec  3 18:17:41 2023
+++ src/usr.bin/xlint/lint1/err.c	Sun Dec 10 15:29:38 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: err.c,v 1.220 2023/12/03 18:17:41 rillig Exp $	*/
+/*	$NetBSD: err.c,v 1.221 2023/12/10 15:29:38 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: err.c,v 1.220 2023/12/03 18:17:41 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.221 2023/12/10 15:29:38 rillig Exp $");
 #endif
 
 #include 
@@ -714,10 +714,11 @@ static const char *queries[] = {
 	"redundant 'extern' in function declaration of '%s'",	  /* Q13 */
 	"comparison '%s' of 'char' with plain integer %d",	  /* Q14 */
 	"implicit conversion from 

CVS commit: src

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 15:29:38 UTC 2023

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

Log Message:
lint: allow querying for 'static' followed by non-'static' declaration


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/tests/usr.bin/xlint/lint1/queries.c
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/xlint/lint1/t_usage.sh
cvs rdiff -u -r1.384 -r1.385 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.220 -r1.221 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.208 -r1.209 src/usr.bin/xlint/lint1/externs1.h

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



CVS commit: src

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 14:59:48 UTC 2023

Modified Files:
src/tests/usr.bin/xlint/lint1: d_c99_bool_strict.c
src/usr.bin/xlint/lint1: decl.c init.c
src/usr.bin/xlint/xlint: xlint.c

Log Message:
lint: clean up comments

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c
cvs rdiff -u -r1.383 -r1.384 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.252 -r1.253 src/usr.bin/xlint/lint1/init.c
cvs rdiff -u -r1.120 -r1.121 src/usr.bin/xlint/xlint/xlint.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/d_c99_bool_strict.c
diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.44 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.45
--- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.44	Wed Aug  2 18:51:25 2023
+++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c	Sun Dec 10 14:59:47 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: d_c99_bool_strict.c,v 1.44 2023/08/02 18:51:25 rillig Exp $	*/
+/*	$NetBSD: d_c99_bool_strict.c,v 1.45 2023/12/10 14:59:47 rillig Exp $	*/
 # 3 "d_c99_bool_strict.c"
 
 /*
@@ -160,7 +160,7 @@ enum strict_bool_constant_expressions {
 	/*
 	 * Without strict bool mode, these two variants of an expression can
 	 * occur when a preprocessor macro is either defined to 1 or left
-	 * empty (since C99), as in lint1/ops.def.
+	 * empty (since C99).
 	 *
 	 * In strict bool mode, the resulting expression can be compared
 	 * against 0 to achieve the same effect (so +0 != 0 or 1 + 0 != 0).

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.383 src/usr.bin/xlint/lint1/decl.c:1.384
--- src/usr.bin/xlint/lint1/decl.c:1.383	Sun Dec  3 18:17:41 2023
+++ src/usr.bin/xlint/lint1/decl.c	Sun Dec 10 14:59:47 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.383 2023/12/03 18:17:41 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.384 2023/12/10 14:59:47 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: decl.c,v 1.383 2023/12/03 18:17:41 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.384 2023/12/10 14:59:47 rillig Exp $");
 #endif
 
 #include 
@@ -97,11 +97,8 @@ initdecl(void)
 }
 
 /*
- * Returns a shared type structure for arithmetic types and void.
- *
- * It's important to duplicate this structure using block_dup_type or
- * expr_dup_type if it is to be modified (adding qualifiers or anything
- * else).
+ * Returns a shared type structure for arithmetic types and void.  The returned
+ * type must not be modified; use block_dup_type or expr_dup_type if necessary.
  */
 type_t *
 gettyp(tspec_t t)
@@ -296,7 +293,6 @@ typedef_error(type_t *td, tspec_t t)
 	return td;
 
 invalid:
-	/* Anything else is not accepted. */
 	dcs->d_invalid_type_combination = true;
 	return td;
 }

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.252 src/usr.bin/xlint/lint1/init.c:1.253
--- src/usr.bin/xlint/lint1/init.c:1.252	Sun Dec  3 13:12:40 2023
+++ src/usr.bin/xlint/lint1/init.c	Sun Dec 10 14:59:47 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.252 2023/12/03 13:12:40 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.253 2023/12/10 14:59:47 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: init.c,v 1.252 2023/12/03 13:12:40 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.253 2023/12/10 14:59:47 rillig Exp $");
 #endif
 
 #include 
@@ -100,7 +100,7 @@ typedef struct designator {
 
 /*
  * The path from the "current object" of a brace level to the sub-object that
- * is initialized by an expression.  Examples for designations are '.member'
+ * is initialized by an expression.  Examples of designations are '.member'
  * or '.member[123].member.member[1][1]'.
  *
  * C99 6.7.8p6, 6.7.8p7
@@ -115,7 +115,7 @@ typedef struct designation {
  * Everything that happens between a '{' and the corresponding '}', as part
  * of an initialization.
  *
- * Each brace level has a "current object".   For the outermost brace level,
+ * Each brace level has a "current object".  For the outermost brace level,
  * it is the same as the object to be initialized.  Each nested '{' begins a
  * nested brace level, for the sub-object pointed to by the designator of the
  * outer brace level.

Index: src/usr.bin/xlint/xlint/xlint.c
diff -u src/usr.bin/xlint/xlint/xlint.c:1.120 src/usr.bin/xlint/xlint/xlint.c:1.121
--- src/usr.bin/xlint/xlint/xlint.c:1.120	Sun Dec  3 18:17:41 2023
+++ src/usr.bin/xlint/xlint/xlint.c	Sun Dec 10 14:59:47 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: xlint.c,v 1.120 2023/12/03 18:17:41 rillig Exp $ */
+/* $NetBSD: xlint.c,v 1.121 2023/12/10 14:59:47 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ 

CVS commit: src

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 14:59:48 UTC 2023

Modified Files:
src/tests/usr.bin/xlint/lint1: d_c99_bool_strict.c
src/usr.bin/xlint/lint1: decl.c init.c
src/usr.bin/xlint/xlint: xlint.c

Log Message:
lint: clean up comments

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c
cvs rdiff -u -r1.383 -r1.384 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.252 -r1.253 src/usr.bin/xlint/lint1/init.c
cvs rdiff -u -r1.120 -r1.121 src/usr.bin/xlint/xlint/xlint.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-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 14:30:51 UTC 2023

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

Log Message:
make: fix crash in ':C' modifier on an empty expression

Since var.c 1.982 from 2021-12-13.


To generate a diff of this commit:
cvs rdiff -u -r1.1076 -r1.1077 src/usr.bin/make/var.c
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/varmod-subst-regex.mk

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

Modified files:

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.1076 src/usr.bin/make/var.c:1.1077
--- src/usr.bin/make/var.c:1.1076	Sat Dec  9 00:13:38 2023
+++ src/usr.bin/make/var.c	Sun Dec 10 14:30:50 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1076 2023/12/09 00:13:38 sjg Exp $	*/
+/*	$NetBSD: var.c,v 1.1077 2023/12/10 14:30:50 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.1076 2023/12/09 00:13:38 sjg Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1077 2023/12/10 14:30:50 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -1002,7 +1002,7 @@ Var_SetWithFlags(GNode *scope, const cha
 			 * If requested, don't export these in the
 			 * environment individually.  We still put
 			 * them in .MAKEOVERRIDES so that the
-			 * command-line settings continue to override 
+			 * command-line settings continue to override
 			 * Makefile settings.
 			 */
 			if (!opts.varNoExportEnv)
@@ -1629,7 +1629,7 @@ ok:
 	wp += (size_t)m[0].rm_eo;
 	if (args->pflags.subGlobal) {
 		flags |= REG_NOTBOL;
-		if (m[0].rm_so == 0 && m[0].rm_eo == 0) {
+		if (m[0].rm_so == 0 && m[0].rm_eo == 0 && *wp != '\0') {
 			SepBuf_AddBytes(buf, wp, 1);
 			wp++;
 		}

Index: src/usr.bin/make/unit-tests/varmod-subst-regex.mk
diff -u src/usr.bin/make/unit-tests/varmod-subst-regex.mk:1.8 src/usr.bin/make/unit-tests/varmod-subst-regex.mk:1.9
--- src/usr.bin/make/unit-tests/varmod-subst-regex.mk:1.8	Sun Nov 19 21:47:52 2023
+++ src/usr.bin/make/unit-tests/varmod-subst-regex.mk	Sun Dec 10 14:30:51 2023
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-subst-regex.mk,v 1.8 2023/11/19 21:47:52 rillig Exp $
+# $NetBSD: varmod-subst-regex.mk,v 1.9 2023/12/10 14:30:51 rillig Exp $
 #
 # Tests for the :C,from,to, variable modifier.
 
@@ -84,6 +84,31 @@ all: unmatched-subexpression
 .  error
 .endif
 
+
+# Contrary to the ':S' modifier, the ':C' modifier matches on an expression
+# that contains no words at all, but only if the regular expression matches an
+# empty string, for example, when the regular expression is anchored at the
+# beginning or the end.
+.if "<${U:S,^,prefix,}> <${:U:C,^,prefix,}>" != "<> "
+.  error
+.endif
+.if "<${U:S,$,suffix,}> <${:U:C,$,suffix,}>" != "<> "
+.  error
+.endif
+.if "<${U:S,^$,whole,}> <${:U:C,^$,whole,}>" != "<> "
+.  error
+.endif
+.if "<${U:S,^,prefix,g}> <${:U:C,^,prefix,g}>" != "<> "
+.  error
+.endif
+.if "<${U:S,$,suffix,g}> <${:U:C,$,suffix,g}>" != "<> "
+.  error
+.endif
+.if "<${U:S,^$,whole,g}> <${:U:C,^$,whole,g}>" != "<> "
+.  error
+.endif
+
+
 # Multiple asterisks form an invalid regular expression.  This produces an
 # error message and (as of 2020-08-28) stops parsing in the middle of the
 # expression.  The unparsed part of the expression is then copied



CVS commit: src/usr.bin/make

2023-12-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 10 14:30:51 UTC 2023

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

Log Message:
make: fix crash in ':C' modifier on an empty expression

Since var.c 1.982 from 2021-12-13.


To generate a diff of this commit:
cvs rdiff -u -r1.1076 -r1.1077 src/usr.bin/make/var.c
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/varmod-subst-regex.mk

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-12-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 10 13:11:59 UTC 2023

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

Log Message:
Ticket #1925


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.211 -r1.1.2.212 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/doc

2023-12-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 10 13:11:59 UTC 2023

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

Log Message:
Ticket #1925


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.211 -r1.1.2.212 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.211 src/doc/CHANGES-8.3:1.1.2.212
--- src/doc/CHANGES-8.3:1.1.2.211	Sat Dec  9 13:39:36 2023
+++ src/doc/CHANGES-8.3	Sun Dec 10 13:11:59 2023
@@ -1,4 +1,4 @@
-$NetBSD: CHANGES-8.3,v 1.1.2.211 2023/12/09 13:39:36 martin Exp $
+$NetBSD: CHANGES-8.3,v 1.1.2.212 2023/12/10 13:11:59 martin Exp $
 
 A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3
 release:
@@ -4131,3 +4131,8 @@ tests/lib/libpthread/t_stack.c			1.1-1.6
 	pthread: PR 57721: fix user-allocated stack addressing.
 	[riastradh, ticket #1924]
 
+lib/libc/net/sethostent.c			1.21
+
+	sethostent(3): fix a couple of (not very likely) memory leaks.
+	[kre, ticket #1925]
+



CVS commit: [netbsd-8] src/lib/libc/net

2023-12-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 10 13:11:13 UTC 2023

Modified Files:
src/lib/libc/net [netbsd-8]: sethostent.c

Log Message:
Pull up following revision(s) (requested by kre in ticket #1925):

lib/libc/net/sethostent.c: revision 1.21

Fix a couple of (not very likely) memory leaks, reported by e...@google.com
who attributed them:

  the malloc one was reported to Android (as
  https://android-review.googlesource.com/c/platform/bionic/+/2856549)
  by wuhaitao3 ; Chris Ferris
   then spotted the goto nospc one.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.18.1 src/lib/libc/net/sethostent.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/lib/libc/net

2023-12-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 10 13:11:13 UTC 2023

Modified Files:
src/lib/libc/net [netbsd-8]: sethostent.c

Log Message:
Pull up following revision(s) (requested by kre in ticket #1925):

lib/libc/net/sethostent.c: revision 1.21

Fix a couple of (not very likely) memory leaks, reported by e...@google.com
who attributed them:

  the malloc one was reported to Android (as
  https://android-review.googlesource.com/c/platform/bionic/+/2856549)
  by wuhaitao3 ; Chris Ferris
   then spotted the goto nospc one.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.18.1 src/lib/libc/net/sethostent.c

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

Modified files:

Index: src/lib/libc/net/sethostent.c
diff -u src/lib/libc/net/sethostent.c:1.20 src/lib/libc/net/sethostent.c:1.20.18.1
--- src/lib/libc/net/sethostent.c:1.20	Mon Mar 17 13:24:23 2014
+++ src/lib/libc/net/sethostent.c	Sun Dec 10 13:11:12 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: sethostent.c,v 1.20 2014/03/17 13:24:23 christos Exp $	*/
+/*	$NetBSD: sethostent.c,v 1.20.18.1 2023/12/10 13:11:12 martin Exp $	*/
 
 /*
  * Copyright (c) 1985, 1993
@@ -35,7 +35,7 @@
 static char sccsid[] = "@(#)sethostent.c	8.1 (Berkeley) 6/4/93";
 static char rcsid[] = "Id: sethostent.c,v 8.5 1996/09/28 06:51:07 vixie Exp ";
 #else
-__RCSID("$NetBSD: sethostent.c,v 1.20 2014/03/17 13:24:23 christos Exp $");
+__RCSID("$NetBSD: sethostent.c,v 1.20.18.1 2023/12/10 13:11:12 martin Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -171,6 +171,7 @@ _hf_gethtbyname2(const char *name, int a
 	}
 
 	if ((ptr = buf = malloc(len = info->buflen)) == NULL) {
+		endhostent_r();
 		*info->he = NETDB_INTERNAL;
 		return NULL;
 	}
@@ -251,6 +252,7 @@ _hf_gethtbyname2(const char *name, int a
 	free(buf);
 	return hp;
 nospc:
+	endhostent_r();
 	*info->he = NETDB_INTERNAL;
 	free(buf);
 	errno = ENOSPC;



CVS commit: [netbsd-9] src/doc

2023-12-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 10 13:10:25 UTC 2023

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

Log Message:
Ticket #1776


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.119 -r1.1.2.120 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-12-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 10 13:10:25 UTC 2023

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

Log Message:
Ticket #1776


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.119 -r1.1.2.120 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.119 src/doc/CHANGES-9.4:1.1.2.120
--- src/doc/CHANGES-9.4:1.1.2.119	Sat Dec  9 13:26:09 2023
+++ src/doc/CHANGES-9.4	Sun Dec 10 13:10:25 2023
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.4,v 1.1.2.119 2023/12/09 13:26:09 martin Exp $
+# $NetBSD: CHANGES-9.4,v 1.1.2.120 2023/12/10 13:10:25 martin Exp $
 
 A complete list of changes from the NetBSD 9.3 release to the NetBSD 9.4
 release:
@@ -2481,3 +2481,8 @@ tests/lib/libpthread/t_stack.c			1.1-1.6
 	pthread: PR 57721: fix user-allocated stack addressing.
 	[riastradh, ticket #1775]
 
+lib/libc/net/sethostent.c			1.21
+
+	sethostent(3): fix a couple of (not very likely) memory leaks.
+	[kre, ticket #1776]
+



CVS commit: [netbsd-9] src/lib/libc/net

2023-12-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 10 13:09:58 UTC 2023

Modified Files:
src/lib/libc/net [netbsd-9]: sethostent.c

Log Message:
Pull up following revision(s) (requested by kre in ticket #1776):

lib/libc/net/sethostent.c: revision 1.21

Fix a couple of (not very likely) memory leaks, reported by e...@google.com
who attributed them:

  the malloc one was reported to Android (as
  https://android-review.googlesource.com/c/platform/bionic/+/2856549)
  by wuhaitao3 ; Chris Ferris
   then spotted the goto nospc one.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.28.1 src/lib/libc/net/sethostent.c

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

Modified files:

Index: src/lib/libc/net/sethostent.c
diff -u src/lib/libc/net/sethostent.c:1.20 src/lib/libc/net/sethostent.c:1.20.28.1
--- src/lib/libc/net/sethostent.c:1.20	Mon Mar 17 13:24:23 2014
+++ src/lib/libc/net/sethostent.c	Sun Dec 10 13:09:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: sethostent.c,v 1.20 2014/03/17 13:24:23 christos Exp $	*/
+/*	$NetBSD: sethostent.c,v 1.20.28.1 2023/12/10 13:09:58 martin Exp $	*/
 
 /*
  * Copyright (c) 1985, 1993
@@ -35,7 +35,7 @@
 static char sccsid[] = "@(#)sethostent.c	8.1 (Berkeley) 6/4/93";
 static char rcsid[] = "Id: sethostent.c,v 8.5 1996/09/28 06:51:07 vixie Exp ";
 #else
-__RCSID("$NetBSD: sethostent.c,v 1.20 2014/03/17 13:24:23 christos Exp $");
+__RCSID("$NetBSD: sethostent.c,v 1.20.28.1 2023/12/10 13:09:58 martin Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -171,6 +171,7 @@ _hf_gethtbyname2(const char *name, int a
 	}
 
 	if ((ptr = buf = malloc(len = info->buflen)) == NULL) {
+		endhostent_r();
 		*info->he = NETDB_INTERNAL;
 		return NULL;
 	}
@@ -251,6 +252,7 @@ _hf_gethtbyname2(const char *name, int a
 	free(buf);
 	return hp;
 nospc:
+	endhostent_r();
 	*info->he = NETDB_INTERNAL;
 	free(buf);
 	errno = ENOSPC;



CVS commit: [netbsd-9] src/lib/libc/net

2023-12-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 10 13:09:58 UTC 2023

Modified Files:
src/lib/libc/net [netbsd-9]: sethostent.c

Log Message:
Pull up following revision(s) (requested by kre in ticket #1776):

lib/libc/net/sethostent.c: revision 1.21

Fix a couple of (not very likely) memory leaks, reported by e...@google.com
who attributed them:

  the malloc one was reported to Android (as
  https://android-review.googlesource.com/c/platform/bionic/+/2856549)
  by wuhaitao3 ; Chris Ferris
   then spotted the goto nospc one.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.28.1 src/lib/libc/net/sethostent.c

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-12-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 10 13:09:22 UTC 2023

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

Log Message:
Tickets #487 and #488


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.167 -r1.1.2.168 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.167 src/doc/CHANGES-10.0:1.1.2.168
--- src/doc/CHANGES-10.0:1.1.2.167	Sat Dec  9 13:15:20 2023
+++ src/doc/CHANGES-10.0	Sun Dec 10 13:09:22 2023
@@ -1,5 +1,5 @@
 
-# $NetBSD: CHANGES-10.0,v 1.1.2.167 2023/12/09 13:15:20 martin Exp $
+# $NetBSD: CHANGES-10.0,v 1.1.2.168 2023/12/10 13:09:22 martin Exp $
 
 A complete list of changes from the initial NetBSD 10.0 branch on 2022-12-16
 until the 10.0 release:
@@ -14264,3 +14264,23 @@ share/man/man7/stack.71.1-1.6
 	stack(7): New man page to help with PR 57708 and related inquiries.
 	[riastradh, ticket #486]
 
+sys/compat/common/compat_90_mod.c		1.5,1.6
+sys/compat/common/compat_mod.h			1.10
+sys/compat/common/files.common			1.11
+sys/compat/common/net_inet6_nd_90.c		1.1,1.2
+sys/kern/compat_stub.c1.23
+sys/modules/compat_90/Makefile			1.2,1.3
+sys/netinet6/icmp6.c1.255
+sys/netinet6/in6.c1.290,1.291
+sys/netinet6/nd6.c1.281
+sys/sys/compat_stub.h1.27
+
+	Improve module handling for non INET6 enabled configurartions
+	and removal of ND6 handling.
+	[pgoyette, ticket #487]
+
+lib/libc/net/sethostent.c			1.21
+
+	sethostent(3): fix a couple of (not very likely) memory leaks.
+	[kre, ticket #488]
+



CVS commit: [netbsd-10] src/doc

2023-12-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 10 13:09:22 UTC 2023

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

Log Message:
Tickets #487 and #488


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.167 -r1.1.2.168 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/lib/libc/net

2023-12-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 10 13:08:31 UTC 2023

Modified Files:
src/lib/libc/net [netbsd-10]: sethostent.c

Log Message:
Pull up following revision(s) (requested by kre in ticket #488):

lib/libc/net/sethostent.c: revision 1.21

Fix a couple of (not very likely) memory leaks, reported by e...@google.com
who attributed them:

  the malloc one was reported to Android (as
  https://android-review.googlesource.com/c/platform/bionic/+/2856549)
  by wuhaitao3 ; Chris Ferris
   then spotted the goto nospc one.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.36.1 src/lib/libc/net/sethostent.c

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

Modified files:

Index: src/lib/libc/net/sethostent.c
diff -u src/lib/libc/net/sethostent.c:1.20 src/lib/libc/net/sethostent.c:1.20.36.1
--- src/lib/libc/net/sethostent.c:1.20	Mon Mar 17 13:24:23 2014
+++ src/lib/libc/net/sethostent.c	Sun Dec 10 13:08:31 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: sethostent.c,v 1.20 2014/03/17 13:24:23 christos Exp $	*/
+/*	$NetBSD: sethostent.c,v 1.20.36.1 2023/12/10 13:08:31 martin Exp $	*/
 
 /*
  * Copyright (c) 1985, 1993
@@ -35,7 +35,7 @@
 static char sccsid[] = "@(#)sethostent.c	8.1 (Berkeley) 6/4/93";
 static char rcsid[] = "Id: sethostent.c,v 8.5 1996/09/28 06:51:07 vixie Exp ";
 #else
-__RCSID("$NetBSD: sethostent.c,v 1.20 2014/03/17 13:24:23 christos Exp $");
+__RCSID("$NetBSD: sethostent.c,v 1.20.36.1 2023/12/10 13:08:31 martin Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -171,6 +171,7 @@ _hf_gethtbyname2(const char *name, int a
 	}
 
 	if ((ptr = buf = malloc(len = info->buflen)) == NULL) {
+		endhostent_r();
 		*info->he = NETDB_INTERNAL;
 		return NULL;
 	}
@@ -251,6 +252,7 @@ _hf_gethtbyname2(const char *name, int a
 	free(buf);
 	return hp;
 nospc:
+	endhostent_r();
 	*info->he = NETDB_INTERNAL;
 	free(buf);
 	errno = ENOSPC;



CVS commit: [netbsd-10] src/lib/libc/net

2023-12-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 10 13:08:31 UTC 2023

Modified Files:
src/lib/libc/net [netbsd-10]: sethostent.c

Log Message:
Pull up following revision(s) (requested by kre in ticket #488):

lib/libc/net/sethostent.c: revision 1.21

Fix a couple of (not very likely) memory leaks, reported by e...@google.com
who attributed them:

  the malloc one was reported to Android (as
  https://android-review.googlesource.com/c/platform/bionic/+/2856549)
  by wuhaitao3 ; Chris Ferris
   then spotted the goto nospc one.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.36.1 src/lib/libc/net/sethostent.c

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



CVS commit: [netbsd-10] src/sys

2023-12-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 10 13:06:16 UTC 2023

Modified Files:
src/sys/compat/common [netbsd-10]: compat_90_mod.c compat_mod.h
files.common
src/sys/kern [netbsd-10]: compat_stub.c
src/sys/modules/compat_90 [netbsd-10]: Makefile
src/sys/netinet6 [netbsd-10]: icmp6.c in6.c nd6.c
src/sys/sys [netbsd-10]: compat_stub.h
Added Files:
src/sys/compat/common [netbsd-10]: net_inet6_nd_90.c

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #487):

sys/compat/common/compat_90_mod.c: revision 1.5
sys/compat/common/compat_90_mod.c: revision 1.6
sys/netinet6/in6.c: revision 1.290
sys/netinet6/in6.c: revision 1.291
sys/compat/common/files.common: revision 1.11
sys/netinet6/icmp6.c: revision 1.255
sys/compat/common/net_inet6_nd_90.c: revision 1.1
sys/compat/common/net_inet6_nd_90.c: revision 1.2
sys/modules/compat_90/Makefile: revision 1.2
sys/modules/compat_90/Makefile: revision 1.3
sys/netinet6/nd6.c: revision 1.281
sys/compat/common/compat_mod.h: revision 1.10
sys/kern/compat_stub.c: revision 1.23
sys/sys/compat_stub.h: revision 1.27

Identify the need to rework the COMPAT_* code to be more
module-aware.
This is an XXX comment block only, NFCI.

Modularize the COMPAT_90 code that resulted from the removal of
netinet6/nd6 from the kernel.  Now, the minimal compat code can
be successfully loaded and unloaded along with the rest of the
COMPAT_90 code.

Allow kernels builds which don't define INET6 to compile compat bits
too.

Default the build of compat_90 module to include IPv6, as is done
for other INET6-sensitive modules (see if_lagg).


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.28.1 src/sys/compat/common/compat_90_mod.c
cvs rdiff -u -r1.6 -r1.6.26.1 src/sys/compat/common/compat_mod.h
cvs rdiff -u -r1.7 -r1.7.4.1 src/sys/compat/common/files.common
cvs rdiff -u -r0 -r1.2.2.2 src/sys/compat/common/net_inet6_nd_90.c
cvs rdiff -u -r1.22 -r1.22.4.1 src/sys/kern/compat_stub.c
cvs rdiff -u -r1.1 -r1.1.28.1 src/sys/modules/compat_90/Makefile
cvs rdiff -u -r1.254 -r1.254.2.1 src/sys/netinet6/icmp6.c
cvs rdiff -u -r1.288.2.1 -r1.288.2.2 src/sys/netinet6/in6.c
cvs rdiff -u -r1.279 -r1.279.4.1 src/sys/netinet6/nd6.c
cvs rdiff -u -r1.25 -r1.25.18.1 src/sys/sys/compat_stub.h

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



CVS commit: [netbsd-10] src/sys

2023-12-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 10 13:06:16 UTC 2023

Modified Files:
src/sys/compat/common [netbsd-10]: compat_90_mod.c compat_mod.h
files.common
src/sys/kern [netbsd-10]: compat_stub.c
src/sys/modules/compat_90 [netbsd-10]: Makefile
src/sys/netinet6 [netbsd-10]: icmp6.c in6.c nd6.c
src/sys/sys [netbsd-10]: compat_stub.h
Added Files:
src/sys/compat/common [netbsd-10]: net_inet6_nd_90.c

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #487):

sys/compat/common/compat_90_mod.c: revision 1.5
sys/compat/common/compat_90_mod.c: revision 1.6
sys/netinet6/in6.c: revision 1.290
sys/netinet6/in6.c: revision 1.291
sys/compat/common/files.common: revision 1.11
sys/netinet6/icmp6.c: revision 1.255
sys/compat/common/net_inet6_nd_90.c: revision 1.1
sys/compat/common/net_inet6_nd_90.c: revision 1.2
sys/modules/compat_90/Makefile: revision 1.2
sys/modules/compat_90/Makefile: revision 1.3
sys/netinet6/nd6.c: revision 1.281
sys/compat/common/compat_mod.h: revision 1.10
sys/kern/compat_stub.c: revision 1.23
sys/sys/compat_stub.h: revision 1.27

Identify the need to rework the COMPAT_* code to be more
module-aware.
This is an XXX comment block only, NFCI.

Modularize the COMPAT_90 code that resulted from the removal of
netinet6/nd6 from the kernel.  Now, the minimal compat code can
be successfully loaded and unloaded along with the rest of the
COMPAT_90 code.

Allow kernels builds which don't define INET6 to compile compat bits
too.

Default the build of compat_90 module to include IPv6, as is done
for other INET6-sensitive modules (see if_lagg).


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.28.1 src/sys/compat/common/compat_90_mod.c
cvs rdiff -u -r1.6 -r1.6.26.1 src/sys/compat/common/compat_mod.h
cvs rdiff -u -r1.7 -r1.7.4.1 src/sys/compat/common/files.common
cvs rdiff -u -r0 -r1.2.2.2 src/sys/compat/common/net_inet6_nd_90.c
cvs rdiff -u -r1.22 -r1.22.4.1 src/sys/kern/compat_stub.c
cvs rdiff -u -r1.1 -r1.1.28.1 src/sys/modules/compat_90/Makefile
cvs rdiff -u -r1.254 -r1.254.2.1 src/sys/netinet6/icmp6.c
cvs rdiff -u -r1.288.2.1 -r1.288.2.2 src/sys/netinet6/in6.c
cvs rdiff -u -r1.279 -r1.279.4.1 src/sys/netinet6/nd6.c
cvs rdiff -u -r1.25 -r1.25.18.1 src/sys/sys/compat_stub.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/compat/common/compat_90_mod.c
diff -u src/sys/compat/common/compat_90_mod.c:1.3 src/sys/compat/common/compat_90_mod.c:1.3.28.1
--- src/sys/compat/common/compat_90_mod.c:1.3	Sat Jan  4 02:40:22 2020
+++ src/sys/compat/common/compat_90_mod.c	Sun Dec 10 13:06:16 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_90_mod.c,v 1.3 2020/01/04 02:40:22 pgoyette Exp $	*/
+/*	$NetBSD: compat_90_mod.c,v 1.3.28.1 2023/12/10 13:06:16 martin Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_90_mod.c,v 1.3 2020/01/04 02:40:22 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_90_mod.c,v 1.3.28.1 2023/12/10 13:06:16 martin Exp $");
 
 #include 
 #include 
@@ -50,14 +50,25 @@ int
 compat_90_init(void)
 {
 
+#ifdef INET6
+	net_inet6_nd_90_init();
+#endif
 	return vfs_syscalls_90_init();
 }
 
 int
 compat_90_fini(void)
 {
+	int error;
+
+	error = vfs_syscalls_90_fini();
+	if (error != 0)
+		return error;
 
-	return vfs_syscalls_90_fini();
+#ifdef INET6
+	net_inet6_nd_90_fini();
+#endif
+	return error;
 }
 
 MODULE(MODULE_CLASS_EXEC, compat_90, NULL);

Index: src/sys/compat/common/compat_mod.h
diff -u src/sys/compat/common/compat_mod.h:1.6 src/sys/compat/common/compat_mod.h:1.6.26.1
--- src/sys/compat/common/compat_mod.h:1.6	Sun Sep 22 22:59:38 2019
+++ src/sys/compat/common/compat_mod.h	Sun Dec 10 13:06:16 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.h,v 1.6 2019/09/22 22:59:38 christos Exp $	*/
+/*	$NetBSD: compat_mod.h,v 1.6.26.1 2023/12/10 13:06:16 martin Exp $	*/
 
 /*-
  * Copyright (c) 2013, 2019 The NetBSD Foundation, Inc.
@@ -37,6 +37,8 @@ int compat_90_init(void);
 int compat_90_fini(void);
 int vfs_syscalls_90_init(void);
 int vfs_syscalls_90_fini(void);
+int net_inet6_nd_90_init(void);
+int net_inet6_nd_90_fini(void);
 #endif
 
 #ifdef COMPAT_80

Index: src/sys/compat/common/files.common
diff -u src/sys/compat/common/files.common:1.7 src/sys/compat/common/files.common:1.7.4.1
--- src/sys/compat/common/files.common:1.7	Mon Aug  9 20:49:09 2021
+++ src/sys/compat/common/files.common	Sun Dec 10 13:06:16 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: files.common,v 1.7 2021/08/09 20:49:09 andvar Exp $
+#	$NetBSD: files.common,v 1.7.4.1 2023/12/10 13:06:16 martin Exp $
 
 #
 # Generic utility files, used by various compat options.
@@ -109,6 +109,7 @@ file	compat/common/if_media_80.c		compat
 # Compatibility