CVS commit: src/lib/libc/gen

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 22:57:16 UTC 2024

Modified Files:
src/lib/libc/gen: time.3

Log Message:
time.3: clarify that *tloc is always set if tloc != NULL


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/lib/libc/gen/time.3

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/gen/time.3
diff -u src/lib/libc/gen/time.3:1.16 src/lib/libc/gen/time.3:1.17
--- src/lib/libc/gen/time.3:1.16	Sat Nov  5 18:17:29 2011
+++ src/lib/libc/gen/time.3	Sun Apr 28 22:57:16 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: time.3,v 1.16 2011/11/05 18:17:29 christos Exp $
+.\"	$NetBSD: time.3,v 1.17 2024/04/28 22:57:16 rillig Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -33,7 +33,7 @@
 .\"
 .\" @(#)time.3	8.1 (Berkeley) 6/4/93
 .\"
-.Dd November 5, 2011
+.Dd April 29, 2024
 .Dt TIME 3
 .Os
 .Sh NAME
@@ -52,21 +52,17 @@ function
 returns the value of time in seconds since 0 hours, 0 minutes,
 0 seconds, January 1, 1970, Coordinated Universal Time.
 .Pp
-A copy of the time value may be saved to the area indicated by the
-pointer
-.Fa tloc .
 If
 .Fa tloc
-is a
-.Dv NULL
-pointer, no value is stored.
+is not a null pointer, a copy of the time value is saved in
+.Fa *tloc .
 .Pp
 Upon successful completion,
 .Fn time
 returns the value of time.
 Otherwise a value of
 .Po
-.Po Fa time_t Pc \-1
+.Po Fa time_t Pc Ns \-1
 .Pc
 is returned and the global variable
 .Va errno



CVS commit: src/lib/libc/gen

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 22:57:16 UTC 2024

Modified Files:
src/lib/libc/gen: time.3

Log Message:
time.3: clarify that *tloc is always set if tloc != NULL


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/lib/libc/gen/time.3

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



CVS commit: src/lib/libc/gen

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 22:43:30 UTC 2024

Modified Files:
src/lib/libc/gen: setmode.3

Log Message:
setmode.3: fix typos


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/lib/libc/gen/setmode.3

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/gen/setmode.3
diff -u src/lib/libc/gen/setmode.3:1.23 src/lib/libc/gen/setmode.3:1.24
--- src/lib/libc/gen/setmode.3:1.23	Sat Mar 12 17:31:39 2022
+++ src/lib/libc/gen/setmode.3	Sun Apr 28 22:43:30 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: setmode.3,v 1.23 2022/03/12 17:31:39 christos Exp $
+.\"	$NetBSD: setmode.3,v 1.24 2024/04/28 22:43:30 rillig Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -51,16 +51,15 @@ function accepts a string representation
 compiles it to binary form, and returns an abstract representation
 that may be passed to
 .Fn getmode .
-The string may be an numeric (octal) or symbolic string of the form
+The string may be a numeric (octal) or symbolic string of the form
 accepted by
 .Xr chmod 1 ,
 and may represent either an exact mode to set or a change to make to
-the existing mode.
+an existing mode.
 .Pp
 The
 .Fn getmode
-function
-adjusts the file permission bits given by
+function adjusts the file permission bits given by
 .Fa mode
 according to the compiled change representation
 .Fa set ,
@@ -116,7 +115,7 @@ or
 .Xr strtol 3 .
 In addition,
 .Fn setmode
-will fail and set
+may fail and set
 .Va errno
 to:
 .Bl -tag -width Er



CVS commit: src/lib/libc/gen

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 22:43:30 UTC 2024

Modified Files:
src/lib/libc/gen: setmode.3

Log Message:
setmode.3: fix typos


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/lib/libc/gen/setmode.3

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



CVS commit: src/lib/libc/sys

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 22:21:21 UTC 2024

Modified Files:
src/lib/libc/sys: execve.2

Log Message:
execve.2: fix typo in markup


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/lib/libc/sys/execve.2

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/sys/execve.2
diff -u src/lib/libc/sys/execve.2:1.45 src/lib/libc/sys/execve.2:1.46
--- src/lib/libc/sys/execve.2:1.45	Wed Sep 18 04:57:53 2019
+++ src/lib/libc/sys/execve.2	Sun Apr 28 22:21:21 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: execve.2,v 1.45 2019/09/18 04:57:53 wiz Exp $
+.\"	$NetBSD: execve.2,v 1.46 2024/04/28 22:21:21 rillig Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -83,7 +83,7 @@ An interpreter file begins with a line o
 .Ed
 .Pp
 When an interpreter file is
-.Sy execve Ar d ,
+.Sy execve Ap d ,
 the system actually
 .Sy execve Ap s
 the specified



CVS commit: src/lib/libc/sys

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 22:21:21 UTC 2024

Modified Files:
src/lib/libc/sys: execve.2

Log Message:
execve.2: fix typo in markup


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/lib/libc/sys/execve.2

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



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

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 18:55:04 UTC 2024

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

Log Message:
tests/cd9660: add debug info to the file list


To generate a diff of this commit:
cvs rdiff -u -r1.433 -r1.434 src/distrib/sets/lists/debug/mi

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

Modified files:

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.433 src/distrib/sets/lists/debug/mi:1.434
--- src/distrib/sets/lists/debug/mi:1.433	Sun Apr 28 01:21:26 2024
+++ src/distrib/sets/lists/debug/mi	Sun Apr 28 18:55:04 2024
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.433 2024/04/28 01:21:26 riastradh Exp $
+# $NetBSD: mi,v 1.434 2024/04/28 18:55:04 rillig Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib
@@ -1681,6 +1681,7 @@
 ./usr/libdata/debug/usr/tests/dev/scsipi/t_cd.debug			tests-fs-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/dev/sysmon/t_swwdog.debug			tests-fs-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/dev/usb/t_hid.debug			tests-fs-debug		debug,atf,rump
+./usr/libdata/debug/usr/tests/fs/cd9660/h_hexdump_r.debug		tests-fs-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/fs/ffs/h_ffs_server.debug			tests-fs-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/fs/ffs/h_quota2_server.debug		tests-obsolete		obsolete,compattestfile
 ./usr/libdata/debug/usr/tests/fs/ffs/h_quota2_tests.debug		tests-fs-debug		debug,atf,rump



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

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 18:55:04 UTC 2024

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

Log Message:
tests/cd9660: add debug info to the file list


To generate a diff of this commit:
cvs rdiff -u -r1.433 -r1.434 src/distrib/sets/lists/debug/mi

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

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 15:10:19 UTC 2024

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

Log Message:
make: don't reallocate memory after evaluating an expression

When an expression is evaluated, the resulting text is short-lived in
almost all cases.  In particular, the compaction neither affects the
target names nor the global variable values, which are the prime
candidates for permanent memory usage.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.bin/make/buf.c
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/make/buf.h
cvs rdiff -u -r1.1107 -r1.1108 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

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 15:10:19 UTC 2024

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

Log Message:
make: don't reallocate memory after evaluating an expression

When an expression is evaluated, the resulting text is short-lived in
almost all cases.  In particular, the compaction neither affects the
target names nor the global variable values, which are the prime
candidates for permanent memory usage.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.bin/make/buf.c
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/make/buf.h
cvs rdiff -u -r1.1107 -r1.1108 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/buf.c
diff -u src/usr.bin/make/buf.c:1.57 src/usr.bin/make/buf.c:1.58
--- src/usr.bin/make/buf.c:1.57	Tue Dec 19 19:33:39 2023
+++ src/usr.bin/make/buf.c	Sun Apr 28 15:10:19 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: buf.c,v 1.57 2023/12/19 19:33:39 rillig Exp $	*/
+/*	$NetBSD: buf.c,v 1.58 2024/04/28 15:10:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -75,7 +75,7 @@
 #include "make.h"
 
 /*	"@(#)buf.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: buf.c,v 1.57 2023/12/19 19:33:39 rillig Exp $");
+MAKE_RCSID("$NetBSD: buf.c,v 1.58 2024/04/28 15:10:19 rillig Exp $");
 
 /* Make space in the buffer for adding at least 16 more bytes. */
 void
@@ -187,30 +187,3 @@ Buf_DoneData(Buffer *buf)
 
 	return data;
 }
-
-#ifndef BUF_COMPACT_LIMIT
-# define BUF_COMPACT_LIMIT 128	/* worthwhile saving */
-#endif
-
-/*
- * Return the data from the buffer.
- * Leave the buffer itself in an indeterminate state.
- *
- * If the buffer size is much greater than its content,
- * a new buffer will be allocated and the old one freed.
- */
-char *
-Buf_DoneDataCompact(Buffer *buf)
-{
-#if BUF_COMPACT_LIMIT > 0
-	if (buf->cap - buf->len >= BUF_COMPACT_LIMIT) {
-		/* We trust realloc to be smart */
-		char *data = bmake_realloc(buf->data, buf->len + 1);
-		buf->data = NULL;
-		data[buf->len] = '\0';	/* XXX: unnecessary */
-		Buf_Done(buf);
-		return data;
-	}
-#endif
-	return Buf_DoneData(buf);
-}

Index: src/usr.bin/make/buf.h
diff -u src/usr.bin/make/buf.h:1.49 src/usr.bin/make/buf.h:1.50
--- src/usr.bin/make/buf.h:1.49	Tue Dec 19 19:33:39 2023
+++ src/usr.bin/make/buf.h	Sun Apr 28 15:10:19 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: buf.h,v 1.49 2023/12/19 19:33:39 rillig Exp $	*/
+/*	$NetBSD: buf.h,v 1.50 2024/04/28 15:10:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -124,6 +124,5 @@ void Buf_Init(Buffer *);
 void Buf_InitSize(Buffer *, size_t);
 void Buf_Done(Buffer *);
 char *Buf_DoneData(Buffer *) MAKE_ATTR_USE;
-char *Buf_DoneDataCompact(Buffer *) MAKE_ATTR_USE;
 
 #endif

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.1107 src/usr.bin/make/var.c:1.1108
--- src/usr.bin/make/var.c:1.1107	Sat Apr 27 21:26:23 2024
+++ src/usr.bin/make/var.c	Sun Apr 28 15:10:19 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1107 2024/04/27 21:26:23 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.1108 2024/04/28 15:10:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -132,7 +132,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1107 2024/04/27 21:26:23 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1108 2024/04/28 15:10:19 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -4731,7 +4731,7 @@ Var_Subst(const char *str, GNode *scope,
 			VarSubstPlain(, );
 	}
 
-	return Buf_DoneDataCompact();
+	return Buf_DoneData();
 }
 
 void



CVS commit: src

2024-04-28 Thread Roland Illig
09:24 2023
+++ src/tests/fs/cd9660/t_high_ino_big_file.sh	Sun Apr 28 14:39:22 2024
@@ -1,4 +1,4 @@
-# $NetBSD: t_high_ino_big_file.sh,v 1.5 2023/12/30 13:09:24 martin Exp $
+# $NetBSD: t_high_ino_big_file.sh,v 1.6 2024/04/28 14:39:22 rillig Exp $
 #
 # Copyright (c) 2014 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -76,13 +76,14 @@ pr_kern_48787_head() {
 }
 
 pr_kern_48787_body() {
-	avail=$( df -Pk . | awk '{if (NR==2) print $4}' )
+	avail=$(df -Pk . | awk 'NR == 2 { print $4 }')
 	if [ $avail -lt 450 ]; then
 		atf_skip "not enough free disk space, have ${avail} Kbytes, need ~ 450 Kbytes"
 	fi
-	bunzip2 < $(atf_get_srcdir)/pr_48787.image.bz2 > pr_48787.image
+	$(atf_get_srcdir)/h_hexdump_r < $(atf_get_srcdir)/pr_48787.image.hex > pr_48787.image || atf_fail "h_hexdump_r failed"
 	mntpnt=$(pwd)/mnt
 	mkdir ${mntpnt}
+
 	rump_cd9660 -o norrip ./pr_48787.image ${mntpnt}
 	if [ ! -r ${mntpnt}/small_file ]; then
 		atf_fail "${mntpnt}/small_file does not exist"
@@ -91,6 +92,7 @@ pr_kern_48787_body() {
 		atf_fail "${mntpnt}/my/large_file does not exist"
 	fi
 	umount ${mntpnt}
+
 	rump_cd9660 ./pr_48787.image ${mntpnt}
 	if [ ! -r ${mntpnt}/small_file ]; then
 		atf_fail "${mntpnt}/small_file does not exist"
@@ -102,6 +104,7 @@ pr_kern_48787_body() {
 	atf_check -o match:"^4329541966$" stat -f "%i" ${mntpnt}/small_file
 	atf_check -o match:"^4329545920$" stat -f "%i" ${mntpnt}/my/large_file
 	umount ${mntpnt}
+
 	touch "done"
 }
 

Added files:

Index: src/tests/fs/cd9660/h_hexdump_r.c
diff -u /dev/null src/tests/fs/cd9660/h_hexdump_r.c:1.1
--- /dev/null	Sun Apr 28 14:39:22 2024
+++ src/tests/fs/cd9660/h_hexdump_r.c	Sun Apr 28 14:39:22 2024
@@ -0,0 +1,100 @@
+/*	$NetBSD: h_hexdump_r.c,v 1.1 2024/04/28 14:39:22 rillig Exp $	*/
+
+/*
+ * Copyright (c) 2024 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code was contributed to The NetBSD Foundation by Roland Illig.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Given the output from "hexdump -C", reconstruct the original file. */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define	H	"[0-9a-f]"
+#define	HH	" (" H H ")"
+
+static off_t off, noff;
+static unsigned char prev_bytes[16], bytes[16], zeroes[16];
+
+int
+main(void)
+{
+	char line[81];
+	regex_t data_re, end_re;
+	regmatch_t m[18];
+
+	if (regcomp(_re, "^(" H "{8,9})"
+	" " HH HH HH HH HH HH HH HH " " HH HH HH HH HH HH HH HH
+	"  \\|.{16}\\|$", REG_EXTENDED) != 0)
+		err(1, "regcomp");
+	if (regcomp(_re, "^(" H "{8,9})$", REG_EXTENDED) != 0)
+		err(1, "regcomp");
+
+	while (fgets(line, sizeof(line), stdin) != NULL) {
+		line[strcspn(line, "\n")] = '\0';
+
+		if (strcmp(line, "*") == 0)
+			continue;
+
+		if (regexec(_re, line, 18, m, 0) == 0) {
+			noff = (off_t)strtoimax(line + m[1].rm_so, NULL, 16);
+			for (size_t i = 0; i < 16; i++)
+bytes[i] = (unsigned char)strtoumax(
+line + m[2 + i].rm_so, NULL, 16);
+
+		} else if (regexec(_re, line, 2, m, 0) == 0) {
+			noff = (off_t)strtoimax(line + m[1].rm_so, NULL, 16);
+			if (off < noff) {
+if (fseeko(stdout, noff - 16, SEEK_SET) != 0)
+	err(1, "fseeko");
+if (fwrite(prev_bytes, 1, 16, stdout) != 16)
+	err(1, "fwrite");
+			}
+		} else
+			err(1, "invalid line '%s'", line);
+
+		if (memcmp(prev_bytes, zeroes, 16) != 0) {
+			while (off < noff) {
+if (fwrite(prev_bytes, 1, 16, stdout) != 16)
+

CVS commit: src

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 14:39:22 UTC 2024

Modified Files:
src/distrib/sets/lists/tests: mi
src/etc/mtree: NetBSD.dist.tests
src/tests/fs/cd9660: Makefile t_high_ino_big_file.sh
Added Files:
src/tests/fs/cd9660: h_hexdump_r.c pr_48787.image.hex
Removed Files:
src/tests/fs/cd9660: pr_48787.image.bz2.uue

Log Message:
tests/cd9660: replace compressed blob with readable hexdump

This test is skipped in most circumstances because it creates a file
whose apparent size is 4.5 GB.  It's an ISO 9660 image though,
containing mostly null bytes.  Nevertheless, tmpfs doesn't allow such a
big file to be created, so this test is skipped in settings where /tmp
is on a tmpfs.

If the test is run, the ISO image is uncompressed, which takes several
minutes.  Replace bzip2 with direct file creation from a hex dump of
that disk image, which is easier to inspect manually and also faster by
about 3 magnitudes.


To generate a diff of this commit:
cvs rdiff -u -r1.1313 -r1.1314 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.204 -r1.205 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/cd9660/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/fs/cd9660/h_hexdump_r.c \
src/tests/fs/cd9660/pr_48787.image.hex
cvs rdiff -u -r1.1 -r0 src/tests/fs/cd9660/pr_48787.image.bz2.uue
cvs rdiff -u -r1.5 -r1.6 src/tests/fs/cd9660/t_high_ino_big_file.sh

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



CVS commit: src/tests

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 07:27:43 UTC 2024

Modified Files:
src/tests/bin/df: t_df.sh
src/tests/bin/pax: t_pax.sh
src/tests/bin/sh: t_ulimit.sh t_varquote.sh
src/tests/bin/tar: t_tar.sh
src/tests/crypto/libcrypto: t_libcrypto.sh
src/tests/fs/psshfs: t_psshfs.sh
src/tests/fs/tmpfs: h_funcs.subr t_create.sh t_devices.sh t_dots.sh
t_exec.sh t_link.sh t_mkdir.sh t_mknod.sh t_mount.sh t_pipes.sh
t_read_write.sh t_readdir.sh t_remove.sh t_rename.sh t_rmdir.sh
t_setattr.sh t_sizes.sh t_sockets.sh t_symlink.sh t_times.sh
t_trail_slash.sh t_vnd.sh t_vnode_leak.sh
src/tests/games: t_factor.sh
src/tests/lib/librumphijack: t_tcpip.sh
src/tests/modules: t_abi_uvm.sh t_klua_pr_52864.sh t_modload.sh
t_threadpool.sh
src/tests/sbin/newfs_msdos: t_create.sh
src/tests/sys/rc: t_rc_d_cli.sh
src/tests/usr.bin/config: t_config.sh
src/tests/usr.bin/id: t_groups.sh t_id.sh t_whoami.sh
src/tests/usr.bin/mtree: t_sets.sh
src/tests/usr.bin/netpgpverify: Testspec t_netpgpverify.sh
src/tests/usr.bin/sdiff: t_sdiff.sh

Log Message:
tests: replace deprecated '-s eq:...' with '-s exit:...'


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/bin/df/t_df.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/bin/pax/t_pax.sh
cvs rdiff -u -r1.3 -r1.4 src/tests/bin/sh/t_ulimit.sh
cvs rdiff -u -r1.5 -r1.6 src/tests/bin/sh/t_varquote.sh
cvs rdiff -u -r1.2 -r1.3 src/tests/bin/tar/t_tar.sh
cvs rdiff -u -r1.9 -r1.10 src/tests/crypto/libcrypto/t_libcrypto.sh
cvs rdiff -u -r1.9 -r1.10 src/tests/fs/psshfs/t_psshfs.sh
cvs rdiff -u -r1.5 -r1.6 src/tests/fs/tmpfs/h_funcs.subr \
src/tests/fs/tmpfs/t_devices.sh src/tests/fs/tmpfs/t_dots.sh \
src/tests/fs/tmpfs/t_exec.sh src/tests/fs/tmpfs/t_mknod.sh \
src/tests/fs/tmpfs/t_pipes.sh src/tests/fs/tmpfs/t_read_write.sh \
src/tests/fs/tmpfs/t_readdir.sh src/tests/fs/tmpfs/t_remove.sh \
src/tests/fs/tmpfs/t_rename.sh src/tests/fs/tmpfs/t_rmdir.sh \
src/tests/fs/tmpfs/t_setattr.sh src/tests/fs/tmpfs/t_sockets.sh \
src/tests/fs/tmpfs/t_symlink.sh src/tests/fs/tmpfs/t_trail_slash.sh
cvs rdiff -u -r1.8 -r1.9 src/tests/fs/tmpfs/t_create.sh \
src/tests/fs/tmpfs/t_mkdir.sh
cvs rdiff -u -r1.6 -r1.7 src/tests/fs/tmpfs/t_link.sh \
src/tests/fs/tmpfs/t_mount.sh src/tests/fs/tmpfs/t_sizes.sh
cvs rdiff -u -r1.7 -r1.8 src/tests/fs/tmpfs/t_times.sh \
src/tests/fs/tmpfs/t_vnode_leak.sh
cvs rdiff -u -r1.13 -r1.14 src/tests/fs/tmpfs/t_vnd.sh
cvs rdiff -u -r1.11 -r1.12 src/tests/games/t_factor.sh
cvs rdiff -u -r1.23 -r1.24 src/tests/lib/librumphijack/t_tcpip.sh
cvs rdiff -u -r1.3 -r1.4 src/tests/modules/t_abi_uvm.sh \
src/tests/modules/t_klua_pr_52864.sh
cvs rdiff -u -r1.13 -r1.14 src/tests/modules/t_modload.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/modules/t_threadpool.sh
cvs rdiff -u -r1.4 -r1.5 src/tests/sbin/newfs_msdos/t_create.sh
cvs rdiff -u -r1.5 -r1.6 src/tests/sys/rc/t_rc_d_cli.sh
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/config/t_config.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/id/t_groups.sh \
src/tests/usr.bin/id/t_id.sh src/tests/usr.bin/id/t_whoami.sh
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/mtree/t_sets.sh
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/netpgpverify/Testspec
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/netpgpverify/t_netpgpverify.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/sdiff/t_sdiff.sh

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



CVS commit: src/tests

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 07:27:43 UTC 2024

Modified Files:
src/tests/bin/df: t_df.sh
src/tests/bin/pax: t_pax.sh
src/tests/bin/sh: t_ulimit.sh t_varquote.sh
src/tests/bin/tar: t_tar.sh
src/tests/crypto/libcrypto: t_libcrypto.sh
src/tests/fs/psshfs: t_psshfs.sh
src/tests/fs/tmpfs: h_funcs.subr t_create.sh t_devices.sh t_dots.sh
t_exec.sh t_link.sh t_mkdir.sh t_mknod.sh t_mount.sh t_pipes.sh
t_read_write.sh t_readdir.sh t_remove.sh t_rename.sh t_rmdir.sh
t_setattr.sh t_sizes.sh t_sockets.sh t_symlink.sh t_times.sh
t_trail_slash.sh t_vnd.sh t_vnode_leak.sh
src/tests/games: t_factor.sh
src/tests/lib/librumphijack: t_tcpip.sh
src/tests/modules: t_abi_uvm.sh t_klua_pr_52864.sh t_modload.sh
t_threadpool.sh
src/tests/sbin/newfs_msdos: t_create.sh
src/tests/sys/rc: t_rc_d_cli.sh
src/tests/usr.bin/config: t_config.sh
src/tests/usr.bin/id: t_groups.sh t_id.sh t_whoami.sh
src/tests/usr.bin/mtree: t_sets.sh
src/tests/usr.bin/netpgpverify: Testspec t_netpgpverify.sh
src/tests/usr.bin/sdiff: t_sdiff.sh

Log Message:
tests: replace deprecated '-s eq:...' with '-s exit:...'


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/bin/df/t_df.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/bin/pax/t_pax.sh
cvs rdiff -u -r1.3 -r1.4 src/tests/bin/sh/t_ulimit.sh
cvs rdiff -u -r1.5 -r1.6 src/tests/bin/sh/t_varquote.sh
cvs rdiff -u -r1.2 -r1.3 src/tests/bin/tar/t_tar.sh
cvs rdiff -u -r1.9 -r1.10 src/tests/crypto/libcrypto/t_libcrypto.sh
cvs rdiff -u -r1.9 -r1.10 src/tests/fs/psshfs/t_psshfs.sh
cvs rdiff -u -r1.5 -r1.6 src/tests/fs/tmpfs/h_funcs.subr \
src/tests/fs/tmpfs/t_devices.sh src/tests/fs/tmpfs/t_dots.sh \
src/tests/fs/tmpfs/t_exec.sh src/tests/fs/tmpfs/t_mknod.sh \
src/tests/fs/tmpfs/t_pipes.sh src/tests/fs/tmpfs/t_read_write.sh \
src/tests/fs/tmpfs/t_readdir.sh src/tests/fs/tmpfs/t_remove.sh \
src/tests/fs/tmpfs/t_rename.sh src/tests/fs/tmpfs/t_rmdir.sh \
src/tests/fs/tmpfs/t_setattr.sh src/tests/fs/tmpfs/t_sockets.sh \
src/tests/fs/tmpfs/t_symlink.sh src/tests/fs/tmpfs/t_trail_slash.sh
cvs rdiff -u -r1.8 -r1.9 src/tests/fs/tmpfs/t_create.sh \
src/tests/fs/tmpfs/t_mkdir.sh
cvs rdiff -u -r1.6 -r1.7 src/tests/fs/tmpfs/t_link.sh \
src/tests/fs/tmpfs/t_mount.sh src/tests/fs/tmpfs/t_sizes.sh
cvs rdiff -u -r1.7 -r1.8 src/tests/fs/tmpfs/t_times.sh \
src/tests/fs/tmpfs/t_vnode_leak.sh
cvs rdiff -u -r1.13 -r1.14 src/tests/fs/tmpfs/t_vnd.sh
cvs rdiff -u -r1.11 -r1.12 src/tests/games/t_factor.sh
cvs rdiff -u -r1.23 -r1.24 src/tests/lib/librumphijack/t_tcpip.sh
cvs rdiff -u -r1.3 -r1.4 src/tests/modules/t_abi_uvm.sh \
src/tests/modules/t_klua_pr_52864.sh
cvs rdiff -u -r1.13 -r1.14 src/tests/modules/t_modload.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/modules/t_threadpool.sh
cvs rdiff -u -r1.4 -r1.5 src/tests/sbin/newfs_msdos/t_create.sh
cvs rdiff -u -r1.5 -r1.6 src/tests/sys/rc/t_rc_d_cli.sh
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/config/t_config.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/id/t_groups.sh \
src/tests/usr.bin/id/t_id.sh src/tests/usr.bin/id/t_whoami.sh
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/mtree/t_sets.sh
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/netpgpverify/Testspec
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/netpgpverify/t_netpgpverify.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/sdiff/t_sdiff.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/bin/df/t_df.sh
diff -u src/tests/bin/df/t_df.sh:1.2 src/tests/bin/df/t_df.sh:1.3
--- src/tests/bin/df/t_df.sh:1.2	Sun Aug 23 15:51:30 2020
+++ src/tests/bin/df/t_df.sh	Sun Apr 28 07:27:40 2024
@@ -1,4 +1,4 @@
-# $NetBSD: t_df.sh,v 1.2 2020/08/23 15:51:30 ryo Exp $
+# $NetBSD: t_df.sh,v 1.3 2024/04/28 07:27:40 rillig Exp $
 #
 # Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -79,7 +79,7 @@ filer:/1202716672   1202716672  
 /dev/strpct   21474836476  10737418240  10737418236  50% /strpct
 /dev/wd0e10485688  2859932  7625756  27% /mount/windows/C
 EOF
-	atf_check -s eq:0 -o file:expout -e empty \
+	atf_check -s exit:0 -o file:expout -e empty \
 	-x "BLOCKSIZE=1k $(atf_get_srcdir)/h_df -n"
 }
 
@@ -137,7 +137,7 @@ filer:/1.1T   1.1T  -172G 117% /
 /dev/strpct 20T10T10T  50% /strpct
 /dev/wd0e   10G   2.7G   7.3G  27% /mount/windows/C
 EOF
-	atf_check -s eq:0 -o file:expout -e empty \
+	atf_check -s exit:0 -o file:expout -e empty \
 	-x "BLOCKSIZE=1k $(atf_get_srcdir)/h_df -hn"
 }
 

Index: src/tests/bin/pax/t_pax.sh
diff -u src/tests/bin/pax/t_pax.sh:1.1 src/tests/bin/pax/t_pax.sh:1.2
--- src/tests/bin/pax/t_pax.sh:1.1	Sat Mar 17 16:33:11 2012
+++ src/tests/bin/pax/t_pax.sh	Sun Apr 28 07:27:40 

CVS commit: src/usr.bin/make

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 21:26:23 UTC 2024

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

Log Message:
make: fix comment about forcing a use-after-free

The previous expression didn't cause any bug, as the modifier
':@VAR@loop@' changed the value of the expression, thus making the
expression independent from the variable value.

Instead, the variable needs to be deleted from within an indirect
modifier, and that modifier needs to evaluate to an empty string, thus
doing nothing and preserving the original expression value.


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

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 21:26:23 UTC 2024

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

Log Message:
make: fix comment about forcing a use-after-free

The previous expression didn't cause any bug, as the modifier
':@VAR@loop@' changed the value of the expression, thus making the
expression independent from the variable value.

Instead, the variable needs to be deleted from within an indirect
modifier, and that modifier needs to evaluate to an empty string, thus
doing nothing and preserving the original expression value.


To generate a diff of this commit:
cvs rdiff -u -r1.1106 -r1.1107 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.1106 src/usr.bin/make/var.c:1.1107
--- src/usr.bin/make/var.c:1.1106	Sat Apr 27 20:41:32 2024
+++ src/usr.bin/make/var.c	Sat Apr 27 21:26:23 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1106 2024/04/27 20:41:32 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.1107 2024/04/27 21:26:23 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -132,7 +132,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1106 2024/04/27 20:41:32 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1107 2024/04/27 21:26:23 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -4542,7 +4542,7 @@ Var_Parse(const char **pp, GNode *scope,
 	 * while its value is still being used:
 	 *
 	 *	VAR=	value
-	 *	_:=	${VAR:${:U@VAR@loop@}:S,^,prefix,}
+	 *	_:=	${VAR:${:U:@VAR@@}:S,^,prefix,}
 	 *
 	 * The same effect might be achievable using the '::=' or the ':_'
 	 * modifiers.



CVS commit: src/usr.bin/make

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 20:41:32 UTC 2024

Modified Files:
src/usr.bin/make: arch.c job.c make.h var.c
src/usr.bin/make/unit-tests: depsrc-end.mk depsrc-nopath.exp
depsrc-nopath.mk depsrc-phony.mk

Log Message:
make: clean up, test .NOPATH

Trim down the comments in the archive module, as they mainly repeated
the code.  Trim down the binary code size in the archive module, as it
is rarely used.

In Var_Parse, delay two variable assignments until they are actually
needed.


To generate a diff of this commit:
cvs rdiff -u -r1.216 -r1.217 src/usr.bin/make/arch.c
cvs rdiff -u -r1.469 -r1.470 src/usr.bin/make/job.c
cvs rdiff -u -r1.331 -r1.332 src/usr.bin/make/make.h
cvs rdiff -u -r1.1105 -r1.1106 src/usr.bin/make/var.c
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/depsrc-end.mk \
src/usr.bin/make/unit-tests/depsrc-nopath.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/depsrc-nopath.mk
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/depsrc-phony.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

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 20:41:32 UTC 2024

Modified Files:
src/usr.bin/make: arch.c job.c make.h var.c
src/usr.bin/make/unit-tests: depsrc-end.mk depsrc-nopath.exp
depsrc-nopath.mk depsrc-phony.mk

Log Message:
make: clean up, test .NOPATH

Trim down the comments in the archive module, as they mainly repeated
the code.  Trim down the binary code size in the archive module, as it
is rarely used.

In Var_Parse, delay two variable assignments until they are actually
needed.


To generate a diff of this commit:
cvs rdiff -u -r1.216 -r1.217 src/usr.bin/make/arch.c
cvs rdiff -u -r1.469 -r1.470 src/usr.bin/make/job.c
cvs rdiff -u -r1.331 -r1.332 src/usr.bin/make/make.h
cvs rdiff -u -r1.1105 -r1.1106 src/usr.bin/make/var.c
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/depsrc-end.mk \
src/usr.bin/make/unit-tests/depsrc-nopath.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/depsrc-nopath.mk
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/depsrc-phony.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/arch.c
diff -u src/usr.bin/make/arch.c:1.216 src/usr.bin/make/arch.c:1.217
--- src/usr.bin/make/arch.c:1.216	Sat Apr 27 17:33:46 2024
+++ src/usr.bin/make/arch.c	Sat Apr 27 20:41:32 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.216 2024/04/27 17:33:46 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.217 2024/04/27 20:41:32 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -126,7 +126,7 @@
 #include "config.h"
 
 /*	"@(#)arch.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: arch.c,v 1.216 2024/04/27 17:33:46 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.217 2024/04/27 20:41:32 rillig Exp $");
 
 typedef struct List ArchList;
 typedef struct ListNode ArchListNode;
@@ -134,7 +134,7 @@ typedef struct ListNode ArchListNode;
 static ArchList archives;	/* The archives we've already examined */
 
 typedef struct Arch {
-	char *name;		/* Name of archive */
+	char *name;
 	HashTable members;	/* All the members of the archive described
  * by  key/value pairs */
 	char *fnametab;		/* Extended name table strings */
@@ -155,7 +155,6 @@ ArchFree(Arch *a)
 {
 	HashIter hi;
 
-	/* Free memory from hash entries */
 	HashIter_Init(, >members);
 	while (HashIter_Next() != NULL)
 		free(hi.entry->value);
@@ -168,32 +167,22 @@ ArchFree(Arch *a)
 #endif
 
 /* Return "archive(member)". */
-static char *
+MAKE_ATTR_NOINLINE static char *
 FullName(const char *archive, const char *member)
 {
-	size_t len1 = strlen(archive);
-	size_t len3 = strlen(member);
-	char *result = bmake_malloc(len1 + 1 + len3 + 1 + 1);
-	memcpy(result, archive, len1);
-	memcpy(result + len1, "(", 1);
-	memcpy(result + len1 + 1, member, len3);
-	memcpy(result + len1 + 1 + len3, ")", 1 + 1);
-	return result;
+	Buffer buf;
+	Buf_Init();
+	Buf_AddStr(, archive);
+	Buf_AddStr(, "(");
+	Buf_AddStr(, member);
+	Buf_AddStr(, ")");
+	return Buf_DoneData();
 }
 
 /*
  * Parse an archive specification such as "archive.a(member1 member2.${EXT})",
- * adding nodes for the expanded members to gns.  Nodes are created as
- * necessary.
- *
- * Input:
- *	pp		The start of the specification.
- *	gns		The list on which to place the nodes.
- *	scope		The scope in which to expand variables.
- *
- * Output:
- *	return		True if it was a valid specification.
- *	*pp		Points to the first non-space after the archive spec.
+ * adding nodes for the expanded members to gns.  If successful, advance pp
+ * beyond the archive specification and any trailing whitespace.
  */
 bool
 Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
@@ -274,12 +263,6 @@ Arch_ParseArchive(char **pp, GNodeList *
 			}
 		}
 
-		/*
-		 * If the specification ends without a closing parenthesis,
-		 * chances are there's something wrong (like a missing
-		 * backslash), so it's better to return failure than allow
-		 * such things to happen
-		 */
 		if (*cp == '\0') {
 			Parse_Error(PARSE_FATAL,
 			"No closing parenthesis "
@@ -287,9 +270,6 @@ Arch_ParseArchive(char **pp, GNodeList *
 			return false;
 		}
 
-		/*
-		 * If we didn't move anywhere, we must be done
-		 */
 		if (cp == mem.str)
 			break;
 
@@ -326,8 +306,7 @@ Arch_ParseArchive(char **pp, GNodeList *
 /*
  * Must contain dynamic sources, so we can't
  * deal with it now. Just create an ARCHV node
- * for the thing and let SuffExpandChildren
- * handle it.
+ * and let SuffExpandChildren handle it.
  */
 gn = Targ_GetNode(fullName);
 gn->type |= OP_ARCHV;
@@ -364,13 +343,6 @@ Arch_ParseArchive(char **pp, GNodeList *
 			gn = Targ_GetNode(fullname);
 			free(fullname);
 
-			/*
-			 * We've found the node, but have to make sure the
-			 * rest of the world knows it's an archive member,
-			 * without having to constantly check for parentheses,
-			 * so we type the thing with the OP_ARCHV bit before

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

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 20:23:22 UTC 2024

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

Log Message:
tests/make: test detection of static library files


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/archive.exp
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/archive.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/archive.exp
diff -u src/usr.bin/make/unit-tests/archive.exp:1.7 src/usr.bin/make/unit-tests/archive.exp:1.8
--- src/usr.bin/make/unit-tests/archive.exp:1.7	Fri Oct  9 06:44:42 2020
+++ src/usr.bin/make/unit-tests/archive.exp	Sat Apr 27 20:23:22 2024
@@ -25,4 +25,12 @@ depend-on-existing-member
 Making remove-archive
 rm -f libprog.a
 
+begin library
+Examining libbad.a...up-to-date.
+Examining -lbad...up-to-date.
+Examining libgood.a...library...up-to-date.
+Examining -lgood...library...up-to-date.
+Examining library...nonexistentPHONY node...out-of-date.
+Examining .END...nonexistent...nonexistent and no sources...out-of-date.
+end library
 exit status 0

Index: src/usr.bin/make/unit-tests/archive.mk
diff -u src/usr.bin/make/unit-tests/archive.mk:1.12 src/usr.bin/make/unit-tests/archive.mk:1.13
--- src/usr.bin/make/unit-tests/archive.mk:1.12	Fri Apr  9 14:42:00 2021
+++ src/usr.bin/make/unit-tests/archive.mk	Sat Apr 27 20:23:22 2024
@@ -1,4 +1,4 @@
-# $NetBSD: archive.mk,v 1.12 2021/04/09 14:42:00 christos Exp $
+# $NetBSD: archive.mk,v 1.13 2024/04/27 20:23:22 rillig Exp $
 #
 # Very basic demonstration of handling archives, based on the description
 # in PSD.doc/tutorial.ms.
@@ -24,6 +24,12 @@ all:
 	@${MAKE} -f ${MAKEFILE} depend-on-existing-member
 	@${MAKE} -f ${MAKEFILE} depend-on-nonexistent-member
 	@${MAKE} -f ${MAKEFILE} remove-archive
+	@${MAKE} -f ${MAKEFILE} set-up-library
+	@${MAKE} -f ${MAKEFILE} -dm library 2>&1 \
+	| sed -n '/^Examining/p' \
+	| sed 's,\.\.\.modified[^.]*,,'
+	@${MAKE} -f ${MAKEFILE} tear-down-library
+
 
 create-archive: ${ARCHIVE} pre post
 
@@ -58,3 +64,28 @@ pre: .USEBEFORE
 	@echo Making ${.TARGET} ${.OODATE:C,.+,out-of-date,W} ${.OODATE:O}
 post: .USE
 	@echo
+
+
+set-up-library: .PHONY
+	@echo "member" > member.txt
+	@echo "not a library" > libbad.a
+	@ar cr libgood.a member.txt
+	@echo "begin library"
+
+.if make(library)
+.SUFFIXES: .a
+.LIBS: .a
+.endif
+# The two lines for libgood contain the word "library", the two lines for
+# libbad don't.
+#
+# expect: Examining libbad.a...up-to-date.
+# expect: Examining -lbad...up-to-date.
+# expect: Examining libgood.a...library...up-to-date.
+# expect: Examining -lgood...library...up-to-date.
+library: .PHONY libbad.a -lbad libgood.a -lgood
+	: Making ${.TARGET} from ${.ALLSRC}
+
+tear-down-library: .PHONY
+	@echo "end library"
+	@rm member.txt libbad.a libgood.a



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

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 20:23:22 UTC 2024

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

Log Message:
tests/make: test detection of static library files


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/archive.exp
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/archive.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

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 17:33:47 UTC 2024

Modified Files:
src/usr.bin/make: arch.c lst.c lst.h main.c meta.c parse.c targ.c

Log Message:
make: simplify freeing of lists


To generate a diff of this commit:
cvs rdiff -u -r1.215 -r1.216 src/usr.bin/make/arch.c
cvs rdiff -u -r1.107 -r1.108 src/usr.bin/make/lst.c
cvs rdiff -u -r1.104 -r1.105 src/usr.bin/make/lst.h
cvs rdiff -u -r1.612 -r1.613 src/usr.bin/make/main.c
cvs rdiff -u -r1.207 -r1.208 src/usr.bin/make/meta.c
cvs rdiff -u -r1.721 -r1.722 src/usr.bin/make/parse.c
cvs rdiff -u -r1.180 -r1.181 src/usr.bin/make/targ.c

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

Modified files:

Index: src/usr.bin/make/arch.c
diff -u src/usr.bin/make/arch.c:1.215 src/usr.bin/make/arch.c:1.216
--- src/usr.bin/make/arch.c:1.215	Wed Feb  7 06:43:02 2024
+++ src/usr.bin/make/arch.c	Sat Apr 27 17:33:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.215 2024/02/07 06:43:02 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.216 2024/04/27 17:33:46 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -126,7 +126,7 @@
 #include "config.h"
 
 /*	"@(#)arch.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: arch.c,v 1.215 2024/02/07 06:43:02 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.216 2024/04/27 17:33:46 rillig Exp $");
 
 typedef struct List ArchList;
 typedef struct ListNode ArchListNode;
@@ -151,9 +151,8 @@ static int ArchSVR4Entry(Arch *, char *,
 
 #ifdef CLEANUP
 static void
-ArchFree(void *ap)
+ArchFree(Arch *a)
 {
-	Arch *a = ap;
 	HashIter hi;
 
 	/* Free memory from hash entries */
@@ -1070,7 +1069,11 @@ void
 Arch_End(void)
 {
 #ifdef CLEANUP
-	Lst_DoneCall(, ArchFree);
+	ArchListNode *ln;
+
+	for (ln = archives.first; ln != NULL; ln = ln->next)
+		ArchFree(ln->datum);
+	Lst_Done();
 #endif
 }
 

Index: src/usr.bin/make/lst.c
diff -u src/usr.bin/make/lst.c:1.107 src/usr.bin/make/lst.c:1.108
--- src/usr.bin/make/lst.c:1.107	Fri Dec 29 20:43:58 2023
+++ src/usr.bin/make/lst.c	Sat Apr 27 17:33:46 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.107 2023/12/29 20:43:58 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.108 2024/04/27 17:33:46 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -34,7 +34,7 @@
 
 #include "make.h"
 
-MAKE_RCSID("$NetBSD: lst.c,v 1.107 2023/12/29 20:43:58 rillig Exp $");
+MAKE_RCSID("$NetBSD: lst.c,v 1.108 2024/04/27 17:33:46 rillig Exp $");
 
 static ListNode *
 LstNodeNew(ListNode *prev, ListNode *next, void *datum)
@@ -60,13 +60,13 @@ Lst_Done(List *list)
 }
 
 void
-Lst_DoneCall(List *list, LstFreeProc freeProc)
+Lst_DoneFree(List *list)
 {
 	ListNode *ln, *next;
 
 	for (ln = list->first; ln != NULL; ln = next) {
 		next = ln->next;
-		freeProc(ln->datum);
+		free(ln->datum);
 		free(ln);
 	}
 }

Index: src/usr.bin/make/lst.h
diff -u src/usr.bin/make/lst.h:1.104 src/usr.bin/make/lst.h:1.105
--- src/usr.bin/make/lst.h:1.104	Fri Dec 29 20:43:58 2023
+++ src/usr.bin/make/lst.h	Sat Apr 27 17:33:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: lst.h,v 1.104 2023/12/29 20:43:58 rillig Exp $	*/
+/*	$NetBSD: lst.h,v 1.105 2024/04/27 17:33:46 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -98,13 +98,10 @@ struct List {
 	ListNode *last;
 };
 
-/* Free the datum of a node, called before freeing the node itself. */
-typedef void LstFreeProc(void *);
-
-/* Free the list nodes, but not the list itself. */
+/* Free the list nodes. */
 void Lst_Done(List *);
-/* Free the list nodes, freeing the node data using the given function. */
-void Lst_DoneCall(List *, LstFreeProc);
+/* Free the list nodes, as well as each node's datum. */
+void Lst_DoneFree(List *);
 
 #define LST_INIT { NULL, NULL }
 

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.612 src/usr.bin/make/main.c:1.613
--- src/usr.bin/make/main.c:1.612	Sun Mar 10 02:53:37 2024
+++ src/usr.bin/make/main.c	Sat Apr 27 17:33:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.612 2024/03/10 02:53:37 sjg Exp $	*/
+/*	$NetBSD: main.c,v 1.613 2024/04/27 17:33:46 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -111,7 +111,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.612 2024/03/10 02:53:37 sjg Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.613 2024/04/27 17:33:46 rillig Exp $");
 #if defined(MAKE_NATIVE)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -1199,7 +1199,7 @@ ReadBuiltinRules(void)
 		Fatal("%s: cannot open %s.",
 		progname, (const char *)sysMkFiles.first->datum);
 
-	Lst_DoneCall(, free);
+	Lst_DoneFree();
 }
 
 static void
@@ -1564,9 +1564,9 @@ static void
 main_CleanUp(void)
 {
 #ifdef CLEANUP
-	Lst_DoneCall(, free);
-	Lst_DoneCall(, free);
-	Lst_DoneCall(, free);
+	Lst_DoneFree();
+	Lst_DoneFree();
+	Lst_DoneFree();
 #endif
 
 	if (DEBUG(GRAPH2))

Index: 

CVS commit: src/usr.bin/make

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 17:33:47 UTC 2024

Modified Files:
src/usr.bin/make: arch.c lst.c lst.h main.c meta.c parse.c targ.c

Log Message:
make: simplify freeing of lists


To generate a diff of this commit:
cvs rdiff -u -r1.215 -r1.216 src/usr.bin/make/arch.c
cvs rdiff -u -r1.107 -r1.108 src/usr.bin/make/lst.c
cvs rdiff -u -r1.104 -r1.105 src/usr.bin/make/lst.h
cvs rdiff -u -r1.612 -r1.613 src/usr.bin/make/main.c
cvs rdiff -u -r1.207 -r1.208 src/usr.bin/make/meta.c
cvs rdiff -u -r1.721 -r1.722 src/usr.bin/make/parse.c
cvs rdiff -u -r1.180 -r1.181 src/usr.bin/make/targ.c

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



CVS commit: src

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 12:46:37 UTC 2024

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

Log Message:
lint: converting a null pointer to another pointer type is not narrowing


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/tests/usr.bin/xlint/lint1/queries.c
cvs rdiff -u -r1.636 -r1.637 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.28 src/tests/usr.bin/xlint/lint1/queries.c:1.29
--- src/tests/usr.bin/xlint/lint1/queries.c:1.28	Sat Apr 27 10:08:54 2024
+++ src/tests/usr.bin/xlint/lint1/queries.c	Sat Apr 27 12:46:37 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: queries.c,v 1.28 2024/04/27 10:08:54 rillig Exp $	*/
+/*	$NetBSD: queries.c,v 1.29 2024/04/27 12:46:37 rillig Exp $	*/
 # 3 "queries.c"
 
 /*
@@ -532,4 +532,6 @@ Q20_void_pointer_conversion(void)
 	int_ptr = char_ptr;
 	/* expect+1: warning: illegal combination of 'pointer to char' and 'pointer to int', op '=' [124] */
 	char_ptr = int_ptr;
+
+	int_ptr = (void *)0;
 }

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.636 src/usr.bin/xlint/lint1/tree.c:1.637
--- src/usr.bin/xlint/lint1/tree.c:1.636	Sat Apr 27 10:08:54 2024
+++ src/usr.bin/xlint/lint1/tree.c	Sat Apr 27 12:46:37 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.636 2024/04/27 10:08:54 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.637 2024/04/27 12:46:37 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.636 2024/04/27 10:08:54 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.637 2024/04/27 12:46:37 rillig Exp $");
 #endif
 
 #include 
@@ -1434,7 +1434,8 @@ build_assignment(op_t op, bool sys, tnod
 
 	if (is_query_enabled[20]
 	&& lt == PTR && ln->tn_type->t_subt->t_tspec != VOID
-	&& rt == PTR && rn->tn_type->t_subt->t_tspec == VOID)
+	&& rt == PTR && rn->tn_type->t_subt->t_tspec == VOID
+	&& !is_null_pointer(rn))
 		/* implicit narrowing conversion from void ... */
 		query_message(20, type_name(ln->tn_type));
 



CVS commit: src

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 12:46:37 UTC 2024

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

Log Message:
lint: converting a null pointer to another pointer type is not narrowing


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/tests/usr.bin/xlint/lint1/queries.c
cvs rdiff -u -r1.636 -r1.637 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

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 10:08:55 UTC 2024

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 conversion from void pointer to other pointer


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/tests/usr.bin/xlint/lint1/queries.c
cvs rdiff -u -r1.19 -r1.20 src/tests/usr.bin/xlint/lint1/t_usage.sh
cvs rdiff -u -r1.240 -r1.241 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.635 -r1.636 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.27 src/tests/usr.bin/xlint/lint1/queries.c:1.28
--- src/tests/usr.bin/xlint/lint1/queries.c:1.27	Sat Mar 30 19:12:37 2024
+++ src/tests/usr.bin/xlint/lint1/queries.c	Sat Apr 27 10:08:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: queries.c,v 1.27 2024/03/30 19:12:37 rillig Exp $	*/
+/*	$NetBSD: queries.c,v 1.28 2024/04/27 10:08:54 rillig Exp $	*/
 # 3 "queries.c"
 
 /*
@@ -16,7 +16,7 @@
  */
 
 /* lint1-extra-flags: -q 1,2,3,4,5,6,7,8,9,10 */
-/* lint1-extra-flags: -q 11,12,13,14,15,16,17,18,19 */
+/* lint1-extra-flags: -q 11,12,13,14,15,16,17,18,19,20 */
 /* lint1-extra-flags: -X 351 */
 
 typedef unsigned char u8_t;
@@ -73,6 +73,8 @@ volatile char *vstr;
 
 void *void_ptr;
 const void *const_void_ptr;
+char *char_ptr;
+int *int_ptr;
 
 int
 Q1(double dbl)
@@ -359,9 +361,9 @@ Q9(int x)
 		return (0.0);
 	case 9:
 		return
-# 363 "queries.c" 3 4
+# 365 "queries.c" 3 4
 		((void *)0)
-# 365 "queries.c"
+# 367 "queries.c"
 		/* expect+1: warning: illegal combination of integer 'int' and pointer 'pointer to void' [183] */
 		;
 	case 10:
@@ -509,10 +511,25 @@ convert_from_integer_to_floating(void)
 	f64 = (double)u32;
 }
 
-/*
- * 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.
- */
-/* expect+1: warning: static variable 'unused' unused [226] */
-static int unused;
+// C allows implicit narrowing conversions from a void pointer to an arbitrary
+// object pointer. C++ doesn't allow this conversion since it is narrowing.
+void
+Q20_void_pointer_conversion(void)
+{
+	/* expect+1: warning: operands of '=' have incompatible pointer types to 'void' and 'const void' [128] */
+	void_ptr = const_void_ptr;
+	const_void_ptr = void_ptr;
+	/* expect+1: implicit narrowing conversion from void pointer to 'pointer to int' [Q20] */
+	int_ptr = void_ptr;
+	/* expect+1: redundant cast from 'pointer to void' to 'pointer to int' before assignment [Q7] */
+	int_ptr = (int *)void_ptr;
+	/* expect+1: implicit narrowing conversion from void pointer to 'pointer to char' [Q20] */
+	char_ptr = void_ptr;
+	void_ptr = char_ptr;
+	/* expect+1: implicit narrowing conversion from void pointer to 'pointer to int' [Q20] */
+	int_ptr = void_ptr;
+	/* expect+1: warning: illegal combination of 'pointer to int' and 'pointer to char', op '=' [124] */
+	int_ptr = char_ptr;
+	/* expect+1: warning: illegal combination of 'pointer to char' and 'pointer to int', op '=' [124] */
+	char_ptr = int_ptr;
+}

Index: src/tests/usr.bin/xlint/lint1/t_usage.sh
diff -u src/tests/usr.bin/xlint/lint1/t_usage.sh:1.19 src/tests/usr.bin/xlint/lint1/t_usage.sh:1.20
--- src/tests/usr.bin/xlint/lint1/t_usage.sh:1.19	Sat Mar 30 17:23:13 2024
+++ src/tests/usr.bin/xlint/lint1/t_usage.sh	Sat Apr 27 10:08:54 2024
@@ -1,4 +1,4 @@
-# $NetBSD: t_usage.sh,v 1.19 2024/03/30 17:23:13 rillig Exp $
+# $NetBSD: t_usage.sh,v 1.20 2024/04/27 10:08:54 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 19 code.c /dev/null
+	"$lint1" -q 20 code.c /dev/null
 
 	# Larger than the largest known query.
 	atf_check \
 	-s 'exit:1' \
-	-e "inline:lint1: invalid query ID '20'\n" \
-	"$lint1" -q 20 code.c /dev/null
+	-e "inline:lint1: invalid query ID '21'\n" \
+	"$lint1" -q 21 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.240 src/usr.bin/xlint/lint1/err.c:1.241
--- src/usr.bin/xlint/lint1/err.c:1.240	Fri Apr 12 05:17:48 2024
+++ src/usr.bin/xlint/lint1/err.c	Sat Apr 27 10:08:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: err.c,v 1.240 2024/04/12 05:17:48 rillig Exp $	*/
+/*	$NetBSD: err.c,v 1.241 2024/04/27 10:08:54 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: err.c,v 1.240 2024/04/12 05:17:48 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.241 2024/04/27 10:08:54 rillig Exp $");
 #endif
 
 #include 
@@ -741,6 +741,7 @@ static 

CVS commit: src

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 10:08:55 UTC 2024

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 conversion from void pointer to other pointer


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/tests/usr.bin/xlint/lint1/queries.c
cvs rdiff -u -r1.19 -r1.20 src/tests/usr.bin/xlint/lint1/t_usage.sh
cvs rdiff -u -r1.240 -r1.241 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.635 -r1.636 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/sys/arch/mips/include

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 06:01:08 UTC 2024

Modified Files:
src/sys/arch/mips/include: float.h

Log Message:
mips: fix syntax error in LDBL_MAX (since 2011)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/mips/include/float.h

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

Modified files:

Index: src/sys/arch/mips/include/float.h
diff -u src/sys/arch/mips/include/float.h:1.18 src/sys/arch/mips/include/float.h:1.19
--- src/sys/arch/mips/include/float.h:1.18	Sun Jul 26 08:08:41 2020
+++ src/sys/arch/mips/include/float.h	Sat Apr 27 06:01:08 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: float.h,v 1.18 2020/07/26 08:08:41 simonb Exp $ */
+/*	$NetBSD: float.h,v 1.19 2024/04/27 06:01:08 rillig Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@
 #if __STDC_VERSION__ >= 199901L
 #define	LDBL_EPSILON	0x1p-112L
 #define	LDBL_MIN	0x1p-16382L
-#define	LDBL_MAX	0x1.p+16383L,
+#define	LDBL_MAX	0x1.p+16383L
 #else
 #define	LDBL_EPSILON	1.9259299443872358530559779425849273E-34L
 #define	LDBL_MIN	3.3621031431120935062626778173217526E-4932L



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

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 06:01:08 UTC 2024

Modified Files:
src/sys/arch/mips/include: float.h

Log Message:
mips: fix syntax error in LDBL_MAX (since 2011)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/mips/include/float.h

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



CVS commit: src

2024-04-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 17:38:44 UTC 2024

Modified Files:
src: BUILDING
src/doc: BUILDING.mdoc

Log Message:
BUILDING: fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/BUILDING
cvs rdiff -u -r1.149 -r1.150 src/doc/BUILDING.mdoc

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



CVS commit: src

2024-04-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 17:38:44 UTC 2024

Modified Files:
src: BUILDING
src/doc: BUILDING.mdoc

Log Message:
BUILDING: fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/BUILDING
cvs rdiff -u -r1.149 -r1.150 src/doc/BUILDING.mdoc

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

Modified files:

Index: src/BUILDING
diff -u src/BUILDING:1.160 src/BUILDING:1.161
--- src/BUILDING:1.160	Sat Jul 22 18:50:04 2023
+++ src/BUILDING	Fri Apr 26 17:38:44 2024
@@ -729,7 +729,7 @@ BUILDING
MACHINE and MACHINE_ARCH settings.
 
  -N noiselevel
-   Set the "noisyness" level of the build, by setting MAKEVERBOSE
+   Set the "noisiness" level of the build, by setting MAKEVERBOSE
to noiselevel.
 
  -nShow the commands that would be executed by build.sh, but do

Index: src/doc/BUILDING.mdoc
diff -u src/doc/BUILDING.mdoc:1.149 src/doc/BUILDING.mdoc:1.150
--- src/doc/BUILDING.mdoc:1.149	Sat Jul 22 18:50:04 2023
+++ src/doc/BUILDING.mdoc	Fri Apr 26 17:38:44 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: BUILDING.mdoc,v 1.149 2023/07/22 18:50:04 lukem Exp $
+.\"	$NetBSD: BUILDING.mdoc,v 1.150 2024/04/26 17:38:44 rillig Exp $
 .\"
 .\" Copyright (c) 2001-2023 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -1645,7 +1645,7 @@ settings.
 .
 .It Fl N Ar noiselevel
 Set the
-.Dq noisyness
+.Dq noisiness
 level of the build, by setting
 .Sy MAKEVERBOSE
 to



CVS commit: src/external/mit/xorg/lib/dri

2024-04-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 17:22:26 UTC 2024

Modified Files:
src/external/mit/xorg/lib/dri: Makefile

Log Message:
dri: disable lint


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/external/mit/xorg/lib/dri/Makefile

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

Modified files:

Index: src/external/mit/xorg/lib/dri/Makefile
diff -u src/external/mit/xorg/lib/dri/Makefile:1.40 src/external/mit/xorg/lib/dri/Makefile:1.41
--- src/external/mit/xorg/lib/dri/Makefile:1.40	Sun Apr 21 00:23:23 2024
+++ src/external/mit/xorg/lib/dri/Makefile	Fri Apr 26 17:22:26 2024
@@ -1,7 +1,9 @@
-# $NetBSD: Makefile,v 1.40 2024/04/21 00:23:23 maya Exp $
+# $NetBSD: Makefile,v 1.41 2024/04/26 17:22:26 rillig Exp $
 
 # Link the mesa_dri_drivers mega driver.
 
+NOLINT=		# Lots of "Unsupported platform" due to undefined __GNUC__
+
 .include 
 
 .include "../mesa-which.mk"



CVS commit: src/external/mit/xorg/lib/dri

2024-04-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 17:22:26 UTC 2024

Modified Files:
src/external/mit/xorg/lib/dri: Makefile

Log Message:
dri: disable lint


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/external/mit/xorg/lib/dri/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

2024-04-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 17:11:22 UTC 2024

Modified Files:
src/usr.bin/make: job.c
src/usr.bin/make/unit-tests: opt-debug-errors-jobs.exp

Log Message:
make: in parallel mode, print the directory in which a job failed

When multiple targets run in parallel, the "stopped in" line may be
several lines away from the "Failed target" line, making them hard to
correlate.


To generate a diff of this commit:
cvs rdiff -u -r1.468 -r1.469 src/usr.bin/make/job.c
cvs rdiff -u -r1.4 -r1.5 \
src/usr.bin/make/unit-tests/opt-debug-errors-jobs.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/job.c
diff -u src/usr.bin/make/job.c:1.468 src/usr.bin/make/job.c:1.469
--- src/usr.bin/make/job.c:1.468	Sat Apr 20 10:18:55 2024
+++ src/usr.bin/make/job.c	Fri Apr 26 17:11:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.468 2024/04/20 10:18:55 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.469 2024/04/26 17:11:22 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -141,7 +141,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.468 2024/04/20 10:18:55 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.469 2024/04/26 17:11:22 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -1062,6 +1062,7 @@ DebugFailedJob(const Job *job)
 
 	debug_printf("\n");
 	debug_printf("*** Failed target: %s\n", job->node->name);
+	debug_printf("*** In directory: %s\n", curdir);
 	debug_printf("*** Failed commands:\n");
 	for (ln = job->node->commands.first; ln != NULL; ln = ln->next) {
 		const char *cmd = ln->datum;

Index: src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp
diff -u src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp:1.4 src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp:1.5
--- src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp:1.4	Sun Nov 28 00:02:07 2021
+++ src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp	Fri Apr 26 17:11:22 2024
@@ -2,6 +2,7 @@ echo '3   spaces'; false
 3   spaces
 
 *** Failed target: fail-spaces
+*** In directory: 
 *** Failed commands:
 	echo '3   spaces'; false
 *** [fail-spaces] Error code 1
@@ -11,6 +12,7 @@ echo \  indented; false
   indented
 
 *** Failed target: fail-escaped-space
+*** In directory: 
 *** Failed commands:
 	echo \  indented; false
 *** [fail-escaped-space] Error code 1
@@ -22,6 +24,7 @@ line1
 line2
 
 *** Failed target: fail-newline
+*** In directory: 
 *** Failed commands:
 	echo 'line1${.newline}line2'; false
 	=> echo 'line1
@@ -33,6 +36,7 @@ echo 'line1 line2'; false
 line1 line2
 
 *** Failed target: fail-multiline
+*** In directory: 
 *** Failed commands:
 	echo 'line1 line2'; false
 *** [fail-multiline] Error code 1
@@ -42,6 +46,7 @@ echo	'word1'			 'word2'; false
 word1 word2
 
 *** Failed target: fail-multiline-intention
+*** In directory: 
 *** Failed commands:
 	echo	'word1'			 'word2'; false
 *** [fail-multiline-intention] Error code 1
@@ -49,6 +54,7 @@ word1 word2
 make: stopped in unit-tests
 
 *** Failed target: fail-vars
+*** In directory: 
 *** Failed commands:
 	@${COMPILE_C} ${COMPILE_C_FLAGS}
 	=> @false c-compiler flag1 -macro="several words"



CVS commit: src/usr.bin/make

2024-04-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 17:11:22 UTC 2024

Modified Files:
src/usr.bin/make: job.c
src/usr.bin/make/unit-tests: opt-debug-errors-jobs.exp

Log Message:
make: in parallel mode, print the directory in which a job failed

When multiple targets run in parallel, the "stopped in" line may be
several lines away from the "Failed target" line, making them hard to
correlate.


To generate a diff of this commit:
cvs rdiff -u -r1.468 -r1.469 src/usr.bin/make/job.c
cvs rdiff -u -r1.4 -r1.5 \
src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp

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



CVS commit: src/external/mit/xorg/lib/gallium

2024-04-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 16:34:18 UTC 2024

Modified Files:
src/external/mit/xorg/lib/gallium: Makefile

Log Message:
gallium: disable lint


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/external/mit/xorg/lib/gallium/Makefile

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

Modified files:

Index: src/external/mit/xorg/lib/gallium/Makefile
diff -u src/external/mit/xorg/lib/gallium/Makefile:1.53 src/external/mit/xorg/lib/gallium/Makefile:1.54
--- src/external/mit/xorg/lib/gallium/Makefile:1.53	Sat Nov 25 20:00:25 2023
+++ src/external/mit/xorg/lib/gallium/Makefile	Fri Apr 26 16:34:17 2024
@@ -1,10 +1,12 @@
-# $NetBSD: Makefile,v 1.53 2023/11/25 20:00:25 rjs Exp $
+# $NetBSD: Makefile,v 1.54 2024/04/26 16:34:17 rillig Exp $
 
 # Link the gallium mega driver.
 
 LIBISMODULE=	yes
 LIBISCXX= yes
 
+NOLINT=		# Lots of "Unsupported platform" due to undefined __GNUC__
+
 .include 
 
 .include "../mesa-which.mk"



CVS commit: src/external/mit/xorg/lib/gallium

2024-04-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 16:34:18 UTC 2024

Modified Files:
src/external/mit/xorg/lib/gallium: Makefile

Log Message:
gallium: disable lint


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/external/mit/xorg/lib/gallium/Makefile

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



CVS commit: src/tests/bin/cp

2024-04-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 01:33:23 UTC 2024

Modified Files:
src/tests/bin/cp: t_cp.sh

Log Message:
tests/cp: clean up

Replace the deprecated "eq:0" with "exit:0", remove redundant "-o empty"
and "-e empty".


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/bin/cp/t_cp.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/bin/cp/t_cp.sh
diff -u src/tests/bin/cp/t_cp.sh:1.1 src/tests/bin/cp/t_cp.sh:1.2
--- src/tests/bin/cp/t_cp.sh:1.1	Sat Mar 17 16:33:10 2012
+++ src/tests/bin/cp/t_cp.sh	Fri Apr 26 01:33:23 2024
@@ -1,4 +1,4 @@
-# $NetBSD: t_cp.sh,v 1.1 2012/03/17 16:33:10 jruoho Exp $
+# $NetBSD: t_cp.sh,v 1.2 2024/04/26 01:33:23 rillig Exp $
 #
 # Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -62,7 +62,7 @@ file_to_file_simple() {
 	rm -f file2
 	umask 022
 	chmod 777 file
-	atf_check -s eq:0 -o empty -e empty cp file file2
+	atf_check cp file file2
 	cp_compare file_to_file_simple file file2
 	if [ `stat -f "%Lp" file2` != "755" ]; then
 		atf_fail "new file not created with umask"
@@ -80,7 +80,7 @@ file_to_file_preserve() {
 	rm file3
 	chmod 644 file
 	chflags nodump file
-	atf_check -s eq:0 -o empty -e empty cp -p file file3
+	atf_check cp -p file file3
 	finfo=`stat -f "%p%u%g%m%z%f" file`
 	f3info=`stat -f "%p%u%g%m%z%f" file3`
 	if [ $finfo != $f3info ]; then
@@ -92,7 +92,7 @@ file_to_file_noflags() {
 	rm file3
 	chmod 644 file
 	chflags nodump file
-	atf_check -s eq:0 -o empty -e empty cp -p -N file file3
+	atf_check cp -p -N file file3
 	finfo=`stat -f "%f" file`
 	f3info=`stat -f "%f" file3`
 	if [ $finfo = $f3info ]; then
@@ -106,7 +106,7 @@ file_to_link_head() {
 }
 file_to_link_body() {
 	reset
-	atf_check -s eq:0 -o empty -e empty cp file2 link
+	atf_check cp file2 link
 	cp_compare file_to_link file file2
 }
 
@@ -117,8 +117,8 @@ link_to_file_head() {
 link_to_file_body() {
 	reset
 	# file and link are identical (not copied).
-	atf_check -s eq:1 -o empty -e ignore cp link file
-	atf_check -s eq:0 -o empty -e empty cp link file2
+	atf_check -s exit:1 -e ignore cp link file
+	atf_check cp link file2
 	cp_compare link_to_file file file2
 }
 
@@ -129,7 +129,7 @@ file_over_link_head() {
 }
 file_over_link_body() {
 	reset
-	atf_check -s eq:0 -o empty -e empty cp -P file link
+	atf_check cp -P file link
 	cp_compare file_over_link file link
 }
 
@@ -140,7 +140,7 @@ link_over_file_head() {
 }
 link_over_file_body() {
 	reset
-	atf_check -s eq:0 -o empty -e empty cp -P link file
+	atf_check cp -P link file
 	if [ `readlink link` != `readlink file` ]; then
 		atf_fail "readlink link != readlink file"
 	fi
@@ -153,8 +153,8 @@ files_to_dir_head() {
 files_to_dir_body() {
 	reset
 	# can't copy multiple files to a file
-	atf_check -s eq:1 -o empty -e ignore cp file file2 file3
-	atf_check -s eq:0 -o empty -e empty cp file file2 link dir
+	atf_check -s exit:1 -e ignore cp file file2 file3
+	atf_check cp file file2 link dir
 	cp_compare files_to_dir file "dir/file"
 }
 
@@ -166,8 +166,8 @@ dir_to_file_head() {
 dir_to_file_body() {
 	reset
 	# can't copy a dir onto a file
-	atf_check -s eq:1 -o empty -e ignore cp dir file
-	atf_check -s eq:1 -o empty -e ignore cp -R dir file
+	atf_check -s exit:1 -e ignore cp dir file
+	atf_check -s exit:1 -e ignore cp -R dir file
 }
 
 atf_test_case file_to_linkdir
@@ -177,12 +177,12 @@ file_to_linkdir_head() {
 }
 file_to_linkdir_body() {
 	reset
-	atf_check -s eq:0 -o empty -e empty cp file dirlink
+	atf_check cp file dirlink
 	cp_compare file_to_linkdir file "dir/file"
 
 	# overwrite the link
-	atf_check -s eq:0 -o empty -e empty cp -P file dirlink
-	atf_check -s eq:1 -o empty -e empty readlink dirlink
+	atf_check cp -P file dirlink
+	atf_check -s exit:1 readlink dirlink
 	cp_compare file_to_linkdir file dirlink
 }
 
@@ -194,21 +194,21 @@ linkdir_to_file_head() {
 linkdir_to_file_body() {
 	reset
 	# cannot copy a dir onto a file
-	atf_check -s eq:1 -o empty -e ignore cp dirlink file
+	atf_check -s exit:1 -e ignore cp dirlink file
 
 	# overwrite the link
-	atf_check -s eq:0 -o empty -e empty cp -P dirlink file
+	atf_check cp -P dirlink file
 	if [ `readlink file` != `readlink dirlink` ]; then
 		atf_fail "readlink link != readlink file"
 	fi
 }
 
 dir_to_dne_no_R() {
-	atf_check -s eq:1 -o empty -e ignore cp dir dir2
+	atf_check -s exit:1 -e ignore cp dir dir2
 }
 
 dir_to_dne() {
-	atf_check -s eq:0 -o empty -e empty cp -R dir dir2
+	atf_check cp -R dir dir2
 	cp_compare dir_to_dne "dir/file" "dir2/file"
 	readlink dir2/link >/dev/null
 	if [ $? -gt 0 ]; then
@@ -218,12 +218,12 @@ dir_to_dne() {
 
 dir_to_dir_H() {
 	dir_to_dir_setup
-	atf_check -s eq:0 -o empty -e empty cp -R dir dir2
+	atf_check cp -R dir dir2
 
 	chmod 777 dir
 
 	# copy a dir into a dir, only command-line links are followed
-	atf_check -s eq:0 -o empty -e empty cp -R -H dirlink dir2
+	

CVS commit: src/tests/bin/cp

2024-04-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 01:33:23 UTC 2024

Modified Files:
src/tests/bin/cp: t_cp.sh

Log Message:
tests/cp: clean up

Replace the deprecated "eq:0" with "exit:0", remove redundant "-o empty"
and "-e empty".


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/bin/cp/t_cp.sh

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



CVS commit: src/tests/bin/cat

2024-04-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 00:57:15 UTC 2024

Modified Files:
src/tests/bin/cat: t_cat.sh

Log Message:
tests/cat: clean up

Multiple arguments to atf_set are joined by spaces, there's no need for
an extra space.

The exit status on success must be 0, so don't ignore it.

Remove the unnecessary shell wrapper, as no redirection is going on.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/bin/cat/t_cat.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/bin/cat/t_cat.sh
diff -u src/tests/bin/cat/t_cat.sh:1.3 src/tests/bin/cat/t_cat.sh:1.4
--- src/tests/bin/cat/t_cat.sh:1.3	Thu Jun 16 01:04:58 2016
+++ src/tests/bin/cat/t_cat.sh	Fri Apr 26 00:57:15 2024
@@ -1,4 +1,4 @@
-# $NetBSD: t_cat.sh,v 1.3 2016/06/16 01:04:58 sevan Exp $
+# $NetBSD: t_cat.sh,v 1.4 2024/04/26 00:57:15 rillig Exp $
 #
 # Copyright (c) 2012 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -30,37 +30,37 @@
 
 atf_test_case align
 align_head() {
-	atf_set "descr" "Test that cat(1) aligns the output " \
+	atf_set "descr" "Test that cat(1) aligns the output" \
 			"right with options '-be' (PR bin/4841)"
 }
 
 align_body() {
 
-	atf_check -s ignore -o file:$(atf_get_srcdir)/d_align.out \
-		-x "cat -be $(atf_get_srcdir)/d_align.in"
+	atf_check -o file:$(atf_get_srcdir)/d_align.out \
+	cat -be $(atf_get_srcdir)/d_align.in
 }
 
 atf_test_case nonexistent
 nonexistent_head() {
-	atf_set "descr" "Test that cat(1) doesn't return zero exit " \
+	atf_set "descr" "Test that cat(1) doesn't return zero exit" \
 			"status for a nonexistent file (PR bin/3538)"
 }
 
 nonexistent_body() {
 
-	atf_check -s not-exit:0 -o empty -e not-empty \
-		-x "cat /some/name/that/does/not/exist"
+	atf_check -s not-exit:0 -e not-empty \
+	cat /some/name/that/does/not/exist
 }
 
 atf_test_case se_output
 se_output_head() {
-	atf_set "descr" "Test that cat(1) prints a $ sign " \
+	atf_set "descr" "Test that cat(1) prints a $ sign" \
 			"on blank lines with options '-se' (PR bin/51250)"
 }
 
 se_output_body() {
-	atf_check -s ignore -o file:$(atf_get_srcdir)/d_se_output.out \
-		-x "cat -se $(atf_get_srcdir)/d_se_output.in"
+	atf_check -o file:$(atf_get_srcdir)/d_se_output.out \
+	cat -se $(atf_get_srcdir)/d_se_output.in
 }
 
 atf_init_test_cases()



CVS commit: src/tests/bin/cat

2024-04-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 00:57:15 UTC 2024

Modified Files:
src/tests/bin/cat: t_cat.sh

Log Message:
tests/cat: clean up

Multiple arguments to atf_set are joined by spaces, there's no need for
an extra space.

The exit status on success must be 0, so don't ignore it.

Remove the unnecessary shell wrapper, as no redirection is going on.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/bin/cat/t_cat.sh

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



CVS commit: src/doc

2024-04-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Apr 25 17:22:49 UTC 2024

Modified Files:
src/doc: CHANGES

Log Message:
CHANGES: fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.3050 -r1.3051 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.3050 src/doc/CHANGES:1.3051
--- src/doc/CHANGES:1.3050	Wed Apr 24 15:41:41 2024
+++ src/doc/CHANGES	Thu Apr 25 17:22:48 2024
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.3050 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.3051 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -137,7 +137,7 @@ Changes from NetBSD 10.0 to NetBSD 11.0:
 		[gutteridge 20230630]
 	tetris(6): Support the informal standard of allowing setting NO_COLOR
 		in the environment to disable the use of color. [nia 20230701]
-	lint(1): Initial support for C23. [rilling 20230702]
+	lint(1): Initial support for C23. [rillig 20230702]
 	heartbeat(9): New mechanism to check progress of kernel.  This uses
 		hard interrupts to check progress of low-priority soft
 		interrupts, and one CPU to check progress of another CPU.
@@ -230,7 +230,7 @@ Changes from NetBSD 10.0 to NetBSD 11.0:
 	kernel: Replace various usage of extent(9) with vmem(9).
 		[thorpej 20231201]
 	indent(1): Use line number of the token start in diagnostics
-		[rilling 20231203]
+		[rillig 20231203]
 	vmem(9): Add the notion of "private boundary tags", allowing vmem
 		to be used VERY early in boot. [thorpej 20231203]
 	kernel: Modularize compat90. [pgoyette 20231209]
@@ -314,7 +314,7 @@ Changes from NetBSD 10.0 to NetBSD 11.0:
 		be matched by ugen(4) and accessed through libusb.
 		[thorpej 20240326]
 	moused(8): Remove undocumented and unused option 'C'.
-		[rilling 20240329]
+		[rillig 20240329]
 	ugen(4): Add a "ugen-unit" device property which devpubd(8) scripts
 		can query to determine which /dev/ugenN.xx nodes a given ugen
 		or ugenif device is using.  [thorpej 20240329]



CVS commit: src/doc

2024-04-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Apr 25 17:22:49 UTC 2024

Modified Files:
src/doc: CHANGES

Log Message:
CHANGES: fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.3050 -r1.3051 src/doc/CHANGES

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



CVS commit: src/usr.sbin/makefs

2024-04-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Apr 24 21:59:39 UTC 2024

Modified Files:
src/usr.sbin/makefs: walk.c

Log Message:
makefs: fix out-of-bounds fsnode count in fsnode_sort

Found by running './makefs img.dat cd9660'.

While here, apply more KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/makefs/walk.c

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



CVS commit: src/usr.sbin/makefs

2024-04-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Apr 24 21:59:39 UTC 2024

Modified Files:
src/usr.sbin/makefs: walk.c

Log Message:
makefs: fix out-of-bounds fsnode count in fsnode_sort

Found by running './makefs img.dat cd9660'.

While here, apply more KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/makefs/walk.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/makefs/walk.c
diff -u src/usr.sbin/makefs/walk.c:1.38 src/usr.sbin/makefs/walk.c:1.39
--- src/usr.sbin/makefs/walk.c:1.38	Wed Apr 24 14:23:37 2024
+++ src/usr.sbin/makefs/walk.c	Wed Apr 24 21:59:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: walk.c,v 1.38 2024/04/24 14:23:37 christos Exp $	*/
+/*	$NetBSD: walk.c,v 1.39 2024/04/24 21:59:39 rillig Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: walk.c,v 1.38 2024/04/24 14:23:37 christos Exp $");
+__RCSID("$NetBSD: walk.c,v 1.39 2024/04/24 21:59:39 rillig Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -93,7 +93,6 @@ fsnode_sort(fsnode *first, const char *r
 	size_t num = 0;
 
 	for (fsnode *tmp = first; tmp; tmp = tmp->next, num++) {
-		num++;
 		if (debug & DEBUG_DUMP_FSNODES_VERBOSE)
 			printf("%s: pre sort: %s %s %s\n",
 			__func__, root, dir, tmp->name);
@@ -103,7 +102,7 @@ fsnode_sort(fsnode *first, const char *r
 	for (fsnode *tmp = first; tmp; tmp = tmp->next)
 		*listptr++ = tmp;
 
-	qsort (list, num, sizeof(*list), fsnode_cmp);
+	qsort(list, num, sizeof(*list), fsnode_cmp);
 
 	for (size_t i = 0; i < num - 1; ++i)
 		list[i]->next = list[i + 1];
@@ -562,7 +561,7 @@ apply_specdir(const char *dir, NODE *spe
 			if (curfsnode->type != S_IFDIR)
 errx(EXIT_FAILURE,
 "`%s' is not a directory", path);
-			assert (curfsnode->child != NULL);
+			assert(curfsnode->child != NULL);
 			apply_specdir(path, curnode, curfsnode->child, speconly);
 		}
 	}
@@ -676,14 +675,14 @@ dump_fsnodes(fsnode *root)
 			assert(cur->symlink != NULL);
 			printf(" -> %s", cur->symlink);
 		} else {
-			assert (cur->symlink == NULL);
+			assert(cur->symlink == NULL);
 		}
 		if (cur->inode->nlink > 1)
 			printf(", nlinks=%d", cur->inode->nlink);
 		putchar('\n');
 
 		if (cur->child) {
-			assert (cur->type == S_IFDIR);
+			assert(cur->type == S_IFDIR);
 			dump_fsnodes(cur->child);
 		}
 	}



CVS commit: src/usr.bin/make

2024-04-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Apr 23 22:51:28 UTC 2024

Modified Files:
src/usr.bin/make: cond.c make.h parse.c var.c
src/usr.bin/make/unit-tests: cmd-errors-jobs.exp cmd-errors-jobs.mk
cmd-errors-lint.exp cmd-errors-lint.mk cmd-errors.exp cmd-errors.mk
cmdline-undefined.mk cmdline.mk comment.mk cond-cmp-string.mk
cond-func-defined.exp cond-func-defined.mk varmod-ifelse.mk
varmod-match.exp varmod-match.mk

Log Message:
make: clean up comments, code and tests


To generate a diff of this commit:
cvs rdiff -u -r1.362 -r1.363 src/usr.bin/make/cond.c
cvs rdiff -u -r1.330 -r1.331 src/usr.bin/make/make.h
cvs rdiff -u -r1.720 -r1.721 src/usr.bin/make/parse.c
cvs rdiff -u -r1.1104 -r1.1105 src/usr.bin/make/var.c
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp \
src/usr.bin/make/unit-tests/cmd-errors-lint.exp \
src/usr.bin/make/unit-tests/cmd-errors.mk
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/cmd-errors-lint.mk
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/cmd-errors.exp \
src/usr.bin/make/unit-tests/cond-func-defined.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cmdline-undefined.mk \
src/usr.bin/make/unit-tests/cmdline.mk
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/comment.mk
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/make/unit-tests/cond-cmp-string.mk
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cond-func-defined.mk
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/unit-tests/varmod-ifelse.mk
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/varmod-match.exp
cvs rdiff -u -r1.21 -r1.22 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.362 src/usr.bin/make/cond.c:1.363
--- src/usr.bin/make/cond.c:1.362	Wed Feb  7 07:21:22 2024
+++ src/usr.bin/make/cond.c	Tue Apr 23 22:51:28 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.362 2024/02/07 07:21:22 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.363 2024/04/23 22:51:28 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -91,7 +91,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.362 2024/02/07 07:21:22 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.363 2024/04/23 22:51:28 rillig Exp $");
 
 /*
  * Conditional expressions conform to this grammar:
@@ -424,13 +424,12 @@ CondParser_StringExpr(CondParser *par, c
  * Parse a string from an expression or an optionally quoted string,
  * on the left-hand and right-hand sides of comparisons.
  *
- * Results:
- *	Returns the string without any enclosing quotes, or NULL on error.
- *	Sets out_quoted if the leaf was a quoted string literal.
+ * Return the string without any enclosing quotes, or NULL on error.
+ * Sets out_quoted if the leaf was a quoted string literal.
  */
-static void
+static FStr
 CondParser_Leaf(CondParser *par, bool doEval, bool unquotedOK,
-		  FStr *out_str, bool *out_quoted)
+		bool *out_quoted)
 {
 	Buffer buf;
 	FStr str;
@@ -492,7 +491,7 @@ return_buf:
 	buf.data = NULL;
 return_str:
 	Buf_Done();
-	*out_str = str;
+	return str;
 }
 
 /*
@@ -602,7 +601,7 @@ CondParser_Comparison(CondParser *par, b
 	ComparisonOp op;
 	bool lhsQuoted, rhsQuoted;
 
-	CondParser_Leaf(par, doEval, par->leftUnquotedOK, , );
+	lhs = CondParser_Leaf(par, doEval, par->leftUnquotedOK, );
 	if (lhs.str == NULL)
 		goto done_lhs;
 
@@ -622,7 +621,7 @@ CondParser_Comparison(CondParser *par, b
 		goto done_lhs;
 	}
 
-	CondParser_Leaf(par, doEval, true, , );
+	rhs = CondParser_Leaf(par, doEval, true, );
 	t = rhs.str == NULL ? TOK_ERROR
 	: !doEval ? TOK_FALSE
 	: EvalCompare(par, lhs.str, lhsQuoted, op, rhs.str, rhsQuoted);

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.330 src/usr.bin/make/make.h:1.331
--- src/usr.bin/make/make.h:1.330	Sat Apr 20 10:18:55 2024
+++ src/usr.bin/make/make.h	Tue Apr 23 22:51:28 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.330 2024/04/20 10:18:55 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.331 2024/04/23 22:51:28 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -399,7 +399,7 @@ typedef struct SearchPath {
 
 /*
  * A graph node represents a target that can possibly be made, including its
- * relation to other targets and a lot of other details.
+ * relation to other targets.
  */
 typedef struct GNode {
 	/* The target's name, such as "clean" or "make.c" */
@@ -581,8 +581,8 @@ extern GNode *SCOPE_GLOBAL;
 extern GNode *SCOPE_CMDLINE;
 
 /*
- * Value returned by Var_Parse when an error is encountered. It actually
- * points to an empty string, so naive callers needn't worry about it.
+ * Value returned by Var_Parse when an error is 

CVS commit: src/usr.bin/make

2024-04-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Apr 23 22:51:28 UTC 2024

Modified Files:
src/usr.bin/make: cond.c make.h parse.c var.c
src/usr.bin/make/unit-tests: cmd-errors-jobs.exp cmd-errors-jobs.mk
cmd-errors-lint.exp cmd-errors-lint.mk cmd-errors.exp cmd-errors.mk
cmdline-undefined.mk cmdline.mk comment.mk cond-cmp-string.mk
cond-func-defined.exp cond-func-defined.mk varmod-ifelse.mk
varmod-match.exp varmod-match.mk

Log Message:
make: clean up comments, code and tests


To generate a diff of this commit:
cvs rdiff -u -r1.362 -r1.363 src/usr.bin/make/cond.c
cvs rdiff -u -r1.330 -r1.331 src/usr.bin/make/make.h
cvs rdiff -u -r1.720 -r1.721 src/usr.bin/make/parse.c
cvs rdiff -u -r1.1104 -r1.1105 src/usr.bin/make/var.c
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp \
src/usr.bin/make/unit-tests/cmd-errors-lint.exp \
src/usr.bin/make/unit-tests/cmd-errors.mk
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/cmd-errors-lint.mk
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/cmd-errors.exp \
src/usr.bin/make/unit-tests/cond-func-defined.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cmdline-undefined.mk \
src/usr.bin/make/unit-tests/cmdline.mk
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/comment.mk
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/make/unit-tests/cond-cmp-string.mk
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cond-func-defined.mk
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/unit-tests/varmod-ifelse.mk
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/varmod-match.exp
cvs rdiff -u -r1.21 -r1.22 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

2024-04-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 21 21:59:48 UTC 2024

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

Log Message:
make: trim down code for parsing the :gmtime and :localtime modifiers

The :gmtime and :localtime modifiers are not used often and thus are not
time-critical. Exchange the custom code that parses an integer from a
substring for an additional memory allocation.

Thanks sjg@ for suggesting to avoid the custom parsing code.


To generate a diff of this commit:
cvs rdiff -u -r1.1103 -r1.1104 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.1103 src/usr.bin/make/var.c:1.1104
--- src/usr.bin/make/var.c:1.1103	Sun Apr 21 08:56:49 2024
+++ src/usr.bin/make/var.c	Sun Apr 21 21:59:48 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1103 2024/04/21 08:56:49 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.1104 2024/04/21 21:59:48 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -137,7 +137,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1103 2024/04/21 08:56:49 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1104 2024/04/21 21:59:48 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -2515,26 +2515,6 @@ TryParseTime(const char **pp, time_t *ou
 	return true;
 }
 
-static bool
-Substring_ParseTime(Substring s, time_t *out_time)
-{
-	const char *p;
-	unsigned long n;
-
-	n = 0;
-	for (p = s.start; p != s.end && ch_isdigit(*p); p++) {
-		unsigned long next = 10 * n + ((unsigned)*p - '0');
-		if (next < n)
-			return false;
-		n = next;
-	}
-	if (p == s.start || p != s.end)
-		return false;
-
-	*out_time = (time_t)n;	/* ignore possible truncation for now */
-	return true;
-}
-
 /* :gmtime and :localtime */
 static ApplyModifierResult
 ApplyModifier_Time(const char **pp, ModChain *ch)
@@ -2552,21 +2532,22 @@ ApplyModifier_Time(const char **pp, ModC
 	if (args[0] == '=') {
 		const char *p = args + 1;
 		LazyBuf buf;
+		FStr arg;
 		if (!ParseModifierPartSubst(, true, '\0', ch->expr->emode,
 		ch, , NULL, NULL))
 			return AMR_CLEANUP;
+		arg = LazyBuf_DoneGet();
 		if (ModChain_ShouldEval(ch)) {
-			Substring arg = LazyBuf_Get();
-			if (!Substring_ParseTime(arg, )) {
+			const char *arg_p = arg.str;
+			if (!TryParseTime(_p, ) || *arg_p != '\0') {
 Parse_Error(PARSE_FATAL,
-"Invalid time value \"%.*s\"",
-(int)Substring_Length(arg), arg.start);
-LazyBuf_Done();
+"Invalid time value \"%s\"", arg.str);
+FStr_Done();
 return AMR_CLEANUP;
 			}
 		} else
 			t = 0;
-		LazyBuf_Done();
+		FStr_Done();
 		*pp = p;
 	} else {
 		t = 0;



CVS commit: src/usr.bin/make

2024-04-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 21 21:59:48 UTC 2024

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

Log Message:
make: trim down code for parsing the :gmtime and :localtime modifiers

The :gmtime and :localtime modifiers are not used often and thus are not
time-critical. Exchange the custom code that parses an integer from a
substring for an additional memory allocation.

Thanks sjg@ for suggesting to avoid the custom parsing code.


To generate a diff of this commit:
cvs rdiff -u -r1.1103 -r1.1104 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/external/bsd/ntp/lib/libntp

2024-04-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 21 17:19:52 UTC 2024

Modified Files:
src/external/bsd/ntp/lib/libntp: Makefile

Log Message:
libntf: make MKREPRO timestamp compatible with NetBSD 10

In NetBSD 10, make(1) cannot handle :gmtime arguments that are
expressions, resulting in the error message "Unknown modifier '1'".


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/external/bsd/ntp/lib/libntp/Makefile

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



CVS commit: src/external/bsd/ntp/lib/libntp

2024-04-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 21 17:19:52 UTC 2024

Modified Files:
src/external/bsd/ntp/lib/libntp: Makefile

Log Message:
libntf: make MKREPRO timestamp compatible with NetBSD 10

In NetBSD 10, make(1) cannot handle :gmtime arguments that are
expressions, resulting in the error message "Unknown modifier '1'".


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/external/bsd/ntp/lib/libntp/Makefile

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

Modified files:

Index: src/external/bsd/ntp/lib/libntp/Makefile
diff -u src/external/bsd/ntp/lib/libntp/Makefile:1.35 src/external/bsd/ntp/lib/libntp/Makefile:1.36
--- src/external/bsd/ntp/lib/libntp/Makefile:1.35	Sat Apr 20 08:03:08 2024
+++ src/external/bsd/ntp/lib/libntp/Makefile	Sun Apr 21 17:19:52 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.35 2024/04/20 08:03:08 rillig Exp $
+#	$NetBSD: Makefile,v 1.36 2024/04/21 17:19:52 rillig Exp $
 
 LIBISPRIVATE=yes
 
@@ -88,8 +88,8 @@ CPPFLAGS+= -I${IDIST}/sntp/libopts
 # For MKREPRO, avoid using __DATE__ and __TIME__.
 .if ${MKREPRO:Uno} == "yes"
 MKREPRO_CPPFLAGS.ntp_calendar.c:= \
-	-DMKREPRO_DATE=\"${%b %e %Y:L:gmtime=${MKREPRO_TIMESTAMP}:Q}\" \
-	-DMKREPRO_TIME=\"${%T:L:gmtime=${MKREPRO_TIMESTAMP}:Q}\"
+	-DMKREPRO_DATE=\"${%b %e %Y:L:${:Ugmtime=${MKREPRO_TIMESTAMP}}:Q}\" \
+	-DMKREPRO_TIME=\"${%T:L:${:Ugmtime=${MKREPRO_TIMESTAMP}}:Q}\"
 CPPFLAGS.ntp_calendar.c += ${MKREPRO_CPPFLAGS.ntp_calendar.c}
 .endif
 



CVS commit: src/usr.bin/make

2024-04-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 21 08:56:49 UTC 2024

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

Log Message:
make: fix out-of-bounds read when evaluating :gmtime and :localtime

The function TryParseTime takes a pointer to a string, but the LazyBuf
returns a Substring, which is not guaranteed to be null-terminated or
delimited.  In TryParseTime, calling strtoul on the Substring read past
the end of the substring.

Noticed in the NetBSD build in libntp, where the :gmtime modifier is
used in two places with the same timestamp value, of which the first was
evaluated correctly and the second wasn't.

The bug was introduced in var.c 1.1050 from 2023-05-09, when the
argument of the :gmtime and :localtime modifiers was allowed to be an
expression instead of an integer constant.


To generate a diff of this commit:
cvs rdiff -u -r1.1102 -r1.1103 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.1102 src/usr.bin/make/var.c:1.1103
--- src/usr.bin/make/var.c:1.1102	Sat Apr 20 10:18:55 2024
+++ src/usr.bin/make/var.c	Sun Apr 21 08:56:49 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1102 2024/04/20 10:18:55 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.1103 2024/04/21 08:56:49 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -137,7 +137,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1102 2024/04/20 10:18:55 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1103 2024/04/21 08:56:49 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -2515,6 +2515,26 @@ TryParseTime(const char **pp, time_t *ou
 	return true;
 }
 
+static bool
+Substring_ParseTime(Substring s, time_t *out_time)
+{
+	const char *p;
+	unsigned long n;
+
+	n = 0;
+	for (p = s.start; p != s.end && ch_isdigit(*p); p++) {
+		unsigned long next = 10 * n + ((unsigned)*p - '0');
+		if (next < n)
+			return false;
+		n = next;
+	}
+	if (p == s.start || p != s.end)
+		return false;
+
+	*out_time = (time_t)n;	/* ignore possible truncation for now */
+	return true;
+}
+
 /* :gmtime and :localtime */
 static ApplyModifierResult
 ApplyModifier_Time(const char **pp, ModChain *ch)
@@ -2537,8 +2557,7 @@ ApplyModifier_Time(const char **pp, ModC
 			return AMR_CLEANUP;
 		if (ModChain_ShouldEval(ch)) {
 			Substring arg = LazyBuf_Get();
-			const char *arg_p = arg.start;
-			if (!TryParseTime(_p, ) || arg_p != arg.end) {
+			if (!Substring_ParseTime(arg, )) {
 Parse_Error(PARSE_FATAL,
 "Invalid time value \"%.*s\"",
 (int)Substring_Length(arg), arg.start);



CVS commit: src/usr.bin/make

2024-04-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 21 08:56:49 UTC 2024

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

Log Message:
make: fix out-of-bounds read when evaluating :gmtime and :localtime

The function TryParseTime takes a pointer to a string, but the LazyBuf
returns a Substring, which is not guaranteed to be null-terminated or
delimited.  In TryParseTime, calling strtoul on the Substring read past
the end of the substring.

Noticed in the NetBSD build in libntp, where the :gmtime modifier is
used in two places with the same timestamp value, of which the first was
evaluated correctly and the second wasn't.

The bug was introduced in var.c 1.1050 from 2023-05-09, when the
argument of the :gmtime and :localtime modifiers was allowed to be an
expression instead of an integer constant.


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

2024-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 20 12:25:46 UTC 2024

Modified Files:
src: build.sh

Log Message:
build.sh: fix typos in usage message


To generate a diff of this commit:
cvs rdiff -u -r1.375 -r1.376 src/build.sh

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



CVS commit: src

2024-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 20 12:25:46 UTC 2024

Modified Files:
src: build.sh

Log Message:
build.sh: fix typos in usage message


To generate a diff of this commit:
cvs rdiff -u -r1.375 -r1.376 src/build.sh

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

Modified files:

Index: src/build.sh
diff -u src/build.sh:1.375 src/build.sh:1.376
--- src/build.sh:1.375	Wed Jan  3 02:48:45 2024
+++ src/build.sh	Sat Apr 20 12:25:46 2024
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#	$NetBSD: build.sh,v 1.375 2024/01/03 02:48:45 thorpej Exp $
+#	$NetBSD: build.sh,v 1.376 2024/04/20 12:25:46 rillig Exp $
 #
 # Copyright (c) 2001-2023 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1091,7 +1091,7 @@ help()
 list-arch   Show a list of valid MACHINE/MACHINE_ARCH values,
 and exit.  The list may be narrowed by passing glob
 patterns or exact values in MACHINE or MACHINE_ARCH.
-mkrepro-timestamp   Show the latest source timestamp used for reproducable
+mkrepro-timestamp   Show the latest source timestamp used for reproducible
 builds and exit.  Requires -P or -V MKREPRO=yes.
 
  Options:
@@ -1114,7 +1114,7 @@ help()
aliases that set MACHINE/MACHINE_ARCH pairs.
[Default: deduced from the host system if the host
OS is NetBSD]
--N NOISY   Set the noisyness (MAKEVERBOSE) level of the build to NOISY:
+-N NOISY   Set the noisiness (MAKEVERBOSE) level of the build to NOISY:
0   Minimal output ("quiet").
1   Describe what is occurring.
2   Describe what is occurring and echo the actual
@@ -2031,7 +2031,7 @@ createmakewrapper()
 	eval cat <

CVS commit: src/usr.bin/make

2024-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 20 10:18:56 UTC 2024

Modified Files:
src/usr.bin/make: compat.c job.c make.h parse.c var.c
src/usr.bin/make/unit-tests: Makefile cmd-errors-jobs.exp
cmd-errors-jobs.mk cmd-errors-lint.exp cmd-errors.exp
cond-token-string.exp cond-token-string.mk deptgt.exp deptgt.mk
directive-for-errors.exp directive-for-errors.mk directive-for.exp
directive-for.mk directive-include.exp directive-include.mk
directive-undef.exp directive-undef.mk lint.exp moderrs.exp
opt-debug-lint.exp opt-debug-lint.mk var-eval-short.exp
var-eval-short.mk var-op-expand.exp var-op-expand.mk vardebug.exp
vardebug.mk varmisc.exp varmod-assign.exp varmod-assign.mk
varmod-edge.exp varmod-edge.mk varmod-gmtime.exp varmod-gmtime.mk
varmod-hash.exp varmod-ifelse.exp varmod-ifelse.mk
varmod-indirect.exp varmod-indirect.mk varmod-localtime.exp
varmod-localtime.mk varmod-loop-delete.exp varmod-loop-delete.mk
varmod-loop-varname.exp varmod-loop-varname.mk
varmod-match-escape.exp varmod-match-escape.mk varmod-match.exp
varmod-match.mk varmod-mtime.exp varmod-mtime.mk varmod-range.exp
varmod-range.mk varmod-subst-regex.exp varmod-subst.exp
varmod-to-separator.exp varmod-to-separator.mk varmod.exp varmod.mk
varparse-errors.exp varparse-errors.mk

Log Message:
make: provide more context information for parse/evaluate errors


To generate a diff of this commit:
cvs rdiff -u -r1.254 -r1.255 src/usr.bin/make/compat.c
cvs rdiff -u -r1.467 -r1.468 src/usr.bin/make/job.c
cvs rdiff -u -r1.329 -r1.330 src/usr.bin/make/make.h
cvs rdiff -u -r1.719 -r1.720 src/usr.bin/make/parse.c
cvs rdiff -u -r1.1101 -r1.1102 src/usr.bin/make/var.c
cvs rdiff -u -r1.342 -r1.343 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp \
src/usr.bin/make/unit-tests/cmd-errors-lint.exp \
src/usr.bin/make/unit-tests/varmod-subst.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cmd-errors.exp \
src/usr.bin/make/unit-tests/varmod-mtime.exp
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cond-token-string.exp \
src/usr.bin/make/unit-tests/directive-include.exp \
src/usr.bin/make/unit-tests/var-eval-short.mk \
src/usr.bin/make/unit-tests/varmod-range.exp \
src/usr.bin/make/unit-tests/varmod-to-separator.exp \
src/usr.bin/make/unit-tests/varparse-errors.mk
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/cond-token-string.mk \
src/usr.bin/make/unit-tests/directive-for-errors.mk \
src/usr.bin/make/unit-tests/directive-undef.exp \
src/usr.bin/make/unit-tests/vardebug.mk \
src/usr.bin/make/unit-tests/varmod-mtime.mk
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/deptgt.exp \
src/usr.bin/make/unit-tests/varmod-match-escape.mk
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/deptgt.mk \
src/usr.bin/make/unit-tests/opt-debug-lint.mk \
src/usr.bin/make/unit-tests/varmod-edge.exp \
src/usr.bin/make/unit-tests/varmod-gmtime.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/directive-for-errors.exp
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/directive-for.exp \
src/usr.bin/make/unit-tests/varmod-gmtime.mk
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/unit-tests/directive-for.mk \
src/usr.bin/make/unit-tests/var-eval-short.exp
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/directive-include.mk \
src/usr.bin/make/unit-tests/directive-undef.mk \
src/usr.bin/make/unit-tests/varmod-localtime.exp \
src/usr.bin/make/unit-tests/varmod-to-separator.mk
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/lint.exp \
src/usr.bin/make/unit-tests/varmod-hash.exp \
src/usr.bin/make/unit-tests/varmod-loop-delete.exp \
src/usr.bin/make/unit-tests/varmod-loop-delete.mk
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/make/unit-tests/moderrs.exp \
src/usr.bin/make/unit-tests/vardebug.exp
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/make/unit-tests/opt-debug-lint.exp \
src/usr.bin/make/unit-tests/varmod-indirect.mk \
src/usr.bin/make/unit-tests/varmod-match-escape.exp
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/var-op-expand.exp \
src/usr.bin/make/unit-tests/varmod.exp
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/var-op-expand.mk \
src/usr.bin/make/unit-tests/varmisc.exp \
src/usr.bin/make/unit-tests/varmod-assign.exp \
src/usr.bin/make/unit-tests/varmod-assign.mk \
src/usr.bin/make/unit-tests/varmod-edge.mk \
src/usr.bin/make/unit-tests/varmod-ifelse.exp
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/make/unit-tests/varmod-ifelse.mk
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/unit-tests/varmod-indirect.exp
cvs rdiff -u 

CVS commit: src/external/bsd/ntp/lib/libntp

2024-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 20 08:03:08 UTC 2024

Modified Files:
src/external/bsd/ntp/lib/libntp: Makefile

Log Message:
libntp: clean up MKREPRO_TIMESTAMP handling

NetBSD's make has built-in support for formatting timestamps, so use
that instead of relying on an external tool.  The month name is still
always in the C locale, and possible errors are reported in the affected
line, due to the ':=' assignment operator.

Without the ':=' assignment operator, the intermediate variable would
not be necessary, but in that case, make's error handling is broken and
unspecific.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/external/bsd/ntp/lib/libntp/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

2024-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 20 10:18:56 UTC 2024

Modified Files:
src/usr.bin/make: compat.c job.c make.h parse.c var.c
src/usr.bin/make/unit-tests: Makefile cmd-errors-jobs.exp
cmd-errors-jobs.mk cmd-errors-lint.exp cmd-errors.exp
cond-token-string.exp cond-token-string.mk deptgt.exp deptgt.mk
directive-for-errors.exp directive-for-errors.mk directive-for.exp
directive-for.mk directive-include.exp directive-include.mk
directive-undef.exp directive-undef.mk lint.exp moderrs.exp
opt-debug-lint.exp opt-debug-lint.mk var-eval-short.exp
var-eval-short.mk var-op-expand.exp var-op-expand.mk vardebug.exp
vardebug.mk varmisc.exp varmod-assign.exp varmod-assign.mk
varmod-edge.exp varmod-edge.mk varmod-gmtime.exp varmod-gmtime.mk
varmod-hash.exp varmod-ifelse.exp varmod-ifelse.mk
varmod-indirect.exp varmod-indirect.mk varmod-localtime.exp
varmod-localtime.mk varmod-loop-delete.exp varmod-loop-delete.mk
varmod-loop-varname.exp varmod-loop-varname.mk
varmod-match-escape.exp varmod-match-escape.mk varmod-match.exp
varmod-match.mk varmod-mtime.exp varmod-mtime.mk varmod-range.exp
varmod-range.mk varmod-subst-regex.exp varmod-subst.exp
varmod-to-separator.exp varmod-to-separator.mk varmod.exp varmod.mk
varparse-errors.exp varparse-errors.mk

Log Message:
make: provide more context information for parse/evaluate errors


To generate a diff of this commit:
cvs rdiff -u -r1.254 -r1.255 src/usr.bin/make/compat.c
cvs rdiff -u -r1.467 -r1.468 src/usr.bin/make/job.c
cvs rdiff -u -r1.329 -r1.330 src/usr.bin/make/make.h
cvs rdiff -u -r1.719 -r1.720 src/usr.bin/make/parse.c
cvs rdiff -u -r1.1101 -r1.1102 src/usr.bin/make/var.c
cvs rdiff -u -r1.342 -r1.343 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp \
src/usr.bin/make/unit-tests/cmd-errors-lint.exp \
src/usr.bin/make/unit-tests/varmod-subst.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cmd-errors.exp \
src/usr.bin/make/unit-tests/varmod-mtime.exp
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cond-token-string.exp \
src/usr.bin/make/unit-tests/directive-include.exp \
src/usr.bin/make/unit-tests/var-eval-short.mk \
src/usr.bin/make/unit-tests/varmod-range.exp \
src/usr.bin/make/unit-tests/varmod-to-separator.exp \
src/usr.bin/make/unit-tests/varparse-errors.mk
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/cond-token-string.mk \
src/usr.bin/make/unit-tests/directive-for-errors.mk \
src/usr.bin/make/unit-tests/directive-undef.exp \
src/usr.bin/make/unit-tests/vardebug.mk \
src/usr.bin/make/unit-tests/varmod-mtime.mk
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/deptgt.exp \
src/usr.bin/make/unit-tests/varmod-match-escape.mk
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/deptgt.mk \
src/usr.bin/make/unit-tests/opt-debug-lint.mk \
src/usr.bin/make/unit-tests/varmod-edge.exp \
src/usr.bin/make/unit-tests/varmod-gmtime.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/directive-for-errors.exp
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/directive-for.exp \
src/usr.bin/make/unit-tests/varmod-gmtime.mk
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/unit-tests/directive-for.mk \
src/usr.bin/make/unit-tests/var-eval-short.exp
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/directive-include.mk \
src/usr.bin/make/unit-tests/directive-undef.mk \
src/usr.bin/make/unit-tests/varmod-localtime.exp \
src/usr.bin/make/unit-tests/varmod-to-separator.mk
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/lint.exp \
src/usr.bin/make/unit-tests/varmod-hash.exp \
src/usr.bin/make/unit-tests/varmod-loop-delete.exp \
src/usr.bin/make/unit-tests/varmod-loop-delete.mk
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/make/unit-tests/moderrs.exp \
src/usr.bin/make/unit-tests/vardebug.exp
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/make/unit-tests/opt-debug-lint.exp \
src/usr.bin/make/unit-tests/varmod-indirect.mk \
src/usr.bin/make/unit-tests/varmod-match-escape.exp
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/var-op-expand.exp \
src/usr.bin/make/unit-tests/varmod.exp
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/var-op-expand.mk \
src/usr.bin/make/unit-tests/varmisc.exp \
src/usr.bin/make/unit-tests/varmod-assign.exp \
src/usr.bin/make/unit-tests/varmod-assign.mk \
src/usr.bin/make/unit-tests/varmod-edge.mk \
src/usr.bin/make/unit-tests/varmod-ifelse.exp
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/make/unit-tests/varmod-ifelse.mk
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/unit-tests/varmod-indirect.exp
cvs rdiff -u 

CVS commit: src/external/bsd/ntp/lib/libntp

2024-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 20 08:03:08 UTC 2024

Modified Files:
src/external/bsd/ntp/lib/libntp: Makefile

Log Message:
libntp: clean up MKREPRO_TIMESTAMP handling

NetBSD's make has built-in support for formatting timestamps, so use
that instead of relying on an external tool.  The month name is still
always in the C locale, and possible errors are reported in the affected
line, due to the ':=' assignment operator.

Without the ':=' assignment operator, the intermediate variable would
not be necessary, but in that case, make's error handling is broken and
unspecific.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/external/bsd/ntp/lib/libntp/Makefile

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

Modified files:

Index: src/external/bsd/ntp/lib/libntp/Makefile
diff -u src/external/bsd/ntp/lib/libntp/Makefile:1.34 src/external/bsd/ntp/lib/libntp/Makefile:1.35
--- src/external/bsd/ntp/lib/libntp/Makefile:1.34	Fri Apr 19 16:04:28 2024
+++ src/external/bsd/ntp/lib/libntp/Makefile	Sat Apr 20 08:03:08 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.34 2024/04/19 16:04:28 jakllsch Exp $
+#	$NetBSD: Makefile,v 1.35 2024/04/20 08:03:08 rillig Exp $
 
 LIBISPRIVATE=yes
 
@@ -86,18 +86,11 @@ ymd2yd.c
 CPPFLAGS+= -I${IDIST}/sntp/libopts
 
 # For MKREPRO, avoid using __DATE__ and __TIME__.
-# Instead, use the date and time from ${MKREPRO_TIMESTAMP}
 .if ${MKREPRO:Uno} == "yes"
-.if ${MKREPRO_TIMESTAMP:Uundefined} == "undefined"
-.error MKREPRO_TIMESTAMP is undefined with MKREPRO active
-.endif
-MKREPRO_DATE != env LC_ALL=C ${TOOL_DATE} -u -r "${MKREPRO_TIMESTAMP}" "+%b %e %Y"
-MKREPRO_TIME != env LC_ALL=C ${TOOL_DATE} -u -r "${MKREPRO_TIMESTAMP}" "+%T"
-.if ${MKREPRO_DATE} == "" || ${MKREPRO_TIME} == ""
-.error empty MKREPRO_DATE or MKREPRO_TIME
-.endif
-CPPFLAGS.ntp_calendar.c += -DMKREPRO_DATE=\"${MKREPRO_DATE:Q}\"
-CPPFLAGS.ntp_calendar.c += -DMKREPRO_TIME=\"${MKREPRO_TIME:Q}\"
+MKREPRO_CPPFLAGS.ntp_calendar.c:= \
+	-DMKREPRO_DATE=\"${%b %e %Y:L:gmtime=${MKREPRO_TIMESTAMP}:Q}\" \
+	-DMKREPRO_TIME=\"${%T:L:gmtime=${MKREPRO_TIMESTAMP}:Q}\"
+CPPFLAGS.ntp_calendar.c += ${MKREPRO_CPPFLAGS.ntp_calendar.c}
 .endif
 
 COPTS.timetoa.c+=	${CC_WNO_FORMAT_TRUNCATION}



CVS commit: src

2024-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 20 14:06:47 UTC 2024

Modified Files:
src: UPDATING

Log Message:
UPDATING: remove not-so-recent entries


To generate a diff of this commit:
cvs rdiff -u -r1.347 -r1.348 src/UPDATING

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

Modified files:

Index: src/UPDATING
diff -u src/UPDATING:1.347 src/UPDATING:1.348
--- src/UPDATING:1.347	Thu Apr 11 06:20:29 2024
+++ src/UPDATING	Sat Apr 20 14:06:47 2024
@@ -1,4 +1,4 @@
-$NetBSD: UPDATING,v 1.347 2024/04/11 06:20:29 nia Exp $
+$NetBSD: UPDATING,v 1.348 2024/04/20 14:06:47 rillig Exp $
 
 This file (UPDATING) is intended to be a brief reference to recent
 changes that might cause problems in the build process, and a guide for
@@ -184,10 +184,6 @@ Recent changes:
 	tools/gcc or external/gpl/gcc, first try cleaning those objects and
 	removing the $DESTDIR/usr/include/g++ subdirectory.
 
-20201230:
-	lint1/ops.c is no longer autogenerated.  If this makes the build
-	fail, clean $OBJDIR/tools/*lint* and $OBJDIR/usr.bin/*xlint*.
-
 20201016:
 	MIPS kernel modules have been disabled until they work.  This will
 	turn up in extra files in the DESTDIR, which should be cleaned.
@@ -339,685 +335,6 @@ Recent changes:
 20190207:
 	GCC 7 switched for many ports.  Update builds are likely to fail.
 
-20180924:
-	A newer OpenSSL version has been imported. If you are doing
-	update builds, make sure to remove all old obj dirs, like:
-	cd /usr/obj && find . -type d -name openssl | xargs rm -rf
-
-20180717:
-	On aarch64 int64_t and related types have changed from long long
-	to long. This requires recompiling all C++ binaries.
-
-20180713:
-	On amd64 and i386 static binaries are now build position
-	independent. This requires recompilation of all object
-	files used to create the crunched /rescue binary.
-	Clean the rescue directory in your obj directory before
-	doing an update build, otherwise linking will fail.
-
-20180414:
-	Existing binutils was migrated to binutils.old.  Manual
-	removal of tools/binutils objects directory may be required
-	to fix tools build failure.
-
-20180311:
-	bdftopcf was updated and may need cleaning in the
-	src/external/mit/xorg/tools/bdftopcf subdirectory if there are
-	link errors.
-
-20180212:
-	between OpenSSL and GCC updates, many things may fail to build.
-	any failure that looks like GCC or openssl is best handled by
-	a clean destdir and objdir.  Full cleandir and destdir deletion
-	is recommended if build failures occur.
-
-20171225:
-	removal of the vadvise syscall requires manual removal of all
-	associated files from the libc build object directory (including
-	the .depend files) - a command like:
-		cd $OBJ && find . -type d -name libc | xargs rm -rf
-	For architectures that support multiple "compat" binary targets,
-	you'll need to cleanup both the regular libc directory and the
-	compat ones (the above command will do that).
-
-20171010:
-	a change to the build structure of external/bsd/acpica/bin/iasl
-	means that its objdir (or *.d and .depend at least) might need
-	to be manually removed - or a build done once without -u.
-
-20170822:
-	a new version of GMP has been imported and probably
-	will break parts of builds related to themselves or GCC, both
-	in the tools and the native section.  Remove all GCC, GMP, MPFR
-	and MPC objdirs or build once without -u.
-
-20170816:
-	a new version of MPFR and MPC have been imported and probably
-	will break parts of builds related to themselves or GCC, both
-	in the tools and the native section.  Remove all GCC, GMP, MPFR
-	and MPC objdirs or build once without -u.
-
-20170402:
-	a new version of dhcpcd has been imported, which does not support
-	update builds from the previous version. Remove your
-	external/bsd/dhcpcd object dir or build once without -u.
-
-20170211:
-	a new terminfo database has been imported.
-	The structure of it has changed slightly from prior versions and
-	an updated tic tool is required.
-	If you build.sh, don't use -u
-
-20170207:
-	various arch dependent libc/exect.S files were removed
-	Either remove the obj directories (lib/libc and compat/amd64/i386/lib
-	if it exists) or do a clean build.
-	(This is a bug in the make system, it should be corrected without
-	human intervention, but isn't.)
-
-20170104:
-	xinput build options have changed.
-	Remove the obj directory (external/mit/xorg/bin/xinput)
-	if you build.sh -u
-
-20170103:
-	a new version of flex has been imported.
-	Remove the file from obj (external/bsd/flex)
-	if you build.sh -u
-
-20161014:
-	a new version of OpenSSL has been imported.
-	Remove the files from obj (crypto/external/bsd/openssl) 
-	if you build.sh -u
-
-20161009:
-	a new version of dhcpcd has been imported with slightly changed
-	build infrastructure. When doing a build.sh -u this requires
-	pruning the external/bsd/dhcpcd objdir.
-
-20160914:
-	i386, amd64, shark, ofppc and macppc have joined 

CVS commit: src

2024-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 20 14:06:47 UTC 2024

Modified Files:
src: UPDATING

Log Message:
UPDATING: remove not-so-recent entries


To generate a diff of this commit:
cvs rdiff -u -r1.347 -r1.348 src/UPDATING

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



CVS commit: src

2024-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 20 13:24:49 UTC 2024

Modified Files:
src/bin: Makefile.inc
src/sbin: Makefile.inc
src/sbin/fsck_lfs: Makefile
src/sbin/newfs_lfs: Makefile
src/sbin/resize_ffs: Makefile
src/usr.bin: Makefile.inc
src/usr.bin/kdump: Makefile
src/usr.bin/ktruss: Makefile
src/usr.bin/rump_server: Makefile
src/usr.sbin: Makefile.inc

Log Message:
{usr.,}{s,}bin: replace LINT_SUPPORTED with the standard NOLINT

While here, re-enable lint in those cases where lint was skipped due to
a bug in interpreting abstract types, which was fixed in cgram.y 1.469
from 2023-08-02.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/bin/Makefile.inc
cvs rdiff -u -r1.23 -r1.24 src/sbin/Makefile.inc
cvs rdiff -u -r1.23 -r1.24 src/sbin/fsck_lfs/Makefile
cvs rdiff -u -r1.15 -r1.16 src/sbin/newfs_lfs/Makefile
cvs rdiff -u -r1.7 -r1.8 src/sbin/resize_ffs/Makefile
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/Makefile.inc
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/kdump/Makefile
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/ktruss/Makefile
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/rump_server/Makefile
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/Makefile.inc

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



CVS commit: src

2024-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 20 13:24:49 UTC 2024

Modified Files:
src/bin: Makefile.inc
src/sbin: Makefile.inc
src/sbin/fsck_lfs: Makefile
src/sbin/newfs_lfs: Makefile
src/sbin/resize_ffs: Makefile
src/usr.bin: Makefile.inc
src/usr.bin/kdump: Makefile
src/usr.bin/ktruss: Makefile
src/usr.bin/rump_server: Makefile
src/usr.sbin: Makefile.inc

Log Message:
{usr.,}{s,}bin: replace LINT_SUPPORTED with the standard NOLINT

While here, re-enable lint in those cases where lint was skipped due to
a bug in interpreting abstract types, which was fixed in cgram.y 1.469
from 2023-08-02.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/bin/Makefile.inc
cvs rdiff -u -r1.23 -r1.24 src/sbin/Makefile.inc
cvs rdiff -u -r1.23 -r1.24 src/sbin/fsck_lfs/Makefile
cvs rdiff -u -r1.15 -r1.16 src/sbin/newfs_lfs/Makefile
cvs rdiff -u -r1.7 -r1.8 src/sbin/resize_ffs/Makefile
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/Makefile.inc
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/kdump/Makefile
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/ktruss/Makefile
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/rump_server/Makefile
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/Makefile.inc

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

Modified files:

Index: src/bin/Makefile.inc
diff -u src/bin/Makefile.inc:1.18 src/bin/Makefile.inc:1.19
--- src/bin/Makefile.inc:1.18	Sat Oct  9 21:06:31 2021
+++ src/bin/Makefile.inc	Sat Apr 20 13:24:48 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.18 2021/10/09 21:06:31 rillig Exp $
+#	$NetBSD: Makefile.inc,v 1.19 2024/04/20 13:24:48 rillig Exp $
 #	@(#)Makefile.inc	8.1 (Berkeley) 5/31/93
 
 .include 		# for MKDYNAMICROOT definition
@@ -10,6 +10,6 @@ BINDIR?=	/bin
 LDSTATIC?=	-static
 .endif
 
-.if ${MKLINT} != "no" && ${LINT_SUPPORTED:Uyes} == "yes"
+.if ${MKLINT} != "no" && !defined(NOLINT)
 realall: lint
 .endif

Index: src/sbin/Makefile.inc
diff -u src/sbin/Makefile.inc:1.23 src/sbin/Makefile.inc:1.24
--- src/sbin/Makefile.inc:1.23	Tue Sep 14 20:13:03 2021
+++ src/sbin/Makefile.inc	Sat Apr 20 13:24:48 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.23 2021/09/14 20:13:03 rillig Exp $
+#	$NetBSD: Makefile.inc,v 1.24 2024/04/20 13:24:48 rillig Exp $
 #	@(#)Makefile.inc	8.1 (Berkeley) 6/8/93
 
 .include 		# for MKDYNAMICROOT definition
@@ -10,6 +10,6 @@ BINDIR?=	/sbin
 LDSTATIC?=	-static
 .endif
 
-.if ${MKLINT} != "no" && ${LINT_SUPPORTED:Uyes} == "yes"
+.if ${MKLINT} != "no" && !defined(NOLINT)
 realall: lint
 .endif

Index: src/sbin/fsck_lfs/Makefile
diff -u src/sbin/fsck_lfs/Makefile:1.23 src/sbin/fsck_lfs/Makefile:1.24
--- src/sbin/fsck_lfs/Makefile:1.23	Tue Sep 14 20:13:03 2021
+++ src/sbin/fsck_lfs/Makefile	Sat Apr 20 13:24:48 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.23 2021/09/14 20:13:03 rillig Exp $
+#	$NetBSD: Makefile,v 1.24 2024/04/20 13:24:48 rillig Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/5/93
 
 WARNS?=	3	# XXX: sign-compare issues
@@ -19,9 +19,4 @@ CPPFLAGS+=-I${.CURDIR} -I${FSCK} -DIN_FS
 LDADD+=-lutil
 DPADD+=${LIBUTIL}
 
-# As of 2021-09-14, lint does not recognize the types as equal, but it should.
-# vnode.c(104): error: redeclaration of register_vget [27]
-# vnode.h(75): previous declaration of register_vget [260]
-LINT_SUPPORTED=	no
-
 .include 

Index: src/sbin/newfs_lfs/Makefile
diff -u src/sbin/newfs_lfs/Makefile:1.15 src/sbin/newfs_lfs/Makefile:1.16
--- src/sbin/newfs_lfs/Makefile:1.15	Tue Sep 14 20:13:03 2021
+++ src/sbin/newfs_lfs/Makefile	Sat Apr 20 13:24:49 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.15 2021/09/14 20:13:03 rillig Exp $
+#	$NetBSD: Makefile,v 1.16 2024/04/20 13:24:49 rillig Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 WARNS?=	3	# XXX: sign-compare issues
@@ -25,9 +25,4 @@ DPADD+=${LIBPROP}
 
 CPPFLAGS+=-I${FSCK_LFS} -I${FSCK} # -DNDEBUG # -DVERBOSE_BLOCKMAP
 
-# As of 2021-09-14, lint does not recognize the types as equal, but it should.
-# vnode.c(104): error: redeclaration of register_vget [27]
-# vnode.h(75): previous declaration of register_vget [260]
-LINT_SUPPORTED=	no
-
 .include 

Index: src/sbin/resize_ffs/Makefile
diff -u src/sbin/resize_ffs/Makefile:1.7 src/sbin/resize_ffs/Makefile:1.8
--- src/sbin/resize_ffs/Makefile:1.7	Tue Sep 14 20:13:03 2021
+++ src/sbin/resize_ffs/Makefile	Sat Apr 20 13:24:49 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.7 2021/09/14 20:13:03 rillig Exp $
+#	$NetBSD: Makefile,v 1.8 2024/04/20 13:24:49 rillig Exp $
 
 .include 
 
@@ -14,7 +14,4 @@ LDADD+= -lutil
 .PATH: ${NETBSDSRCDIR}/sys/ufs/ffs
 .PATH: ${NETBSDSRCDIR}/sbin/fsck
 
-# resize_ffs.c(90): error: cannot take size/alignment of incomplete type [143]
-LINT_SUPPORTED=	no
-
 .include 

Index: src/usr.bin/Makefile.inc
diff -u src/usr.bin/Makefile.inc:1.11 src/usr.bin/Makefile.inc:1.12
--- src/usr.bin/Makefile.inc:1.11	Sun Aug 22 22:24:11 2021
+++ src/usr.bin/Makefile.inc	Sat Apr 20 13:24:49 2024

CVS commit: src/tests/usr.bin/xlint/lint1

2024-04-19 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 19 20:59:18 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_207.c

Log Message:
tests/lint: show how to trigger message 207


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_207.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/msg_207.c
diff -u src/tests/usr.bin/xlint/lint1/msg_207.c:1.3 src/tests/usr.bin/xlint/lint1/msg_207.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_207.c:1.3	Thu Jun 16 21:24:41 2022
+++ src/tests/usr.bin/xlint/lint1/msg_207.c	Fri Apr 19 20:59:18 2024
@@ -1,8 +1,51 @@
-/*	$NetBSD: msg_207.c,v 1.3 2022/06/16 21:24:41 rillig Exp $	*/
+/*	$NetBSD: msg_207.c,v 1.4 2024/04/19 20:59:18 rillig Exp $	*/
 # 3 "msg_207.c"
 
 // Test for message: loop not entered at top [207]
 
-/* expect+1: error: syntax error ':' [249] */
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+static void
+/* expect+1: warning: static function 'for_loop' unused [236] */
+for_loop(void)
+{
+	for (int i = 0; i < 10; i++)
+		if (0 == 1)
+			for (i = 0;
+			i < 5;
+/* expect+2: warning: loop not entered at top [207] */
+/* expect+1: warning: end-of-loop code not reached [223] */
+			i += 4)
+return;
+
+	// XXX: Why is this different from the snippet above?
+	for (int i = 0; i < 10; i++)
+		if (0 == 1)
+			/* expect+1: warning: statement not reached [193] */
+			for (int j = 0;
+			j < 5;
+			/* expect+1: warning: end-of-loop code not reached [223] */
+			j += 4)
+return;
+}
+
+static void
+/* expect+1: warning: static function 'while_loop' unused [236] */
+while_loop(void)
+{
+	for (int i = 0; i < 10; i++)
+		if (0 == 1)
+			/* expect+1: warning: loop not entered at top [207] */
+			while (i < 5)
+i += 4;
+}
+
+static void
+/* expect+1: warning: static function 'do_loop' unused [236] */
+do_loop(void)
+{
+	for (int i = 0; i < 10; i++)
+		if (0 == 1)
+			/* expect+1: warning: loop not entered at top [207] */
+			do {
+i += 4;
+			} while (i < 5);
+}



CVS commit: src/tests/usr.bin/xlint/lint1

2024-04-19 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 19 20:59:18 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_207.c

Log Message:
tests/lint: show how to trigger message 207


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_207.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

2024-04-14 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 14 15:21:20 UTC 2024

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

Log Message:
make: make string matching platform-independent

Previously, whether the character range '[a-ä]' matched, depended on the
signedness of the plain 'char' type.  Since make operates on byte
strings and does not support UTF-8 or other multi-byte character
encodings, this edge case is not expected to occur in practice.

No change in the unit tests as this edge case is not covered by tests.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 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.102 src/usr.bin/make/str.c:1.103
--- src/usr.bin/make/str.c:1.102	Fri Jan  5 23:22:06 2024
+++ src/usr.bin/make/str.c	Sun Apr 14 15:21:20 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: str.c,v 1.102 2024/01/05 23:22:06 rillig Exp $	*/
+/*	$NetBSD: str.c,v 1.103 2024/04/14 15:21:20 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.102 2024/01/05 23:22:06 rillig Exp $");
+MAKE_RCSID("$NetBSD: str.c,v 1.103 2024/04/14 15:21:20 rillig Exp $");
 
 
 static HashTable interned_strings;
@@ -297,26 +297,6 @@ Str_Words(const char *str, bool expand)
 }
 
 /*
- * XXX: In the extreme edge case that one of the characters is from the basic
- * execution character set and the other isn't, the result of the comparison
- * differs depending on whether plain char is signed or unsigned.
- *
- * An example is the character range from \xE4 to 'a', where \xE4 may come
- * from U+00E4 'Latin small letter A with diaeresis'.
- *
- * If char is signed, \xE4 evaluates to -28, the first half of the condition
- * becomes -28 <= '0' && '0' <= 'a', which evaluates to true.
- *
- * If char is unsigned, \xE4 evaluates to 228, the second half of the
- * condition becomes 'a' <= '0' && '0' <= 228, which evaluates to false.
- */
-static bool
-in_range(char e1, char c, char e2)
-{
-	return (e1 <= c && c <= e2) || (e2 <= c && c <= e1);
-}
-
-/*
  * Test if a string matches a pattern like "*.[ch]". The pattern matching
  * characters are '*', '?' and '[]', as in fnmatch(3).
  *
@@ -360,7 +340,11 @@ match_fixed_length:
 return res;
 			}
 			if (pat[1] == '-') {
-if (in_range(pat[0], *str, pat[2]))
+unsigned char e1 = (unsigned char)pat[0];
+unsigned char c = (unsigned char)*str;
+unsigned char e2 = (unsigned char)pat[2];
+if ((e1 <= c && c <= e2)
+|| (e2 <= c && c <= e1))
 	goto end_of_char_list;
 pat += 2;
 			}



CVS commit: src/usr.bin/make

2024-04-14 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 14 15:21:20 UTC 2024

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

Log Message:
make: make string matching platform-independent

Previously, whether the character range '[a-ä]' matched, depended on the
signedness of the plain 'char' type.  Since make operates on byte
strings and does not support UTF-8 or other multi-byte character
encodings, this edge case is not expected to occur in practice.

No change in the unit tests as this edge case is not covered by tests.


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

2024-04-14 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 14 12:30:48 UTC 2024

Modified Files:
src/usr.bin/make: parse.c
src/usr.bin/make/unit-tests: directive-export-impl.exp
directive-for-escape.exp opt-debug-parse.exp var-eval-short.exp
varmod-loop.exp varname-dot-shell.exp

Log Message:
make: add debug logging for .if and .for lines in -dp mode

This helps track down in which line a condition is evaluated.


To generate a diff of this commit:
cvs rdiff -u -r1.718 -r1.719 src/usr.bin/make/parse.c
cvs rdiff -u -r1.17 -r1.18 \
src/usr.bin/make/unit-tests/directive-export-impl.exp
cvs rdiff -u -r1.23 -r1.24 \
src/usr.bin/make/unit-tests/directive-for-escape.exp \
src/usr.bin/make/unit-tests/var-eval-short.exp
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/opt-debug-parse.exp
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/varmod-loop.exp
cvs rdiff -u -r1.20 -r1.21 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/parse.c
diff -u src/usr.bin/make/parse.c:1.718 src/usr.bin/make/parse.c:1.719
--- src/usr.bin/make/parse.c:1.718	Mon Apr  1 12:26:02 2024
+++ src/usr.bin/make/parse.c	Sun Apr 14 12:30:47 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.718 2024/04/01 12:26:02 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.719 2024/04/14 12:30:47 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -105,7 +105,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.718 2024/04/01 12:26:02 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.719 2024/04/14 12:30:47 rillig Exp $");
 
 /* Detects a multiple-inclusion guard in a makefile. */
 typedef enum {
@@ -2607,6 +2607,7 @@ ReadHighLevelLine(void)
 		if (line == NULL)
 			return NULL;
 
+		DEBUG2(PARSE, "Parsing line %u: %s\n", curFile->lineno, line);
 		if (curFile->guardState != GS_NO
 		&& ((curFile->guardState == GS_START && line[0] != '.')
 			|| curFile->guardState == GS_DONE))
@@ -2929,8 +2930,6 @@ Parse_File(const char *name, int fd)
 
 	do {
 		while ((line = ReadHighLevelLine()) != NULL) {
-			DEBUG2(PARSE, "Parsing line %u: %s\n",
-			CurFile()->lineno, line);
 			ParseLine(line);
 		}
 	} while (ParseEOF());

Index: src/usr.bin/make/unit-tests/directive-export-impl.exp
diff -u src/usr.bin/make/unit-tests/directive-export-impl.exp:1.17 src/usr.bin/make/unit-tests/directive-export-impl.exp:1.18
--- src/usr.bin/make/unit-tests/directive-export-impl.exp:1.17	Thu Mar  3 19:36:35 2022
+++ src/usr.bin/make/unit-tests/directive-export-impl.exp	Sun Apr 14 12:30:47 2024
@@ -10,6 +10,7 @@ Pattern for ':N' is "*"
 ModifyWords: split "<>" into 1 word
 Result of ${UT_VAR:N*} is ""
 ParseDependency(: )
+Parsing line 42: .if ${:!echo "\$UT_VAR"!} != "<>"
 CondParser_Eval: ${:!echo "\$UT_VAR"!} != "<>"
 Var_Parse: ${:!echo "\$UT_VAR"!} != "<>" (eval-defined)
 Evaluating modifier ${:!...} on value "" (eval-defined, undefined)
@@ -34,6 +35,7 @@ Result of ${UT_VAR:N*} is ""
 ParseDependency(: )
 Parsing line 54: REF=		defined
 Global: REF = defined
+Parsing line 58: .if ${:!echo "\$UT_VAR"!} != ""
 CondParser_Eval: ${:!echo "\$UT_VAR"!} != ""
 Var_Parse: ${:!echo "\$UT_VAR"!} != "" (eval-defined)
 Evaluating modifier ${:!...} on value "" (eval-defined, undefined)

Index: src/usr.bin/make/unit-tests/directive-for-escape.exp
diff -u src/usr.bin/make/unit-tests/directive-for-escape.exp:1.23 src/usr.bin/make/unit-tests/directive-for-escape.exp:1.24
--- src/usr.bin/make/unit-tests/directive-for-escape.exp:1.23	Sun Nov 19 22:06:15 2023
+++ src/usr.bin/make/unit-tests/directive-for-escape.exp	Sun Apr 14 12:30:47 2024
@@ -106,6 +106,7 @@ make: "directive-for-escape.mk" line 228
 For: end for 1
 For: loop body with i = "
 ":
+Parsing line 244: .for i in "${.newline}"
 For: end for 1
 Parse_PushInput: .for loop in directive-for-escape.mk, line 244
 make: "directive-for-escape.mk" line 244: newline in .for value
Index: src/usr.bin/make/unit-tests/var-eval-short.exp
diff -u src/usr.bin/make/unit-tests/var-eval-short.exp:1.23 src/usr.bin/make/unit-tests/var-eval-short.exp:1.24
--- src/usr.bin/make/unit-tests/var-eval-short.exp:1.23	Thu Jun  1 20:56:35 2023
+++ src/usr.bin/make/unit-tests/var-eval-short.exp	Sun Apr 14 12:30:47 2024
@@ -1,5 +1,6 @@
 make: "var-eval-short.mk" line 46: In the :@ modifier of "", the variable name "${FAIL}" must not contain a dollar
 make: "var-eval-short.mk" line 46: Malformed conditional (0 && ${:Uword:@${FAIL}@expr@})
+Parsing line 159: .if 0 && ${0:?${FAIL}then:${FAIL}else}
 CondParser_Eval: 0 && ${0:?${FAIL}then:${FAIL}else}
 Var_Parse: ${0:?${FAIL}then:${FAIL}else} (parse-only)
 Parsing modifier ${0:?...}
@@ -10,6 +11,7 @@ Modifier part: "${FAIL}else"
 Result of ${0:?${FAIL}then:${FAIL}else} is "" (parse-only, defined)
 Parsing line 167: DEFINED=	defined
 Global: 

CVS commit: src/usr.bin/make

2024-04-14 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 14 12:30:48 UTC 2024

Modified Files:
src/usr.bin/make: parse.c
src/usr.bin/make/unit-tests: directive-export-impl.exp
directive-for-escape.exp opt-debug-parse.exp var-eval-short.exp
varmod-loop.exp varname-dot-shell.exp

Log Message:
make: add debug logging for .if and .for lines in -dp mode

This helps track down in which line a condition is evaluated.


To generate a diff of this commit:
cvs rdiff -u -r1.718 -r1.719 src/usr.bin/make/parse.c
cvs rdiff -u -r1.17 -r1.18 \
src/usr.bin/make/unit-tests/directive-export-impl.exp
cvs rdiff -u -r1.23 -r1.24 \
src/usr.bin/make/unit-tests/directive-for-escape.exp \
src/usr.bin/make/unit-tests/var-eval-short.exp
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/opt-debug-parse.exp
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/varmod-loop.exp
cvs rdiff -u -r1.20 -r1.21 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/tests/lib/libc/gen

2024-04-13 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 13 14:02:51 UTC 2024

Modified Files:
src/tests/lib/libc/gen: t_fmtcheck.c

Log Message:
tests/fmtcheck: show that fmtcheck does not support "%2$s"


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/gen/t_fmtcheck.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/libc/gen/t_fmtcheck.c
diff -u src/tests/lib/libc/gen/t_fmtcheck.c:1.5 src/tests/lib/libc/gen/t_fmtcheck.c:1.6
--- src/tests/lib/libc/gen/t_fmtcheck.c:1.5	Wed Dec 13 06:47:04 2017
+++ src/tests/lib/libc/gen/t_fmtcheck.c	Sat Apr 13 14:02:51 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_fmtcheck.c,v 1.5 2017/12/13 06:47:04 rin Exp $	*/
+/*	$NetBSD: t_fmtcheck.c,v 1.6 2024/04/13 14:02:51 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -75,6 +75,10 @@ struct test_fmt {
 	{ "%ld %30s %#llx %-10.*e", "This number %lu%% and string %s has %qd numbers and %.*g floats", 1 },
 	{ "%o", "%lx", 2 },
 	{ "%p", "%lu", 2 },
+	// When fmtcheck supports '$', it could be used in dcngettext.
+	{ "%1$s", "%s", 2 },
+	{ "%1$s %2$s", "%s %s", 2 },
+	{ "%2$d %1$s", "%s %d", 2 },
 };
 
 ATF_TC(fmtcheck_basic);



CVS commit: src/tests/lib/libc/gen

2024-04-13 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 13 14:02:51 UTC 2024

Modified Files:
src/tests/lib/libc/gen: t_fmtcheck.c

Log Message:
tests/fmtcheck: show that fmtcheck does not support "%2$s"


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/gen/t_fmtcheck.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/xlint/lint1

2024-04-11 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 12 05:44:38 UTC 2024

Modified Files:
src/usr.bin/xlint/lint1: cksnprintb.c externs1.h tree.c

Log Message:
lint: clean up and speed up the check for snprintb


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/xlint/lint1/cksnprintb.c
cvs rdiff -u -r1.221 -r1.222 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.634 -r1.635 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/usr.bin/xlint/lint1/cksnprintb.c
diff -u src/usr.bin/xlint/lint1/cksnprintb.c:1.13 src/usr.bin/xlint/lint1/cksnprintb.c:1.14
--- src/usr.bin/xlint/lint1/cksnprintb.c:1.13	Fri Apr 12 05:17:48 2024
+++ src/usr.bin/xlint/lint1/cksnprintb.c	Fri Apr 12 05:44:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cksnprintb.c,v 1.13 2024/04/12 05:17:48 rillig Exp $	*/
+/*	$NetBSD: cksnprintb.c,v 1.14 2024/04/12 05:44:38 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: cksnprintb.c,v 1.13 2024/04/12 05:17:48 rillig Exp $");
+__RCSID("$NetBSD: cksnprintb.c,v 1.14 2024/04/12 05:44:38 rillig Exp $");
 #endif
 
 #include 
@@ -46,7 +46,7 @@ __RCSID("$NetBSD: cksnprintb.c,v 1.13 20
 typedef struct {
 	bool new_style;
 	const buffer *fmt;
-	const tnode_t *value;
+	uint64_t possible_value_bits;
 
 	quoted_iterator it;
 	uint64_t field_width;
@@ -128,7 +128,7 @@ check_bit(checker *ck, uint64_t dir_lsb,
 		}
 	}
 
-	if (!(possible_bits(ck->value) & field_mask))
+	if (!(ck->possible_value_bits & field_mask))
 		/* conversion '%.*s' is unreachable by input value */
 		warning(378, len, start);
 }
@@ -265,9 +265,8 @@ check_conversion(checker *ck)
 }
 
 void
-check_snprintb(const tnode_t *expr)
+check_snprintb(const function_call *call)
 {
-	const function_call *call = expr->u.call;
 	const char *name;
 	const buffer *fmt;
 	const tnode_t *value;
@@ -287,7 +286,7 @@ check_snprintb(const tnode_t *expr)
 
 	checker ck = {
 		.fmt = fmt,
-		.value = value,
+		.possible_value_bits = possible_bits(value),
 		.field_width = 64,
 	};
 

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.221 src/usr.bin/xlint/lint1/externs1.h:1.222
--- src/usr.bin/xlint/lint1/externs1.h:1.221	Fri Mar 29 08:35:32 2024
+++ src/usr.bin/xlint/lint1/externs1.h	Fri Apr 12 05:44:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.221 2024/03/29 08:35:32 rillig Exp $	*/
+/*	$NetBSD: externs1.h,v 1.222 2024/04/12 05:44:38 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -422,4 +422,4 @@ void check_getopt_end_switch(void);
 void check_getopt_end_while(void);
 
 /* cksnprintb.c */
-void check_snprintb(const tnode_t *);
+void check_snprintb(const function_call *);

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.634 src/usr.bin/xlint/lint1/tree.c:1.635
--- src/usr.bin/xlint/lint1/tree.c:1.634	Sun Mar 31 20:28:45 2024
+++ src/usr.bin/xlint/lint1/tree.c	Fri Apr 12 05:44:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.634 2024/03/31 20:28:45 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.635 2024/04/12 05:44:38 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.634 2024/03/31 20:28:45 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.635 2024/04/12 05:44:38 rillig Exp $");
 #endif
 
 #include 
@@ -4507,7 +4507,10 @@ check_expr_call(const tnode_t *tn, const
 	lint_assert(ln->u.ops.left->tn_op == NAME);
 	if (!szof && !is_compiler_builtin(ln->u.ops.left->u.sym->s_name))
 		outcall(tn, vctx || cond, retval_discarded);
-	check_snprintb(tn);
+
+	const function_call *call = tn->u.call;
+	if (call->args_len == 4 || call->args_len == 5)
+		check_snprintb(call);
 }
 
 static void



CVS commit: src/usr.bin/xlint/lint1

2024-04-11 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 12 05:44:38 UTC 2024

Modified Files:
src/usr.bin/xlint/lint1: cksnprintb.c externs1.h tree.c

Log Message:
lint: clean up and speed up the check for snprintb


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/xlint/lint1/cksnprintb.c
cvs rdiff -u -r1.221 -r1.222 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.634 -r1.635 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

2024-04-11 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 12 05:17:48 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_363.c msg_371.c msg_376.c
src/usr.bin/xlint/lint1: cksnprintb.c err.c

Log Message:
lint: in snprintb, warn about all escaped characters in descriptions


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_363.c
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_371.c
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_376.c
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/xlint/lint1/cksnprintb.c
cvs rdiff -u -r1.239 -r1.240 src/usr.bin/xlint/lint1/err.c

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



CVS commit: src

2024-04-11 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 12 05:17:48 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_363.c msg_371.c msg_376.c
src/usr.bin/xlint/lint1: cksnprintb.c err.c

Log Message:
lint: in snprintb, warn about all escaped characters in descriptions


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_363.c
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_371.c
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_376.c
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/xlint/lint1/cksnprintb.c
cvs rdiff -u -r1.239 -r1.240 src/usr.bin/xlint/lint1/err.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/msg_363.c
diff -u src/tests/usr.bin/xlint/lint1/msg_363.c:1.4 src/tests/usr.bin/xlint/lint1/msg_363.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_363.c:1.4	Sun Mar  3 16:09:01 2024
+++ src/tests/usr.bin/xlint/lint1/msg_363.c	Fri Apr 12 05:17:48 2024
@@ -1,12 +1,13 @@
-/*	$NetBSD: msg_363.c,v 1.4 2024/03/03 16:09:01 rillig Exp $	*/
+/*	$NetBSD: msg_363.c,v 1.5 2024/04/12 05:17:48 rillig Exp $	*/
 # 3 "msg_363.c"
 
-// Test for message: non-printing character '%.*s' in description '%.*s' [363]
+// Test for message: escaped character '%.*s' in description of conversion '%.*s' [363]
 
 /*
  * The purpose of snprintb is to produce a printable, visible representation
- * of a binary number, therefore the description should consist of visible
- * characters only.
+ * of a binary number, therefore the description should consist of simple
+ * characters only, and these should not need to be escaped.  If they are,
+ * it's often due to a typo, such as a missing terminating '\0'.
  */
 
 /* lint1-extra-flags: -X 351 */
@@ -22,17 +23,17 @@ old_style_description(unsigned u32)
 	char buf[64];
 
 	/* expect+6: warning: bit position '\t' in '\tprint' should be escaped as octal or hex [369] */
-	/* expect+5: warning: non-printing character '\377' in description 'able\377' [363] */
+	/* expect+5: warning: escaped character '\377' in description of conversion '\nable\377' [363] */
 	/* expect+4: warning: bit position '\n' in '\nable\377' should be escaped as octal or hex [369] */
 	snprintb(buf, sizeof(buf),
 	"\020"
 	"\001non\tprint\nable\377",
 	u32);
 
-	/* expect+10: warning: non-printing character '\177' in description '\177' [363] */
-	/* expect+9: warning: non-printing character '\177' in description 'aa\177' [363] */
-	/* expect+8: warning: non-printing character '\177' in description 'bb""\177' [363] */
-	/* expect+7: warning: non-printing character '\177' in description 'cc\177' [363] */
+	/* expect+10: warning: escaped character '\177' in description of conversion '\002""\177' [363] */
+	/* expect+9: warning: escaped character '\177' in description of conversion '\003aa\177' [363] */
+	/* expect+8: warning: escaped character '\177' in description of conversion '\004""bb""\177' [363] */
+	/* expect+7: warning: escaped character '\177' in description of conversion '\005cc\177' [363] */
 	snprintb(buf, sizeof(buf),
 	"\020"
 	"\002""\177"

Index: src/tests/usr.bin/xlint/lint1/msg_371.c
diff -u src/tests/usr.bin/xlint/lint1/msg_371.c:1.1 src/tests/usr.bin/xlint/lint1/msg_371.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_371.c:1.1	Fri Mar  1 19:39:29 2024
+++ src/tests/usr.bin/xlint/lint1/msg_371.c	Fri Apr 12 05:17:48 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_371.c,v 1.1 2024/03/01 19:39:29 rillig Exp $	*/
+/*	$NetBSD: msg_371.c,v 1.2 2024/04/12 05:17:48 rillig Exp $	*/
 # 3 "msg_371.c"
 
 // Test for message: bit position '%.*s' (%ju) in '%.*s' out of range %u..%u [371]
@@ -21,9 +21,10 @@ example(unsigned u32, uint64_t u64)
 {
 	char buf[64];
 
-	/* expect+11: warning: bit position '\000' (0) in '\000zero' out of range 1..32 [371] */
-	/* expect+10: warning: non-printing character '\177' in description 'bit32""\041bit33""\177' [363] */
-	/* expect+9: warning: non-printing character '\377' in description 'bit32""\041bit33""\177bit127""\377' [363] */
+	/* expect+12: warning: bit position '\000' (0) in '\000zero' out of range 1..32 [371] */
+	/* expect+11: warning: escaped character '\041' in description of conversion '\040bit32""\041' [363] */
+	/* expect+10: warning: escaped character '\177' in description of conversion '\040bit32""\041bit33""\177' [363] */
+	/* expect+9: warning: escaped character '\377' in description of conversion '\040bit32""\041bit33""\177bit127""\377' [363] */
 	snprintb(buf, sizeof(buf),
 	"\020"
 	"\000zero"

Index: src/tests/usr.bin/xlint/lint1/msg_376.c
diff -u src/tests/usr.bin/xlint/lint1/msg_376.c:1.2 src/tests/usr.bin/xlint/lint1/msg_376.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_376.c:1.2	Sun Mar  3 00:50:41 2024
+++ src/tests/usr.bin/xlint/lint1/msg_376.c	Fri Apr 12 05:17:48 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_376.c,v 1.2 2024/03/03 

CVS commit: src/bin/ed

2024-04-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Apr 10 17:52:41 UTC 2024

Modified Files:
src/bin/ed: glbl.c

Log Message:
ed: fix inconsistency in comment


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/bin/ed/glbl.c

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



CVS commit: src/bin/ed

2024-04-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Apr 10 17:52:41 UTC 2024

Modified Files:
src/bin/ed: glbl.c

Log Message:
ed: fix inconsistency in comment


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/bin/ed/glbl.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/ed/glbl.c
diff -u src/bin/ed/glbl.c:1.10 src/bin/ed/glbl.c:1.11
--- src/bin/ed/glbl.c:1.10	Fri Jan  4 19:13:58 2019
+++ src/bin/ed/glbl.c	Wed Apr 10 17:52:41 2024
@@ -1,6 +1,6 @@
-/*	$NetBSD: glbl.c,v 1.10 2019/01/04 19:13:58 maya Exp $	*/
+/*	$NetBSD: glbl.c,v 1.11 2024/04/10 17:52:41 rillig Exp $	*/
 
-/* glob.c: This file contains the global command routines for the ed line
+/* glbl.c: This file contains the global command routines for the ed line
editor */
 /*-
  * Copyright (c) 1993 Andrew Moore, Talke Studio.
@@ -33,7 +33,7 @@
 #if 0
 static char *rcsid = "@(#)glob.c,v 1.1 1994/02/01 00:34:40 alm Exp";
 #else
-__RCSID("$NetBSD: glbl.c,v 1.10 2019/01/04 19:13:58 maya Exp $");
+__RCSID("$NetBSD: glbl.c,v 1.11 2024/04/10 17:52:41 rillig Exp $");
 #endif
 #endif /* not lint */
 



Re: CVS commit: src/lib/libutil

2024-04-08 Thread Roland Illig
Am 08.04.2024 um 21:18 schrieb Valery Ushakov:
>   "=\017FIFTEEN\0"
>
> with its result a few lines below that has:
>
>   BURST=0xf=FIFTEEN

Thank you for explaining this example. I had a gut feeling that there
would be some hidden correlation between some octal/hexadecimal
combinations, but I couldn't name it. Indeed, if the number base for
output is hexadecimal, the field comparisons should be done in
hexadecimal as well.

I adjusted the description and examples in the manual page accordingly.

Roland



CVS commit: src

2024-04-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Apr  8 21:28:36 UTC 2024

Modified Files:
src/lib/libutil: snprintb.3
src/tests/lib/libutil: t_snprintb.c

Log Message:
snprintb.3: provide examples for hexadecimal character escapes

Suggested by uwe@, in reaction to the previous commit, which preferred
octal in the examples. Hexadecimal escapes are more familiar to most
programmers, and the chance of mistaking \x14 for decimal 14 is less
than the chance of mistaking octal \014 for decimal 14.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/lib/libutil/snprintb.3
cvs rdiff -u -r1.35 -r1.36 src/tests/lib/libutil/t_snprintb.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/libutil/snprintb.3
diff -u src/lib/libutil/snprintb.3:1.38 src/lib/libutil/snprintb.3:1.39
--- src/lib/libutil/snprintb.3:1.38	Sun Apr  7 14:28:26 2024
+++ src/lib/libutil/snprintb.3	Mon Apr  8 21:28:35 2024
@@ -1,4 +1,4 @@
-.\" $NetBSD: snprintb.3,v 1.38 2024/04/07 14:28:26 rillig Exp $
+.\" $NetBSD: snprintb.3,v 1.39 2024/04/08 21:28:35 rillig Exp $
 .\"
 .\" Copyright (c) 1998, 2024 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 7, 2024
+.Dd April 8, 2024
 .Dt SNPRINTB 3
 .Os
 .Sh NAME
@@ -118,7 +118,10 @@ the bit positions are 0-based.
 If the first character of
 .Fa fmt
 is
-.Ql \e177 ,
+.Pq in C escape-character format
+.Ql \e177
+or
+.Ql \ex7f ,
 the remainder of the
 .Fa fmt
 argument follows the
@@ -131,14 +134,18 @@ The next character
 format
 .Pc
 specifies the numeral base in which to print the numbers in the output.
-The possible values
-.Pq in C escape-character format
-are
+The possible values are
 .Ql \e010
+or
+.Ql \ex08
 for octal,
 .Ql \e012
+or
+.Ql \ex0a
 for decimal, and
 .Ql \e020
+or
+.Ql \ex10
 for hexadecimal.
 .Pp
 The remaining characters in the
@@ -160,8 +167,12 @@ and a description that is printed if the
 The bit position is a 1-based single-byte binary value,
 ranging from
 .Ql \e001
+or
+.Ql \ex01
 (1) for the least significant bit up to
 .Ql \e040
+or
+.Ql \ex20
 (32) for the most significant bit.
 .Pp
 The description is delimited by the next character whose value is 32 or less
@@ -182,8 +193,12 @@ followed by a
 The bit positions are 0-based,
 ranging from
 .Ql \e000
+or
+.Ql \ex00
 (0) for the least significant bit to
 .Ql \e077
+or
+.Ql \ex3f
 (63) for the most significant bit.
 .
 .Bl -tag -width Cm
@@ -212,6 +227,26 @@ and
 .Sq Cm \&*
 conversions below.
 .
+.It Cm \&= Ar cmp Ar descr
+Compares the field value from the previous
+.Sq Cm f
+conversion to the single-byte value
+.Ar cmp ,
+ranging from
+.Ql \e000
+or
+.Ql \ex00
+(0) to
+.Ql \e377
+or
+.Ql \exff
+(255).
+If they are equal, prints
+.Ql \&=
+followed by the description from
+.Ar descr .
+This conversion may be repeated.
+.
 .It Cm F Ar lsb Ar width Op Ar descr
 Describes a multi-bit field like
 .Sq Cm f ,
@@ -225,24 +260,20 @@ The description from
 is ignored,
 it is only present for uniformity with the other conversions.
 .
-.It Cm \&= Ar cmp Ar descr
-Compares the field value from the previous
-.Sq Cm f
-conversion to the single-byte value
-.Ar cmp ,
-which ranges from 0 to 255.
-If they are equal, prints
-.Ql \&=
-followed by the description from
-.Ar descr .
-This conversion may be repeated.
-.
 .It Cm \&: Ar cmp Ar descr
 Compares the field value from the previous
 .Sq Cm F
 conversion to the single-byte value
 .Ar cmp ,
-which ranges from 0 to 255.
+ranging from
+.Ql \e000
+or
+.Ql \ex00
+(0) to
+.Ql \e377
+or
+.Ql \exff
+(255).
 If they are equal, prints the description from
 .Ar descr .
 This conversion may be repeated.
@@ -255,7 +286,7 @@ or
 conversions matched, prints the format string
 .Ar fmt
 via
-.Xr printf 3 .
+.Xr snprintf 3 .
 The format string
 .Ar fmt
 may contain a single
@@ -289,11 +320,18 @@ snprintb(buf, bufsize, "\e010\e002BITTWO
 \(rA "03"
 
 snprintb(buf, bufsize,
-"\e020"
-"\ex10""NOTBOOT"   "\ex0f""FPP"   "\ex0e""SDVMA"
-"\ex0c""VIDEO" "\ex0b""LORES" "\ex0a""FPA"
-"\ex09""DIAG"  "\ex07""CACHE" "\ex06""IOCACHE"
-"\ex05""LOOPBACK"  "\ex04""DBGCACHE",
+"\ex10"
+"\ex10" "NOTBOOT"
+"\ex0f" "FPP"
+"\ex0e" "SDVMA"
+"\ex0c" "VIDEO"
+"\ex0b" "LORES"
+"\ex0a" "FPA"
+"\ex09" "DIAG"
+"\ex07" "CACHE"
+"\ex06" "IOCACHE"
+"\ex05" "LOOPBACK"
+"\ex04" "DBGCACHE",
 0xe860)
 \(rA "0xe860"
 .Ed
@@ -302,9 +340,13 @@ An example of the new formatting style:
 .Bd -literal -offset indent
 snprintb(buf, bufsize,
 "\e177\e020"
-"b\e000LSB\e0" "b\e001BITONE\e0" "f\e004\e004NIBBLE2\e0"
-"f\e020\e004BURST\e0" "=\e004FOUR\e0" "=\e017FIFTEEN\e0"
-"b\e037MSB\e0",
+"b\e000" "LSB\e0"
+"b\e001" "BITONE\e0"
+"f\e004\e004" 

CVS commit: src

2024-04-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Apr  8 21:28:36 UTC 2024

Modified Files:
src/lib/libutil: snprintb.3
src/tests/lib/libutil: t_snprintb.c

Log Message:
snprintb.3: provide examples for hexadecimal character escapes

Suggested by uwe@, in reaction to the previous commit, which preferred
octal in the examples. Hexadecimal escapes are more familiar to most
programmers, and the chance of mistaking \x14 for decimal 14 is less
than the chance of mistaking octal \014 for decimal 14.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/lib/libutil/snprintb.3
cvs rdiff -u -r1.35 -r1.36 src/tests/lib/libutil/t_snprintb.c

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



Re: CVS commit: src/lib/libutil

2024-04-08 Thread Roland Illig
Am 08.04.2024 um 03:24 schrieb Valery Ushakov:
> On Sun, Apr 07, 2024 at 14:28:27 +0000, Roland Illig wrote:
>
>> Log Message:
>> snprintb.3: clean up formatting and wording, prefer octal in examples
>>
>> Using hexadecimal character escapes requires separate string literals if
>> the description starts with one of the letters A-F; octal character
>> escapes have at most 3 digits, reducing ambiguity.
>
> 70s are over, very few people speak octal fluently.  If anything, the
> man page should highlight the potential snag.  Besides, separate
> literal for the name is good for readability anyway.

When I looked through the NetBSD tree exploring the current usage, I
found that a significant majority uses octal instead of hexadecimal. I
don't know the exact reasons for this, it might be due to existing
practice in the 1990s, to avoid splitting the bit position and the
description to separate string literals, to be able to easily split the
bit position into the byte and the bit portion mentally, or maybe
something entirely different.

While your claim that "very few people speak octal fluently" may be true
for programmers in general, I expect those using the snprintb function
to be more fluent than others. Of course, I saw cases where "\040" was
followed by "\039", just as I saw cases of "\x0fFIELD". Lint now warns
in both these cases.

Regarding the separate literals, I didn't see them in wide use up to
now. Existing code seems to focus more on compressing the source code
into as few lines as possible rather than making it easily readable. I
agree that separate string literals are more readable, and I converted
the example that uses hexadecimal escapes to this style.

I didn't eradicate _all_ hexadecimal examples, I just made each example
use only one number base, not mix them both. There are both octal and
hexadecimal examples in the manual page.

Roland



CVS commit: src/sys/arch

2024-04-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr  7 17:08:00 UTC 2024

Modified Files:
src/sys/arch/sparc/include: psl.h
src/sys/arch/sparc/sparc: memeccreg.h
src/sys/arch/sparc64/include: psl.h

Log Message:
sparc: fix typos and omissions in PSTATE_BITS and ECC_AFR_BITS

Fixes PR 57869.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/sparc/include/psl.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sparc/sparc/memeccreg.h
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/sparc64/include/psl.h

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



CVS commit: src/sys/arch

2024-04-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr  7 17:08:00 UTC 2024

Modified Files:
src/sys/arch/sparc/include: psl.h
src/sys/arch/sparc/sparc: memeccreg.h
src/sys/arch/sparc64/include: psl.h

Log Message:
sparc: fix typos and omissions in PSTATE_BITS and ECC_AFR_BITS

Fixes PR 57869.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/sparc/include/psl.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sparc/sparc/memeccreg.h
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/sparc64/include/psl.h

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

Modified files:

Index: src/sys/arch/sparc/include/psl.h
diff -u src/sys/arch/sparc/include/psl.h:1.52 src/sys/arch/sparc/include/psl.h:1.53
--- src/sys/arch/sparc/include/psl.h:1.52	Tue Jul 11 13:10:08 2023
+++ src/sys/arch/sparc/include/psl.h	Sun Apr  7 17:08:00 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: psl.h,v 1.52 2023/07/11 13:10:08 martin Exp $ */
+/*	$NetBSD: psl.h,v 1.53 2024/04/07 17:08:00 rillig Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -113,8 +113,11 @@
 #define PSTATE_IE	0x002	/* interrupt enable */
 #define PSTATE_AG	0x001	/* enable alternate globals */
 
-#define PSTATE_BITS "\20\14IG\13MG\12CLE\11TLE\10\7MM\6RED\5PEF\4AM\3PRIV\2IE\1AG"
-
+#define PSTATE_BITS "\177\020"		\
+	"b\013IG\0"	"b\012MG\0"	"b\011CLE\0"	"b\010TLE\0"	\
+			"F\006\002\0"	":\000MM_TSO\0"	":\001MM_PSO\0"	\
+	":\002MM_RMO\0"	"*?\0"		"b\005RED\0"	"b\004PEF\0"	\
+	"b\003AM\0"	"b\002PRIV\0"	"b\001IE\0"	"b\000AG\0"
 
 /*
  * 32-bit code requires TSO or at best PSO since that's what's supported on

Index: src/sys/arch/sparc/sparc/memeccreg.h
diff -u src/sys/arch/sparc/sparc/memeccreg.h:1.2 src/sys/arch/sparc/sparc/memeccreg.h:1.3
--- src/sys/arch/sparc/sparc/memeccreg.h:1.2	Mon Apr 28 20:23:36 2008
+++ src/sys/arch/sparc/sparc/memeccreg.h	Sun Apr  7 17:08:00 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: memeccreg.h,v 1.2 2008/04/28 20:23:36 martin Exp $	*/
+/*	$NetBSD: memeccreg.h,v 1.3 2024/04/07 17:08:00 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
 #define ECC_AFR_S	0x0800	/* Access was in supervisor mode */
 #define ECC_AFR_MID	0xf000	/* Module code */
 #define ECC_AFR_BITS	"\177\020"\
-			"f\0\4VAH\0f\4\4TYPE\0f\10\3SIZE\0"	\
+			"f\0\4PAH\0f\4\4TYPE\0f\10\3SIZE\0"	\
 			"b\13C\0b\14LOCK\0b\15MBL\0"		\
 			"f\16\10VA\0b\33S\0f\34\4MID\0"
 

Index: src/sys/arch/sparc64/include/psl.h
diff -u src/sys/arch/sparc64/include/psl.h:1.64 src/sys/arch/sparc64/include/psl.h:1.65
--- src/sys/arch/sparc64/include/psl.h:1.64	Sat Sep  2 05:51:57 2023
+++ src/sys/arch/sparc64/include/psl.h	Sun Apr  7 17:08:00 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: psl.h,v 1.64 2023/09/02 05:51:57 jdc Exp $ */
+/*	$NetBSD: psl.h,v 1.65 2024/04/07 17:08:00 rillig Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -129,7 +129,11 @@
 #define PSTATE_IE	0x002	/* interrupt enable */
 #define PSTATE_AG	0x001	/* enable alternate globals */
 
-#define PSTATE_BITS "\20\14IG\13MG\12CLE\11TLE\10\7MM\6RED\5PEF\4AM\3PRIV\2IE\1AG"
+#define PSTATE_BITS "\177\020"		\
+	"b\013IG\0"	"b\012MG\0"	"b\011CLE\0"	"b\010TLE\0"	\
+			"F\006\002\0"	":\000MM_TSO\0"	":\001MM_PSO\0"	\
+	":\002MM_RMO\0"	"*?\0"		"b\005RED\0"	"b\004PEF\0"	\
+	"b\003AM\0"	"b\002PRIV\0"	"b\001IE\0"	"b\000AG\0"
 
 
 /*



CVS commit: src

2024-04-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr  7 15:20:17 UTC 2024

Modified Files:
src/common/lib/libutil: snprintb.c
src/tests/lib/libutil: t_snprintb.c

Log Message:
snprintb: reject empty bit descriptions and wrongly placed defaults


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/common/lib/libutil/snprintb.c
cvs rdiff -u -r1.34 -r1.35 src/tests/lib/libutil/t_snprintb.c

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

Modified files:

Index: src/common/lib/libutil/snprintb.c
diff -u src/common/lib/libutil/snprintb.c:1.47 src/common/lib/libutil/snprintb.c:1.48
--- src/common/lib/libutil/snprintb.c:1.47	Sun Apr  7 12:05:23 2024
+++ src/common/lib/libutil/snprintb.c	Sun Apr  7 15:20:16 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: snprintb.c,v 1.47 2024/04/07 12:05:23 rillig Exp $	*/
+/*	$NetBSD: snprintb.c,v 1.48 2024/04/07 15:20:16 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2024 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #  include 
 #  if defined(LIBC_SCCS)
-__RCSID("$NetBSD: snprintb.c,v 1.47 2024/04/07 12:05:23 rillig Exp $");
+__RCSID("$NetBSD: snprintb.c,v 1.48 2024/04/07 15:20:16 rillig Exp $");
 #  endif
 
 #  include 
@@ -46,7 +46,7 @@ __RCSID("$NetBSD: snprintb.c,v 1.47 2024
 #  include 
 # else /* ! _KERNEL */
 #  include 
-__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.47 2024/04/07 12:05:23 rillig Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.48 2024/04/07 15:20:16 rillig Exp $");
 #  include 
 #  include 
 #  include 
@@ -133,15 +133,17 @@ old_style(state *s)
 	while (*s->bitfmt != '\0') {
 		const char *cur_bitfmt = s->bitfmt;
 		uint8_t bit = *s->bitfmt;
-		if (bit > ' ')
+		if (bit > 32)
+			return -1;
+		if ((uint8_t)cur_bitfmt[1] <= 32)
 			return -1;
 		if (s->val & (1U << (bit - 1))) {
 			store_delimiter(s);
-			while ((uint8_t)*++s->bitfmt > ' ')
+			while ((uint8_t)*++s->bitfmt > 32)
 store(s, *s->bitfmt);
 			maybe_wrap_line(s, cur_bitfmt);
 		} else
-			while ((uint8_t)*++s->bitfmt > ' ')
+			while ((uint8_t)*++s->bitfmt > 32)
 continue;
 	}
 	return 0;
@@ -222,6 +224,7 @@ new_style(state *s)
 		case '*':
 			if (field_kind == 0)
 return -1;
+			field_kind = 0;
 			if (cur_bitfmt[1] == '\0')
 return -1;
 			s->bitfmt++;

Index: src/tests/lib/libutil/t_snprintb.c
diff -u src/tests/lib/libutil/t_snprintb.c:1.34 src/tests/lib/libutil/t_snprintb.c:1.35
--- src/tests/lib/libutil/t_snprintb.c:1.34	Sun Apr  7 12:05:23 2024
+++ src/tests/lib/libutil/t_snprintb.c	Sun Apr  7 15:20:17 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: t_snprintb.c,v 1.34 2024/04/07 12:05:23 rillig Exp $ */
+/* $NetBSD: t_snprintb.c,v 1.35 2024/04/07 15:20:17 rillig Exp $ */
 
 /*
  * Copyright (c) 2002, 2004, 2008, 2010, 2024 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008, 2010, 2024\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_snprintb.c,v 1.34 2024/04/07 12:05:23 rillig Exp $");
+__RCSID("$NetBSD: t_snprintb.c,v 1.35 2024/04/07 15:20:17 rillig Exp $");
 
 #include 
 #include 
@@ -309,16 +309,16 @@ ATF_TC_BODY(snprintb, tc)
 
 	// old style, empty description
 	//
-	// Empty descriptions result in multiple commas in a row, which is a
-	// mistake.
-	h_snprintb(
+	// The description of a bit in the old format must not be empty,
+	// to prevent multiple commas in a row.
+	h_snprintb_val_error(
 	"\020"
 	"\001lsb"
 	"\004"
 	"\005"
 	"\010msb",
 	0xff,
-	"0xff");
+	"0xff");
 
-	// new style unknown directive, at the beginning
+	// new style unknown conversion, at the beginning
 	h_snprintb_val_error(
 	"\177\020"
 	"unknown\0",
 	0xff,
 	"0xff#");
 
-	// new style unknown directive, after a known directive
+	// new style unknown conversion, after a known conversion
 	h_snprintb_val_error(
 	"\177\020"
 	"b\007msb\0"
@@ -946,42 +946,51 @@ ATF_TC_BODY(snprintb, tc)
 
 	// new style combinations, 'f' '*' '='
 	//
-	// After a catch-all '*' directive, any following '=' directive
-	// generates misleading output, which is a mistake.
-	h_snprintb(
+	// After a catch-all '*' conversions, there must not be further '='
+	// conversions.
+	h_snprintb_val_error(
 	"\177\020"
 	"f\000\010f\0"
 		"*=default\0"
 		"=\245match\0",
 	0xa5,
-	"0xa5");
+	"0xa5");
+	"0xa5");
+	"0xa5

CVS commit: src

2024-04-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr  7 15:20:17 UTC 2024

Modified Files:
src/common/lib/libutil: snprintb.c
src/tests/lib/libutil: t_snprintb.c

Log Message:
snprintb: reject empty bit descriptions and wrongly placed defaults


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/common/lib/libutil/snprintb.c
cvs rdiff -u -r1.34 -r1.35 src/tests/lib/libutil/t_snprintb.c

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



CVS commit: src/lib/libutil

2024-04-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr  7 14:28:27 UTC 2024

Modified Files:
src/lib/libutil: snprintb.3

Log Message:
snprintb.3: clean up formatting and wording, prefer octal in examples

Using hexadecimal character escapes requires separate string literals if
the description starts with one of the letters A-F; octal character
escapes have at most 3 digits, reducing ambiguity.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/lib/libutil/snprintb.3

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

Modified files:

Index: src/lib/libutil/snprintb.3
diff -u src/lib/libutil/snprintb.3:1.37 src/lib/libutil/snprintb.3:1.38
--- src/lib/libutil/snprintb.3:1.37	Sun Apr  7 12:05:23 2024
+++ src/lib/libutil/snprintb.3	Sun Apr  7 14:28:26 2024
@@ -1,4 +1,4 @@
-.\" $NetBSD: snprintb.3,v 1.37 2024/04/07 12:05:23 rillig Exp $
+.\" $NetBSD: snprintb.3,v 1.38 2024/04/07 14:28:26 rillig Exp $
 .\"
 .\" Copyright (c) 1998, 2024 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 22, 2024
+.Dd April 7, 2024
 .Dt SNPRINTB 3
 .Os
 .Sh NAME
@@ -180,10 +180,10 @@ followed by type-specific parameters, ea
 followed by a
 .Tn NUL Ns -terminated description.
 The bit positions are 0-based,
-they range from
-.Sq \e000
-for the least significant bit to
-.Sq \e077
+ranging from
+.Ql \e000
+(0) for the least significant bit to
+.Ql \e077
 (63) for the most significant bit.
 .
 .Bl -tag -width Cm
@@ -252,15 +252,15 @@ If none of the previous
 .Sq Cm \&=
 or
 .Sq Cm \&:
-conversions matched, prints the field value, using the
-.Xr printf 3
-format
-.Ar fmt .
+conversions matched, prints the format string
+.Ar fmt
+via
+.Xr printf 3 .
 The format string
 .Ar fmt
 may contain a single
 .Vt uintmax_t
-conversion specification that prints the value that did not match.
+conversion specification to print the field value that did not match.
 .El
 .Pp
 The new format is terminated by an additional
@@ -285,15 +285,15 @@ total number of bytes.
 .Sh EXAMPLES
 Two examples of the old formatting style:
 .Bd -literal -offset indent
-snprintb(buf, bufsize, "\e10\e2BITTWO\e1BITONE", 3)
+snprintb(buf, bufsize, "\e010\e002BITTWO\e001BITONE", 3)
 \(rA "03"
 
 snprintb(buf, bufsize,
-"\e20"
-"\ex10NOTBOOT" "\ex0f""FPP" "\ex0eSDVMA"
-"\ex0cVIDEO" "\ex0bLORES" "\ex0a""FPA" "\ex09""DIAG"
-"\ex07""CACHE" "\ex06IOCACHE" "\ex05LOOPBACK"
-"\ex04""DBGCACHE",
+"\e020"
+"\ex10""NOTBOOT"   "\ex0f""FPP"   "\ex0e""SDVMA"
+"\ex0c""VIDEO" "\ex0b""LORES" "\ex0a""FPA"
+"\ex09""DIAG"  "\ex07""CACHE" "\ex06""IOCACHE"
+"\ex05""LOOPBACK"  "\ex04""DBGCACHE",
 0xe860)
 \(rA "0xe860"
 .Ed
@@ -302,9 +302,9 @@ An example of the new formatting style:
 .Bd -literal -offset indent
 snprintb(buf, bufsize,
 "\e177\e020"
-"b\e0LSB\e0" "b\e1BITONE\e0" "f\e4\e4NIBBLE2\e0"
-"f\ex10\e4BURST\e0" "=\e4FOUR\e0" "=\exf""FIFTEEN\e0"
-"b\ex1fMSB\e0",
+"b\e000LSB\e0" "b\e001BITONE\e0" "f\e004\e004NIBBLE2\e0"
+"f\e020\e004BURST\e0" "=\e004FOUR\e0" "=\e017FIFTEEN\e0"
+"b\e037MSB\e0",
 0x800f0701)
 \(rA "0x800f0701"
 .Ed
@@ -313,9 +313,9 @@ The same example using snprintb_m:
 .Bd -literal -offset indent
 snprintb_m(buf, bufsize,
 "\e177\e020"
-"b\e0LSB\e0" "b\e1BITONE\e0" "f\e4\e4NIBBLE2\e0"
-"f\ex10\e4BURST\e0" "=\e4FOUR\e0" "=\exf""FIFTEEN\e0"
-"b\ex1fMSB\e0",
+"b\e000LSB\e0" "b\e001BITONE\e0" "f\e004\e004NIBBLE2\e0"
+"f\e020\e004BURST\e0" "=\e004FOUR\e0" "=\e017FIFTEEN\e0"
+"b\e037MSB\e0",
 0x800f0701, 34)
 \(rA "0x800f0701\e0"
"0x800f0701\e0"



CVS commit: src/lib/libutil

2024-04-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr  7 14:28:27 UTC 2024

Modified Files:
src/lib/libutil: snprintb.3

Log Message:
snprintb.3: clean up formatting and wording, prefer octal in examples

Using hexadecimal character escapes requires separate string literals if
the description starts with one of the letters A-F; octal character
escapes have at most 3 digits, reducing ambiguity.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/lib/libutil/snprintb.3

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



CVS commit: src

2024-04-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr  7 12:05:23 UTC 2024

Modified Files:
src/common/lib/libutil: snprintb.c
src/lib/libutil: snprintb.3
src/tests/lib/libutil: t_snprintb.c

Log Message:
snprintb: reject combinations of 'f' with ':' as well as 'F' with '='

These combinations would lead to garbled output.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/common/lib/libutil/snprintb.c
cvs rdiff -u -r1.36 -r1.37 src/lib/libutil/snprintb.3
cvs rdiff -u -r1.33 -r1.34 src/tests/lib/libutil/t_snprintb.c

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

Modified files:

Index: src/common/lib/libutil/snprintb.c
diff -u src/common/lib/libutil/snprintb.c:1.46 src/common/lib/libutil/snprintb.c:1.47
--- src/common/lib/libutil/snprintb.c:1.46	Sun Apr  7 10:10:54 2024
+++ src/common/lib/libutil/snprintb.c	Sun Apr  7 12:05:23 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: snprintb.c,v 1.46 2024/04/07 10:10:54 rillig Exp $	*/
+/*	$NetBSD: snprintb.c,v 1.47 2024/04/07 12:05:23 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2024 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #  include 
 #  if defined(LIBC_SCCS)
-__RCSID("$NetBSD: snprintb.c,v 1.46 2024/04/07 10:10:54 rillig Exp $");
+__RCSID("$NetBSD: snprintb.c,v 1.47 2024/04/07 12:05:23 rillig Exp $");
 #  endif
 
 #  include 
@@ -46,7 +46,7 @@ __RCSID("$NetBSD: snprintb.c,v 1.46 2024
 #  include 
 # else /* ! _KERNEL */
 #  include 
-__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.46 2024/04/07 10:10:54 rillig Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.47 2024/04/07 12:05:23 rillig Exp $");
 #  include 
 #  include 
 #  include 
@@ -150,7 +150,8 @@ old_style(state *s)
 static int
 new_style(state *s)
 {
-	uint64_t field = s->val;
+	uint8_t field_kind = 0;	// 0 or 'f' or 'F'
+	uint64_t field = 0;	// valid if field_kind != '\0'
 	int matched = 1;
 	const char *prev_bitfmt = s->bitfmt;
 	while (*s->bitfmt != '\0') {
@@ -158,6 +159,7 @@ new_style(state *s)
 		uint8_t kind = cur_bitfmt[0];
 		switch (kind) {
 		case 'b':
+			field_kind = 0;
 			prev_bitfmt = cur_bitfmt;
 			uint8_t b_bit = cur_bitfmt[1];
 			if (b_bit >= 64)
@@ -174,6 +176,7 @@ new_style(state *s)
 			break;
 		case 'f':
 		case 'F':
+			field_kind = kind;
 			prev_bitfmt = cur_bitfmt;
 			matched = 0;
 			uint8_t f_lsb = cur_bitfmt[1];
@@ -200,6 +203,10 @@ new_style(state *s)
 		case '=':
 		case ':':
 			s->bitfmt += 2;
+			if (kind == '=' && field_kind != 'f')
+return -1;
+			if (kind == ':' && field_kind != 'F')
+return -1;
 			uint8_t cmp = cur_bitfmt[1];
 			if (cur_bitfmt[2] == '\0')
 return -1;
@@ -213,6 +220,8 @@ new_style(state *s)
 			maybe_wrap_line(s, prev_bitfmt);
 			break;
 		case '*':
+			if (field_kind == 0)
+return -1;
 			if (cur_bitfmt[1] == '\0')
 return -1;
 			s->bitfmt++;

Index: src/lib/libutil/snprintb.3
diff -u src/lib/libutil/snprintb.3:1.36 src/lib/libutil/snprintb.3:1.37
--- src/lib/libutil/snprintb.3:1.36	Thu Feb 29 21:08:54 2024
+++ src/lib/libutil/snprintb.3	Sun Apr  7 12:05:23 2024
@@ -1,4 +1,4 @@
-.\" $NetBSD: snprintb.3,v 1.36 2024/02/29 21:08:54 rillig Exp $
+.\" $NetBSD: snprintb.3,v 1.37 2024/04/07 12:05:23 rillig Exp $
 .\"
 .\" Copyright (c) 1998, 2024 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -48,7 +48,6 @@ The
 .Fn snprintb
 function formats a bitmask into a mnemonic form suitable for printing.
 .Pp
-This conversion is useful for decoding bit fields in device registers.
 It formats the integer
 .Fa val
 into the buffer
@@ -103,13 +102,18 @@ character
 The decoding directive in
 .Fa fmt
 describes how the bitfield is to be interpreted and displayed.
-It follows two possible syntaxes, referred to as
+It follows two possible formats, referred to as
 .Dq old
 and
 .Dq new .
-The main advantage of the
+The
+.Dq old
+format is limited to describing single bits in a 32-bit value,
+the bit positions are 1-based.
+The
 .Dq new
-formatting is that it is capable of handling multi-bit fields.
+format supports multi-bit fields and 64-bit values,
+the bit positions are 0-based.
 .Pp
 If the first character of
 .Fa fmt
@@ -119,153 +123,149 @@ the remainder of the
 .Fa fmt
 argument follows the
 .Dq new
-syntax.
-The second character
-.Pq the first for the old format
-is a binary character representation of the
-output numeral base in which the bitfield will be printed before it is decoded.
-Recognized radix values
+format.
+.Pp
+The next character
+.Po the first for the
+.Dq old
+format
+.Pc
+specifies the numeral base in which to print the numbers in the output.
+The possible values
 .Pq in C escape-character format
 are
-.Ql \e10
-.Pq octal ,
-.Ql \e12
-.Pq decimal ,
-and
-.Ql \e20
-.Pq hexadecimal .
+.Ql \e010
+for octal,
+.Ql \e012
+for decimal, and
+.Ql \e020
+for hexadecimal.
 .Pp
 The remaining characters in the
 .Fa fmt
-argument are interpreted as a list of formatting directives.
+argument represent 

CVS commit: src

2024-04-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr  7 12:05:23 UTC 2024

Modified Files:
src/common/lib/libutil: snprintb.c
src/lib/libutil: snprintb.3
src/tests/lib/libutil: t_snprintb.c

Log Message:
snprintb: reject combinations of 'f' with ':' as well as 'F' with '='

These combinations would lead to garbled output.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/common/lib/libutil/snprintb.c
cvs rdiff -u -r1.36 -r1.37 src/lib/libutil/snprintb.3
cvs rdiff -u -r1.33 -r1.34 src/tests/lib/libutil/t_snprintb.c

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



CVS commit: src

2024-04-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr  7 10:10:54 UTC 2024

Modified Files:
src/common/lib/libutil: snprintb.c
src/tests/lib/libutil: t_snprintb.c

Log Message:
snprintb: reject empty descriptions

In cases where the snprintb output is garbled, it is not trustworthy, so
make sure the mistakes in the bitfmt are fixed early.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/common/lib/libutil/snprintb.c
cvs rdiff -u -r1.32 -r1.33 src/tests/lib/libutil/t_snprintb.c

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



CVS commit: src

2024-04-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr  7 10:10:54 UTC 2024

Modified Files:
src/common/lib/libutil: snprintb.c
src/tests/lib/libutil: t_snprintb.c

Log Message:
snprintb: reject empty descriptions

In cases where the snprintb output is garbled, it is not trustworthy, so
make sure the mistakes in the bitfmt are fixed early.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/common/lib/libutil/snprintb.c
cvs rdiff -u -r1.32 -r1.33 src/tests/lib/libutil/t_snprintb.c

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

Modified files:

Index: src/common/lib/libutil/snprintb.c
diff -u src/common/lib/libutil/snprintb.c:1.45 src/common/lib/libutil/snprintb.c:1.46
--- src/common/lib/libutil/snprintb.c:1.45	Mon Apr  1 08:53:42 2024
+++ src/common/lib/libutil/snprintb.c	Sun Apr  7 10:10:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: snprintb.c,v 1.45 2024/04/01 08:53:42 rillig Exp $	*/
+/*	$NetBSD: snprintb.c,v 1.46 2024/04/07 10:10:54 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2024 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #  include 
 #  if defined(LIBC_SCCS)
-__RCSID("$NetBSD: snprintb.c,v 1.45 2024/04/01 08:53:42 rillig Exp $");
+__RCSID("$NetBSD: snprintb.c,v 1.46 2024/04/07 10:10:54 rillig Exp $");
 #  endif
 
 #  include 
@@ -46,7 +46,7 @@ __RCSID("$NetBSD: snprintb.c,v 1.45 2024
 #  include 
 # else /* ! _KERNEL */
 #  include 
-__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.45 2024/04/01 08:53:42 rillig Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.46 2024/04/07 10:10:54 rillig Exp $");
 #  include 
 #  include 
 #  include 
@@ -162,6 +162,8 @@ new_style(state *s)
 			uint8_t b_bit = cur_bitfmt[1];
 			if (b_bit >= 64)
 return -1;
+			if (cur_bitfmt[2] == '\0')
+return -1;
 			s->bitfmt += 2;
 			if (((s->val >> b_bit) & 1) == 0)
 goto skip_description;
@@ -180,6 +182,8 @@ new_style(state *s)
 			uint8_t f_width = cur_bitfmt[2];
 			if (f_width > 64)
 return -1;
+			if (kind == 'f' && cur_bitfmt[3] == '\0')
+return -1;
 			field = s->val >> f_lsb;
 			if (f_width < 64)
 field &= ((uint64_t) 1 << f_width) - 1;
@@ -197,6 +201,8 @@ new_style(state *s)
 		case ':':
 			s->bitfmt += 2;
 			uint8_t cmp = cur_bitfmt[1];
+			if (cur_bitfmt[2] == '\0')
+return -1;
 			if (field != cmp)
 goto skip_description;
 			matched = 1;
@@ -207,6 +213,8 @@ new_style(state *s)
 			maybe_wrap_line(s, prev_bitfmt);
 			break;
 		case '*':
+			if (cur_bitfmt[1] == '\0')
+return -1;
 			s->bitfmt++;
 			if (matched)
 goto skip_description;

Index: src/tests/lib/libutil/t_snprintb.c
diff -u src/tests/lib/libutil/t_snprintb.c:1.32 src/tests/lib/libutil/t_snprintb.c:1.33
--- src/tests/lib/libutil/t_snprintb.c:1.32	Mon Apr  1 09:15:51 2024
+++ src/tests/lib/libutil/t_snprintb.c	Sun Apr  7 10:10:54 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: t_snprintb.c,v 1.32 2024/04/01 09:15:51 rillig Exp $ */
+/* $NetBSD: t_snprintb.c,v 1.33 2024/04/07 10:10:54 rillig Exp $ */
 
 /*
  * Copyright (c) 2002, 2004, 2008, 2010, 2024 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008, 2010, 2024\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_snprintb.c,v 1.32 2024/04/01 09:15:51 rillig Exp $");
+__RCSID("$NetBSD: t_snprintb.c,v 1.33 2024/04/07 10:10:54 rillig Exp $");
 
 #include 
 #include 
@@ -415,16 +415,20 @@ ATF_TC_BODY(snprintb, tc)
 	0xff,
 	"0xff");
 
-	// new style single bits, empty description
-	h_snprintb(
+	// new style single bits, 'b' with empty description
+	//
+	// The description of a 'b' conversion must not be empty, as the
+	// output would contain several commas in a row.
+	h_snprintb_len(
+	1024,
 	"\177\020"
 	"b\000lsb\0"
 	"b\001\0"
 	"b\002\0"
-	"b\007msb\0"
-	,
+	"b\007msb\0",
 	0xff,
-	"0xff");
+	-1,
+	"0xff");
+	-1,
+	"0x1");
+	-1,
+	"0x1<#");
 
 	// new style bit-field, 'F', ':' with empty description, '*'
 	//
-	// An empty description of a ':' directive that matches results in
-	// normal-looking output, but if it didn't match, the output would
-	// contain empty angle brackets, which is a mistake.
-	h_snprintb(
+	// The description of a ':' conversion must not be empty, as the
+	// output would contain empty angle brackets. Not in this particular
+	// test case, as the value is different, but the structural error is
+	// detected nevertheless.
+	h_snprintb_len(
+	1024,
 	"\177\020"
 	"F\000\004\0"
 		":\001\0"
 		"*default\0",
 	0x2,
-	"0x2");
+	-1,
+	"0x2<#");
 
 	// new style bit-field, 'f' with non-exhaustive '='
 	h_snprintb(



CVS commit: src/external/bsd/flex/bin

2024-04-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  5 22:21:40 UTC 2024

Modified Files:
src/external/bsd/flex/bin: flex.1

Log Message:
flex.1: fix single-bit error in contributor name


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/flex/bin/flex.1

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

Modified files:

Index: src/external/bsd/flex/bin/flex.1
diff -u src/external/bsd/flex/bin/flex.1:1.5 src/external/bsd/flex/bin/flex.1:1.6
--- src/external/bsd/flex/bin/flex.1:1.5	Sun Aug 28 10:48:16 2022
+++ src/external/bsd/flex/bin/flex.1	Fri Apr  5 22:21:40 2024
@@ -1,4 +1,4 @@
-.\" $NetBSD: flex.1,v 1.5 2022/08/28 10:48:16 hgutch Exp $
+.\" $NetBSD: flex.1,v 1.6 2024/04/05 22:21:40 rillig Exp $
 .\"
 .TH FLEX 1 "December 2021" "Version 2.5"
 .SH NAME
@@ -4266,7 +4266,7 @@ Frederic Raimbault, Pat Rankin, Rick Ric
 Kevin Rodgers, Kai Uwe Rommel, Jim Roskind, Alberto Santini,
 Andreas Scherer, Darrell Schiebel, Raf Schietekat,
 Doug Schmidt, Philippe Schnoebelen, Andreas Schwab,
-Larry Schwimmer, Alex Siegel, Eckehard Stolz, Jan-Erik Strvmquist,
+Larry Schwimmer, Alex Siegel, Eckehard Stolz, Jan-Erik Str\[:o]mquist,
 Mike Stump, Paul Stuart, Dave Tallman, Ian Lance Taylor,
 Chris Thewalt, Richard M. Timoney, Jodi Tsai,
 Paul Tuinenga, Gary Weik, Frank Whaley, Gerhard Wilhelms, Kent Williams, Ken



CVS commit: src/external/bsd/flex/bin

2024-04-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  5 22:21:40 UTC 2024

Modified Files:
src/external/bsd/flex/bin: flex.1

Log Message:
flex.1: fix single-bit error in contributor name


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/flex/bin/flex.1

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



CVS commit: src/lib/libc/arch/sparc/gen

2024-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Apr  2 20:42:13 UTC 2024

Modified Files:
src/lib/libc/arch/sparc/gen: fpsetround.c

Log Message:
sparc/fpsetround: fix the nearby signed integer overflow as well

Same as for sparc64 a few days ago.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/arch/sparc/gen/fpsetround.c

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



CVS commit: src/lib/libc/arch/sparc/gen

2024-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Apr  2 20:42:13 UTC 2024

Modified Files:
src/lib/libc/arch/sparc/gen: fpsetround.c

Log Message:
sparc/fpsetround: fix the nearby signed integer overflow as well

Same as for sparc64 a few days ago.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/arch/sparc/gen/fpsetround.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/arch/sparc/gen/fpsetround.c
diff -u src/lib/libc/arch/sparc/gen/fpsetround.c:1.7 src/lib/libc/arch/sparc/gen/fpsetround.c:1.8
--- src/lib/libc/arch/sparc/gen/fpsetround.c:1.7	Tue Apr  2 20:27:44 2024
+++ src/lib/libc/arch/sparc/gen/fpsetround.c	Tue Apr  2 20:42:12 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpsetround.c,v 1.7 2024/04/02 20:27:44 christos Exp $	*/
+/*	$NetBSD: fpsetround.c,v 1.8 2024/04/02 20:42:12 rillig Exp $	*/
 
 /*
  * Written by J.T. Conklin, Apr 10, 1995
@@ -7,7 +7,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpsetround.c,v 1.7 2024/04/02 20:27:44 christos Exp $");
+__RCSID("$NetBSD: fpsetround.c,v 1.8 2024/04/02 20:42:12 rillig Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -27,8 +27,8 @@ fpsetround(fp_rnd rnd_dir)
 	__asm("st %%fsr,%0" : "=m" (*));
 
 	new = old;
-	new &= ~(0x03U << 30); 
-	new |= ((rnd_dir & 0x03) << 30);
+	new &= ~(0x03U << 30);
+	new |= ((rnd_dir & 0x03U) << 30);
 
 	__asm("ld %0,%%fsr" : : "m" (*));
 



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

2024-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Apr  2 15:05:15 UTC 2024

Modified Files:
src/usr.bin/make/unit-tests: opt-keep-going-indirect.mk

Log Message:
tests/make: pass PATH onto child processes

This fixes the tests on some Cygwin variant where the shell does not
initialize the PATH environment variable when it's missing.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/usr.bin/make/unit-tests/opt-keep-going-indirect.mk

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

Modified files:

Index: src/usr.bin/make/unit-tests/opt-keep-going-indirect.mk
diff -u src/usr.bin/make/unit-tests/opt-keep-going-indirect.mk:1.2 src/usr.bin/make/unit-tests/opt-keep-going-indirect.mk:1.3
--- src/usr.bin/make/unit-tests/opt-keep-going-indirect.mk:1.2	Sat Feb 12 20:05:36 2022
+++ src/usr.bin/make/unit-tests/opt-keep-going-indirect.mk	Tue Apr  2 15:05:15 2024
@@ -1,4 +1,4 @@
-# $NetBSD: opt-keep-going-indirect.mk,v 1.2 2022/02/12 20:05:36 rillig Exp $
+# $NetBSD: opt-keep-going-indirect.mk,v 1.3 2024/04/02 15:05:15 rillig Exp $
 #
 # Tests for the -k command line option, which stops building a target as soon
 # as an error is detected, but continues building the other, independent
@@ -49,19 +49,19 @@
 # to the child processes.
 all:
 	@echo 'direct compat'
-	@set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k direct; echo "exited $$?"
+	@set +e; env -i "PATH=$$PATH" ${MAKE} -r -f ${MAKEFILE} -k direct; echo "exited $$?"
 	@echo
 
 	@echo 'direct jobs'
-	@set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k direct -j1; echo "exited $$?"
+	@set +e; env -i "PATH=$$PATH" ${MAKE} -r -f ${MAKEFILE} -k direct -j1; echo "exited $$?"
 	@echo
 
 	@echo 'indirect compat'
-	@set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k indirect; echo "exited $$?"
+	@set +e; env -i "PATH=$$PATH" ${MAKE} -r -f ${MAKEFILE} -k indirect; echo "exited $$?"
 	@echo
 
 	@echo 'indirect jobs'
-	@set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k indirect -j1; echo "exited $$?"
+	@set +e; env -i "PATH=$$PATH" ${MAKE} -r -f ${MAKEFILE} -k indirect -j1; echo "exited $$?"
 	@echo
 
 indirect: direct



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

2024-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Apr  2 15:05:15 UTC 2024

Modified Files:
src/usr.bin/make/unit-tests: opt-keep-going-indirect.mk

Log Message:
tests/make: pass PATH onto child processes

This fixes the tests on some Cygwin variant where the shell does not
initialize the PATH environment variable when it's missing.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/usr.bin/make/unit-tests/opt-keep-going-indirect.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

2024-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Apr  2 11:11:00 UTC 2024

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

Log Message:
tests/make: remove test for overly long chdir argument

On Cygwin, the path '/././..././' is normalized before being passed to
the child 'make' process. Since overly long pathnames are not required
to be supported on all platforms, remove the test.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/opt-chdir.exp
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/opt-chdir.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/opt-chdir.exp
diff -u src/usr.bin/make/unit-tests/opt-chdir.exp:1.3 src/usr.bin/make/unit-tests/opt-chdir.exp:1.4
--- src/usr.bin/make/unit-tests/opt-chdir.exp:1.3	Sun Dec 27 11:47:04 2020
+++ src/usr.bin/make/unit-tests/opt-chdir.exp	Tue Apr  2 11:11:00 2024
@@ -1,5 +1,3 @@
-make: chdir /././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././
 ././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././.
 /././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././
 

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

2024-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Apr  2 11:11:00 UTC 2024

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

Log Message:
tests/make: remove test for overly long chdir argument

On Cygwin, the path '/././..././' is normalized before being passed to
the child 'make' process. Since overly long pathnames are not required
to be supported on all platforms, remove the test.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/opt-chdir.exp
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/opt-chdir.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

2024-04-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Apr  1 12:33:28 UTC 2024

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

Log Message:
make: remove unreachable code in handling .for loops


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

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

Modified files:

Index: src/usr.bin/make/for.c
diff -u src/usr.bin/make/for.c:1.178 src/usr.bin/make/for.c:1.179
--- src/usr.bin/make/for.c:1.178	Sun Jan 21 15:02:17 2024
+++ src/usr.bin/make/for.c	Mon Apr  1 12:33:27 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: for.c,v 1.178 2024/01/21 15:02:17 rillig Exp $	*/
+/*	$NetBSD: for.c,v 1.179 2024/04/01 12:33:27 rillig Exp $	*/
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -58,7 +58,7 @@
 #include "make.h"
 
 /*	"@(#)for.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: for.c,v 1.178 2024/01/21 15:02:17 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.179 2024/04/01 12:33:27 rillig Exp $");
 
 
 typedef struct ForLoop {
@@ -196,11 +196,7 @@ ForLoop_ParseItems(ForLoop *f, const cha
 	cpp_skip_whitespace();
 
 	items = Var_Subst(p, SCOPE_GLOBAL, VARE_WANTRES);
-	if (items == var_Error) {
-		/* TODO: Make this part of the code reachable. */
-		Parse_Error(PARSE_FATAL, "Error in .for loop items");
-		return false;
-	}
+	/* TODO: handle errors */
 
 	f->items = Substring_Words(items, false);
 	free(items);
@@ -490,12 +486,11 @@ ForLoop_SubstBody(ForLoop *f, unsigned i
 			p += 2;
 			ForLoop_SubstVarLong(f, firstItem, body,
 			, endc, );
-		} else if (p[1] != '\0') {
+		} else {
 			ForLoop_SubstVarShort(f, firstItem, body,
 			p + 1, );
 			p += 2;
-		} else
-			break;
+		}
 	}
 
 	Buf_AddRange(body, mark, end);



CVS commit: src/usr.bin/make

2024-04-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Apr  1 12:33:28 UTC 2024

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

Log Message:
make: remove unreachable code in handling .for loops


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

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



  1   2   3   4   5   6   7   8   9   10   >