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

2024-06-01 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Jun  2 00:22:21 UTC 2024

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

Log Message:
Include usr/share/zoneinfo/leap-seconds.list


To generate a diff of this commit:
cvs rdiff -u -r1.1344 -r1.1345 src/distrib/sets/lists/base/mi

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/base

2024-06-01 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Jun  2 00:22:21 UTC 2024

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

Log Message:
Include usr/share/zoneinfo/leap-seconds.list


To generate a diff of this commit:
cvs rdiff -u -r1.1344 -r1.1345 src/distrib/sets/lists/base/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/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1344 src/distrib/sets/lists/base/mi:1.1345
--- src/distrib/sets/lists/base/mi:1.1344	Sat Apr 13 08:50:18 2024
+++ src/distrib/sets/lists/base/mi	Sun Jun  2 00:22:21 2024
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1344 2024/04/13 08:50:18 nakayama Exp $
+# $NetBSD: mi,v 1.1345 2024/06/02 00:22:21 kre Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -6274,6 +6274,7 @@
 ./usr/share/zoneinfo/WET			base-sys-share		share
 ./usr/share/zoneinfo/Zulu			base-sys-share		share
 ./usr/share/zoneinfo/iso3166.tab		base-sys-share		share
+./usr/share/zoneinfo/leap-seconds.list		base-sys-share		share
 ./usr/share/zoneinfo/leapseconds		base-sys-share		share
 ./usr/share/zoneinfo/posixrules			base-sys-share		share
 ./usr/share/zoneinfo/zone.tab			base-sys-share		share



CVS commit: src/external/public-domain/tz/share/zoneinfo

2024-06-01 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Jun  2 00:21:12 UTC 2024

Modified Files:
src/external/public-domain/tz/share/zoneinfo: Makefile

Log Message:
Install /usr/share/zoneinfo/leap-seconds.list

Requested by Mallory Adams in tech-userlevel@ a couple of weeks ago.

XXX pullup -10


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/public-domain/tz/share/zoneinfo/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/public-domain/tz/share/zoneinfo/Makefile
diff -u src/external/public-domain/tz/share/zoneinfo/Makefile:1.4 src/external/public-domain/tz/share/zoneinfo/Makefile:1.5
--- src/external/public-domain/tz/share/zoneinfo/Makefile:1.4	Thu Oct  8 13:44:36 2020
+++ src/external/public-domain/tz/share/zoneinfo/Makefile	Sun Jun  2 00:21:12 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2020/10/08 13:44:36 kre Exp $
+#	$NetBSD: Makefile,v 1.5 2024/06/02 00:21:12 kre Exp $
 
 .include 
 .include "../../Makefile.inc"
@@ -52,7 +52,7 @@ YDATA=		$(PRIMARY_YDATA) etcetera backwa
 NDATA=		factory
 TDATA=		$(YDATA) $(NDATA)
 ZONETABLES=	zone1970.tab zone.tab
-TABDATA=	iso3166.tab leapseconds $(ZONETABLES)
+TABDATA=	iso3166.tab leapseconds leap-seconds.list $(ZONETABLES)
 DATA=		$(YDATA) $(NDATA) $(TABDATA)
 
 TZBUILDDIR=	${.OBJDIR}/builddir



CVS commit: src/external/public-domain/tz/share/zoneinfo

2024-06-01 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Jun  2 00:21:12 UTC 2024

Modified Files:
src/external/public-domain/tz/share/zoneinfo: Makefile

Log Message:
Install /usr/share/zoneinfo/leap-seconds.list

Requested by Mallory Adams in tech-userlevel@ a couple of weeks ago.

XXX pullup -10


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/public-domain/tz/share/zoneinfo/Makefile

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



CVS commit: src/usr.sbin/installboot

2024-06-01 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sat Jun  1 20:19:42 UTC 2024

Modified Files:
src/usr.sbin/installboot: installboot.8

Log Message:
installboot.8: reflect current evbmips support


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/usr.sbin/installboot/installboot.8

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/installboot/installboot.8
diff -u src/usr.sbin/installboot/installboot.8:1.109 src/usr.sbin/installboot/installboot.8:1.110
--- src/usr.sbin/installboot/installboot.8:1.109	Sun May 19 15:48:57 2024
+++ src/usr.sbin/installboot/installboot.8	Sat Jun  1 20:19:41 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: installboot.8,v 1.109 2024/05/19 15:48:57 tsutsui Exp $
+.\"	$NetBSD: installboot.8,v 1.110 2024/06/01 20:19:41 gutteridge Exp $
 .\"
 .\" Copyright (c) 2002-2023 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -32,7 +32,7 @@
 .\" Usage: \*(UB
 .ds UB U\(hyBoot
 .
-.Dd May 19, 2024
+.Dd June 1, 2024
 .Dt INSTALLBOOT 8
 .Os
 .Sh NAME
@@ -725,6 +725,9 @@ SiByte/Broadcom
 and
 .Tn BCM1480
 CPUs.
+There is also
+\*(UB support for the
+.Tn Creator CI20 .
 .Bl -tag -width Pa
 .
 .It Pa /usr/mdec/sbmips/boot
@@ -742,10 +745,9 @@ primary bootstrap for LFSv1 and LFSv2 fi
 .It Pa /usr/mdec/sbmips/netboot
 .Tn SBMIPS
 primary bootstrap for network root.
-.Pp
-Note that
-.Nm
-does not currently support evbmips directly.
+.It Pa /usr/share/installboot/evbmips/boards.plist
+Base board database, used to provide information about which
+\*(UB package is required for a given board.
 .
 .El
 .



CVS commit: src/usr.bin/make

2024-06-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jun  1 20:19:41 UTC 2024

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

Log Message:
make: fix memory leak in realpath cache


To generate a diff of this commit:
cvs rdiff -u -r1.622 -r1.623 src/usr.bin/make/main.c

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

Modified files:

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.622 src/usr.bin/make/main.c:1.623
--- src/usr.bin/make/main.c:1.622	Sat Jun  1 12:27:31 2024
+++ src/usr.bin/make/main.c	Sat Jun  1 20:19:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.622 2024/06/01 12:27:31 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.623 2024/06/01 20:19:41 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.622 2024/06/01 12:27:31 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.623 2024/06/01 20:19:41 rillig Exp $");
 #if defined(MAKE_NATIVE)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -1980,11 +1980,8 @@ purge_relative_cached_realpaths(void)
 		more = HashIter_Next();
 		if (he->key[0] != '/') {
 			DEBUG1(DIR, "cached_realpath: purging %s\n", he->key);
+			free(he->value);
 			HashTable_DeleteEntry(_realpaths, he);
-			/*
-			 * XXX: What about the allocated he->value? Either
-			 * free them or document why they cannot be freed.
-			 */
 		}
 	}
 }



CVS commit: src/usr.sbin/installboot

2024-06-01 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sat Jun  1 20:19:42 UTC 2024

Modified Files:
src/usr.sbin/installboot: installboot.8

Log Message:
installboot.8: reflect current evbmips support


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/usr.sbin/installboot/installboot.8

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-06-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jun  1 20:19:41 UTC 2024

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

Log Message:
make: fix memory leak in realpath cache


To generate a diff of this commit:
cvs rdiff -u -r1.622 -r1.623 src/usr.bin/make/main.c

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



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

2024-06-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jun  1 18:44:05 UTC 2024

Modified Files:
src/usr.bin/make/unit-tests: directive-export-literal.exp
directive-export-literal.mk varmod-head.mk varmod-sysv.exp
varmod-sysv.mk varmod-tail.mk varmod-to-separator.exp
varmod-to-separator.mk varmod.exp varmod.mk
varname-dot-make-level.exp varname-dot-make-level.mk

Log Message:
tests/make: test more modifiers and special variables


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/usr.bin/make/unit-tests/directive-export-literal.exp \
src/usr.bin/make/unit-tests/varmod-tail.mk
cvs rdiff -u -r1.7 -r1.8 \
src/usr.bin/make/unit-tests/directive-export-literal.mk
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-head.mk
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/varmod-sysv.exp
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/varmod-sysv.mk
cvs rdiff -u -r1.12 -r1.13 \
src/usr.bin/make/unit-tests/varmod-to-separator.exp
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/varmod-to-separator.mk
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod.exp
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmod.mk
cvs rdiff -u -r1.1 -r1.2 \
src/usr.bin/make/unit-tests/varname-dot-make-level.exp
cvs rdiff -u -r1.2 -r1.3 \
src/usr.bin/make/unit-tests/varname-dot-make-level.mk

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

Modified files:

Index: src/usr.bin/make/unit-tests/directive-export-literal.exp
diff -u src/usr.bin/make/unit-tests/directive-export-literal.exp:1.4 src/usr.bin/make/unit-tests/directive-export-literal.exp:1.5
--- src/usr.bin/make/unit-tests/directive-export-literal.exp:1.4	Mon Oct  5 19:27:48 2020
+++ src/usr.bin/make/unit-tests/directive-export-literal.exp	Sat Jun  1 18:44:05 2024
@@ -1,2 +1,5 @@
 value with ${UNEXPANDED} expression
+value literal
+value indirect
+value ${indirect:L}
 exit status 0
Index: src/usr.bin/make/unit-tests/varmod-tail.mk
diff -u src/usr.bin/make/unit-tests/varmod-tail.mk:1.4 src/usr.bin/make/unit-tests/varmod-tail.mk:1.5
--- src/usr.bin/make/unit-tests/varmod-tail.mk:1.4	Sun Dec 20 22:57:40 2020
+++ src/usr.bin/make/unit-tests/varmod-tail.mk	Sat Jun  1 18:44:05 2024
@@ -1,8 +1,16 @@
-# $NetBSD: varmod-tail.mk,v 1.4 2020/12/20 22:57:40 rillig Exp $
+# $NetBSD: varmod-tail.mk,v 1.5 2024/06/01 18:44:05 rillig Exp $
 #
 # Tests for the :T variable modifier, which returns the basename of each of
 # the words in the variable value.
 
+
+# If the ':T' is not directly followed by a delimiting ':' or '}', the
+# ':from=to' modifier is tried as a fallback.
+.if ${:U Tail :Tail=replaced} != "replaced"
+.  error
+.endif
+
+
 all:
 .for path in a/b/c def a.b.c a.b/c a a.a .gitignore a a.a trailing/
 	@echo "tail (basename) of '"${path:Q}"' is '"${path:T:Q}"'"

Index: src/usr.bin/make/unit-tests/directive-export-literal.mk
diff -u src/usr.bin/make/unit-tests/directive-export-literal.mk:1.7 src/usr.bin/make/unit-tests/directive-export-literal.mk:1.8
--- src/usr.bin/make/unit-tests/directive-export-literal.mk:1.7	Sun Dec 13 01:07:54 2020
+++ src/usr.bin/make/unit-tests/directive-export-literal.mk	Sat Jun  1 18:44:05 2024
@@ -1,4 +1,4 @@
-# $NetBSD: directive-export-literal.mk,v 1.7 2020/12/13 01:07:54 rillig Exp $
+# $NetBSD: directive-export-literal.mk,v 1.8 2024/06/01 18:44:05 rillig Exp $
 #
 # Tests for the .export-literal directive, which exports a variable value
 # without expanding it.
@@ -9,5 +9,28 @@ UT_VAR=		value with ${UNEXPANDED} expres
 
 .export-literal			# oops: missing argument
 
+# After a variable whose value does not contain a '$' is exported, a following
+# .export-literal can be skipped, to avoid a setenv call, which may leak
+# memory on some platforms.
+UT_TWICE_LITERAL=	value literal
+.export UT_TWICE_LITERAL
+.export-literal UT_TWICE_LITERAL
+
+# XXX: After an .export, an .export-literal has no effect, even when the
+# variable value contains a '$'.
+UT_TWICE_EXPR=		value ${indirect:L}
+.export UT_TWICE_EXPR
+.export-literal UT_TWICE_EXPR
+
+# After an .export, an .unexport resets the variable's exported state,
+# re-enabling a later .export-literal.
+UT_TWICE_EXPR_UNEXPORT=	value ${indirect:L}
+.export UT_TWICE_EXPR_UNEXPORT
+.unexport UT_TWICE_EXPR_UNEXPORT
+.export-literal UT_TWICE_EXPR_UNEXPORT
+
 all:
 	@echo "$$UT_VAR"
+	@echo "$$UT_TWICE_LITERAL"
+	@echo "$$UT_TWICE_EXPR"
+	@echo "$$UT_TWICE_EXPR_UNEXPORT"

Index: src/usr.bin/make/unit-tests/varmod-head.mk
diff -u src/usr.bin/make/unit-tests/varmod-head.mk:1.5 src/usr.bin/make/unit-tests/varmod-head.mk:1.6
--- src/usr.bin/make/unit-tests/varmod-head.mk:1.5	Sun Jul 10 21:11:49 2022
+++ src/usr.bin/make/unit-tests/varmod-head.mk	Sat Jun  1 18:44:05 2024
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-head.mk,v 1.5 2022/07/10 21:11:49 rillig Exp $
+# $NetBSD: varmod-head.mk,v 1.6 2024/06/01 18:44:05 rillig Exp 

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

2024-06-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jun  1 18:44:05 UTC 2024

Modified Files:
src/usr.bin/make/unit-tests: directive-export-literal.exp
directive-export-literal.mk varmod-head.mk varmod-sysv.exp
varmod-sysv.mk varmod-tail.mk varmod-to-separator.exp
varmod-to-separator.mk varmod.exp varmod.mk
varname-dot-make-level.exp varname-dot-make-level.mk

Log Message:
tests/make: test more modifiers and special variables


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/usr.bin/make/unit-tests/directive-export-literal.exp \
src/usr.bin/make/unit-tests/varmod-tail.mk
cvs rdiff -u -r1.7 -r1.8 \
src/usr.bin/make/unit-tests/directive-export-literal.mk
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-head.mk
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/varmod-sysv.exp
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/varmod-sysv.mk
cvs rdiff -u -r1.12 -r1.13 \
src/usr.bin/make/unit-tests/varmod-to-separator.exp
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/varmod-to-separator.mk
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod.exp
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmod.mk
cvs rdiff -u -r1.1 -r1.2 \
src/usr.bin/make/unit-tests/varname-dot-make-level.exp
cvs rdiff -u -r1.2 -r1.3 \
src/usr.bin/make/unit-tests/varname-dot-make-level.mk

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



Re: CVS commit: src/usr.bin/gzip

2024-06-01 Thread Izumi Tsutsui
> Your diff is backwards and I guess that is the cause for the confusion.

Ah, I checked a wrong tree. Sorry for the noise.
---
Izumi Tsutsui


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

2024-06-01 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Sat Jun  1 15:54:41 UTC 2024

Modified Files:
src/usr.bin/make/unit-tests: Makefile

Log Message:
Run check-expect.lua in .CURDIR


To generate a diff of this commit:
cvs rdiff -u -r1.346 -r1.347 src/usr.bin/make/unit-tests/Makefile

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

Modified files:

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.346 src/usr.bin/make/unit-tests/Makefile:1.347
--- src/usr.bin/make/unit-tests/Makefile:1.346	Sat Jun  1 10:06:23 2024
+++ src/usr.bin/make/unit-tests/Makefile	Sat Jun  1 15:54:40 2024
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.346 2024/06/01 10:06:23 rillig Exp $
+# $NetBSD: Makefile,v 1.347 2024/06/01 15:54:40 sjg Exp $
 #
 # Unit tests for make(1)
 #
@@ -776,7 +776,7 @@ test:	${OUTFILES} .PHONY
 	  lua=${LUA:Ulua} ; \
 	  have_lua=$$("$$lua" -e 'print "yes"' 2>&1) ; \
 	  if [ "$$have_lua" = "yes" ]; then \
-	"$$lua" ./check-expect.lua *.mk; \
+	(cd ${.CURDIR} && "$$lua" ./check-expect.lua *.mk); \
 	  fi; \
 	fi
 



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

2024-06-01 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Sat Jun  1 15:54:41 UTC 2024

Modified Files:
src/usr.bin/make/unit-tests: Makefile

Log Message:
Run check-expect.lua in .CURDIR


To generate a diff of this commit:
cvs rdiff -u -r1.346 -r1.347 src/usr.bin/make/unit-tests/Makefile

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



Re: CVS commit: src/usr.bin/gzip

2024-06-01 Thread Martin Husemann
On Sat, Jun 01, 2024 at 11:17:11PM +0900, Izumi Tsutsui wrote:
> > Log Message:
> > Fix typo in previous
> 
> ---
> @@ -1126,7 +1126,7 @@ copymodes(int fd, const struct stat *sbp
>   if (fchmod(fd, sb.st_mode) < 0)
>   maybe_warn("couldn't fchmod: %s", file);
>  
> -#if !HAVE_NBTOOL_CONFIG_H
> +#ifdef !HAVE_NBTOOL_CONFIG_H
[..]
> If HAVE_NBTOOL_CONFIG_H is not defined, it's treated as 0 so
> !HAVE_NBTOOL_CONFIG_H still works.

Your diff is backwards and I guess that is the cause for the confusion.

The change was from #ifdef (which does not work with !) to #if, to
unbreak the build.

The !HAVE_NBTOOL_CONFIG_H is still there and everything should work as
you intended.

Martin


Re: CVS commit: src/usr.bin/gzip

2024-06-01 Thread Izumi Tsutsui
martin@ wrote:

> Module Name:  src
> Committed By: martin
> Date: Sat Jun  1 10:17:12 UTC 2024
> 
> Modified Files:
>   src/usr.bin/gzip: gzip.c
> 
> Log Message:
> Fix typo in previous

---
@@ -1126,7 +1126,7 @@ copymodes(int fd, const struct stat *sbp
if (fchmod(fd, sb.st_mode) < 0)
maybe_warn("couldn't fchmod: %s", file);
 
-#if !HAVE_NBTOOL_CONFIG_H
+#ifdef !HAVE_NBTOOL_CONFIG_H
TIMESPEC_TO_TIMEVAL([0], _atimespec);
TIMESPEC_TO_TIMEVAL([1], _mtimespec);
if (futimes(fd, times) < 0)
---

What's the problem in previous?
gzip.c already has the following lines:

>> #if HAVE_NBTOOL_CONFIG_H
>> #include "nbtool_config.h"
>> #endif

and  also has
>> #if !HAVE_NBTOOL_CONFIG_H
>> #define DISKUNIT(dev)   (minor(dev) / MAXPARTITIONS)
>> #define DISKPART(dev)   (minor(dev) % MAXPARTITIONS)
>> #define DISKMINOR(unit, part) \
>> (((unit) * MAXPARTITIONS) + (part))
>> #endif /* !HAVE_NBTOOL_CONFIG_H */
(though  etc uses !defined(HAVE_NBTOOL_CONFIG_H))

If HAVE_NBTOOL_CONFIG_H is not defined, it's treated as 0 so
!HAVE_NBTOOL_CONFIG_H still works.

If you don't like !HAVE_NBTOOL_CONFIG_H, could you please fix
all other files?

Thanks,
---
Izumi Tsutsui


CVS commit: src/lib/libc/compat/sys

2024-06-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jun  1 13:33:46 UTC 2024

Modified Files:
src/lib/libc/compat/sys: compat__lwp_park.c

Log Message:
Don't include both  and .


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/compat/sys/compat__lwp_park.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/compat/sys/compat__lwp_park.c
diff -u src/lib/libc/compat/sys/compat__lwp_park.c:1.2 src/lib/libc/compat/sys/compat__lwp_park.c:1.3
--- src/lib/libc/compat/sys/compat__lwp_park.c:1.2	Sun Jan 11 02:46:26 2009
+++ src/lib/libc/compat/sys/compat__lwp_park.c	Sat Jun  1 13:33:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat__lwp_park.c,v 1.2 2009/01/11 02:46:26 christos Exp $ */
+/*	$NetBSD: compat__lwp_park.c,v 1.3 2024/06/01 13:33:46 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -37,14 +37,13 @@
  */
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: compat__lwp_park.c,v 1.2 2009/01/11 02:46:26 christos Exp $");
+__RCSID("$NetBSD: compat__lwp_park.c,v 1.3 2024/06/01 13:33:46 thorpej Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
 #define __LIBC12_SOURCE__
 #include 
 #include 
-#include 
 #include 
 
 __warn_references(_lwp_park,



CVS commit: src/lib/libc/compat/sys

2024-06-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jun  1 13:33:46 UTC 2024

Modified Files:
src/lib/libc/compat/sys: compat__lwp_park.c

Log Message:
Don't include both  and .


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/compat/sys/compat__lwp_park.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-06-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jun  1 12:27:31 UTC 2024

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

Log Message:
make: replace strncpy with snprintf

There's no point copying a MAXPATHLEN buffer in its entirety when only
the initial string part is ever used.


To generate a diff of this commit:
cvs rdiff -u -r1.621 -r1.622 src/usr.bin/make/main.c

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

Modified files:

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.621 src/usr.bin/make/main.c:1.622
--- src/usr.bin/make/main.c:1.621	Sat Jun  1 12:17:41 2024
+++ src/usr.bin/make/main.c	Sat Jun  1 12:27:31 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.621 2024/06/01 12:17:41 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.622 2024/06/01 12:27:31 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.621 2024/06/01 12:17:41 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.622 2024/06/01 12:27:31 rillig Exp $");
 #if defined(MAKE_NATIVE)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -368,7 +368,7 @@ MainParseArgChdir(const char *argvalue)
 	stat(curdir, ) != -1 &&
 	sa.st_ino == sb.st_ino &&
 	sa.st_dev == sb.st_dev)
-		strncpy(curdir, argvalue, MAXPATHLEN);
+		snprintf(curdir, MAXPATHLEN, "%s", argvalue);
 	ignorePWD = true;
 }
 
@@ -1041,7 +1041,7 @@ HandlePWD(const struct stat *curdir_st)
 	if (stat(pwd, _st) == 0 &&
 	curdir_st->st_ino == pwd_st.st_ino &&
 	curdir_st->st_dev == pwd_st.st_dev)
-		(void)strncpy(curdir, pwd, MAXPATHLEN);
+		snprintf(curdir, MAXPATHLEN, "%s", pwd);
 
 ignore_pwd:
 	FStr_Done();
@@ -1999,9 +1999,7 @@ cached_realpath(const char *pathname, ch
 
 	rp = HashTable_FindValue(_realpaths, pathname);
 	if (rp != NULL) {
-		/* a hit */
-		strncpy(resolved, rp, MAXPATHLEN);
-		resolved[MAXPATHLEN - 1] = '\0';
+		snprintf(resolved, MAXPATHLEN, "%s", rp);
 		return resolved;
 	}
 



CVS commit: src/usr.bin/make

2024-06-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jun  1 12:27:31 UTC 2024

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

Log Message:
make: replace strncpy with snprintf

There's no point copying a MAXPATHLEN buffer in its entirety when only
the initial string part is ever used.


To generate a diff of this commit:
cvs rdiff -u -r1.621 -r1.622 src/usr.bin/make/main.c

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



CVS commit: src/usr.bin/make

2024-06-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jun  1 12:17:41 UTC 2024

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

Log Message:
make: fix variable lifetime when initializing MAKE and .MAKE

The pathbuf buffer is aliased by abspath, which later escapes the block
where the buffer is declared.


To generate a diff of this commit:
cvs rdiff -u -r1.620 -r1.621 src/usr.bin/make/main.c

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

Modified files:

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.620 src/usr.bin/make/main.c:1.621
--- src/usr.bin/make/main.c:1.620	Sat Jun  1 07:37:19 2024
+++ src/usr.bin/make/main.c	Sat Jun  1 12:17:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.620 2024/06/01 07:37:19 sjg Exp $	*/
+/*	$NetBSD: main.c,v 1.621 2024/06/01 12:17:41 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.620 2024/06/01 07:37:19 sjg Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.621 2024/06/01 12:17:41 rillig Exp $");
 #if defined(MAKE_NATIVE)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -1126,9 +1126,9 @@ static void
 InitVarMake(const char *argv0)
 {
 	const char *make = argv0;
+	char pathbuf[MAXPATHLEN];
 
 	if (argv0[0] != '/' && strchr(argv0, '/') != NULL) {
-		char pathbuf[MAXPATHLEN];
 		const char *abspath = cached_realpath(argv0, pathbuf);
 		struct stat st;
 		if (abspath != NULL && abspath[0] == '/' &&



CVS commit: src/usr.bin/make

2024-06-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jun  1 12:17:41 UTC 2024

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

Log Message:
make: fix variable lifetime when initializing MAKE and .MAKE

The pathbuf buffer is aliased by abspath, which later escapes the block
where the buffer is declared.


To generate a diff of this commit:
cvs rdiff -u -r1.620 -r1.621 src/usr.bin/make/main.c

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



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

2024-06-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jun  1 11:24:11 UTC 2024

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

Log Message:
tests/make: test invalid character in a late .for variable name

This covers the cleanup code that frees the earlier variable names when
a late variable name is invalid.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/usr.bin/make/unit-tests/directive-for-errors.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-06-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jun  1 11:24:11 UTC 2024

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

Log Message:
tests/make: test invalid character in a late .for variable name

This covers the cleanup code that frees the earlier variable names when
a late variable name is invalid.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/usr.bin/make/unit-tests/directive-for-errors.mk

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

Modified files:

Index: src/usr.bin/make/unit-tests/directive-for-errors.mk
diff -u src/usr.bin/make/unit-tests/directive-for-errors.mk:1.10 src/usr.bin/make/unit-tests/directive-for-errors.mk:1.11
--- src/usr.bin/make/unit-tests/directive-for-errors.mk:1.10	Sat Apr 20 10:18:55 2024
+++ src/usr.bin/make/unit-tests/directive-for-errors.mk	Sat Jun  1 11:24:11 2024
@@ -1,4 +1,4 @@
-# $NetBSD: directive-for-errors.mk,v 1.10 2024/04/20 10:18:55 rillig Exp $
+# $NetBSD: directive-for-errors.mk,v 1.11 2024/06/01 11:24:11 rillig Exp $
 #
 # Tests for error handling in .for loops.
 
@@ -41,7 +41,7 @@
 ${:U\$}=	dollar		# see whether the "variable" '$' is local
 ${:U\\}=	backslash	# see whether the "variable" '\' is local
 # expect+1: invalid character '$' in .for loop variable name
-.for $ \ in 1 2 3 4
+.for a b $ \ in 1 2 3 4
 .  info Dollar $$ ${$} $($) and backslash $\ ${\} $(\).
 .endfor
 



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

2024-06-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jun  1 11:06:17 UTC 2024

Modified Files:
src/usr.bin/make/unit-tests: varname-dot-objdir.exp
varname-dot-objdir.mk

Log Message:
tests/make: cover purging the realpath cache

In purge_relative_cached_realpaths, the hash table containing the cache
is modified while being iterated, which needs extra care, so add a test
that covers this code in at least a single simple scenario.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varname-dot-objdir.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varname-dot-objdir.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/varname-dot-objdir.exp
diff -u src/usr.bin/make/unit-tests/varname-dot-objdir.exp:1.1 src/usr.bin/make/unit-tests/varname-dot-objdir.exp:1.2
--- src/usr.bin/make/unit-tests/varname-dot-objdir.exp:1.1	Sun Aug 16 12:07:52 2020
+++ src/usr.bin/make/unit-tests/varname-dot-objdir.exp	Sat Jun  1 11:06:17 2024
@@ -1 +1,2 @@
+: purge-cache was reached.
 exit status 0

Index: src/usr.bin/make/unit-tests/varname-dot-objdir.mk
diff -u src/usr.bin/make/unit-tests/varname-dot-objdir.mk:1.2 src/usr.bin/make/unit-tests/varname-dot-objdir.mk:1.3
--- src/usr.bin/make/unit-tests/varname-dot-objdir.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varname-dot-objdir.mk	Sat Jun  1 11:06:17 2024
@@ -1,8 +1,15 @@
-# $NetBSD: varname-dot-objdir.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varname-dot-objdir.mk,v 1.3 2024/06/01 11:06:17 rillig Exp $
 #
 # Tests for the special .OBJDIR variable.
 
 # TODO: Implementation
 
 all:
-	@:;
+	# Add an entry to the cached_realpath table, to test cleaning up
+	# that table in purge_relative_cached_realpaths.
+	# Having a ':=' assignment in the command line is construed but works
+	# well enough to reach the code.
+	@${MAKE} -f ${MAKEFILE} 'VAR:=$${:U.:tA}' purge-cache
+
+purge-cache:
+	: ${.TARGET} was reached.



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

2024-06-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jun  1 11:06:17 UTC 2024

Modified Files:
src/usr.bin/make/unit-tests: varname-dot-objdir.exp
varname-dot-objdir.mk

Log Message:
tests/make: cover purging the realpath cache

In purge_relative_cached_realpaths, the hash table containing the cache
is modified while being iterated, which needs extra care, so add a test
that covers this code in at least a single simple scenario.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varname-dot-objdir.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varname-dot-objdir.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/gzip

2024-06-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun  1 10:17:12 UTC 2024

Modified Files:
src/usr.bin/gzip: gzip.c

Log Message:
Fix typo in previous


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/usr.bin/gzip/gzip.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/gzip/gzip.c
diff -u src/usr.bin/gzip/gzip.c:1.126 src/usr.bin/gzip/gzip.c:1.127
--- src/usr.bin/gzip/gzip.c:1.126	Sat Jun  1 09:45:36 2024
+++ src/usr.bin/gzip/gzip.c	Sat Jun  1 10:17:12 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gzip.c,v 1.126 2024/06/01 09:45:36 tsutsui Exp $	*/
+/*	$NetBSD: gzip.c,v 1.127 2024/06/01 10:17:12 martin Exp $	*/
 
 /*
  * Copyright (c) 1997-2024 Matthew R. Green
@@ -34,7 +34,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1997-2024 Matthew R. Green. "
 	"All rights reserved.");
-__RCSID("$NetBSD: gzip.c,v 1.126 2024/06/01 09:45:36 tsutsui Exp $");
+__RCSID("$NetBSD: gzip.c,v 1.127 2024/06/01 10:17:12 martin Exp $");
 #endif /* not lint */
 
 /*
@@ -1126,7 +1126,7 @@ copymodes(int fd, const struct stat *sbp
 	if (fchmod(fd, sb.st_mode) < 0)
 		maybe_warn("couldn't fchmod: %s", file);
 
-#ifdef !HAVE_NBTOOL_CONFIG_H
+#if !HAVE_NBTOOL_CONFIG_H
 	TIMESPEC_TO_TIMEVAL([0], _atimespec);
 	TIMESPEC_TO_TIMEVAL([1], _mtimespec);
 	if (futimes(fd, times) < 0)



CVS commit: src/usr.bin/gzip

2024-06-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun  1 10:17:12 UTC 2024

Modified Files:
src/usr.bin/gzip: gzip.c

Log Message:
Fix typo in previous


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/usr.bin/gzip/gzip.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-06-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jun  1 10:10:50 UTC 2024

Modified Files:
src/usr.bin/make: hash.h

Log Message:
make: require return value of HashIter_Next to be used

This would have prevented an endless loop in
purge_relative_cached_realpaths.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/make/hash.h

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/hash.h
diff -u src/usr.bin/make/hash.h:1.49 src/usr.bin/make/hash.h:1.50
--- src/usr.bin/make/hash.h:1.49	Fri May 31 05:50:11 2024
+++ src/usr.bin/make/hash.h	Sat Jun  1 10:10:50 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hash.h,v 1.49 2024/05/31 05:50:11 rillig Exp $	*/
+/*	$NetBSD: hash.h,v 1.50 2024/06/01 10:10:50 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -140,7 +140,7 @@ void HashTable_Set(HashTable *, const ch
 void HashTable_DeleteEntry(HashTable *, HashEntry *);
 void HashTable_DebugStats(HashTable *, const char *);
 
-bool HashIter_Next(HashIter *);
+bool HashIter_Next(HashIter *) MAKE_ATTR_USE;
 
 MAKE_INLINE void
 HashSet_Init(HashSet *set)



CVS commit: src/usr.bin/make

2024-06-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jun  1 10:10:50 UTC 2024

Modified Files:
src/usr.bin/make: hash.h

Log Message:
make: require return value of HashIter_Next to be used

This would have prevented an endless loop in
purge_relative_cached_realpaths.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/make/hash.h

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-06-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jun  1 10:06:23 UTC 2024

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

Log Message:
tests/make: require all expected messages to be listed in the .mk files


To generate a diff of this commit:
cvs rdiff -u -r1.345 -r1.346 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/directive-export.exp
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/directive-export.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/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.345 src/usr.bin/make/unit-tests/Makefile:1.346
--- src/usr.bin/make/unit-tests/Makefile:1.345	Fri May 24 23:02:46 2024
+++ src/usr.bin/make/unit-tests/Makefile	Sat Jun  1 10:06:23 2024
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.345 2024/05/24 23:02:46 rillig Exp $
+# $NetBSD: Makefile,v 1.346 2024/06/01 10:06:23 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -773,6 +773,11 @@ test:	${OUTFILES} .PHONY
 	  echo "Failed tests: $${failed}" ; false ; \
 	else \
 	  echo "All tests passed" ; \
+	  lua=${LUA:Ulua} ; \
+	  have_lua=$$("$$lua" -e 'print "yes"' 2>&1) ; \
+	  if [ "$$have_lua" = "yes" ]; then \
+	"$$lua" ./check-expect.lua *.mk; \
+	  fi; \
 	fi
 
 accept:

Index: src/usr.bin/make/unit-tests/directive-export.exp
diff -u src/usr.bin/make/unit-tests/directive-export.exp:1.7 src/usr.bin/make/unit-tests/directive-export.exp:1.8
--- src/usr.bin/make/unit-tests/directive-export.exp:1.7	Sat Jun  1 06:26:36 2024
+++ src/usr.bin/make/unit-tests/directive-export.exp	Sat Jun  1 10:06:23 2024
@@ -1,5 +1,5 @@
-make: "directive-export.mk" line 33: warning: .export requires an argument.
-make: "directive-export.mk" line 57: 00:00:00
-make: "directive-export.mk" line 62: 00:00:00
-make: "directive-export.mk" line 65: 16:00:00
+make: "directive-export.mk" line 36: warning: .export requires an argument.
+make: "directive-export.mk" line 60: 00:00:00
+make: "directive-export.mk" line 65: 00:00:00
+make: "directive-export.mk" line 68: 16:00:00
 exit status 0

Index: src/usr.bin/make/unit-tests/directive-export.mk
diff -u src/usr.bin/make/unit-tests/directive-export.mk:1.11 src/usr.bin/make/unit-tests/directive-export.mk:1.12
--- src/usr.bin/make/unit-tests/directive-export.mk:1.11	Sat Jun  1 06:26:36 2024
+++ src/usr.bin/make/unit-tests/directive-export.mk	Sat Jun  1 10:06:23 2024
@@ -1,4 +1,4 @@
-# $NetBSD: directive-export.mk,v 1.11 2024/06/01 06:26:36 sjg Exp $
+# $NetBSD: directive-export.mk,v 1.12 2024/06/01 10:06:23 rillig Exp $
 #
 # Tests for the .export directive.
 #
@@ -28,8 +28,11 @@ VAR=		value $$ ${INDIRECT}
 .  error
 .endif
 
-# No syntactical argument used to mean export all variables.
-# Since var.c 1.1117 2024/06/01 it causes a warning.
+# Before var.c 1.1117 from 2024-06-01, a plain ".export" without a syntactical
+# argument exported all global variables.  This case could be triggered
+# unintentionally by writing a line of the form ".export ${VARNAMES}" to a
+# makefile, when VARNAMES was an empty list.
+# expect+1: warning: .export requires an argument.
 .export
 
 # An empty argument means no additional variables to export.



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

2024-06-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jun  1 10:06:23 UTC 2024

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

Log Message:
tests/make: require all expected messages to be listed in the .mk files


To generate a diff of this commit:
cvs rdiff -u -r1.345 -r1.346 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/directive-export.exp
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/directive-export.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/gzip

2024-06-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jun  1 09:45:37 UTC 2024

Modified Files:
src/usr.bin/gzip: gzip.c

Log Message:
Don't try to set non-POSIX struct stat members on tools builds.

Fixes PR/58278 (src/tools/gzip build failed on Cygwin).


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/usr.bin/gzip/gzip.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/gzip/gzip.c
diff -u src/usr.bin/gzip/gzip.c:1.125 src/usr.bin/gzip/gzip.c:1.126
--- src/usr.bin/gzip/gzip.c:1.125	Tue Apr  2 12:42:35 2024
+++ src/usr.bin/gzip/gzip.c	Sat Jun  1 09:45:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gzip.c,v 1.125 2024/04/02 12:42:35 christos Exp $	*/
+/*	$NetBSD: gzip.c,v 1.126 2024/06/01 09:45:36 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1997-2024 Matthew R. Green
@@ -34,7 +34,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1997-2024 Matthew R. Green. "
 	"All rights reserved.");
-__RCSID("$NetBSD: gzip.c,v 1.125 2024/04/02 12:42:35 christos Exp $");
+__RCSID("$NetBSD: gzip.c,v 1.126 2024/06/01 09:45:36 tsutsui Exp $");
 #endif /* not lint */
 
 /*
@@ -1126,7 +1126,7 @@ copymodes(int fd, const struct stat *sbp
 	if (fchmod(fd, sb.st_mode) < 0)
 		maybe_warn("couldn't fchmod: %s", file);
 
-#ifdef TIMESPEC_TO_TIMEVAL
+#ifdef !HAVE_NBTOOL_CONFIG_H
 	TIMESPEC_TO_TIMEVAL([0], _atimespec);
 	TIMESPEC_TO_TIMEVAL([1], _mtimespec);
 	if (futimes(fd, times) < 0)



CVS commit: src/usr.bin/gzip

2024-06-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jun  1 09:45:37 UTC 2024

Modified Files:
src/usr.bin/gzip: gzip.c

Log Message:
Don't try to set non-POSIX struct stat members on tools builds.

Fixes PR/58278 (src/tools/gzip build failed on Cygwin).


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/usr.bin/gzip/gzip.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-06-01 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Sat Jun  1 07:37:19 UTC 2024

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

Log Message:
make: ensure loop termination in purge_relative_cached_realpaths

You cannot ignore the return from HashIter_Next


To generate a diff of this commit:
cvs rdiff -u -r1.619 -r1.620 src/usr.bin/make/main.c

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

Modified files:

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.619 src/usr.bin/make/main.c:1.620
--- src/usr.bin/make/main.c:1.619	Fri May 31 05:50:11 2024
+++ src/usr.bin/make/main.c	Sat Jun  1 07:37:19 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.619 2024/05/31 05:50:11 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.620 2024/06/01 07:37:19 sjg 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.619 2024/05/31 05:50:11 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.620 2024/06/01 07:37:19 sjg Exp $");
 #if defined(MAKE_NATIVE)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -1971,12 +1971,13 @@ static void
 purge_relative_cached_realpaths(void)
 {
 	HashIter hi;
+	bool more;
 
 	HashIter_Init(, _realpaths);
-	HashIter_Next();
-	while (hi.entry != NULL) {
+	more = HashIter_Next();
+	while (more) {
 		HashEntry *he = hi.entry;
-		HashIter_Next();
+		more = HashIter_Next();
 		if (he->key[0] != '/') {
 			DEBUG1(DIR, "cached_realpath: purging %s\n", he->key);
 			HashTable_DeleteEntry(_realpaths, he);



CVS commit: src/usr.bin/make

2024-06-01 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Sat Jun  1 07:37:19 UTC 2024

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

Log Message:
make: ensure loop termination in purge_relative_cached_realpaths

You cannot ignore the return from HashIter_Next


To generate a diff of this commit:
cvs rdiff -u -r1.619 -r1.620 src/usr.bin/make/main.c

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



CVS commit: src/usr.bin/make

2024-06-01 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Sat Jun  1 06:26:36 UTC 2024

Modified Files:
src/usr.bin/make: make.1 make.h parse.c var.c
src/usr.bin/make/unit-tests: directive-export.exp directive-export.mk
export-all.mk

Log Message:
make: add .export-all

An explicit syntax for exporting all global variables is much safer
than allowing .export with no argument to do the same.

Add .export-all and have .export with no argument throw a warning saying
to use .export-all

Reviewed by: rillig


To generate a diff of this commit:
cvs rdiff -u -r1.376 -r1.377 src/usr.bin/make/make.1
cvs rdiff -u -r1.336 -r1.337 src/usr.bin/make/make.h
cvs rdiff -u -r1.728 -r1.729 src/usr.bin/make/parse.c
cvs rdiff -u -r1.1116 -r1.1117 src/usr.bin/make/var.c
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/directive-export.exp
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/directive-export.mk
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/export-all.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-06-01 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Sat Jun  1 06:26:36 UTC 2024

Modified Files:
src/usr.bin/make: make.1 make.h parse.c var.c
src/usr.bin/make/unit-tests: directive-export.exp directive-export.mk
export-all.mk

Log Message:
make: add .export-all

An explicit syntax for exporting all global variables is much safer
than allowing .export with no argument to do the same.

Add .export-all and have .export with no argument throw a warning saying
to use .export-all

Reviewed by: rillig


To generate a diff of this commit:
cvs rdiff -u -r1.376 -r1.377 src/usr.bin/make/make.1
cvs rdiff -u -r1.336 -r1.337 src/usr.bin/make/make.h
cvs rdiff -u -r1.728 -r1.729 src/usr.bin/make/parse.c
cvs rdiff -u -r1.1116 -r1.1117 src/usr.bin/make/var.c
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/directive-export.exp
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/directive-export.mk
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/export-all.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/make.1
diff -u src/usr.bin/make/make.1:1.376 src/usr.bin/make/make.1:1.377
--- src/usr.bin/make/make.1:1.376	Tue May 28 19:09:04 2024
+++ src/usr.bin/make/make.1	Sat Jun  1 06:26:36 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.376 2024/05/28 19:09:04 sjg Exp $
+.\"	$NetBSD: make.1,v 1.377 2024/06/01 06:26:36 sjg Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	from: @(#)make.1	8.4 (Berkeley) 3/19/94
 .\"
-.Dd May 28, 2024
+.Dd June 1, 2024
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -1960,12 +1960,7 @@ The directives for exporting and unexpor
 .Bl -tag -width Ds
 .It Ic .export Ar variable No ...
 Export the specified global variable.
-If no variable list is provided, all globals are exported
-except for internal variables (those that start with
-.Ql \&. ) .
-This is not affected by the
-.Fl X
-flag, so should be used with caution.
+.Pp
 For compatibility with other make programs,
 .Cm export Ar variable\| Ns Cm \&= Ns Ar value
 (without leading dot) is also accepted.
@@ -1973,6 +1968,12 @@ For compatibility with other make progra
 Appending a variable name to
 .Va .MAKE.EXPORTED
 is equivalent to exporting a variable.
+.It Ic .export-all
+Export all globals except for internal variables (those that start with
+.Ql \&. ) .
+This is not affected by the
+.Fl X
+flag, so should be used with caution.
 .It Ic .export-env Ar variable No ...
 The same as
 .Ql .export ,

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.336 src/usr.bin/make/make.h:1.337
--- src/usr.bin/make/make.h:1.336	Sat Jun  1 05:08:48 2024
+++ src/usr.bin/make/make.h	Sat Jun  1 06:26:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.336 2024/06/01 05:08:48 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.337 2024/06/01 06:26:36 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -992,6 +992,8 @@ typedef enum VarSetFlags {
 } VarSetFlags;
 
 typedef enum VarExportMode {
+	/* .export-all */
+	VEM_ALL,
 	/* .export-env */
 	VEM_ENV,
 	/* .export: Initial export or update an already exported variable. */

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.728 src/usr.bin/make/parse.c:1.729
--- src/usr.bin/make/parse.c:1.728	Fri May 31 05:50:11 2024
+++ src/usr.bin/make/parse.c	Sat Jun  1 06:26:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.728 2024/05/31 05:50:11 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.729 2024/06/01 06:26:36 sjg 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.728 2024/05/31 05:50:11 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.729 2024/06/01 06:26:36 sjg Exp $");
 
 /* Detects a multiple-inclusion guard in a makefile. */
 typedef enum {
@@ -2759,6 +2759,8 @@ ParseDirective(char *line)
 		Var_Undef(arg);
 	else if (Substring_Equals(dir, "export"))
 		Var_Export(VEM_PLAIN, arg);
+	else if (Substring_Equals(dir, "export-all"))
+		Var_Export(VEM_ALL, arg);
 	else if (Substring_Equals(dir, "export-env"))
 		Var_Export(VEM_ENV, arg);
 	else if (Substring_Equals(dir, "export-literal"))

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.1116 src/usr.bin/make/var.c:1.1117
--- src/usr.bin/make/var.c:1.1116	Sat Jun  1 05:08:48 2024
+++ src/usr.bin/make/var.c	Sat Jun  1 06:26:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1116 2024/06/01 05:08:48 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.1117 2024/06/01 06:26:36 sjg 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.1116 2024/06/01 05:08:48 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1117 2024/06/01 06:26:36 sjg Exp $");
 
 /*
  * Variables are defined using one of the