CVS commit: src/lib/libc/time

2023-12-06 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Dec  6 21:42:01 UTC 2023

Modified Files:
src/lib/libc/time: zic.8

Log Message:
More markup fixes.This man page remains exceedingly ugly (particularly
relating to vertical space - which often is missing where it would be
better if it weren't, or is present and wasteful/ugly).


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/lib/libc/time/zic.8

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



CVS commit: src/lib/libc/time

2023-12-06 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Dec  6 21:42:01 UTC 2023

Modified Files:
src/lib/libc/time: zic.8

Log Message:
More markup fixes.This man page remains exceedingly ugly (particularly
relating to vertical space - which often is missing where it would be
better if it weren't, or is present and wasteful/ugly).


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/lib/libc/time/zic.8

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/time/zic.8
diff -u src/lib/libc/time/zic.8:1.44 src/lib/libc/time/zic.8:1.45
--- src/lib/libc/time/zic.8:1.44	Wed Dec  6 20:01:44 2023
+++ src/lib/libc/time/zic.8	Wed Dec  6 21:42:01 2023
@@ -1,4 +1,4 @@
-.\" $NetBSD: zic.8,v 1.44 2023/12/06 20:01:44 christos Exp $
+.\" $NetBSD: zic.8,v 1.45 2023/12/06 21:42:01 kre Exp $
 .\" @(#)zic.8	8.6
 .\" This file is in the public domain, so clarified as of
 .\" 2009-05-17 by Arthur David Olson.
@@ -124,7 +124,7 @@ are possibly signed decimal counts of se
 (1970-01-01 00:00:00 UTC).
 Omitted counts default to extreme values.
 The output files use UT offset 0 and abbreviation
-.q "\*-00"
+.Qq "\*-00"
 in place of the omitted timestamp data.
 For example,
 .Bd -literal
@@ -441,7 +441,7 @@ equivalent to 0
 .El
 .Pp
 Although
-.I zic
+.Nm
 rounds times to the nearest integer second
 (breaking ties to the even integer), the fractions may be useful
 to other applications requiring greater precision.
@@ -464,7 +464,7 @@ in the absence of an indicator,
 local (wall clock) time is assumed.
 These forms ignore leap seconds; for example,
 if a leap second occurs at 00:59:60 local time,
-.q "1:00"
+.Qq "1:00"
 stands for 3601 seconds after local midnight instead of the usual 3600 seconds.
 The intent is that a rule line describes the instants when a
 clock/calendar set to the type of time specified in the
@@ -615,14 +615,14 @@ continuation.
 If a zone changes at the same instant that a rule would otherwise take
 effect in the earlier zone or continuation line, the rule is ignored.
 A zone or continuation line
-.I L
+.Em L
 with a named rule set starts with standard time by default:
 that is, any of
-.IR L 's
+.Em L Ns 's
 timestamps preceding
-.IR L 's
+.Em L Ns 's
 earliest rule use the rule in effect after
-.IR L 's
+.Em L Ns 's
 first transition into standard time.
 In a single zone it is an error if two rules take effect at the same
 instant, or if two zone changes take effect at the same instant.



CVS commit: src/lib/libc/time

2023-12-06 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Dec  6 21:45:11 UTC 2023

Modified Files:
src/lib/libc/time: zdump.8

Log Message:
A couple more (relatively minor) markup fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/lib/libc/time/zdump.8

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



CVS commit: src/lib/libc/time

2023-12-06 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Dec  6 21:45:11 UTC 2023

Modified Files:
src/lib/libc/time: zdump.8

Log Message:
A couple more (relatively minor) markup fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/lib/libc/time/zdump.8

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/time/zdump.8
diff -u src/lib/libc/time/zdump.8:1.24 src/lib/libc/time/zdump.8:1.25
--- src/lib/libc/time/zdump.8:1.24	Wed Dec  6 20:01:44 2023
+++ src/lib/libc/time/zdump.8	Wed Dec  6 21:45:11 2023
@@ -1,4 +1,4 @@
-.\" $NetBSD: zdump.8,v 1.24 2023/12/06 20:01:44 christos Exp $
+.\" $NetBSD: zdump.8,v 1.25 2023/12/06 21:45:11 kre Exp $
 .\" @(#)zdump.8	8.2
 .\" This file is in the public domain, so clarified as of
 .\" 2009-05-17 by Arthur David Olson.
@@ -48,9 +48,9 @@ For each
 on the command line,
 print the times at the two extreme time values,
 the times (if present) at and just beyond the boundaries of years that
-.BR localtime (3)
+.Xr localtime 3
 and
-.BR gmtime (3)
+.Xr gmtime 3
 can represent, and
 the times both one second before and exactly at
 each detected time discontinuity.



CVS commit: src/lib/libc/time

2023-12-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Dec  7 20:13:37 UTC 2023

Modified Files:
src/lib/libc/time: zic.8

Log Message:
Fix a wording botch noticed by uwe@ (and one more smaller one), and
a few more markup issues.   While here, consistemntly use minus when
minus is meant, rather that just using a hyphen.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/lib/libc/time/zic.8

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



CVS commit: src/lib/libc/time

2023-12-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Dec  7 20:13:37 UTC 2023

Modified Files:
src/lib/libc/time: zic.8

Log Message:
Fix a wording botch noticed by uwe@ (and one more smaller one), and
a few more markup issues.   While here, consistemntly use minus when
minus is meant, rather that just using a hyphen.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/lib/libc/time/zic.8

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/time/zic.8
diff -u src/lib/libc/time/zic.8:1.46 src/lib/libc/time/zic.8:1.47
--- src/lib/libc/time/zic.8:1.46	Thu Dec  7 16:16:03 2023
+++ src/lib/libc/time/zic.8	Thu Dec  7 20:13:37 2023
@@ -1,4 +1,4 @@
-.\" $NetBSD: zic.8,v 1.46 2023/12/07 16:16:03 uwe Exp $
+.\" $NetBSD: zic.8,v 1.47 2023/12/07 20:13:37 kre Exp $
 .\" @(#)zic.8	8.6
 .\" This file is in the public domain, so clarified as of
 .\" 2009-05-17 by Arthur David Olson.
@@ -11,8 +11,8 @@
 .Nd timezone compiler
 .Sh SYNOPSIS
 .Nm
-.Op Fl \-version
-.Op Fl \-help
+.Op Fl Fl version
+.Op Fl Fl help
 .Op Fl b
 .Op Fl d Ar directory
 .Op Fl L Ar leapsecondfilename
@@ -32,7 +32,7 @@ specified in this input.
 If a
 .Ar file
 is
-.Ql \&- ,
+.Ql \&\- ,
 standard input is read.
 .Ss Options
 .Bl -tag -width Fl
@@ -79,7 +79,7 @@ will act as if the input contained a lin
 If
 .Ar timezone
 is
-.Ql - ,
+.Ql \&\- ,
 any already-existing link is removed.
 .It Fl L Ar leapsecondfilename
 Read leap second information from the file with the given name.
@@ -89,7 +89,7 @@ no leap second information appears in ou
 Use
 .Ar timezone Ap s
 rules when handling POSIX-format TZ strings like
-.Ql EET-2EEST
+.Ql EET\-2EEST
 that lack transition rules.
 .Nm
 will act as if the input contained a link line of the form
@@ -99,7 +99,7 @@ will act as if the input contained a lin
 Unless
 .Ar timezone
 is
-.Ql - ,
+.Ql \&\- ,
 this option is obsolete and poorly supported.
 Among other things it should not be used for timestamps after the year 2037,
 and it should not be combined with
@@ -110,7 +110,7 @@ transitions are at standard time or Univ
 If
 .Ar timezone
 is
-.Ql - ,
+.Ql \&\- ,
 any already-existing link is removed.
 .It Fl r Op Cm @ Ns Ar lo Ns Op Cm /@ Ns Ar hi
 Limit the applicability of output files
@@ -126,7 +126,7 @@ are possibly signed decimal counts of se
 (1970-01-01 00:00:00 UTC).
 Omitted counts default to extreme values.
 The output files use UT offset 0 and abbreviation
-.Qq "\*-00"
+.Qq \&\-00
 in place of the omitted timestamp data.
 For example,
 .Pp
@@ -256,13 +256,13 @@ POSIX requires at least 3, and requires 
 at least 6.
 .It
 An output file name contains a byte that is not an ASCII letter,
-.Ql - ,
+.Ql \&\- ,
 .Ql / ,
 or
 .Ql _ ;
 or it contains a file name component that contains more than 14 bytes
 or that starts with
-.Ql - .
+.Ql \&\- .
 .El
 .El
 .\"
@@ -328,13 +328,13 @@ A
 has the form
 .Pp
 .Bl -column -compact -offset indent "Rule" "NAME" "FROM" "1995" "\&*" "Apr" "lastSun" "2:00w" "1:00d" "LETTER/S"
-.It Rule	NAME	FROM	TO	\&-	IN	ON	AT	SAVE	LETTER/S
+.It Rule	NAME	FROM	TO	\&\-	IN	ON	AT	SAVE	LETTER/S
 .El
 .Pp
 For example:
 .Pp
 .Bl -column -compact -offset indent "Rule" "NAME" "FROM" "1995" "\&*" "Apr" "lastSun" "2:00w" "1:00d" "LETTER/S"
-.It Rule	US	1967	1973	\&-	Apr	lastSun	2:00w	1:00d	D
+.It Rule	US	1967	1973	\&\-	Apr	lastSun	2:00w	1:00d	D
 .El
 .Pp
 The fields that make up a rule line are:
@@ -345,7 +345,7 @@ Gives the name of the rule set that cont
 The name must start with a character that is neither an
 .Tn ASCII
 digit nor
-.Ql -
+.Ql \&\-
 nor
 .Ql + .
 To allow for future extensions,
@@ -380,16 +380,16 @@ may be used to repeat the value of the
 .Ar FROM
 field.
 .\"
-.It Cm \&-
-should be
-.Ql \&-
+.It Cm \&\-
+should always be
+.Ql \&\-
 for compatibility with older versions of
 .Nm .
 It was previously known as the
 .Ar TYPE
 field, which could contain values to allow a
 separate script to further restrict in which
-.Em types
+.Qq types
 of years the rule would apply.
 .\"
 .It Ar IN
@@ -458,9 +458,9 @@ midday, 12 hours after 00:00
 end of day, 24 hours after 00:00
 .It Li 260:00
 260 hours after 00:00
-.It Li -2:30
+.It Li \-2:30
 2.5 hours before 00:00
-.It Li -
+.It Li \-
 equivalent to 0
 .El
 .Pp
@@ -500,8 +500,7 @@ Gives the amount of time to be added to 
 effect, and whether the resulting time is standard or daylight saving.
 This field has the same format as the
 .Ar AT
-field
-.\" XXX: edito?
+field, except with a different set of suffix letters:
 .Ql s
 for standard time and
 .Ql d
@@ -534,7 +533,7 @@ or
 .Ql EDT )
 of time zone abbreviations to be used when this rule is in effect.
 If this field is
-.Ql - ,
+.Ql \&\- ,
 the variable part is null.
 .El
 .\"
@@ -585,7 +584,7 @@ alternatively, a field in the same forma
 column, giving the amount of time to be added to local standard time
 and whether the resulting time is standard or daylight saving.
 If thi

CVS commit: src/lib/libc/net

2023-12-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Dec  7 22:33:49 UTC 2023

Modified Files:
src/lib/libc/net: sethostent.c

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

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


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

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



CVS commit: src/lib/libc/net

2023-12-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Dec  7 22:33:49 UTC 2023

Modified Files:
src/lib/libc/net: sethostent.c

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

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


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

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

Modified files:

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



CVS commit: src/lib/libc/time

2023-12-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Dec  7 23:42:28 UTC 2023

Modified Files:
src/lib/libc/time: zic.8

Log Message:
Fix yet another wording (editing) botch noticed by uwe@


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/lib/libc/time/zic.8

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



CVS commit: src/lib/libc/time

2023-12-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Dec  7 23:42:28 UTC 2023

Modified Files:
src/lib/libc/time: zic.8

Log Message:
Fix yet another wording (editing) botch noticed by uwe@


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/lib/libc/time/zic.8

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/time/zic.8
diff -u src/lib/libc/time/zic.8:1.48 src/lib/libc/time/zic.8:1.49
--- src/lib/libc/time/zic.8:1.48	Thu Dec  7 23:21:21 2023
+++ src/lib/libc/time/zic.8	Thu Dec  7 23:42:28 2023
@@ -1,4 +1,4 @@
-.\" $NetBSD: zic.8,v 1.48 2023/12/07 23:21:21 uwe Exp $
+.\" $NetBSD: zic.8,v 1.49 2023/12/07 23:42:28 kre Exp $
 .\" @(#)zic.8	8.6
 .\" This file is in the public domain, so clarified as of
 .\" 2009-05-17 by Arthur David Olson.
@@ -883,7 +883,7 @@ and Swiss daylight saving rules (defined
 .Qq "Rule Swiss"
 apply.
 From 1981 to the present, EU daylight saving rules have
-From 1981 to the present, EU daylight saving rules have
+applied, and the UTC offset has remained at one hour.
 .Pp
 In 1941 and 1942, daylight saving time applied from the first Monday
 in May at 01:00 to the first Monday in October at 02:00.



CVS commit: src/bin/df

2023-12-18 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 18 08:27:24 UTC 2023

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

Log Message:
Correctly compute the "Filesystem" column with when using -W
(that added "NAME=" occupies space!)

XXX pullup -10


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/bin/df/df.c

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



CVS commit: src/bin/df

2023-12-18 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 18 08:27:24 UTC 2023

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

Log Message:
Correctly compute the "Filesystem" column with when using -W
(that added "NAME=" occupies space!)

XXX pullup -10


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/bin/df/df.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/df/df.c
diff -u src/bin/df/df.c:1.101 src/bin/df/df.c:1.102
--- src/bin/df/df.c:1.101	Tue Aug  9 08:14:03 2022
+++ src/bin/df/df.c	Mon Dec 18 08:27:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: df.c,v 1.101 2022/08/09 08:14:03 wiz Exp $ */
+/*	$NetBSD: df.c,v 1.102 2023/12/18 08:27:24 kre Exp $ */
 
 /*
  * Copyright (c) 1980, 1990, 1993, 1994
@@ -45,7 +45,7 @@ __COPYRIGHT(
 #if 0
 static char sccsid[] = "@(#)df.c	8.7 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: df.c,v 1.101 2022/08/09 08:14:03 wiz Exp $");
+__RCSID("$NetBSD: df.c,v 1.102 2023/12/18 08:27:24 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -243,8 +243,13 @@ main(int argc, char *argv[])
 
 	maxwidth = 0;
 	for (i = 0; i < mntcount; i++) {
-		width = (int)strlen(Wflag && mntbuf[i].f_mntfromlabel[0] ?
-		mntbuf[i].f_mntfromlabel : mntbuf[i].f_mntfromname);
+		width = 0;
+		if (Wflag && mntbuf[i].f_mntfromlabel[0]) {
+			/* +5 is for "NAME=" added later */
+			width = (int)strlen(mntbuf[i].f_mntfromlabel) + 5;
+		}
+		if (width == 0)
+			width = (int)strlen(mntbuf[i].f_mntfromname);
 		if (width > maxwidth)
 			maxwidth = width;
 		if (cflag)



CVS import: src/external/public-domain/tz/dist

2023-12-23 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Dec 23 15:38:19 UTC 2023

Update of /cvsroot/src/external/public-domain/tz/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv6163

Log Message:
Import tzdata2023d from 
https://github.com/JodaOrg/global-tz/releases/download/2023dgtz/tzdata2023dgtz.tar.gz

Summary of changes in tzdata2023d (2023-12-21 20:02:24 -0800):
  * Ittoqqortoormiit, Greenland (America/Scoresbysund) joins most of
the rest of Greenland's timekeeping practice on 2024-03-31, by
changing its time zone from -01/+00 to -02/-01.
  * Fix predictions for DST transitions in Palestine in 2072-2075,
correcting a typo introduced in 2023a.
  * Various fixes to zones for several Antarctic bases.

Status:

Vendor Tag: TZDATA
Release Tags:   TZDATA2023DGTZ

U src/external/public-domain/tz/dist/calendars
U src/external/public-domain/tz/dist/CONTRIBUTING
U src/external/public-domain/tz/dist/LICENSE
U src/external/public-domain/tz/dist/Makefile
U src/external/public-domain/tz/dist/NEWS
U src/external/public-domain/tz/dist/README
U src/external/public-domain/tz/dist/SECURITY
U src/external/public-domain/tz/dist/theory.html
C src/external/public-domain/tz/dist/version
U src/external/public-domain/tz/dist/africa
U src/external/public-domain/tz/dist/antarctica
C src/external/public-domain/tz/dist/asia
C src/external/public-domain/tz/dist/australasia
U src/external/public-domain/tz/dist/europe
U src/external/public-domain/tz/dist/northamerica
U src/external/public-domain/tz/dist/southamerica
U src/external/public-domain/tz/dist/etcetera
U src/external/public-domain/tz/dist/factory
U src/external/public-domain/tz/dist/backward
U src/external/public-domain/tz/dist/backzone
U src/external/public-domain/tz/dist/iso3166.tab
C src/external/public-domain/tz/dist/leap-seconds.list
C src/external/public-domain/tz/dist/leapseconds
U src/external/public-domain/tz/dist/zone.tab
N src/external/public-domain/tz/dist/zonenow.tab
U src/external/public-domain/tz/dist/zone1970.tab
U src/external/public-domain/tz/dist/checklinks.awk
N src/external/public-domain/tz/dist/checknow.awk
U src/external/public-domain/tz/dist/checktab.awk
U src/external/public-domain/tz/dist/leapseconds.awk
U src/external/public-domain/tz/dist/ziguard.awk
U src/external/public-domain/tz/dist/zishrink.awk

5 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jTZDATA:yesterday -jTZDATA 
src/external/public-domain/tz/dist



CVS import: src/external/public-domain/tz/dist

2023-12-23 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Dec 23 15:38:19 UTC 2023

Update of /cvsroot/src/external/public-domain/tz/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv6163

Log Message:
Import tzdata2023d from 
https://github.com/JodaOrg/global-tz/releases/download/2023dgtz/tzdata2023dgtz.tar.gz

Summary of changes in tzdata2023d (2023-12-21 20:02:24 -0800):
  * Ittoqqortoormiit, Greenland (America/Scoresbysund) joins most of
the rest of Greenland's timekeeping practice on 2024-03-31, by
changing its time zone from -01/+00 to -02/-01.
  * Fix predictions for DST transitions in Palestine in 2072-2075,
correcting a typo introduced in 2023a.
  * Various fixes to zones for several Antarctic bases.

Status:

Vendor Tag: TZDATA
Release Tags:   TZDATA2023DGTZ

U src/external/public-domain/tz/dist/calendars
U src/external/public-domain/tz/dist/CONTRIBUTING
U src/external/public-domain/tz/dist/LICENSE
U src/external/public-domain/tz/dist/Makefile
U src/external/public-domain/tz/dist/NEWS
U src/external/public-domain/tz/dist/README
U src/external/public-domain/tz/dist/SECURITY
U src/external/public-domain/tz/dist/theory.html
C src/external/public-domain/tz/dist/version
U src/external/public-domain/tz/dist/africa
U src/external/public-domain/tz/dist/antarctica
C src/external/public-domain/tz/dist/asia
C src/external/public-domain/tz/dist/australasia
U src/external/public-domain/tz/dist/europe
U src/external/public-domain/tz/dist/northamerica
U src/external/public-domain/tz/dist/southamerica
U src/external/public-domain/tz/dist/etcetera
U src/external/public-domain/tz/dist/factory
U src/external/public-domain/tz/dist/backward
U src/external/public-domain/tz/dist/backzone
U src/external/public-domain/tz/dist/iso3166.tab
C src/external/public-domain/tz/dist/leap-seconds.list
C src/external/public-domain/tz/dist/leapseconds
U src/external/public-domain/tz/dist/zone.tab
N src/external/public-domain/tz/dist/zonenow.tab
U src/external/public-domain/tz/dist/zone1970.tab
U src/external/public-domain/tz/dist/checklinks.awk
N src/external/public-domain/tz/dist/checknow.awk
U src/external/public-domain/tz/dist/checktab.awk
U src/external/public-domain/tz/dist/leapseconds.awk
U src/external/public-domain/tz/dist/ziguard.awk
U src/external/public-domain/tz/dist/zishrink.awk

5 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jTZDATA:yesterday -jTZDATA 
src/external/public-domain/tz/dist



CVS commit: src/external/public-domain/tz/dist

2023-12-23 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Dec 23 15:46:44 UTC 2023

Modified Files:
src/external/public-domain/tz/dist: TZDATA_VERSION asia australasia
leap-seconds.list leapseconds version

Log Message:
Merge tzdata2023d


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/external/public-domain/tz/dist/TZDATA_VERSION
cvs rdiff -u -r1.10 -r1.11 src/external/public-domain/tz/dist/asia \
src/external/public-domain/tz/dist/version
cvs rdiff -u -r1.7 -r1.8 src/external/public-domain/tz/dist/australasia
cvs rdiff -u -r1.5 -r1.6 src/external/public-domain/tz/dist/leap-seconds.list \
src/external/public-domain/tz/dist/leapseconds

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



CVS commit: src/external/public-domain/tz/dist

2023-12-23 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Dec 23 15:46:44 UTC 2023

Modified Files:
src/external/public-domain/tz/dist: TZDATA_VERSION asia australasia
leap-seconds.list leapseconds version

Log Message:
Merge tzdata2023d


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/external/public-domain/tz/dist/TZDATA_VERSION
cvs rdiff -u -r1.10 -r1.11 src/external/public-domain/tz/dist/asia \
src/external/public-domain/tz/dist/version
cvs rdiff -u -r1.7 -r1.8 src/external/public-domain/tz/dist/australasia
cvs rdiff -u -r1.5 -r1.6 src/external/public-domain/tz/dist/leap-seconds.list \
src/external/public-domain/tz/dist/leapseconds

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/dist/TZDATA_VERSION
diff -u src/external/public-domain/tz/dist/TZDATA_VERSION:1.35 src/external/public-domain/tz/dist/TZDATA_VERSION:1.36
--- src/external/public-domain/tz/dist/TZDATA_VERSION:1.35	Fri Mar 31 19:05:28 2023
+++ src/external/public-domain/tz/dist/TZDATA_VERSION	Sat Dec 23 15:46:44 2023
@@ -1 +1 @@
-tzdata-2023cgtz
+tzdata-2023dgtz

Index: src/external/public-domain/tz/dist/asia
diff -u src/external/public-domain/tz/dist/asia:1.10 src/external/public-domain/tz/dist/asia:1.11
--- src/external/public-domain/tz/dist/asia:1.10	Fri Mar 31 19:05:28 2023
+++ src/external/public-domain/tz/dist/asia	Sat Dec 23 15:46:44 2023
@@ -676,7 +676,6 @@ Zone	Asia/Shanghai	8:05:43	-	LMT	1901
 			8:00	PRC	C%sT
 # Xinjiang time, used by many in western China; represented by Ürümqi / Ürümchi
 # / Wulumuqi.  (Please use Asia/Shanghai if you prefer Beijing time.)
-# Vostok base in Antarctica matches this since 1970.
 Zone	Asia/Urumqi	5:50:20	-	LMT	1928
 			6:00	-	+06
 
@@ -3477,6 +3476,9 @@ Zone	Asia/Karachi	4:28:12 -	LMT	1907
 # From Heba Hamad (2023-03-22):
 # ... summer time will begin in Palestine from Saturday 04-29-2023,
 # 02:00 AM by 60 minutes forward.
+# From Heba Hemad (2023-10-09):
+# ... winter time will begin in Palestine from Saturday 10-28-2023,
+# 02:00 AM by 60 minutes back.
 #
 # From Paul Eggert (2023-03-22):
 # For now, guess that spring and fall transitions will normally
@@ -3598,13 +3600,13 @@ Rule Palestine	2070	only	-	Oct	 4	2:00	0
 Rule Palestine	2071	only	-	Sep	19	2:00	0	-
 Rule Palestine	2072	only	-	Sep	10	2:00	0	-
 Rule Palestine	2072	only	-	Oct	15	2:00	1:00	S
+Rule Palestine	2072	max	-	Oct	Sat<=30	2:00	0	-
 Rule Palestine	2073	only	-	Sep	 2	2:00	0	-
 Rule Palestine	2073	only	-	Oct	 7	2:00	1:00	S
 Rule Palestine	2074	only	-	Aug	18	2:00	0	-
 Rule Palestine	2074	only	-	Sep	29	2:00	1:00	S
 Rule Palestine	2075	only	-	Aug	10	2:00	0	-
 Rule Palestine	2075	only	-	Sep	14	2:00	1:00	S
-Rule Palestine	2075	max	-	Oct	Sat<=30	2:00	0	-
 Rule Palestine	2076	only	-	Jul	25	2:00	0	-
 Rule Palestine	2076	only	-	Sep	 5	2:00	1:00	S
 Rule Palestine	2077	only	-	Jul	17	2:00	0	-
Index: src/external/public-domain/tz/dist/version
diff -u src/external/public-domain/tz/dist/version:1.10 src/external/public-domain/tz/dist/version:1.11
--- src/external/public-domain/tz/dist/version:1.10	Fri Mar 31 19:05:28 2023
+++ src/external/public-domain/tz/dist/version	Sat Dec 23 15:46:44 2023
@@ -1 +1 @@
-2023cgtz
+2023dgtz

Index: src/external/public-domain/tz/dist/australasia
diff -u src/external/public-domain/tz/dist/australasia:1.7 src/external/public-domain/tz/dist/australasia:1.8
--- src/external/public-domain/tz/dist/australasia:1.7	Thu Mar 23 16:40:39 2023
+++ src/external/public-domain/tz/dist/australasia	Sat Dec 23 15:46:44 2023
@@ -401,8 +401,14 @@ Zone	Indian/Cocos	6:27:40	-	LMT	1900
 # Please note that there will not be any daylight savings time change
 # in Fiji for 2022-2023
 # https://www.facebook.com/FijianGovernment/posts/pfbid0mmWVTYmTibn66ybpFda75pDcf34SSpoSaskJW5gXwaKo5Sgc7273Q4fXWc6kQV6Hl
+
+# From Almaz Mingaleev (2023-10-06):
+# Cabinet approved the suspension of Daylight Saving and appropriate
+# legislative changes will be considered including the repeal of the
+# Daylight Saving Act 1998
+# https://www.fiji.gov.fj/Media-Centre/Speeches/English/CABINET-DECISIONS-3-OCTOBER-2023
 #
-# From Paul Eggert (2022-10-27):
+# From Paul Eggert (2023-10-06):
 # For now, assume DST is suspended indefinitely.
 
 # Rule	NAME	FROM	TO	-	IN	ON	AT	SAVE	LETTER/S

Index: src/external/public-domain/tz/dist/leap-seconds.list
diff -u src/external/public-domain/tz/dist/leap-seconds.list:1.5 src/external/public-domain/tz/dist/leap-seconds.list:1.6
--- src/external/public-domain/tz/dist/leap-seconds.list:1.5	Thu Mar 23 16:47:49 2023
+++ src/external/public-domain/tz/dist/leap-seconds.list	Sat Dec 23 15:46:44 2023
@@ -204,10 +204,10 @@
 #	current -- the update time stamp, the data and the name of the file
 #	will not change.
 #
-#	Updated through IERS Bulletin C65
-#	File expires on:  28 December 2023
+#	Updated through IERS Bulletin C66
+#	File expires on:  28 June 2024
 #
-#@	3912710

CVS commit: src/doc

2023-12-23 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Dec 23 15:52:11 UTC 2023

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
Note update of tzdata to 2023d (2023dgtz).


To generate a diff of this commit:
cvs rdiff -u -r1.1971 -r1.1972 src/doc/3RDPARTY
cvs rdiff -u -r1.3024 -r1.3025 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/doc

2023-12-23 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Dec 23 15:52:11 UTC 2023

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
Note update of tzdata to 2023d (2023dgtz).


To generate a diff of this commit:
cvs rdiff -u -r1.1971 -r1.1972 src/doc/3RDPARTY
cvs rdiff -u -r1.3024 -r1.3025 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/3RDPARTY
diff -u src/doc/3RDPARTY:1.1971 src/doc/3RDPARTY:1.1972
--- src/doc/3RDPARTY:1.1971	Sat Dec 23 07:36:54 2023
+++ src/doc/3RDPARTY	Sat Dec 23 15:52:11 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1971 2023/12/23 07:36:54 wiz Exp $
+#	$NetBSD: 3RDPARTY,v 1.1972 2023/12/23 15:52:11 kre Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1429,8 +1429,8 @@ Location:	external/bsd/tradcpp
 Notes:
 
 Package:	tz
-Version:	tzcode2023c / tzdata2023cgtz
-Current Vers:	tzcode2023c / tzdata2023c
+Version:	tzcode2023c / tzdata2023dgtz
+Current Vers:	tzcode2023d / tzdata2023d
 Maintainer:	Paul Eggert 
 Archive Site:	ftp://ftp.iana.org/tz/releases/
 Archive Site:	ftp://munnari.oz.au/pub/oldtz/

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.3024 src/doc/CHANGES:1.3025
--- src/doc/CHANGES:1.3024	Wed Dec 20 17:19:16 2023
+++ src/doc/CHANGES	Sat Dec 23 15:52:11 2023
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.3024 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.3025 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -243,3 +243,4 @@ Changes from NetBSD 10.0 to NetBSD 11.0:
 	libsa: Add NFSv3 support. [mlelstv 20231212]
 	dhcpcd: Import version 10.0.6. [roy 20231218]
 	OpenSSH: Import 9.6. [christos 20231220]
+	tzdata: Updated to 2023d (via 2023dgtz) [kre 20231223]



CVS commit: src/bin/sh

2023-12-24 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 02:28:47 UTC 2023

Modified Files:
src/bin/sh: expand.c

Log Message:
Correct a bizarre piece of source formatting that crept in by
accident several years ago (change a space into newline tab).

NFC


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/bin/sh/expand.c

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



CVS commit: src/bin/sh

2023-12-24 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 02:28:47 UTC 2023

Modified Files:
src/bin/sh: expand.c

Log Message:
Correct a bizarre piece of source formatting that crept in by
accident several years ago (change a space into newline tab).

NFC


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/bin/sh/expand.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/sh/expand.c
diff -u src/bin/sh/expand.c:1.142 src/bin/sh/expand.c:1.143
--- src/bin/sh/expand.c:1.142	Mon Mar  6 05:54:34 2023
+++ src/bin/sh/expand.c	Mon Dec 25 02:28:47 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: expand.c,v 1.142 2023/03/06 05:54:34 kre Exp $	*/
+/*	$NetBSD: expand.c,v 1.143 2023/12/25 02:28:47 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)expand.c	8.5 (Berkeley) 5/15/95";
 #else
-__RCSID("$NetBSD: expand.c,v 1.142 2023/03/06 05:54:34 kre Exp $");
+__RCSID("$NetBSD: expand.c,v 1.143 2023/12/25 02:28:47 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -465,7 +465,8 @@ exptilde(const char *p, int flag)
 	if (home == NULL) {
 		CTRACE(DBG_EXPAND, (": returning unused \"%s\"\n", startp));
 		return startp;
-	} while ((c = *home++) != '\0') {
+	}
+	while ((c = *home++) != '\0') {
 		if ((quotes && NEEDESC(c)) || ISCTL(c))
 			STPUTC(CTLESC, expdest);
 		STPUTC(c, expdest);



CVS commit: src/bin/sh

2023-12-24 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 04:52:38 UTC 2023

Modified Files:
src/bin/sh: eval.c

Log Message:
PR bin/57773

Fix a bug reported by Jarle Fredrik Greipsland in PR bin/57773,
where a substring expansion where the substring to be removed from
a variable expansion is itself a var expansion where the value
contains one (or more) of sh's CTLxxx chars - the pattern had
CTLESC inserted, the string to be matched against did not.  Fail.
We fix that by always inserting CTLESC in var assign expansions.
See the PR for all the gory details.

Thanks for the PR.

XXX pullup to everything.


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/bin/sh/eval.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/sh/eval.c
diff -u src/bin/sh/eval.c:1.190 src/bin/sh/eval.c:1.191
--- src/bin/sh/eval.c:1.190	Sat Jun 24 05:17:02 2023
+++ src/bin/sh/eval.c	Mon Dec 25 04:52:38 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: eval.c,v 1.190 2023/06/24 05:17:02 msaitoh Exp $	*/
+/*	$NetBSD: eval.c,v 1.191 2023/12/25 04:52:38 kre Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)eval.c	8.9 (Berkeley) 6/8/95";
 #else
-__RCSID("$NetBSD: eval.c,v 1.190 2023/06/24 05:17:02 msaitoh Exp $");
+__RCSID("$NetBSD: eval.c,v 1.191 2023/12/25 04:52:38 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -932,7 +932,8 @@ evalcommand(union node *cmd, int flgs, s
 		line_number = argp->narg.lineno;
 		if (!isassignment(argp->narg.text))
 			break;
-		expandarg(argp, &varlist, EXP_VARTILDE);
+		/* EXP_CASE handles CTL* chars in expansions properly */
+		expandarg(argp, &varlist, EXP_VARTILDE | EXP_CASE);
 	}
 	*varlist.lastp = NULL;
 



CVS commit: src/bin/sh

2023-12-24 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 04:52:38 UTC 2023

Modified Files:
src/bin/sh: eval.c

Log Message:
PR bin/57773

Fix a bug reported by Jarle Fredrik Greipsland in PR bin/57773,
where a substring expansion where the substring to be removed from
a variable expansion is itself a var expansion where the value
contains one (or more) of sh's CTLxxx chars - the pattern had
CTLESC inserted, the string to be matched against did not.  Fail.
We fix that by always inserting CTLESC in var assign expansions.
See the PR for all the gory details.

Thanks for the PR.

XXX pullup to everything.


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/bin/sh/eval.c

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



CVS commit: src/etc/rc.d

2023-12-24 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 07:39:59 UTC 2023

Modified Files:
src/etc/rc.d: securelevel

Log Message:
No longer use obsolete test "-a" option - use sh && instead.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/etc/rc.d/securelevel

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



CVS commit: src/etc/rc.d

2023-12-24 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 07:39:59 UTC 2023

Modified Files:
src/etc/rc.d: securelevel

Log Message:
No longer use obsolete test "-a" option - use sh && instead.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/etc/rc.d/securelevel

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

Modified files:

Index: src/etc/rc.d/securelevel
diff -u src/etc/rc.d/securelevel:1.8 src/etc/rc.d/securelevel:1.9
--- src/etc/rc.d/securelevel:1.8	Tue Dec 29 17:06:10 2009
+++ src/etc/rc.d/securelevel	Mon Dec 25 07:39:59 2023
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: securelevel,v 1.8 2009/12/29 17:06:10 elad Exp $
+# $NetBSD: securelevel,v 1.9 2023/12/25 07:39:59 kre Exp $
 #
 
 # PROVIDE: securelevel
@@ -25,7 +25,7 @@ securelevel_start()
 		exit 1
 	fi
 
-	if [ -n "$securelevel" -a "$securelevel" != "$osecurelevel" ]; then
+	if [ -n "$securelevel" ] && [ "$securelevel" != "$osecurelevel" ]; then
 		if [ "$securelevel" -lt "$osecurelevel" ]; then
 			echo "Can't lower securelevel."
 			exit 1



CVS commit: src/etc/rc.d

2023-12-24 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 07:43:03 UTC 2023

Modified Files:
src/etc/rc.d: certctl_init

Log Message:
No longer use obsolete test(1) -a option/operator, use sh && instead.

While here a couple of minor formatting improvements - in general it
is always a good idea to surround sh operator chars (like '>' '(' ...)
with white space, to guard against thet possibility that some other (or
later enhanced) sh might have additional operators which happen to be
the character string used.

I don't understand while the final part of the condition for not doing
anything needs to run in a subshell, but that can stay for now.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/etc/rc.d/certctl_init

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



CVS commit: src/etc/rc.d

2023-12-24 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 07:43:03 UTC 2023

Modified Files:
src/etc/rc.d: certctl_init

Log Message:
No longer use obsolete test(1) -a option/operator, use sh && instead.

While here a couple of minor formatting improvements - in general it
is always a good idea to surround sh operator chars (like '>' '(' ...)
with white space, to guard against thet possibility that some other (or
later enhanced) sh might have additional operators which happen to be
the character string used.

I don't understand while the final part of the condition for not doing
anything needs to run in a subshell, but that can stay for now.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/etc/rc.d/certctl_init

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

Modified files:

Index: src/etc/rc.d/certctl_init
diff -u src/etc/rc.d/certctl_init:1.1 src/etc/rc.d/certctl_init:1.2
--- src/etc/rc.d/certctl_init:1.1	Wed Sep 27 00:24:13 2023
+++ src/etc/rc.d/certctl_init	Mon Dec 25 07:43:03 2023
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: certctl_init,v 1.1 2023/09/27 00:24:13 riastradh Exp $
+# $NetBSD: certctl_init,v 1.2 2023/12/25 07:43:03 kre Exp $
 #
 # PROVIDE: certctl_init
 # REQUIRE: mountcritremote
@@ -36,10 +36,9 @@ certctl_init()
 	# directory, or is a directory but is nonempty, then we're not
 	# in the first boot's initial configuration.  So do nothing.
 	if [ -h "$certsdir" ] ||
-	[ -e "$certsdir" -a ! -d "$certsdir" ] ||
-	([ -d "$certsdir" ] &&
-		find -f "$certsdir" -- \
-		-maxdepth 0 -type d -empty -exit 1)
+	{ [ -e "$certsdir" ] && ! [ -d "$certsdir" ] ; } ||
+	( [ -d "$certsdir" ] &&
+		find -f "$certsdir" -- -maxdepth 0 -type d -empty -exit 1 )
 then
 		return
 	fi



CVS commit: src/etc/rc.d

2023-12-24 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 07:46:12 UTC 2023

Modified Files:
src/etc/rc.d: certctl_init

Log Message:
Whitespace:  8 spaces -> tab


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/etc/rc.d/certctl_init

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



CVS commit: src/etc/rc.d

2023-12-24 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 07:46:12 UTC 2023

Modified Files:
src/etc/rc.d: certctl_init

Log Message:
Whitespace:  8 spaces -> tab


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/etc/rc.d/certctl_init

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

Modified files:

Index: src/etc/rc.d/certctl_init
diff -u src/etc/rc.d/certctl_init:1.2 src/etc/rc.d/certctl_init:1.3
--- src/etc/rc.d/certctl_init:1.2	Mon Dec 25 07:43:03 2023
+++ src/etc/rc.d/certctl_init	Mon Dec 25 07:46:12 2023
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: certctl_init,v 1.2 2023/12/25 07:43:03 kre Exp $
+# $NetBSD: certctl_init,v 1.3 2023/12/25 07:46:12 kre Exp $
 #
 # PROVIDE: certctl_init
 # REQUIRE: mountcritremote
@@ -39,7 +39,7 @@ certctl_init()
 	{ [ -e "$certsdir" ] && ! [ -d "$certsdir" ] ; } ||
 	( [ -d "$certsdir" ] &&
 		find -f "$certsdir" -- -maxdepth 0 -type d -empty -exit 1 )
-then
+	then
 		return
 	fi
 



CVS commit: src/etc/rc.d

2023-12-24 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 07:49:22 UTC 2023

Modified Files:
src/etc/rc.d: ip6addrctl

Log Message:
Don't use obsolete test(1) -a option/operator - use sh && instead.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/etc/rc.d/ip6addrctl

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

Modified files:

Index: src/etc/rc.d/ip6addrctl
diff -u src/etc/rc.d/ip6addrctl:1.7 src/etc/rc.d/ip6addrctl:1.8
--- src/etc/rc.d/ip6addrctl:1.7	Tue Sep  8 12:52:18 2020
+++ src/etc/rc.d/ip6addrctl	Mon Dec 25 07:49:22 2023
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: ip6addrctl,v 1.7 2020/09/08 12:52:18 martin Exp $
+# $NetBSD: ip6addrctl,v 1.8 2023/12/25 07:49:22 kre Exp $
 # FreeBSD: head/etc/rc.d/ip6addrctl 270836 2014-08-30 07:08:10Z hrs
 #
 
@@ -58,7 +58,7 @@ ip6addrctl_start()
 	# install the policy of the address selection algorithm.
 	case "${ip6addrctl_policy}" in
 	[Aa][Uu][Tt][Oo])
-		if [ -r "${config_file}" -a -s "${config_file}" ]; then
+		if [ -r "${config_file}" ] && [ -s "${config_file}" ]; then
 			${IP6ADDRCTL_CMD} flush >/dev/null 2>&1
 			${IP6ADDRCTL_CMD} install "${config_file}"
 		else



CVS commit: src/etc/rc.d

2023-12-24 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 07:49:22 UTC 2023

Modified Files:
src/etc/rc.d: ip6addrctl

Log Message:
Don't use obsolete test(1) -a option/operator - use sh && instead.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/etc/rc.d/ip6addrctl

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



CVS commit: src/etc/rc.d

2023-12-25 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 08:23:36 UTC 2023

Modified Files:
src/etc/rc.d: bluetooth

Log Message:
Clean up obsolete test(1) usage - don't use -o, use sh || instead.

This one was particularly bad:

if [ -z ${dev} -o ${junk} ]; then

was supposed to be validating an entry read from a config file,
dev should be not empty, and junk should be empty (ie: correct
number of fields present).   If that test succeeds, the line is
bad, and we error out.

But if dev was empty, and junk was also empty, that turned into

if [ -z -o ]; then

which tests if "-o" is the empty string, which it isn't, so instead
of succeeding, and considering the entry invalid (no dev specified)
the code would just carry on as if all was good.

Because of this, a bunch of quoting fixes were also made (there might
perhaps be more needed).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/etc/rc.d/bluetooth

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

Modified files:

Index: src/etc/rc.d/bluetooth
diff -u src/etc/rc.d/bluetooth:1.2 src/etc/rc.d/bluetooth:1.3
--- src/etc/rc.d/bluetooth:1.2	Fri Nov 26 12:51:24 2021
+++ src/etc/rc.d/bluetooth	Mon Dec 25 08:23:35 2023
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: bluetooth,v 1.2 2021/11/26 12:51:24 sborrill Exp $
+# $NetBSD: bluetooth,v 1.3 2023/12/25 08:23:35 kre Exp $
 #
 
 # PROVIDE: bluetooth
@@ -85,13 +85,13 @@ bluetooth_start()
 			;;
 		esac
 
-		if [ -z ${dev} -o ${junk} ]; then
+		if [ -z "${dev}" ] || [ -n "${junk}" ]; then
 			echo "${name}: invalid entry"
 			return 1
 		fi
 
 		echo "attaching Bluetooth ${service} service from \"${addr}\""
-		${btdevctl_cmd} -A -a ${addr} -d ${dev} -s ${service}
+		${btdevctl_cmd} -A -a "${addr}" -d "${dev}" -s "${service}"
 	done < ${btdevctl_conf}
 
 	#
@@ -111,7 +111,7 @@ bluetooth_stop()
 	echo -n "disabling Bluetooth controllers:"
 	for dev in ${btconfig_devices:-$(${btconfig_cmd} -l)}; do
 		echo -n " ${dev}"
-		${btconfig_cmd} ${dev} disable
+		${btconfig_cmd} "${dev}" disable
 	done
 	echo "."
 



CVS commit: src/etc/rc.d

2023-12-25 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 08:23:36 UTC 2023

Modified Files:
src/etc/rc.d: bluetooth

Log Message:
Clean up obsolete test(1) usage - don't use -o, use sh || instead.

This one was particularly bad:

if [ -z ${dev} -o ${junk} ]; then

was supposed to be validating an entry read from a config file,
dev should be not empty, and junk should be empty (ie: correct
number of fields present).   If that test succeeds, the line is
bad, and we error out.

But if dev was empty, and junk was also empty, that turned into

if [ -z -o ]; then

which tests if "-o" is the empty string, which it isn't, so instead
of succeeding, and considering the entry invalid (no dev specified)
the code would just carry on as if all was good.

Because of this, a bunch of quoting fixes were also made (there might
perhaps be more needed).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/etc/rc.d/bluetooth

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



CVS commit: src/etc/rc.d

2023-12-25 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 08:24:58 UTC 2023

Modified Files:
src/etc/rc.d: ipfs

Log Message:
Clean up obsolete test(1) usage, use sh && rather than test's old -a
(and while here prefer sh's ! operator over test's - it simplifies
things for test).


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/etc/rc.d/ipfs

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



CVS commit: src/etc/rc.d

2023-12-25 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 08:24:58 UTC 2023

Modified Files:
src/etc/rc.d: ipfs

Log Message:
Clean up obsolete test(1) usage, use sh && rather than test's old -a
(and while here prefer sh's ! operator over test's - it simplifies
things for test).


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/etc/rc.d/ipfs

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

Modified files:

Index: src/etc/rc.d/ipfs
diff -u src/etc/rc.d/ipfs:1.8 src/etc/rc.d/ipfs:1.9
--- src/etc/rc.d/ipfs:1.8	Sun Sep 23 07:24:19 2018
+++ src/etc/rc.d/ipfs	Mon Dec 25 08:24:58 2023
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: ipfs,v 1.8 2018/09/23 07:24:19 maxv Exp $
+# $NetBSD: ipfs,v 1.9 2023/12/25 08:24:58 kre Exp $
 #
 
 # PROVIDE: ipfs
@@ -17,7 +17,8 @@ stop_cmd="ipfs_stop"
 
 ipfs_start()
 {
-	if [ -r /var/db/ipf/ipstate.ipf -a -r /var/db/ipf/ipnat.ipf ]; then
+	if [ -r /var/db/ipf/ipstate.ipf ] && [ -r /var/db/ipf/ipnat.ipf ]
+	then
 		/usr/sbin/ipfs -R ${rc_flags}
 		rm -f /var/db/ipf/ipstate.ipf /var/db/ipf/ipnat.ipf
 	fi
@@ -25,7 +26,7 @@ ipfs_start()
 
 ipfs_stop()
 {
-	if [ ! -d /var/db/ipf ]; then
+	if ! [ -d /var/db/ipf ]; then
 		mkdir /var/db/ipf
 		chmod 700 /var/db/ipf
 		chown root:wheel /var/db/ipf



CVS commit: src/etc/rc.d

2023-12-25 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 08:29:05 UTC 2023

Modified Files:
src/etc/rc.d: iscsid_volumes

Log Message:
Clean up obsolere test(1) -a option/operator - use sh && instead.
Take the opportunity to do a little sh formatting cleanups, the \
line continuation can ususually be avoided by placing sh operators at
the appropriate places.

Note the [ x"$var" = x"$other" ] usage no longer needs the 'x',
avoiding that kind of nonsense is partly why test was much more
precisely specified, and a lot of the unnecessary stuff made obsolete.
Those however I did not remove (they're harmless).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/etc/rc.d/iscsid_volumes

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



CVS commit: src/etc/rc.d

2023-12-25 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 08:29:05 UTC 2023

Modified Files:
src/etc/rc.d: iscsid_volumes

Log Message:
Clean up obsolere test(1) -a option/operator - use sh && instead.
Take the opportunity to do a little sh formatting cleanups, the \
line continuation can ususually be avoided by placing sh operators at
the appropriate places.

Note the [ x"$var" = x"$other" ] usage no longer needs the 'x',
avoiding that kind of nonsense is partly why test was much more
precisely specified, and a lot of the unnecessary stuff made obsolete.
Those however I did not remove (they're harmless).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/etc/rc.d/iscsid_volumes

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

Modified files:

Index: src/etc/rc.d/iscsid_volumes
diff -u src/etc/rc.d/iscsid_volumes:1.4 src/etc/rc.d/iscsid_volumes:1.5
--- src/etc/rc.d/iscsid_volumes:1.4	Sat Jul 22 10:31:35 2023
+++ src/etc/rc.d/iscsid_volumes	Mon Dec 25 08:29:05 2023
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: iscsid_volumes,v 1.4 2023/07/22 10:31:35 mlelstv Exp $
+# $NetBSD: iscsid_volumes,v 1.5 2023/12/25 08:29:05 kre Exp $
 #
 
 # PROVIDE: iscsid_volumes
@@ -98,17 +98,19 @@ iscsid_volumes_stop()
 		*)
 			echo "Remove target ${alias:-$target}"
 
-			/sbin/iscsictl list_sessions \
-			| while read key1 num key2 sesstarget; do
-if [ x"$key1" = x"Session" -a \
- x"$key2" = x"Target" -a \
- x"$sesstarget" = x"$target" ]; then
-	/sbin/iscsictl logout -I "$num" | grep -v '^OK$'
+			/sbin/iscsictl list_sessions |
+			while read key1 num key2 sesstarget; do
+if [ x"$key1" = x"Session" ] &&
+   [ x"$key2" = x"Target"  ] &&
+   [ x"$sesstarget" = x"$target" ]
+then
+	/sbin/iscsictl logout -I "$num" |
+	grep -v '^OK$'
 fi
 			done
 
-			/sbin/iscsictl list_targets \
-			| while read num talias ttarget; do
+			/sbin/iscsictl list_targets |
+			while read num talias ttarget; do
 if [ x"$ttarget" = x"$target" ]; then
 	/sbin/iscsictl remove_target -I "$num"
 fi



CVS commit: src/etc/rc.d

2023-12-25 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 08:35:07 UTC 2023

Modified Files:
src/etc/rc.d: named

Log Message:
Clean up obsolete test(1) usage - use sh's || instead of test's obsolete -o,
and sh's && instead of test's obsolete -a.

Minor formatting cleanups, including removing unneeded \ line continuations.

The somewhat bizarre way that named_migrate() was made to work in a
subshell (which of itself is fine, and looks needed) has been made more
rational.  Because of that, the need to use local vars is no longer there,
(subshells can't affect the parent) and "local" in that func could be deleted
(but hasn't been).


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/etc/rc.d/named

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



CVS commit: src/etc/rc.d

2023-12-25 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 08:35:07 UTC 2023

Modified Files:
src/etc/rc.d: named

Log Message:
Clean up obsolete test(1) usage - use sh's || instead of test's obsolete -o,
and sh's && instead of test's obsolete -a.

Minor formatting cleanups, including removing unneeded \ line continuations.

The somewhat bizarre way that named_migrate() was made to work in a
subshell (which of itself is fine, and looks needed) has been made more
rational.  Because of that, the need to use local vars is no longer there,
(subshells can't affect the parent) and "local" in that func could be deleted
(but hasn't been).


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/etc/rc.d/named

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

Modified files:

Index: src/etc/rc.d/named
diff -u src/etc/rc.d/named:1.27 src/etc/rc.d/named:1.28
--- src/etc/rc.d/named:1.27	Wed Mar 31 04:57:25 2021
+++ src/etc/rc.d/named	Mon Dec 25 08:35:07 2023
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: named,v 1.27 2021/03/31 04:57:25 christos Exp $
+# $NetBSD: named,v 1.28 2023/12/25 08:35:07 kre Exp $
 #
 
 # PROVIDE: named
@@ -19,11 +19,10 @@ extra_commands="reload"
 required_dirs="$named_chrootdir"	# if it is set, it must exist
 
 named_migrate()
-{
+(
 	local src="$1"
 	local dst="$2$1"
 	echo "Migrating $src to $dst"
-(
 	diff=false
 	cd "$src"
 	mkdir -p "$dst"
@@ -59,15 +58,14 @@ named_migrate()
 		ln -s "$dst" "$src"
 	fi
 )
-}
 
 copy_if_newer()
 {
 	local chrootdir="$1"
 	local dir="$2"
 	local file="$3"
-	if [ ! -x "${chrootdir}${dir}/${file}" -o \
-	"${chrootdir}${dir}/${file}" -ot "${dir}/${file}" ]; then
+	if ! [ -x "${chrootdir}${dir}/${file}" ] ||
+	 [ "${chrootdir}${dir}/${file}" -ot "${dir}/${file}" ]; then
 		rm -f "${chrootdir}${dir}/${file}"
 		cp -p "${dir}/${file}" "${chrootdir}${dir}/${file}"
 	fi
@@ -75,13 +73,13 @@ copy_if_newer()
 
 named_precmd()
 {
-	if [ ! -e "/etc/rndc.key" ]; then
+	if ! [ -e "/etc/rndc.key" ]; then
 		echo "Generating rndc.key"
 		/usr/sbin/rndc-confgen -a
 	fi
 
 	if [ -z "$named_chrootdir" ]; then
-		if [ ! -d "/etc/namedb/keys" ]; then
+		if ! [ -d "/etc/namedb/keys" ]; then
 			mkdir -m 775 "/etc/namedb/keys"
 			chown named:named "/etc/namedb/keys"
 		fi
@@ -100,7 +98,7 @@ named_precmd()
 	case "$($command -v)" in
 	BIND*)	# 9 no group, named-xfer, or ndc
 		named_plugindir="/usr/libexec/named"
-		if [ ! -d "${named_chrootdir}${named_plugindir}" ]; then
+		if ! [ -d "${named_chrootdir}${named_plugindir}" ]; then
 		mkdir -p -m 755 "${named_chrootdir}${named_plugindir}"
 		chown root:wheel "${named_chrootdir}${named_plugindir}"
 		fi
@@ -117,32 +115,34 @@ named_precmd()
 	esac
 
 	for i in null random urandom; do
-		if [ ! -c "${named_chrootdir}/dev/$i" ]; then
+		if ! [ -c "${named_chrootdir}/dev/$i" ]; then
 			rm -f "${named_chrootdir}/dev/$i"
-			(cd /dev &&
-			/bin/pax -rw -pe "$i" "${named_chrootdir}/dev")
+			( cd /dev &&
+			/bin/pax -rw -pe "$i" "${named_chrootdir}/dev" )
 		fi
 	done
 
-	if [ ! -h /etc/namedb ]; then
-		named_migrate /etc/namedb ${named_chrootdir}
+	if ! [ -h /etc/namedb ]; then
+		named_migrate /etc/namedb "${named_chrootdir}"
 	fi
 
 	for i in named.conf rndc.key; do
-		if [ \( -r "/etc/$i" \) -a \( ! -h "/etc/$i" \) -a \
-		 \( ! -r "${named_chrootdir}/etc/$i" \) ]; then
+		if [ -r "/etc/$i" ] && ! [ -h "/etc/$i" ] &&
+		 ! [ -r "${named_chrootdir}/etc/$i" ]
+		then
 			mv "/etc/$i" "${named_chrootdir}/etc/$i"
 			ln -s "${named_chrootdir}/etc/$i" "/etc/$i"
 		fi
 	done
 
-	if [ \( ! -r ${named_chrootdir}/etc/named.conf \) -a \
-	\( -r ${named_chrootdir}/etc/namedb/named.conf \) ]; then
-		ln -s namedb/named.conf ${named_chrootdir}/etc
+	if ! [ -r ${named_chrootdir}/etc/named.conf ]  &&
+	 [ -r ${named_chrootdir}/etc/namedb/named.conf ]
+	then
+		ln -s namedb/named.conf "${named_chrootdir}/etc"
 	fi
 
 	if [ -f /etc/localtime ]; then
-		cmp -s /etc/localtime "${named_chrootdir}/etc/localtime" || \
+		cmp -s /etc/localtime "${named_chrootdir}/etc/localtime" ||
 		cp -p /etc/localtime "${named_chrootdir}/etc/localtime"
 	fi
 



CVS commit: src/etc/rc.d

2023-12-25 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 08:37:09 UTC 2023

Modified Files:
src/etc/rc.d: postfix

Log Message:
Do away with the obsolete text(1) -a operator, use sh && instead.
Prefer sh ! operator over test's ! (less question what it means).
A few minor formatting changes.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/etc/rc.d/postfix

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



CVS commit: src/etc/rc.d

2023-12-25 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 08:37:09 UTC 2023

Modified Files:
src/etc/rc.d: postfix

Log Message:
Do away with the obsolete text(1) -a operator, use sh && instead.
Prefer sh ! operator over test's ! (less question what it means).
A few minor formatting changes.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/etc/rc.d/postfix

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

Modified files:

Index: src/etc/rc.d/postfix
diff -u src/etc/rc.d/postfix:1.19 src/etc/rc.d/postfix:1.20
--- src/etc/rc.d/postfix:1.19	Fri Aug  9 10:05:44 2019
+++ src/etc/rc.d/postfix	Mon Dec 25 08:37:08 2023
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postfix,v 1.19 2019/08/09 10:05:44 rin Exp $
+# $NetBSD: postfix,v 1.20 2023/12/25 08:37:08 kre Exp $
 #
 
 # PROVIDE: mail
@@ -53,7 +53,7 @@ postfix_precmd()
 		case "$1" in
 		hash)
 			if [ -f "$2.db" ]; then
-if [ ! "$2" -ot "$2.db" ]; then
+if ! [ "$2" -ot "$2.db" ]; then
 	_rebuild "$2" "out of date"
 fi
 			else
@@ -85,8 +85,8 @@ check_use_postfix()
 	echo YES
 	else
 	echo "WARNING: default postfix not used as not selected in mailer.conf" >&2
-	if [ "${_mta_path}" = "${_sendmail_path}" -a \
-		! -x "${_mta_path}" ]; then
+	if [ "${_mta_path}" = "${_sendmail_path}" ] &&
+	 ! [ -x "${_mta_path}" ]; then
 		echo "WARNING: mailer.conf points to the removed sendmail" >&2
 		echo "update /etc/mailer.conf to get a working mailer configuration" >&2
 	fi



CVS commit: src/etc/rc.d

2023-12-25 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 08:38:32 UTC 2023

Modified Files:
src/etc/rc.d: sysdb

Log Message:
Stop using the obsolete test(1) -o operator, use sh || instead.
Prefer sh ! over test's ! (though that one is not completely obsolete).


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/etc/rc.d/sysdb

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



CVS commit: src/etc/rc.d

2023-12-25 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec 25 08:38:32 UTC 2023

Modified Files:
src/etc/rc.d: sysdb

Log Message:
Stop using the obsolete test(1) -o operator, use sh || instead.
Prefer sh ! over test's ! (though that one is not completely obsolete).


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/etc/rc.d/sysdb

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

Modified files:

Index: src/etc/rc.d/sysdb
diff -u src/etc/rc.d/sysdb:1.25 src/etc/rc.d/sysdb:1.26
--- src/etc/rc.d/sysdb:1.25	Sat Apr 23 21:24:31 2016
+++ src/etc/rc.d/sysdb	Mon Dec 25 08:38:32 2023
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: sysdb,v 1.25 2016/04/23 21:24:31 dholland Exp $
+# $NetBSD: sysdb,v 1.26 2023/12/25 08:38:32 kre Exp $
 #
 
 # PROVIDE: sysdb
@@ -40,10 +40,10 @@ check_file()
 	local db="$2"
 
 	shift 2
-	if [ ! -e "$src" ]; then
+	if ! [ -e "$src" ]; then
 		return
 	fi
-	if [ \( ! -f "$db" \) -o \( "$src" -nt "$db" \) ]; then
+	if ! [ -f "$db" ] || [ "$src" -nt "$db" ]; then
 		$echo -n "$comma${src##*/}"
 		comma=", "
 		"$@"
@@ -81,7 +81,7 @@ build_utmp()
 	#
 	local i
 	for i in "" x; do
-		if [ ! -f /var/run/utmp$i ]; then
+		if ! [ -f /var/run/utmp$i ]; then
 			$echo -n "${comma}utmp$i"
 			comma=", "
 			install -c -m 664 -g utmp /dev/null /var/run/utmp$i



Re: CVS commit: src/tests/bin/sh

2023-12-28 Thread Robert Elz
Date:Thu, 28 Dec 2023 20:04:11 +
From:"Andrius Varanavicius" 
Message-ID:  <20231228200411.283ccf...@cvs.netbsd.org>

  | Modified Files:
  | src/tests/bin/sh: t_syntax.sh
  | Log Message:
  | s/synax/syntax/ in test description.

Thanks for the correction, but, not that it matters, that
was in the test code, not just a description.

[I could claim that the typo was deliberate, as part of
the test  but that would be kind of absurd, sh does
no spell checking to test.]

kre



CVS commit: src/bin/sh

2023-12-29 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Dec 29 15:49:24 UTC 2023

Modified Files:
src/bin/sh: expand.c

Log Message:
PR bin/57773

Fix another bug reported by Jarle Fredrik Greipsland and added
to PR bin/57773, which relates to calculating the length of a
positional parameter which contains CTL chars -- yes, this one
really is that specific, though it would also affect the special
param $0 if it were to contain CTL chars, and its length was
requested - that is fixed with the same change.  And note: $0
is not affected because it looks like a positional param (it
isn't, ${00} would be, but is always unset, ${0} isn't) all
special parame would be affected the same way, but the only one
that can ever contain a CTL char is $0 I believe.  ($@ and $*
were affected, but just because they're expanding the positional
params ... ${#@} and ${#*} are both technically unspecified
expansions - and different shells produce different results.

See the PR for the details of this one (and the previous).

Thanks for the PR.

XXX pullup to everything.


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/bin/sh/expand.c

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



CVS commit: src/bin/sh

2023-12-29 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Dec 29 15:49:24 UTC 2023

Modified Files:
src/bin/sh: expand.c

Log Message:
PR bin/57773

Fix another bug reported by Jarle Fredrik Greipsland and added
to PR bin/57773, which relates to calculating the length of a
positional parameter which contains CTL chars -- yes, this one
really is that specific, though it would also affect the special
param $0 if it were to contain CTL chars, and its length was
requested - that is fixed with the same change.  And note: $0
is not affected because it looks like a positional param (it
isn't, ${00} would be, but is always unset, ${0} isn't) all
special parame would be affected the same way, but the only one
that can ever contain a CTL char is $0 I believe.  ($@ and $*
were affected, but just because they're expanding the positional
params ... ${#@} and ${#*} are both technically unspecified
expansions - and different shells produce different results.

See the PR for the details of this one (and the previous).

Thanks for the PR.

XXX pullup to everything.


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/bin/sh/expand.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/sh/expand.c
diff -u src/bin/sh/expand.c:1.143 src/bin/sh/expand.c:1.144
--- src/bin/sh/expand.c:1.143	Mon Dec 25 02:28:47 2023
+++ src/bin/sh/expand.c	Fri Dec 29 15:49:23 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: expand.c,v 1.143 2023/12/25 02:28:47 kre Exp $	*/
+/*	$NetBSD: expand.c,v 1.144 2023/12/29 15:49:23 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)expand.c	8.5 (Berkeley) 5/15/95";
 #else
-__RCSID("$NetBSD: expand.c,v 1.143 2023/12/25 02:28:47 kre Exp $");
+__RCSID("$NetBSD: expand.c,v 1.144 2023/12/29 15:49:23 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -1206,7 +1206,7 @@ varvalue(const char *name, int quoted, i
 	quoted ? ", quoted" : "", subtype, flag));
 
 	if (subtype == VSLENGTH)	/* no magic required ... */
-		flag &= ~EXP_FULL;
+		flag &= ~(EXP_FULL | EXP_QNEEDED);
 
 #define STRTODEST(p) \
 	do {\
@@ -1218,7 +1218,7 @@ varvalue(const char *name, int quoted, i
 			} \
 		} else \
 			while (*p) { \
-if (ISCTL(*p)) \
+if ((flag & EXP_QNEEDED) && ISCTL(*p)) \
 	STPUTC(CTLESC, expdest); \
 STPUTC(*p++, expdest); \
 			} \



CVS commit: src/sys/sys

2024-01-02 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Jan  2 22:35:22 UTC 2024

Modified Files:
src/sys/sys: rbtree.h

Log Message:
Put back  - but only when RBDEBUG is defined (the
similarly conditional rb_tree_check() prototype needs "bool").


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/sys/rbtree.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/sys/rbtree.h
diff -u src/sys/sys/rbtree.h:1.9 src/sys/sys/rbtree.h:1.10
--- src/sys/sys/rbtree.h:1.9	Tue Jan  2 19:27:57 2024
+++ src/sys/sys/rbtree.h	Tue Jan  2 22:35:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: rbtree.h,v 1.9 2024/01/02 19:27:57 christos Exp $	*/
+/*	$NetBSD: rbtree.h,v 1.10 2024/01/02 22:35:22 kre Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -36,6 +36,10 @@
 #include 
 #include 
 
+#ifdef RBDEBUG
+#include 
+#endif
+
 __BEGIN_DECLS
 
 typedef struct rb_node {



CVS commit: src/usr.sbin/tprof

2024-01-02 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Jan  2 22:35:26 UTC 2024

Modified Files:
src/usr.sbin/tprof: tprof_top.c

Log Message:
This needs  - it used to come from  (inappropriately)
but no longer (normally).This should unbreak the builds.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/tprof/tprof_top.c

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



CVS commit: src/sys/sys

2024-01-02 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Jan  2 22:35:22 UTC 2024

Modified Files:
src/sys/sys: rbtree.h

Log Message:
Put back  - but only when RBDEBUG is defined (the
similarly conditional rb_tree_check() prototype needs "bool").


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/sys/rbtree.h

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



CVS commit: src/usr.sbin/tprof

2024-01-02 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Jan  2 22:35:26 UTC 2024

Modified Files:
src/usr.sbin/tprof: tprof_top.c

Log Message:
This needs  - it used to come from  (inappropriately)
but no longer (normally).This should unbreak the builds.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/tprof/tprof_top.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/tprof/tprof_top.c
diff -u src/usr.sbin/tprof/tprof_top.c:1.9 src/usr.sbin/tprof/tprof_top.c:1.10
--- src/usr.sbin/tprof/tprof_top.c:1.9	Mon Apr 17 08:37:24 2023
+++ src/usr.sbin/tprof/tprof_top.c	Tue Jan  2 22:35:26 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: tprof_top.c,v 1.9 2023/04/17 08:37:24 msaitoh Exp $	*/
+/*	$NetBSD: tprof_top.c,v 1.10 2024/01/02 22:35:26 kre Exp $	*/
 
 /*-
  * Copyright (c) 2022 Ryo Shimizu 
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: tprof_top.c,v 1.9 2023/04/17 08:37:24 msaitoh Exp $");
+__RCSID("$NetBSD: tprof_top.c,v 1.10 2024/01/02 22:35:26 kre Exp $");
 #endif /* not lint */
 
 #include 
@@ -46,6 +46,7 @@ __RCSID("$NetBSD: tprof_top.c,v 1.9 2023
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 



CVS commit: src/sys/sys

2024-01-02 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Jan  2 22:39:00 UTC 2024

Modified Files:
src/sys/sys: rbtree.h

Log Message:
Fix previous so  isn't included with _KERNEL (etc).
Like it used to be.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/sys/rbtree.h

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



CVS commit: src/sys/sys

2024-01-02 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Jan  2 22:39:00 UTC 2024

Modified Files:
src/sys/sys: rbtree.h

Log Message:
Fix previous so  isn't included with _KERNEL (etc).
Like it used to be.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/sys/rbtree.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/sys/rbtree.h
diff -u src/sys/sys/rbtree.h:1.10 src/sys/sys/rbtree.h:1.11
--- src/sys/sys/rbtree.h:1.10	Tue Jan  2 22:35:22 2024
+++ src/sys/sys/rbtree.h	Tue Jan  2 22:39:00 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: rbtree.h,v 1.10 2024/01/02 22:35:22 kre Exp $	*/
+/*	$NetBSD: rbtree.h,v 1.11 2024/01/02 22:39:00 kre Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include 
 #include 
 
-#ifdef RBDEBUG
+#if !defined(_KERNEL) && !defined(_STANDALONE) && defined(RBDEBUG)
 #include 
 #endif
 



Re: CVS commit: src/sys/sys

2024-01-02 Thread Robert Elz
Date:Wed, 3 Jan 2024 03:15:39 +0300
From:Valery Ushakov 
Message-ID:  

  | for userland uses should include stddef.h where size_t is supposed
  | to come from

Unfortunately, while  is defined to specify size_t it
isn't specified to include ssize_t - and many things that need
size_t also need ssize_t (which includes src/usr.bin/tprof one of
the users of )

All of this is horribly ugly - perhaps we'd do better to remove
stuff from  that shouldn't be there (which is probably
any definition which doesn't end in _t except probably the old u_char
u_short ... and their uchar/ushort/... variants).   In particular
I doubt that  should really be including 
and almost certainly not , and shouldn't have prototypes
for any functions at all.

kre



Re: CVS commit: src/sys/sys

2024-01-02 Thread Robert Elz
Date:Tue, 2 Jan 2024 21:20:42 -0500
From:Jason Thorpe 
Message-ID:  

  |  seems safe

Safe probably, but also wrong.   It looks to be there puerly
for the __BEGIN_DECLS / __END_DECLS definitions - which are
needed just beause  has prototypes for lseek()
truncate() and ftruncate() which make no sense in 
at all (beyond ancient history).

kre


CVS commit: src/bin/sh

2024-01-16 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Jan 16 14:30:22 UTC 2024

Modified Files:
src/bin/sh: sh.1

Log Message:
Remove an ancient incorrect notion which somehow survived intact for ages.
"$@" is (as it is in double quotes) not subject to field splitting.  "$@"
generates (potentially) multiple words, but field splitting has nothing
to do with it.

While here, rename the section from "White Space Splitting (Field Splitting)"
to simply be "Field Splitting" as white space is only relevant if it happens
to occur in IFS (which is the default case, but IFS can be anything, and
isn't required to contain any white space at all).


To generate a diff of this commit:
cvs rdiff -u -r1.258 -r1.259 src/bin/sh/sh.1

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



CVS commit: src/bin/sh

2024-01-16 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Jan 16 14:30:22 UTC 2024

Modified Files:
src/bin/sh: sh.1

Log Message:
Remove an ancient incorrect notion which somehow survived intact for ages.
"$@" is (as it is in double quotes) not subject to field splitting.  "$@"
generates (potentially) multiple words, but field splitting has nothing
to do with it.

While here, rename the section from "White Space Splitting (Field Splitting)"
to simply be "Field Splitting" as white space is only relevant if it happens
to occur in IFS (which is the default case, but IFS can be anything, and
isn't required to contain any white space at all).


To generate a diff of this commit:
cvs rdiff -u -r1.258 -r1.259 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.258 src/bin/sh/sh.1:1.259
--- src/bin/sh/sh.1:1.258	Thu Oct 12 01:45:07 2023
+++ src/bin/sh/sh.1	Tue Jan 16 14:30:22 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.258 2023/10/12 01:45:07 uwe Exp $
+.\"	$NetBSD: sh.1,v 1.259 2024/01/16 14:30:22 kre Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -2299,14 +2299,11 @@ and
 .Dq \&[ .
 .\"
 .\"
-.Ss White Space Splitting (Field Splitting)
+.Ss Field Splitting
 .\"
 After parameter expansion, command substitution, and
 arithmetic expansion the shell scans the results of
 expansions and substitutions that did not occur in double quotes,
-and
-.Dq Li $@
-even if it did,
 for field splitting and multiple fields can result.
 .Pp
 The shell treats each character of the



CVS commit: src/sys/compat/sys

2024-01-20 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Jan 20 08:40:37 UTC 2024

Modified Files:
src/sys/compat/sys: resource.h

Log Message:
Now that rusage_to_rusage50() has switched from being an external
function, to a static inline, we need  for it to work.
Not all callers provide that (and nor should they need to), so include
it here.

Should unbreak the builds.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/compat/sys/resource.h

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



CVS commit: src/sys/compat/sys

2024-01-20 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Jan 20 08:40:37 UTC 2024

Modified Files:
src/sys/compat/sys: resource.h

Log Message:
Now that rusage_to_rusage50() has switched from being an external
function, to a static inline, we need  for it to work.
Not all callers provide that (and nor should they need to), so include
it here.

Should unbreak the builds.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/compat/sys/resource.h

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

Modified files:

Index: src/sys/compat/sys/resource.h
diff -u src/sys/compat/sys/resource.h:1.6 src/sys/compat/sys/resource.h:1.7
--- src/sys/compat/sys/resource.h:1.6	Fri Jan 19 18:39:15 2024
+++ src/sys/compat/sys/resource.h	Sat Jan 20 08:40:37 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: resource.h,v 1.6 2024/01/19 18:39:15 christos Exp $	*/
+/*	$NetBSD: resource.h,v 1.7 2024/01/20 08:40:37 kre Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -35,6 +35,7 @@
 #define	_COMPAT_SYS_RESOURCE_H_
 
 #include 
+#include 
 #include 
 #include 
 



CVS commit: src

2024-01-20 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Jan 20 11:04:53 UTC 2024

Modified Files:
src/sys/lib/libkern: Makefile.libkern
src/sys/stand/efiboot: Makefile.efiboot
Added Files:
src/common/include/libc: extern.h

Log Message:
Compensate for src/common/lib/libc/atomic/atomic_init_cas.c losing
the extern declaration of __libc_atomic_init() and instead using a
new one added to src/lib/libc/include/extern.h

That file is outside src/common and src/sys so is unavailable to
kernel builds, so instead make a new include file in src/common
which the kernel can read which contains the needed extern decl
for __libc_atomic_init()

This seems to fix the evbarm builds (maybe others) - but it is
all MUCH TOO UGLY to keep.   Someone please make a better fix,
even if that just means reverting rev 1.5 of
src/common/lib/libc/atomic/atomic_init_cas.c
and all of the changes here (the addition to libc/include/extern.h
should be harmless to keep).


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/common/include/libc/extern.h
cvs rdiff -u -r1.54 -r1.55 src/sys/lib/libkern/Makefile.libkern
cvs rdiff -u -r1.29 -r1.30 src/sys/stand/efiboot/Makefile.efiboot

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



CVS commit: src

2024-01-20 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Jan 20 11:04:53 UTC 2024

Modified Files:
src/sys/lib/libkern: Makefile.libkern
src/sys/stand/efiboot: Makefile.efiboot
Added Files:
src/common/include/libc: extern.h

Log Message:
Compensate for src/common/lib/libc/atomic/atomic_init_cas.c losing
the extern declaration of __libc_atomic_init() and instead using a
new one added to src/lib/libc/include/extern.h

That file is outside src/common and src/sys so is unavailable to
kernel builds, so instead make a new include file in src/common
which the kernel can read which contains the needed extern decl
for __libc_atomic_init()

This seems to fix the evbarm builds (maybe others) - but it is
all MUCH TOO UGLY to keep.   Someone please make a better fix,
even if that just means reverting rev 1.5 of
src/common/lib/libc/atomic/atomic_init_cas.c
and all of the changes here (the addition to libc/include/extern.h
should be harmless to keep).


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/common/include/libc/extern.h
cvs rdiff -u -r1.54 -r1.55 src/sys/lib/libkern/Makefile.libkern
cvs rdiff -u -r1.29 -r1.30 src/sys/stand/efiboot/Makefile.efiboot

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

Modified files:

Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.54 src/sys/lib/libkern/Makefile.libkern:1.55
--- src/sys/lib/libkern/Makefile.libkern:1.54	Mon Jan  1 20:33:34 2024
+++ src/sys/lib/libkern/Makefile.libkern	Sat Jan 20 11:04:53 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.54 2024/01/01 20:33:34 rhialto Exp $
+#	$NetBSD: Makefile.libkern,v 1.55 2024/01/20 11:04:53 kre Exp $
 
 #
 # Variable definitions for libkern.
@@ -35,6 +35,7 @@ CPPFLAGS+=	-I$M ${KERNCPPFLAGS} ${KERNMI
 .include "${.PARSEDIR}/../../../common/lib/libppath/Makefile.inc"
 
 CPPFLAGS+=	-I${KERNDIR}/../../../common/include
+CPPFLAGS+=	-I${KERNDIR}/../../../common/include/libc
 CPPFLAGS+=	-I${KERNDIR}/../../../common/libc/hash/sha3
 
 .PATH.c: ${KERNDIR}

Index: src/sys/stand/efiboot/Makefile.efiboot
diff -u src/sys/stand/efiboot/Makefile.efiboot:1.29 src/sys/stand/efiboot/Makefile.efiboot:1.30
--- src/sys/stand/efiboot/Makefile.efiboot:1.29	Thu Jun 15 03:20:58 2023
+++ src/sys/stand/efiboot/Makefile.efiboot	Sat Jan 20 11:04:53 2024
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.29 2023/06/15 03:20:58 rin Exp $
+# $NetBSD: Makefile.efiboot,v 1.30 2024/01/20 11:04:53 kre Exp $
 
 S=		${.CURDIR}/../../..
 
@@ -127,6 +127,7 @@ KERN_AS= library
 LIBKERN_ARCH?= ${MACHINE_ARCH}
 KERNMISCMAKEFLAGS+="LIBKERN_ARCH=${LIBKERN_ARCH}"
 .include "${S}/lib/libkern/Makefile.inc"
+CPPFLAGS+= -I${S}/../common/include/libc
 LIBKERN= ${KERNLIB}
 
 ### find out what to use for libz

Added files:

Index: src/common/include/libc/extern.h
diff -u /dev/null src/common/include/libc/extern.h:1.1
--- /dev/null	Sat Jan 20 11:04:53 2024
+++ src/common/include/libc/extern.h	Sat Jan 20 11:04:53 2024
@@ -0,0 +1,3 @@
+void  __section(".text.startup") __attribute__((__visibility__("hidden")))  
+__libc_atomic_init(void);
+



CVS commit: src/lib/libc/net

2024-01-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Jan 21 12:58:10 UTC 2024

Modified Files:
src/lib/libc/net: getaddrinfo.c

Log Message:
Unwrap a line which wasn't wrapped before it had an __UNCONST() added
to it, and now that that is gone again, doesn't need wrapping any more.

That line is now unaltered from what it was 3 revs ago (bit for bit).

NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/lib/libc/net/getaddrinfo.c

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

Modified files:

Index: src/lib/libc/net/getaddrinfo.c
diff -u src/lib/libc/net/getaddrinfo.c:1.126 src/lib/libc/net/getaddrinfo.c:1.127
--- src/lib/libc/net/getaddrinfo.c:1.126	Sat Jan 20 16:18:56 2024
+++ src/lib/libc/net/getaddrinfo.c	Sun Jan 21 12:58:10 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: getaddrinfo.c,v 1.126 2024/01/20 16:18:56 christos Exp $	*/
+/*	$NetBSD: getaddrinfo.c,v 1.127 2024/01/21 12:58:10 kre Exp $	*/
 /*	$KAME: getaddrinfo.c,v 1.29 2000/08/31 17:26:57 itojun Exp $	*/
 
 /*
@@ -55,7 +55,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: getaddrinfo.c,v 1.126 2024/01/20 16:18:56 christos Exp $");
+__RCSID("$NetBSD: getaddrinfo.c,v 1.127 2024/01/21 12:58:10 kre Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #ifndef RUMP_ACTION
@@ -1440,8 +1440,7 @@ explore_numeric_scope(const struct addri
 			if (cur->ai_family != AF_INET6)
 continue;
 			sin6 = (struct sockaddr_in6 *)(void *)cur->ai_addr;
-			if (ip6_str2scopeid(scope, sin6, &scopeid)
-			== -1) {
+			if (ip6_str2scopeid(scope, sin6, &scopeid) == -1) {
 free(hostname2);
 return EAI_NODATA; /* XXX: is return OK? */
 			}



CVS commit: src/lib/libc/net

2024-01-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Jan 21 12:58:10 UTC 2024

Modified Files:
src/lib/libc/net: getaddrinfo.c

Log Message:
Unwrap a line which wasn't wrapped before it had an __UNCONST() added
to it, and now that that is gone again, doesn't need wrapping any more.

That line is now unaltered from what it was 3 revs ago (bit for bit).

NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/lib/libc/net/getaddrinfo.c

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



CVS commit: src/sys/dev/fdt

2024-01-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Jan 21 15:10:08 UTC 2024

Modified Files:
src/sys/dev/fdt: fdt_boot.c

Log Message:
Include  for struct mbr_sector


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/fdt/fdt_boot.c

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



CVS commit: src/sys/dev/fdt

2024-01-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Jan 21 15:10:08 UTC 2024

Modified Files:
src/sys/dev/fdt: fdt_boot.c

Log Message:
Include  for struct mbr_sector


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/fdt/fdt_boot.c

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

Modified files:

Index: src/sys/dev/fdt/fdt_boot.c
diff -u src/sys/dev/fdt/fdt_boot.c:1.5 src/sys/dev/fdt/fdt_boot.c:1.6
--- src/sys/dev/fdt/fdt_boot.c:1.5	Fri Jan 19 09:09:04 2024
+++ src/sys/dev/fdt/fdt_boot.c	Sun Jan 21 15:10:07 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: fdt_boot.c,v 1.5 2024/01/19 09:09:04 skrll Exp $	*/
+/*	$NetBSD: fdt_boot.c,v 1.6 2024/01/21 15:10:07 kre Exp $	*/
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -56,13 +56,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_boot.c,v 1.5 2024/01/19 09:09:04 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_boot.c,v 1.6 2024/01/21 15:10:07 kre Exp $");
 
 #include "opt_efi.h"
 #include "opt_md.h"
 
 #include 
 
+#include 
 #include 
 #include 
 #include 



Re: CVS commit: src/bin/date

2024-01-21 Thread Robert Elz
Date:Sun, 21 Jan 2024 18:16:28 - (UTC)
From:chris...@astron.com (Christos Zoulas)
Message-ID:  

  | I think this is the yacc used by the build process, not the yacc
  | to build tools with? I.e. will this yacc produce c files usable in
  | the host compilation environment?

I was also looking at that problem, but in a different direction.
Rather than making -d work in the tools date (either by somehow
making parsedate work - which really isn't worth the effort for
this, or via your hack) but by using -j and specifying the date
in canonincal form instead of parsedate random form.

That is, it is trivial to make

date -j '+whatever format you like' 202401220314

work (including in the tools date), provided you can convert the date
string you're starting with into that canonical form - that takes make
magic, a topic of which I am barely aware exists, let alone competant,
so that was as far as I took it...

kre


CVS commit: src

2024-01-22 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Jan 22 12:15:19 UTC 2024

Modified Files:
src/include: math.h
src/lib/libm/ld80: b_expl.c b_logl.c b_tgammal.c
src/lib/libm/src: math_private.h s_atanl.c s_remquol.c

Log Message:
This set of changes seem to be sufficient to make at least the
amd64 port build again after the long double math function infusion
from yesterday.

Feel free (without consulting me, I'm just hacking about) to revert
any of this and do it a better way.

Note: this is not intended to be complete, in particular, in 
I added prototypes only for the functions that are needed for a
successful build, not all of the new ones...


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/include/math.h
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/ld80/b_expl.c \
src/lib/libm/ld80/b_logl.c src/lib/libm/ld80/b_tgammal.c
cvs rdiff -u -r1.28 -r1.29 src/lib/libm/src/math_private.h
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_atanl.c \
src/lib/libm/src/s_remquol.c

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



CVS commit: src

2024-01-22 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Jan 22 12:15:19 UTC 2024

Modified Files:
src/include: math.h
src/lib/libm/ld80: b_expl.c b_logl.c b_tgammal.c
src/lib/libm/src: math_private.h s_atanl.c s_remquol.c

Log Message:
This set of changes seem to be sufficient to make at least the
amd64 port build again after the long double math function infusion
from yesterday.

Feel free (without consulting me, I'm just hacking about) to revert
any of this and do it a better way.

Note: this is not intended to be complete, in particular, in 
I added prototypes only for the functions that are needed for a
successful build, not all of the new ones...


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/include/math.h
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/ld80/b_expl.c \
src/lib/libm/ld80/b_logl.c src/lib/libm/ld80/b_tgammal.c
cvs rdiff -u -r1.28 -r1.29 src/lib/libm/src/math_private.h
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_atanl.c \
src/lib/libm/src/s_remquol.c

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

Modified files:

Index: src/include/math.h
diff -u src/include/math.h:1.67 src/include/math.h:1.68
--- src/include/math.h:1.67	Sat Aug 27 08:31:59 2022
+++ src/include/math.h	Mon Jan 22 12:15:19 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: math.h,v 1.67 2022/08/27 08:31:59 christos Exp $	*/
+/*	$NetBSD: math.h,v 1.68 2024/01/22 12:15:19 kre Exp $	*/
 
 /*
  * 
@@ -591,6 +591,21 @@ int	__isnanl(long double);
 int	__signbitl(long double);
 #endif
 
+/* XXX: Probable temporary hacks for new math functions - 20240122 */
+double	cospi(double);
+float	cospif(float);
+double	sinpi(double);
+float	sinpif(float);
+double	tanpi(double);
+float	tanpif(float);
+
+#ifdef __HAVE_LONG_DOUBLE
+long double	cospil(long double);
+long double	lgammal_r(long double, int *);
+long double	sinpil(long double);
+long double	tanpil(long double);
+#endif
+
 __END_DECLS
 
 #endif /* _MATH_H_ */

Index: src/lib/libm/ld80/b_expl.c
diff -u src/lib/libm/ld80/b_expl.c:1.1 src/lib/libm/ld80/b_expl.c:1.2
--- src/lib/libm/ld80/b_expl.c:1.1	Sun Jan 21 18:53:16 2024
+++ src/lib/libm/ld80/b_expl.c	Mon Jan 22 12:15:19 2024
@@ -29,6 +29,7 @@
  * SUCH DAMAGE.
  */
 
+#include 
 /*
  * See bsdsrc/b_exp.c for implementation details.
  *
Index: src/lib/libm/ld80/b_logl.c
diff -u src/lib/libm/ld80/b_logl.c:1.1 src/lib/libm/ld80/b_logl.c:1.2
--- src/lib/libm/ld80/b_logl.c:1.1	Sun Jan 21 18:53:16 2024
+++ src/lib/libm/ld80/b_logl.c	Mon Jan 22 12:15:19 2024
@@ -29,12 +29,16 @@
  * SUCH DAMAGE.
  */
 
+#include 
+
 /*
  * See bsdsrc/b_log.c for implementation details.
  *
  * bsdrc/b_log.c converted to long double by Steven G. Kargl.
  */
 
+#include "math_private.h"
+
 #define N 128
 
 /*
Index: src/lib/libm/ld80/b_tgammal.c
diff -u src/lib/libm/ld80/b_tgammal.c:1.1 src/lib/libm/ld80/b_tgammal.c:1.2
--- src/lib/libm/ld80/b_tgammal.c:1.1	Sun Jan 21 18:53:16 2024
+++ src/lib/libm/ld80/b_tgammal.c	Mon Jan 22 12:15:19 2024
@@ -41,6 +41,8 @@
  * bsdrc/b_tgamma.c converted to long double by Steven G. Kargl.
  */
 
+#include 
+
 /*
  * See bsdsrc/t_tgamma.c for implementation details.
  */

Index: src/lib/libm/src/math_private.h
diff -u src/lib/libm/src/math_private.h:1.28 src/lib/libm/src/math_private.h:1.29
--- src/lib/libm/src/math_private.h:1.28	Sun Jan 21 18:53:18 2024
+++ src/lib/libm/src/math_private.h	Mon Jan 22 12:15:19 2024
@@ -11,7 +11,7 @@
 
 /*
  * from: @(#)fdlibm.h 5.1 93/09/24
- * $NetBSD: math_private.h,v 1.28 2024/01/21 18:53:18 christos Exp $
+ * $NetBSD: math_private.h,v 1.29 2024/01/22 12:15:19 kre Exp $
  */
 
 #ifndef _MATH_PRIVATE_H_
@@ -318,10 +318,10 @@ do {\
 #ifdef __i386__
 /* Long double constants are broken on i386. */
 #define	LD80C(m, ex, v) {		\
-	.extu_fracl = __CONCAT(m, ULL);	\
-	.extu_frach = __CONCAT(m, ULL) >> EXT_FRACLBITS;		\
-	.extu_exp = (0x3fff + (ex)) | ((v) < 0 ? 0x8000 : 0),		\
-	.extu_sign = (0x3fff + (ex)) | ((v) < 0 ? 0x8000 : 0) >> EXP_EXPBITS,\
+	.extu_fracl = (uint32_t)(__CONCAT(m, ULL)),			\
+	.extu_frach = __CONCAT(m, ULL) >> EXT_FRACLBITS,		\
+	.extu_exp = (0x3fff + (ex)),	\
+	.extu_sign = ((v) < 0 ? 0x8000 : 0) >> EXT_EXPBITS,		\
 }
 #else
 /* The above works on non-i386 too, but we use this to check v. */

Index: src/lib/libm/src/s_atanl.c
diff -u src/lib/libm/src/s_atanl.c:1.1 src/lib/libm/src/s_atanl.c:1.2
--- src/lib/libm/src/s_atanl.c:1.1	Sun Jan 21 18:53:18 2024
+++ src/lib/libm/src/s_atanl.c	Mon Jan 22 12:15:19 2024
@@ -15,6 +15,9 @@
 
 #include 
 
+#include "math.h"
+#include "math_private.h"
+
 #ifdef __HAVE_LONG_DOUBLE
 __weak_alias(atanl, _atanl)
 
@@ -31,8 +34,6 @@ __weak_alias(atanl, _atanl)
 #else
 #error "Unsupported long double format"
 #endif
-#include "math.h"
-#include "math_private.h"
 
 #ifdef LDBL_IMPLICIT_NBIT
 #define	LDBL_NBIT	0
Index: src/lib/libm/src/s_remquol.c
diff -u src/lib/libm/src/s_remquo

CVS commit: src/include

2024-01-22 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Jan 22 14:01:50 UTC 2024

Modified Files:
src/include: math.h

Log Message:
It seems that we need prototypes for long double math functions, even
when !__HAVE_LONG_DOUBLE -- they still exist, but just aren't...

This might unbreak several more builds.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/include/math.h

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

Modified files:

Index: src/include/math.h
diff -u src/include/math.h:1.68 src/include/math.h:1.69
--- src/include/math.h:1.68	Mon Jan 22 12:15:19 2024
+++ src/include/math.h	Mon Jan 22 14:01:50 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: math.h,v 1.68 2024/01/22 12:15:19 kre Exp $	*/
+/*	$NetBSD: math.h,v 1.69 2024/01/22 14:01:50 kre Exp $	*/
 
 /*
  * 
@@ -599,12 +599,10 @@ float	sinpif(float);
 double	tanpi(double);
 float	tanpif(float);
 
-#ifdef __HAVE_LONG_DOUBLE
 long double	cospil(long double);
 long double	lgammal_r(long double, int *);
 long double	sinpil(long double);
 long double	tanpil(long double);
-#endif
 
 __END_DECLS
 



CVS commit: src/include

2024-01-22 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Jan 22 14:01:50 UTC 2024

Modified Files:
src/include: math.h

Log Message:
It seems that we need prototypes for long double math functions, even
when !__HAVE_LONG_DOUBLE -- they still exist, but just aren't...

This might unbreak several more builds.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/include/math.h

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



CVS commit: src/lib/libm/src

2024-01-22 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Jan 22 14:26:18 UTC 2024

Modified Files:
src/lib/libm/src: math_private.h

Log Message:
Simply an overly complex way of saying "0 or 1" into a cleaner version.

While here add a commment about how the __i386__ magic LD80C macro
might no longer work on all other arch's as well (if someone can verify
that it still does, or can fix it so that it still works on i386, but
also works everywhere else, then please remove that XXX comment.
The issue I am (perhaps imagining) is the (uint32_t) cast.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/lib/libm/src/math_private.h

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



CVS commit: src/lib/libm/src

2024-01-22 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Jan 22 14:26:18 UTC 2024

Modified Files:
src/lib/libm/src: math_private.h

Log Message:
Simply an overly complex way of saying "0 or 1" into a cleaner version.

While here add a commment about how the __i386__ magic LD80C macro
might no longer work on all other arch's as well (if someone can verify
that it still does, or can fix it so that it still works on i386, but
also works everywhere else, then please remove that XXX comment.
The issue I am (perhaps imagining) is the (uint32_t) cast.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/lib/libm/src/math_private.h

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

Modified files:

Index: src/lib/libm/src/math_private.h
diff -u src/lib/libm/src/math_private.h:1.29 src/lib/libm/src/math_private.h:1.30
--- src/lib/libm/src/math_private.h:1.29	Mon Jan 22 12:15:19 2024
+++ src/lib/libm/src/math_private.h	Mon Jan 22 14:26:18 2024
@@ -11,7 +11,7 @@
 
 /*
  * from: @(#)fdlibm.h 5.1 93/09/24
- * $NetBSD: math_private.h,v 1.29 2024/01/22 12:15:19 kre Exp $
+ * $NetBSD: math_private.h,v 1.30 2024/01/22 14:26:18 kre Exp $
  */
 
 #ifndef _MATH_PRIVATE_H_
@@ -321,9 +321,10 @@ do {\
 	.extu_fracl = (uint32_t)(__CONCAT(m, ULL)),			\
 	.extu_frach = __CONCAT(m, ULL) >> EXT_FRACLBITS,		\
 	.extu_exp = (0x3fff + (ex)),	\
-	.extu_sign = ((v) < 0 ? 0x8000 : 0) >> EXT_EXPBITS,		\
+	.extu_sign = ((v) < 0),		\
 }
 #else
+/**XXX: the following comment may no longer be true:  kre 20240122 **/
 /* The above works on non-i386 too, but we use this to check v. */
 #define	LD80C(m, ex, v)	{ .extu_ld = (v), }
 #endif



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

2024-01-22 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Jan 22 14:37:25 UTC 2024

Modified Files:
src/sys/arch/m68k/include: ieee.h

Log Message:
Add multiple inclusion protection guard - the long double math routines
have a tendency to sometimes make that happen.

This seems to fix the sun3 build, and probably other m68k builds which
were working before the libm upgrades (it will do nothing for any that
were failing before that).


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/m68k/include/ieee.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/m68k/include/ieee.h
diff -u src/sys/arch/m68k/include/ieee.h:1.16 src/sys/arch/m68k/include/ieee.h:1.17
--- src/sys/arch/m68k/include/ieee.h:1.16	Mon Sep 20 16:13:35 2010
+++ src/sys/arch/m68k/include/ieee.h	Mon Jan 22 14:37:25 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee.h,v 1.16 2010/09/20 16:13:35 christos Exp $	*/
+/*	$NetBSD: ieee.h,v 1.17 2024/01/22 14:37:25 kre Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -40,6 +40,9 @@
  *	@(#)ieee.h	8.1 (Berkeley) 6/11/93
  */
 
+#ifndef	__68K_IEEE_H_INCLUDED
+#define	__68K_IEEE_H_INCLUDED
+
 /*
  * ieee.h defines the machine-dependent layout of the machine's IEEE
  * floating point.  It does *not* define (yet?) any of the rounding
@@ -111,3 +114,5 @@ union ieee_ext_u {
 #define LDBL_NBIT	0x8000
 #define mask_nbit_l(u)	((u).extu_frach &= ~LDBL_NBIT)
 #endif /* !__mc68010__ || _KERNEL */
+
+#endif /* __68K_IEEE_H_INCLUDED */



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

2024-01-22 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Jan 22 14:37:25 UTC 2024

Modified Files:
src/sys/arch/m68k/include: ieee.h

Log Message:
Add multiple inclusion protection guard - the long double math routines
have a tendency to sometimes make that happen.

This seems to fix the sun3 build, and probably other m68k builds which
were working before the libm upgrades (it will do nothing for any that
were failing before that).


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/m68k/include/ieee.h

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



CVS commit: src

2024-01-22 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Jan 22 15:19:39 UTC 2024

Modified Files:
src/distrib/sets/lists/base: shl.mi
src/distrib/sets/lists/debug: shl.mi
src/lib/libm: shlib_version

Log Message:
Bump libm minor rev (libm.so.0.13 -> libm.so.0.14) after addition of
all the long double functions (with actual implementations).


To generate a diff of this commit:
cvs rdiff -u -r1.973 -r1.974 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.334 -r1.335 src/distrib/sets/lists/debug/shl.mi
cvs rdiff -u -r1.18 -r1.19 src/lib/libm/shlib_version

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



CVS commit: src

2024-01-22 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Jan 22 15:19:39 UTC 2024

Modified Files:
src/distrib/sets/lists/base: shl.mi
src/distrib/sets/lists/debug: shl.mi
src/lib/libm: shlib_version

Log Message:
Bump libm minor rev (libm.so.0.13 -> libm.so.0.14) after addition of
all the long double functions (with actual implementations).


To generate a diff of this commit:
cvs rdiff -u -r1.973 -r1.974 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.334 -r1.335 src/distrib/sets/lists/debug/shl.mi
cvs rdiff -u -r1.18 -r1.19 src/lib/libm/shlib_version

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/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.973 src/distrib/sets/lists/base/shl.mi:1.974
--- src/distrib/sets/lists/base/shl.mi:1.973	Wed Dec 20 17:17:21 2023
+++ src/distrib/sets/lists/base/shl.mi	Mon Jan 22 15:19:38 2024
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.973 2023/12/20 17:17:21 christos Exp $
+# $NetBSD: shl.mi,v 1.974 2024/01/22 15:19:38 kre Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -66,7 +66,7 @@
 ./lib/liblzma.so.2.0base-sys-shlib		dynamicroot
 ./lib/libm.so	base-sys-shlib		dynamicroot
 ./lib/libm.so.0	base-sys-shlib		dynamicroot
-./lib/libm.so.0.13base-sys-shlib		dynamicroot
+./lib/libm.so.0.14base-sys-shlib		dynamicroot
 ./lib/libnpf.so	base-npf-shlib		dynamicroot,npf
 ./lib/libnpf.so.0base-npf-shlib		dynamicroot,npf
 ./lib/libnpf.so.0.1base-npf-shlib		dynamicroot,npf
@@ -444,7 +444,7 @@
 ./usr/lib/liblzma.so.2.0			base-sys-shlib		compatfile
 ./usr/lib/libm.sobase-sys-shlib		compatfile
 ./usr/lib/libm.so.0base-sys-shlib		compatfile
-./usr/lib/libm.so.0.13base-sys-shlib		compatfile
+./usr/lib/libm.so.0.14base-sys-shlib		compatfile
 ./usr/lib/libmagic.sobase-sys-shlib		compatfile
 ./usr/lib/libmagic.so.8base-sys-shlib		compatfile
 ./usr/lib/libmagic.so.8.0			base-sys-shlib		compatfile

Index: src/distrib/sets/lists/debug/shl.mi
diff -u src/distrib/sets/lists/debug/shl.mi:1.334 src/distrib/sets/lists/debug/shl.mi:1.335
--- src/distrib/sets/lists/debug/shl.mi:1.334	Wed Dec 20 17:17:21 2023
+++ src/distrib/sets/lists/debug/shl.mi	Mon Jan 22 15:19:39 2024
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.334 2023/12/20 17:17:21 christos Exp $
+# $NetBSD: shl.mi,v 1.335 2024/01/22 15:19:39 kre Exp $
 ./usr/lib/libbfd_g.a		comp-c-debuglib	debuglib,compatfile,binutils
 ./usr/libdata/debug/lib		base-sys-usr	debug,dynamicroot,compatdir
 ./usr/libdata/debug/lib/libavl.so.0.0.debug			comp-zfs-debug	debug,dynamicroot,zfs
@@ -18,7 +18,7 @@
 ./usr/libdata/debug/lib/libkvm.so.6.0.debug			comp-sys-debug	debug,dynamicroot
 ./usr/libdata/debug/lib/liblzf.so.1.0.debug			comp-sys-debug	debug,dynamicroot
 ./usr/libdata/debug/lib/liblzma.so.2.0.debug			comp-sys-debug	debug,dynamicroot
-./usr/libdata/debug/lib/libm.so.0.13.debug			comp-sys-debug	debug,dynamicroot
+./usr/libdata/debug/lib/libm.so.0.14.debug			comp-sys-debug	debug,dynamicroot
 ./usr/libdata/debug/lib/libnpf.so.0.1.debug			comp-sys-debug	debug,dynamicroot
 ./usr/libdata/debug/lib/libnvpair.so.0.0.debug			comp-zfs-debug	debug,dynamicroot,zfs
 ./usr/libdata/debug/lib/libpcap.so.9.0.debug			comp-sys-debug	debug,dynamicroot
@@ -146,7 +146,7 @@
 ./usr/libdata/debug/usr/lib/liblutok.so.3.0.debug		comp-kyua-debug	debug,compatfile,kyua
 ./usr/libdata/debug/usr/lib/liblzf.so.1.0.debug			comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/liblzma.so.2.0.debug		comp-sys-debug	debug,compatfile
-./usr/libdata/debug/usr/lib/libm.so.0.13.debug			comp-sys-debug	debug,compatfile
+./usr/libdata/debug/usr/lib/libm.so.0.14.debug			comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libmagic.so.8.0.debug		comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libmenu.so.8.0.debug		comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libmj.so.1.0.debug			comp-crypto-debug	debug,compatfile

Index: src/lib/libm/shlib_version
diff -u src/lib/libm/shlib_version:1.18 src/lib/libm/shlib_version:1.19
--- src/lib/libm/shlib_version:1.18	Thu Mar 23 12:38:13 2023
+++ src/lib/libm/shlib_version	Mon Jan 22 15:19:38 2024
@@ -1,8 +1,8 @@
-#	$NetBSD: shlib_version,v 1.18 2023/03/23 12:38:13 riastradh Exp $
+#	$NetBSD: shlib_version,v 1.19 2024/01/22 15:19:38 kre Exp $
 #	Remember to update distrib/sets/lists/base/shl.* when changing
 #
 # things we wish to do on next major version bump:
 # - remove compatibility cabs
 # - not provide isinff / isnanf (only provide __isinff version)
 major=0
-minor=13
+minor=14



CVS commit: src/bin/sh

2024-01-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Jan 30 19:05:07 UTC 2024

Modified Files:
src/bin/sh: jobs.c

Log Message:
PR bin/57894

For jobs -p for a non-job-control job, avoid just printing 0 (as
there is no process group pid) and instead output what we used to,
the pid of one of the processes in the job (usually the right one!)

XXX pullup -10 (9 and earlier not affected).


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/bin/sh/jobs.c

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



CVS commit: src/bin/sh

2024-01-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Jan 30 19:05:07 UTC 2024

Modified Files:
src/bin/sh: jobs.c

Log Message:
PR bin/57894

For jobs -p for a non-job-control job, avoid just printing 0 (as
there is no process group pid) and instead output what we used to,
the pid of one of the processes in the job (usually the right one!)

XXX pullup -10 (9 and earlier not affected).


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/bin/sh/jobs.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/sh/jobs.c
diff -u src/bin/sh/jobs.c:1.118 src/bin/sh/jobs.c:1.119
--- src/bin/sh/jobs.c:1.118	Fri Apr  7 10:34:13 2023
+++ src/bin/sh/jobs.c	Tue Jan 30 19:05:07 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.118 2023/04/07 10:34:13 kre Exp $	*/
+/*	$NetBSD: jobs.c,v 1.119 2024/01/30 19:05:07 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)jobs.c	8.5 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: jobs.c,v 1.118 2023/04/07 10:34:13 kre Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.119 2024/01/30 19:05:07 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -439,7 +439,8 @@ showjob(struct output *out, struct job *
 #if JOBS
 	if (mode & SHOW_PGID) {
 		/* output only the process group ID (lead process ID) */
-		outfmt(out, "%ld\n", (long)jp->pgrp);
+		outfmt(out, "%ld\n",
+		jp->pgrp != 0 ? (long)jp->pgrp : (long)jp->ps->pid);
 		return;
 	}
 #endif



CVS import: src/external/public-domain/tz/dist

2024-02-05 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Feb  5 21:34:47 UTC 2024

Update of /cvsroot/src/external/public-domain/tz/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv12946

Log Message:
Import tzdata2024a from 
https://github.com/JodaOrg/global-tz/releases/download/2024agtz/tzdata2024agtz.tar.gz

Summary of changes in tzdata2024a (2024-02-01 09:28:56 -0800):
  * Kazakhstan unifies on UTC+5.
  * Palestine summer time begins a week later than previously predicted
in 2024 and 2025.
  * Historic corrections for Asia/Ho_Chi_Minh (1955) America/Toronto (1947-9)
and America/Miquelon (1911).

Status:

Vendor Tag: TZDATA
Release Tags:   TZDATA2024AGTZ

U src/external/public-domain/tz/dist/calendars
U src/external/public-domain/tz/dist/CONTRIBUTING
U src/external/public-domain/tz/dist/LICENSE
U src/external/public-domain/tz/dist/Makefile
U src/external/public-domain/tz/dist/NEWS
U src/external/public-domain/tz/dist/README
U src/external/public-domain/tz/dist/SECURITY
U src/external/public-domain/tz/dist/theory.html
C src/external/public-domain/tz/dist/version
U src/external/public-domain/tz/dist/africa
U src/external/public-domain/tz/dist/antarctica
C src/external/public-domain/tz/dist/asia
C src/external/public-domain/tz/dist/australasia
U src/external/public-domain/tz/dist/europe
U src/external/public-domain/tz/dist/northamerica
U src/external/public-domain/tz/dist/southamerica
U src/external/public-domain/tz/dist/etcetera
U src/external/public-domain/tz/dist/factory
U src/external/public-domain/tz/dist/backward
U src/external/public-domain/tz/dist/backzone
U src/external/public-domain/tz/dist/iso3166.tab
C src/external/public-domain/tz/dist/leap-seconds.list
C src/external/public-domain/tz/dist/leapseconds
U src/external/public-domain/tz/dist/zone.tab
U src/external/public-domain/tz/dist/zonenow.tab
U src/external/public-domain/tz/dist/zone1970.tab
U src/external/public-domain/tz/dist/checklinks.awk
U src/external/public-domain/tz/dist/checknow.awk
U src/external/public-domain/tz/dist/checktab.awk
U src/external/public-domain/tz/dist/leapseconds.awk
U src/external/public-domain/tz/dist/ziguard.awk
U src/external/public-domain/tz/dist/zishrink.awk

5 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jTZDATA:yesterday -jTZDATA 
src/external/public-domain/tz/dist



CVS import: src/external/public-domain/tz/dist

2024-02-05 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Feb  5 21:34:47 UTC 2024

Update of /cvsroot/src/external/public-domain/tz/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv12946

Log Message:
Import tzdata2024a from 
https://github.com/JodaOrg/global-tz/releases/download/2024agtz/tzdata2024agtz.tar.gz

Summary of changes in tzdata2024a (2024-02-01 09:28:56 -0800):
  * Kazakhstan unifies on UTC+5.
  * Palestine summer time begins a week later than previously predicted
in 2024 and 2025.
  * Historic corrections for Asia/Ho_Chi_Minh (1955) America/Toronto (1947-9)
and America/Miquelon (1911).

Status:

Vendor Tag: TZDATA
Release Tags:   TZDATA2024AGTZ

U src/external/public-domain/tz/dist/calendars
U src/external/public-domain/tz/dist/CONTRIBUTING
U src/external/public-domain/tz/dist/LICENSE
U src/external/public-domain/tz/dist/Makefile
U src/external/public-domain/tz/dist/NEWS
U src/external/public-domain/tz/dist/README
U src/external/public-domain/tz/dist/SECURITY
U src/external/public-domain/tz/dist/theory.html
C src/external/public-domain/tz/dist/version
U src/external/public-domain/tz/dist/africa
U src/external/public-domain/tz/dist/antarctica
C src/external/public-domain/tz/dist/asia
C src/external/public-domain/tz/dist/australasia
U src/external/public-domain/tz/dist/europe
U src/external/public-domain/tz/dist/northamerica
U src/external/public-domain/tz/dist/southamerica
U src/external/public-domain/tz/dist/etcetera
U src/external/public-domain/tz/dist/factory
U src/external/public-domain/tz/dist/backward
U src/external/public-domain/tz/dist/backzone
U src/external/public-domain/tz/dist/iso3166.tab
C src/external/public-domain/tz/dist/leap-seconds.list
C src/external/public-domain/tz/dist/leapseconds
U src/external/public-domain/tz/dist/zone.tab
U src/external/public-domain/tz/dist/zonenow.tab
U src/external/public-domain/tz/dist/zone1970.tab
U src/external/public-domain/tz/dist/checklinks.awk
U src/external/public-domain/tz/dist/checknow.awk
U src/external/public-domain/tz/dist/checktab.awk
U src/external/public-domain/tz/dist/leapseconds.awk
U src/external/public-domain/tz/dist/ziguard.awk
U src/external/public-domain/tz/dist/zishrink.awk

5 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jTZDATA:yesterday -jTZDATA 
src/external/public-domain/tz/dist



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

2024-02-05 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Feb  5 21:52:39 UTC 2024

Modified Files:
src/external/public-domain/tz: tzdata2netbsd
src/external/public-domain/tz/dist: TZDATA_VERSION asia australasia
leap-seconds.list leapseconds version

Log Message:
Complete tzdata2024a update (using tzdata2024agtz) by fixing files that
the script manages to forget to handle.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/external/public-domain/tz/tzdata2netbsd
cvs rdiff -u -r1.36 -r1.37 src/external/public-domain/tz/dist/TZDATA_VERSION
cvs rdiff -u -r1.11 -r1.12 src/external/public-domain/tz/dist/asia \
src/external/public-domain/tz/dist/version
cvs rdiff -u -r1.8 -r1.9 src/external/public-domain/tz/dist/australasia
cvs rdiff -u -r1.6 -r1.7 src/external/public-domain/tz/dist/leap-seconds.list \
src/external/public-domain/tz/dist/leapseconds

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



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

2024-02-05 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Feb  5 21:52:39 UTC 2024

Modified Files:
src/external/public-domain/tz: tzdata2netbsd
src/external/public-domain/tz/dist: TZDATA_VERSION asia australasia
leap-seconds.list leapseconds version

Log Message:
Complete tzdata2024a update (using tzdata2024agtz) by fixing files that
the script manages to forget to handle.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/external/public-domain/tz/tzdata2netbsd
cvs rdiff -u -r1.36 -r1.37 src/external/public-domain/tz/dist/TZDATA_VERSION
cvs rdiff -u -r1.11 -r1.12 src/external/public-domain/tz/dist/asia \
src/external/public-domain/tz/dist/version
cvs rdiff -u -r1.8 -r1.9 src/external/public-domain/tz/dist/australasia
cvs rdiff -u -r1.6 -r1.7 src/external/public-domain/tz/dist/leap-seconds.list \
src/external/public-domain/tz/dist/leapseconds

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/tzdata2netbsd
diff -u src/external/public-domain/tz/tzdata2netbsd:1.15 src/external/public-domain/tz/tzdata2netbsd:1.16
--- src/external/public-domain/tz/tzdata2netbsd:1.15	Wed Aug 17 14:32:34 2022
+++ src/external/public-domain/tz/tzdata2netbsd	Mon Feb  5 21:52:38 2024
@@ -1,4 +1,4 @@
-# $NetBSD: tzdata2netbsd,v 1.15 2022/08/17 14:32:34 kre Exp $
+# $NetBSD: tzdata2netbsd,v 1.16 2024/02/05 21:52:38 kre Exp $
 
 # For use by NetBSD developers when updating to new versions of tzdata.
 #
@@ -22,7 +22,7 @@ VERS_PATTERN='2[0-9][0-9][0-9][a-z]'
 # First in the late xx90's sometime, allow the new one by changing the leading
 # digit from a specific value to the class containing the current and
 # following values (eg: in 2098 or so, change '2' to be '[23]').
-# Tnen in the following early xx00's sometime, delete the class, and insert
+# Then in the following early xx00's sometime, delete the class, and
 # leave only the current value as valid (eg: in 3001 or 3002,
 # change '[23]' to be just '3'
 # Doing it this way helps guard against invalid specifications.
@@ -42,13 +42,20 @@ VERS_PATTERN='2[0-9][0-9][0-9][a-z]'
 # need to match those.
 # If that convention changes (as of date of writing, it has never been
 # exercised) then code changes below will be required.
+# Note it doesn't matter (here) if z is followed by aa or za
 
 DIST_HOST=ftp.iana.org
 DIST_PATH=tz
 DIST_FILES=releases
 
+GTZURL=https://github.com/JodaOrg/global-tz/releases/download
+
 EDITOR=${EDITOR:-vi}
-WORK_PFX=$(pwd)/update-work || fail "Cannot obtain PWD"
+
+TZBASE=$(pwd)	|| fail 'Cannot find myself ($PWD)'
+cd -P "$TZBASE"	|| fail "Cannot return home: ${TZBASE}"
+
+WORK_PFX=${TZBASE}/update-work
 UPDATE_FROM=${WORK_PFX}/updating.from.version
 
 usage()
@@ -58,7 +65,11 @@ usage()
 		" where a version-id is of the form x (eg: 2018c)" \
 		" or '' for new-version-id (to specify only the old)"  \
 		" and where new-version-id can have =fetch-version-id" \
-		" appended to specify fetching that version instead"
+		" appended to specify fetching that version instead" \
+		" where the 'fetch-version-id' can be omitted if it" \
+		" is \${new-version-id}gtz  - and simply using '=' means" \
+		" to work out the new-version-id but then use the gtz fork"
+
 	exit 2
 }
 
@@ -138,15 +149,29 @@ argparse()
 	case "$#" in
 	0|1)
 		# once we have obtained OLDVER once, never guess it again.
-		test -f "${UPDATE_FROM}" && OLDVER=$(cat "${UPDATE_FROM}") ||
+		if  [ -f "${UPDATE_FROM}" ]
+		then
+			OLDVER=$(cat "${UPDATE_FROM}")
+		elif [ -f dist/TZDATA_VERSION ]
+		then
+			OLDVER=$(cat dist/TZDATA_VERSION)
+		elif [ -f dist/version ]
+		then
+			OLDVER=$(cat dist/version)
+		fi
+		OLDVER=${OLDVER#tzdata}		# TZDATA_VERS is tzdata-X
+		OLDVER=${OLDVER#-}		# but the '-' is optional
+		OLDVERGTZ=${OLDVER}		# This would have been the cvs tag
+		OLDVER=${OLDVER%gtz}		# want the base version elsewhere
 
-		OLDVER=$(cat dist/version) || {
+		if [ -z "${OLDVER}" ]
+		then
 			printf >&2 '%s\n'  \
-			"Cannot determine current installed version"  \
-			"Specify it on the command line."  \
-			""
+			'Cannot determine current installed version'  \
+			'Specify it on the command line.'  \
+			''
 			usage
-		}
+		fi
 
 		valid_vers old "${OLDVER}" ||
 			fail "Calculated bad OLDVER, give as 2nd arg"
@@ -159,9 +184,12 @@ argparse()
 		;;
 	esac
 
+	GLOBAL=false
 	case "$#:$1" in
 	0: | 1: | 2: )
 		;;
+	1:=|2:=)
+		GLOBAL=true;;
 	1:=?*|2:=?*)	
 		valid_vers fetch "${1#=}" && FETCHVER="${1#=}" || usage
 		;;
@@ -179,19 +207,27 @@ argparse()
 
 	test -z "${NEWVER}" && get_curvers
 
-	test -z "${FETCHVER}" && FETCHVER=${NEWVER}
+	if [ -z "${FETCHVER}" ]
+	then
+		if $GLOBAL
+		then
+			FETCHVER=${NEWVER}gtz
+		else
+			FETCHVER=${NEWVER}
+		fi
+	fi
 
 	case "${FETCHVER}" in
 	*gtz)	GLOBAL=true;;
 	*)	GLOBAL=false;;
 	esac
 
-	test "${NEWV

CVS commit: src/doc

2024-02-05 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Feb  5 21:57:00 UTC 2024

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
Notre tzdata update to 2024a


To generate a diff of this commit:
cvs rdiff -u -r1.1982 -r1.1983 src/doc/3RDPARTY
cvs rdiff -u -r1.3033 -r1.3034 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/doc

2024-02-05 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Feb  5 21:57:00 UTC 2024

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
Notre tzdata update to 2024a


To generate a diff of this commit:
cvs rdiff -u -r1.1982 -r1.1983 src/doc/3RDPARTY
cvs rdiff -u -r1.3033 -r1.3034 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/3RDPARTY
diff -u src/doc/3RDPARTY:1.1982 src/doc/3RDPARTY:1.1983
--- src/doc/3RDPARTY:1.1982	Thu Feb  1 10:06:08 2024
+++ src/doc/3RDPARTY	Mon Feb  5 21:57:00 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1982 2024/02/01 10:06:08 wiz Exp $
+#	$NetBSD: 3RDPARTY,v 1.1983 2024/02/05 21:57:00 kre Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1429,8 +1429,8 @@ Location:	external/bsd/tradcpp
 Notes:
 
 Package:	tz
-Version:	tzcode2023d / tzdata2023dgtz
-Current Vers:	tzcode2023d / tzdata2023d
+Version:	tzcode2023d / tzdata2024agtz
+Current Vers:	tzcode2024a / tzdata2024a
 Maintainer:	Paul Eggert 
 Archive Site:	ftp://ftp.iana.org/tz/releases/
 Archive Site:	ftp://munnari.oz.au/pub/oldtz/

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.3033 src/doc/CHANGES:1.3034
--- src/doc/CHANGES:1.3033	Sat Feb  3 20:38:49 2024
+++ src/doc/CHANGES	Mon Feb  5 21:57:00 2024
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.3033 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.3034 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -256,3 +256,4 @@ Changes from NetBSD 10.0 to NetBSD 11.0:
 	libm: Import more long double functions from FreeBSD.
 		[christos 20240121]
 	terminfo: Import 20231209 [christos 20240127]
+	tzdata: Updated to 2024a (using 2024agtz) [kre 20240205]



CVS commit: src/usr.bin/touch

2024-02-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Feb  8 02:53:13 UTC 2024

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

Log Message:
KNF (space after keyword, and 80 column police).

NFCI

(This is the first of a series of changes to be committed
in rapid sequence).


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/touch/touch.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/touch

2024-02-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Feb  8 02:53:13 UTC 2024

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

Log Message:
KNF (space after keyword, and 80 column police).

NFCI

(This is the first of a series of changes to be committed
in rapid sequence).


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/touch/touch.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/touch/touch.c
diff -u src/usr.bin/touch/touch.c:1.33 src/usr.bin/touch/touch.c:1.34
--- src/usr.bin/touch/touch.c:1.33	Mon Mar  2 03:17:24 2015
+++ src/usr.bin/touch/touch.c	Thu Feb  8 02:53:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: touch.c,v 1.33 2015/03/02 03:17:24 enami Exp $	*/
+/*	$NetBSD: touch.c,v 1.34 2024/02/08 02:53:13 kre Exp $	*/
 
 /*
  * Copyright (c) 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1993\
 #if 0
 static char sccsid[] = "@(#)touch.c	8.2 (Berkeley) 4/28/95";
 #endif
-__RCSID("$NetBSD: touch.c,v 1.33 2015/03/02 03:17:24 enami Exp $");
+__RCSID("$NetBSD: touch.c,v 1.34 2024/02/08 02:53:13 kre Exp $");
 #endif /* not lint */
 
 #include 
@@ -92,7 +92,7 @@ main(int argc, char *argv[])
 
 	while ((ch = getopt_long(argc, argv, "acd:fhmr:t:", touch_longopts,
 	NULL)) != -1)
-		switch(ch) {
+		switch (ch) {
 		case 'a':
 			aflag = 1;
 			break;
@@ -331,7 +331,7 @@ static void
 usage(void)
 {
 	(void)fprintf(stderr,
-	"Usage: %s [-acfhm] [-d|--date datetime] [-r|--reference file] [-t time] file ...\n",
-	getprogname());
+	"Usage: %s [-acfhm] [-d|--date datetime] [-r|--reference file]"
+	" [-t time] file ...\n", getprogname());
 	exit(EXIT_FAILURE);
 }



CVS commit: src/usr.bin/touch

2024-02-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Feb  8 02:53:28 UTC 2024

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

Log Message:
Parameterise the "if year < 69 it is 20xx and if >=69 it is 19xx" rule
to make it simpler to (eventually, many years hence) to change that rule
to be "if year is < NN it is 21xx and if >= NN it is 20xx" instead.

Avoid comparing a time_t to -1 directly, as time_t might be unsigned.
Instead define NO_TIME as ((time_t)-1) and compare with that instead.
This makes no difference at all when time_t is signed (as it is on
NetBSD).

Use "ss" rather than "SS" as the seconds indicators (in messages)
to match with hh (hours) and mm (minutes) rather than looking like
some relation to YY (year) MM (month) and DD (day).   Why this was
ever written as SS is beyond me, but it has been that way forever.
(doc update will follow).

Minor improvement to the error message if the arg to a -t option
is unable to be parsed correctly.

NMFCI (No meaningful...)


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/touch/touch.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/touch

2024-02-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Feb  8 02:53:28 UTC 2024

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

Log Message:
Parameterise the "if year < 69 it is 20xx and if >=69 it is 19xx" rule
to make it simpler to (eventually, many years hence) to change that rule
to be "if year is < NN it is 21xx and if >= NN it is 20xx" instead.

Avoid comparing a time_t to -1 directly, as time_t might be unsigned.
Instead define NO_TIME as ((time_t)-1) and compare with that instead.
This makes no difference at all when time_t is signed (as it is on
NetBSD).

Use "ss" rather than "SS" as the seconds indicators (in messages)
to match with hh (hours) and mm (minutes) rather than looking like
some relation to YY (year) MM (month) and DD (day).   Why this was
ever written as SS is beyond me, but it has been that way forever.
(doc update will follow).

Minor improvement to the error message if the arg to a -t option
is unable to be parsed correctly.

NMFCI (No meaningful...)


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/touch/touch.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/touch/touch.c
diff -u src/usr.bin/touch/touch.c:1.34 src/usr.bin/touch/touch.c:1.35
--- src/usr.bin/touch/touch.c:1.34	Thu Feb  8 02:53:13 2024
+++ src/usr.bin/touch/touch.c	Thu Feb  8 02:53:28 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: touch.c,v 1.34 2024/02/08 02:53:13 kre Exp $	*/
+/*	$NetBSD: touch.c,v 1.35 2024/02/08 02:53:28 kre Exp $	*/
 
 /*
  * Copyright (c) 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1993\
 #if 0
 static char sccsid[] = "@(#)touch.c	8.2 (Berkeley) 4/28/95";
 #endif
-__RCSID("$NetBSD: touch.c,v 1.34 2024/02/08 02:53:13 kre Exp $");
+__RCSID("$NetBSD: touch.c,v 1.35 2024/02/08 02:53:28 kre Exp $");
 #endif /* not lint */
 
 #include 
@@ -74,6 +74,12 @@ struct option touch_longopts[] = {
 		0 },
 };
 
+#define	YEAR_BOUNDARY		69
+#define	LOW_YEAR_CENTURY	2000	/* for 2 digit years < YEAR_BOUNDARY */
+#define	HIGH_YEAR_CENTURY	1900	/* for 2 digit years >=  "  */
+
+#define	NO_TIME		((time_t)-1)	/* time_t might be unsigned */
+
 int
 main(int argc, char *argv[])
 {
@@ -214,7 +220,7 @@ static void
 stime_arg0(char *arg, struct timespec *tsp)
 {
 	tsp[1].tv_sec = tsp[0].tv_sec = parsedate(arg, NULL, NULL);
-	if (tsp[0].tv_sec == -1)
+	if (tsp[0].tv_sec == NO_TIME)
 		errx(EXIT_FAILURE, "Could not parse `%s'", arg);
 	tsp[0].tv_nsec = tsp[1].tv_nsec = 0;
 }
@@ -226,11 +232,13 @@ stime_arg1(char *arg, struct timespec *t
 	time_t tmptime;
 	int yearset;
 	char *p;
+	char *initarg = arg;
+
 	/* Start with the current time. */
 	tmptime = tsp[0].tv_sec;
 	if ((t = localtime(&tmptime)) == NULL)
 		err(EXIT_FAILURE, "localtime");
-	/* [[CC]YY]MMDDhhmm[.SS] */
+	/* [[CC]YY]MMDDhhmm[.ss] */
 	if ((p = strchr(arg, '.')) == NULL)
 		t->tm_sec = 0;		/* Seconds defaults to 0. */
 	else {
@@ -251,10 +259,12 @@ stime_arg1(char *arg, struct timespec *t
 			t->tm_year += ATOI2(arg);
 		} else {
 			yearset = ATOI2(arg);
-			if (yearset < 69)
-t->tm_year = yearset + 2000 - TM_YEAR_BASE;
+			if (yearset < YEAR_BOUNDARY)
+t->tm_year = yearset +
+LOW_YEAR_CENTURY - TM_YEAR_BASE;
 			else
-t->tm_year = yearset + 1900 - TM_YEAR_BASE;
+t->tm_year = yearset +
+HIGH_YEAR_CENTURY - TM_YEAR_BASE;
 		}
 		/* FALLTHROUGH */
 	case 8:/* MMDDhhmm */
@@ -276,9 +286,9 @@ stime_arg1(char *arg, struct timespec *t
 
 	t->tm_isdst = -1;		/* Figure out DST. */
 	tsp[0].tv_sec = tsp[1].tv_sec = mktime(t);
-	if (tsp[0].tv_sec == -1)
-terr:		errx(EXIT_FAILURE,
-	"out of range or illegal time specification: [[CC]YY]MMDDhhmm[.SS]");
+	if (tsp[0].tv_sec == NO_TIME)
+ terr:		errx(EXIT_FAILURE, "out of range or bad time specification:\n"
+		"\t'%s' should be [[CC]YY]MMDDhhmm[.ss]", initarg);
 
 	tsp[0].tv_nsec = tsp[1].tv_nsec = 0;
 }
@@ -300,18 +310,18 @@ stime_arg2(char *arg, int year, struct t
 	t->tm_min = ATOI2(arg);
 	if (year) {
 		year = ATOI2(arg);
-		if (year < 69)
-			t->tm_year = year + 2000 - TM_YEAR_BASE;
+		if (year < YEAR_BOUNDARY)
+			t->tm_year = year + LOW_YEAR_CENTURY - TM_YEAR_BASE;
 		else
-			t->tm_year = year + 1900 - TM_YEAR_BASE;
+			t->tm_year = year + HIGH_YEAR_CENTURY - TM_YEAR_BASE;
 	}
 	t->tm_sec = 0;
 
 	t->tm_isdst = -1;		/* Figure out DST. */
 	tsp[0].tv_sec = tsp[1].tv_sec = mktime(t);
-	if (tsp[0].tv_sec == -1)
+	if (tsp[0].tv_sec == NO_TIME)
 		errx(EXIT_FAILURE,
-	"out of range or illegal time specification: MMDDhhmm[yy]");
+		"out of range or bad time specification: MMDDhhmm[YY]");
 
 	tsp[0].tv_nsec = tsp[1].tv_nsec = 0;
 }



CVS commit: src/usr.bin/touch

2024-02-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Feb  8 02:53:40 UTC 2024

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

Log Message:
Sprinkle come const - but not too much of a good thing.

NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/usr.bin/touch/touch.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/touch

2024-02-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Feb  8 02:53:40 UTC 2024

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

Log Message:
Sprinkle come const - but not too much of a good thing.

NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/usr.bin/touch/touch.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/touch/touch.c
diff -u src/usr.bin/touch/touch.c:1.35 src/usr.bin/touch/touch.c:1.36
--- src/usr.bin/touch/touch.c:1.35	Thu Feb  8 02:53:28 2024
+++ src/usr.bin/touch/touch.c	Thu Feb  8 02:53:40 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: touch.c,v 1.35 2024/02/08 02:53:28 kre Exp $	*/
+/*	$NetBSD: touch.c,v 1.36 2024/02/08 02:53:40 kre Exp $	*/
 
 /*
  * Copyright (c) 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1993\
 #if 0
 static char sccsid[] = "@(#)touch.c	8.2 (Berkeley) 4/28/95";
 #endif
-__RCSID("$NetBSD: touch.c,v 1.35 2024/02/08 02:53:28 kre Exp $");
+__RCSID("$NetBSD: touch.c,v 1.36 2024/02/08 02:53:40 kre Exp $");
 #endif /* not lint */
 
 #include 
@@ -59,10 +59,10 @@ __RCSID("$NetBSD: touch.c,v 1.35 2024/02
 #include 
 #include 
 
-static void	stime_arg0(char *, struct timespec *);
+static void	stime_arg0(const char *, struct timespec *);
 static void	stime_arg1(char *, struct timespec *);
-static void	stime_arg2(char *, int, struct timespec *);
-static void	stime_file(char *, struct timespec *);
+static void	stime_arg2(const char *, int, struct timespec *);
+static void	stime_file(const char *, struct timespec *);
 __dead static void	usage(void);
 
 struct option touch_longopts[] = {
@@ -217,7 +217,7 @@ main(int argc, char *argv[])
 #define	ATOI2(s)	((s) += 2, ((s)[-2] - '0') * 10 + ((s)[-1] - '0'))
 
 static void
-stime_arg0(char *arg, struct timespec *tsp)
+stime_arg0(const char *arg, struct timespec *tsp)
 {
 	tsp[1].tv_sec = tsp[0].tv_sec = parsedate(arg, NULL, NULL);
 	if (tsp[0].tv_sec == NO_TIME)
@@ -294,7 +294,7 @@ stime_arg1(char *arg, struct timespec *t
 }
 
 static void
-stime_arg2(char *arg, int year, struct timespec *tsp)
+stime_arg2(const char *arg, int year, struct timespec *tsp)
 {
 	struct tm *t;
 	time_t tmptime;
@@ -327,7 +327,7 @@ stime_arg2(char *arg, int year, struct t
 }
 
 static void
-stime_file(char *fname, struct timespec *tsp)
+stime_file(const char *fname, struct timespec *tsp)
 {
 	struct stat sb;
 



CVS commit: src/usr.bin/touch

2024-02-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Feb  8 02:53:53 UTC 2024

Modified Files:
src/usr.bin/touch: Makefile touch.c

Log Message:
Properly implement the POSIX format -d option.

Previously we have hacked that using parsedate(3) - but parsedate()
returns a time_t and consequently while it "handles" fractional seconds,
all that meant (all it really can mean) is that they're ignored.

The POSIX spec expects that (at least if the filesystem supports them)
fractional seconds can be set using the -d option.

Handle that by first attempting to parse the -d arg as a posix format
date-time string (using a reasonably strict parser), and if that fails,
then fall back on parsedate(3) to parse the arg.

If the posix format parse succeeds, the result will be the same as
parsedate(3) would return for the same string - except any fractional
seconds will be handled properly.   If it fails, then nothing changes
from what we currently do.

Note the POSIX string is
-MM-DDThh:mm:ss[.frac][Z]
where  is (at least) 4 digits (leading 0's are acceptable if
you really must!) all the MM DD hh mm ss fields are exactly 2
digits, T is either 'T' or ' ', '.' is either itself, or ',',
and 'frac' is one or more digits.  Z (if given) is 'Z'.  The
[.,]frac and Z fields are optional.   Specify a time in a
slight shorthand like 2024-2-8T7:44:20  and the POSIX parse
will fail, leaving parsedate() to handle that (which it should).
But any fractional seconds which were given would be ignored.

Doc update coming - note the doc will call the  field CCYY
instead, that's just a convenience to make other parts of what
is there make more sense - it is still one 4 (or more) digit field.

This should be an almost invisible change.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/touch/Makefile
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/touch/touch.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/touch

2024-02-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Feb  8 02:53:53 UTC 2024

Modified Files:
src/usr.bin/touch: Makefile touch.c

Log Message:
Properly implement the POSIX format -d option.

Previously we have hacked that using parsedate(3) - but parsedate()
returns a time_t and consequently while it "handles" fractional seconds,
all that meant (all it really can mean) is that they're ignored.

The POSIX spec expects that (at least if the filesystem supports them)
fractional seconds can be set using the -d option.

Handle that by first attempting to parse the -d arg as a posix format
date-time string (using a reasonably strict parser), and if that fails,
then fall back on parsedate(3) to parse the arg.

If the posix format parse succeeds, the result will be the same as
parsedate(3) would return for the same string - except any fractional
seconds will be handled properly.   If it fails, then nothing changes
from what we currently do.

Note the POSIX string is
-MM-DDThh:mm:ss[.frac][Z]
where  is (at least) 4 digits (leading 0's are acceptable if
you really must!) all the MM DD hh mm ss fields are exactly 2
digits, T is either 'T' or ' ', '.' is either itself, or ',',
and 'frac' is one or more digits.  Z (if given) is 'Z'.  The
[.,]frac and Z fields are optional.   Specify a time in a
slight shorthand like 2024-2-8T7:44:20  and the POSIX parse
will fail, leaving parsedate() to handle that (which it should).
But any fractional seconds which were given would be ignored.

Doc update coming - note the doc will call the  field CCYY
instead, that's just a convenience to make other parts of what
is there make more sense - it is still one 4 (or more) digit field.

This should be an almost invisible change.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/touch/Makefile
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/touch/touch.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/touch/Makefile
diff -u src/usr.bin/touch/Makefile:1.4 src/usr.bin/touch/Makefile:1.5
--- src/usr.bin/touch/Makefile:1.4	Wed Jul 25 01:23:46 2012
+++ src/usr.bin/touch/Makefile	Thu Feb  8 02:53:53 2024
@@ -1,8 +1,9 @@
-#	$NetBSD: Makefile,v 1.4 2012/07/25 01:23:46 christos Exp $
+#	$NetBSD: Makefile,v 1.5 2024/02/08 02:53:53 kre Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/6/93
 
 PROG=	touch
 LDADD+=	-lutil
+LDADD+=	-lm
 DPADD+=	${LIBUTIL}
 
 .include 

Index: src/usr.bin/touch/touch.c
diff -u src/usr.bin/touch/touch.c:1.36 src/usr.bin/touch/touch.c:1.37
--- src/usr.bin/touch/touch.c:1.36	Thu Feb  8 02:53:40 2024
+++ src/usr.bin/touch/touch.c	Thu Feb  8 02:53:53 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: touch.c,v 1.36 2024/02/08 02:53:40 kre Exp $	*/
+/*	$NetBSD: touch.c,v 1.37 2024/02/08 02:53:53 kre Exp $	*/
 
 /*
  * Copyright (c) 1993
@@ -39,16 +39,19 @@ __COPYRIGHT("@(#) Copyright (c) 1993\
 #if 0
 static char sccsid[] = "@(#)touch.c	8.2 (Berkeley) 4/28/95";
 #endif
-__RCSID("$NetBSD: touch.c,v 1.36 2024/02/08 02:53:40 kre Exp $");
+__RCSID("$NetBSD: touch.c,v 1.37 2024/02/08 02:53:53 kre Exp $");
 #endif /* not lint */
 
 #include 
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -63,6 +66,7 @@ static void	stime_arg0(const char *, str
 static void	stime_arg1(char *, struct timespec *);
 static void	stime_arg2(const char *, int, struct timespec *);
 static void	stime_file(const char *, struct timespec *);
+static int	stime_posix(const char *, struct timespec *);
 __dead static void	usage(void);
 
 struct option touch_longopts[] = {
@@ -107,7 +111,8 @@ main(int argc, char *argv[])
 			break;
 		case 'd':
 			timeset = 1;
-			stime_arg0(optarg, ts);
+			if (!stime_posix(optarg, ts))
+stime_arg0(optarg, ts);
 			break;
 		case 'f':
 			break;
@@ -337,6 +342,147 @@ stime_file(const char *fname, struct tim
 	tsp[1] = sb.st_mtimespec;
 }
 
+static int
+stime_posix(const char *arg, struct timespec *tsp)
+{
+	struct tm tm;
+	const char *p;
+	char *ep;
+	int utc = 0;
+	long val;
+
+#define	isdigch(c)	(isdigit((int)((unsigned char)(c
+
+	if ((p = strchr(arg, '-')) == NULL)
+		return 0;
+	if (p - arg < 4)	/* at least 4 year digits required */
+		return 0;
+
+	if (!isdigch(arg[0]))	/* and the first must be a digit! */
+		return 0;
+
+	errno = 0;
+	val = strtol(arg, &ep, 10);		/*  */
+	if (val < 0 || val > INT_MAX)
+		return 0;
+	if (*ep != '-')
+		return 0;
+	tm.tm_year = (int)val - 1900;
+
+	p = ep + 1;
+
+	if (!isdigch(*p))
+		return 0;
+	val = strtol(p, &ep, 10);		/* MM */
+	if (val < 1 || val > 12)
+		return 0;
+	if (*ep != '-' || ep != p + 2)
+		return 0;
+	tm.tm_mon = (int)val - 1;
+
+	p = ep + 1;
+
+	if (!isdigch(*p))
+		return 0;
+	val = strtol(p, &ep, 10);		/* DD */
+	if (val < 1 || val > 31)
+		return 0;
+	if ((*ep != 'T' && *ep != ' ') || ep != p + 2)
+		return 0;
+	tm.tm_mday = (int)val;
+
+	p = ep + 1;
+
+	if (!is

CVS commit: src/usr.bin/touch

2024-02-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Feb  8 02:54:07 UTC 2024

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

Log Message:
Check that mktime() (or timegm() the one time it is used) do not
alter any of the material fields of the struct tm that was handed
to it.   If any were altered, then the time string passed in was
not a valid time representation, and so should be rejected.

This one is not an invisible change, it prevents use of things like
"-t 20240230"  (which previously would have been interpreted as
"-t 20240301" - the day after the 29th of Feb in 2024).

I believe this is an improvement however, and in line with the
general intent that if you specify a date and time, that exact
date and time is what touch should be using.   It does mean that
specifying "60" for the seconds field is almost guaranteed to
fail on any POSIX system, as leap seconds simply don't exist
there (on a non-POSIX-conforming system that uses leap seconds,
the :60 should work, if specified with the correct date and time
at which the leap second actually occurs).

The one exception is when parsedate(3) is used, as that does not
do this check (which allows things like "-1 day" on the 1st of
a month to work).

(This is the last of this sequence of updates to touch.c, an
update to touch.1 follows).


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/touch/touch.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/touch

2024-02-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Feb  8 02:54:13 UTC 2024

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

Log Message:
Document the -d posix-datetime arg variation, to allow specifying
fractional seconds.   (Alternate ways to achieve that for the other
ways of specifying the date and time may be forthcoming in a future
update).

Also add a warning about the (still far) future likely change of
the interpretation of 2 digit years (the coming POSIX standard
contains a similar warning).

While here, clean up wording, some macro usage, etc etc etc...


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/touch/touch.1

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



CVS commit: src/usr.bin/touch

2024-02-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Feb  8 02:54:07 UTC 2024

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

Log Message:
Check that mktime() (or timegm() the one time it is used) do not
alter any of the material fields of the struct tm that was handed
to it.   If any were altered, then the time string passed in was
not a valid time representation, and so should be rejected.

This one is not an invisible change, it prevents use of things like
"-t 20240230"  (which previously would have been interpreted as
"-t 20240301" - the day after the 29th of Feb in 2024).

I believe this is an improvement however, and in line with the
general intent that if you specify a date and time, that exact
date and time is what touch should be using.   It does mean that
specifying "60" for the seconds field is almost guaranteed to
fail on any POSIX system, as leap seconds simply don't exist
there (on a non-POSIX-conforming system that uses leap seconds,
the :60 should work, if specified with the correct date and time
at which the leap second actually occurs).

The one exception is when parsedate(3) is used, as that does not
do this check (which allows things like "-1 day" on the 1st of
a month to work).

(This is the last of this sequence of updates to touch.c, an
update to touch.1 follows).


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/touch/touch.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/touch/touch.c
diff -u src/usr.bin/touch/touch.c:1.37 src/usr.bin/touch/touch.c:1.38
--- src/usr.bin/touch/touch.c:1.37	Thu Feb  8 02:53:53 2024
+++ src/usr.bin/touch/touch.c	Thu Feb  8 02:54:07 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: touch.c,v 1.37 2024/02/08 02:53:53 kre Exp $	*/
+/*	$NetBSD: touch.c,v 1.38 2024/02/08 02:54:07 kre Exp $	*/
 
 /*
  * Copyright (c) 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1993\
 #if 0
 static char sccsid[] = "@(#)touch.c	8.2 (Berkeley) 4/28/95";
 #endif
-__RCSID("$NetBSD: touch.c,v 1.37 2024/02/08 02:53:53 kre Exp $");
+__RCSID("$NetBSD: touch.c,v 1.38 2024/02/08 02:54:07 kre Exp $");
 #endif /* not lint */
 
 #include 
@@ -67,6 +67,7 @@ static void	stime_arg1(char *, struct ti
 static void	stime_arg2(const char *, int, struct timespec *);
 static void	stime_file(const char *, struct timespec *);
 static int	stime_posix(const char *, struct timespec *);
+static int	difftm(const struct tm *, const struct tm *);
 __dead static void	usage(void);
 
 struct option touch_longopts[] = {
@@ -233,7 +234,7 @@ stime_arg0(const char *arg, struct times
 static void
 stime_arg1(char *arg, struct timespec *tsp)
 {
-	struct tm *t;
+	struct tm *t, tm;
 	time_t tmptime;
 	int yearset;
 	char *p;
@@ -290,8 +291,9 @@ stime_arg1(char *arg, struct timespec *t
 	}
 
 	t->tm_isdst = -1;		/* Figure out DST. */
+	tm = *t;
 	tsp[0].tv_sec = tsp[1].tv_sec = mktime(t);
-	if (tsp[0].tv_sec == NO_TIME)
+	if (tsp[0].tv_sec == NO_TIME || difftm(t, &tm))
  terr:		errx(EXIT_FAILURE, "out of range or bad time specification:\n"
 		"\t'%s' should be [[CC]YY]MMDDhhmm[.ss]", initarg);
 
@@ -301,7 +303,7 @@ stime_arg1(char *arg, struct timespec *t
 static void
 stime_arg2(const char *arg, int year, struct timespec *tsp)
 {
-	struct tm *t;
+	struct tm *t, tm;
 	time_t tmptime;
 	/* Start with the current time. */
 	tmptime = tsp[0].tv_sec;
@@ -323,8 +325,9 @@ stime_arg2(const char *arg, int year, st
 	t->tm_sec = 0;
 
 	t->tm_isdst = -1;		/* Figure out DST. */
+	tm = *t;
 	tsp[0].tv_sec = tsp[1].tv_sec = mktime(t);
-	if (tsp[0].tv_sec == NO_TIME)
+	if (tsp[0].tv_sec == NO_TIME || difftm(t, &tm))
 		errx(EXIT_FAILURE,
 		"out of range or bad time specification: MMDDhhmm[YY]");
 
@@ -345,7 +348,7 @@ stime_file(const char *fname, struct tim
 static int
 stime_posix(const char *arg, struct timespec *tsp)
 {
-	struct tm tm;
+	struct tm tm, tms;
 	const char *p;
 	char *ep;
 	int utc = 0;
@@ -361,6 +364,8 @@ stime_posix(const char *arg, struct time
 	if (!isdigch(arg[0]))	/* and the first must be a digit! */
 		return 0;
 
+	(void)memset(&tm, 0, sizeof tm);
+
 	errno = 0;
 	val = strtol(arg, &ep, 10);		/*  */
 	if (val < 0 || val > INT_MAX)
@@ -472,17 +477,46 @@ stime_posix(const char *arg, struct time
 		return 0;
 
 	tm.tm_isdst = -1;
+	tms = tm;
 	if (utc)
 		tsp[0].tv_sec = tsp[1].tv_sec = timegm(&tm);
 	else
 		tsp[0].tv_sec = tsp[1].tv_sec = mktime(&tm);
 
-	if (errno != 0 && tsp[1].tv_sec == NO_TIME)
+	if ((errno != 0 && tsp[1].tv_sec == NO_TIME) || difftm(&tm, &tms))
 		return 0;
 
 	return 1;
 }
 
+/*
+ * Determine whether 2 struct tn's are different
+ * return true (1) if theu are, false (0) otherwise.
+ *
+ * Note that we only consider the fields that are set
+ * for mktime() to use - if mktime() returns them
+ * differently than was set, then there was a problem
+ * with the setting.
+ */
+static int
+difftm(const struct tm *t1, const struct tm *t2)

CVS commit: src/usr.bin/touch

2024-02-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Feb  8 02:54:13 UTC 2024

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

Log Message:
Document the -d posix-datetime arg variation, to allow specifying
fractional seconds.   (Alternate ways to achieve that for the other
ways of specifying the date and time may be forthcoming in a future
update).

Also add a warning about the (still far) future likely change of
the interpretation of 2 digit years (the coming POSIX standard
contains a similar warning).

While here, clean up wording, some macro usage, etc etc etc...


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/touch/touch.1

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

Modified files:

Index: src/usr.bin/touch/touch.1
diff -u src/usr.bin/touch/touch.1:1.26 src/usr.bin/touch/touch.1:1.27
--- src/usr.bin/touch/touch.1:1.26	Sat Dec 24 15:49:18 2016
+++ src/usr.bin/touch/touch.1	Thu Feb  8 02:54:13 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: touch.1,v 1.26 2016/12/24 15:49:18 abhinav Exp $
+.\"	$NetBSD: touch.1,v 1.27 2024/02/08 02:54:13 kre Exp $
 .\"
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\" @(#)touch.1	8.3 (Berkeley) 4/28/95
 .\"
-.Dd December 24, 2016
+.Dd February 7, 2024
 .Dt TOUCH 1
 .Os
 .Sh NAME
@@ -41,63 +41,181 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl acfhm
-.Op Fl d Ar human-datetime
-.Op Fl Fl date Ar human-datetime
-.Op Fl r Ar file
-.Op Fl Fl reference Ar file
+.Op Fl d Ar posix-datetime|human-datetime
+.Op Fl Fl \|date Ar posix-datetime|human-datetime
+.Op Fl r Ar ref-file
+.Op Fl Fl \|reference Ar ref-file
 .Op Fl t Ar datetime
 .Ar file ...
 .Sh DESCRIPTION
 The
 .Nm
-utility changes the access and modification times of files to the
-current time of day.
-If the file doesn't exist, it is created with default permissions.
+utility changes either or both of the access and modification times of the
+.Ar file Ns s
+to the time specified by the options, described below,
+or to the current time of day, if none of those options is present.
+If the file doesn't exist, it is first created with default permissions.
 .Pp
 The following options are available:
-.Bl -tag -width "-d human-datetime"
+.Bl -tag -compact -width Fl
+.Pp
 .It Fl a
-Change the access time of the file.
-The modification time of the file is not changed unless the
+Change the access time of the
+.Ar file .
+The modification time of the
+.Ar file
+is not changed unless the
 .Fl m
 flag is also specified.
+.Pp
 .It Fl c
-Do not create the file if it does not exist.
+Do not create the
+.Ar file
+if it does not exist.
 The
 .Nm
 utility does not treat this as an error.
 No error messages are displayed and the exit value is not affected.
+.Pp
+.It Fl d Ar posix-datetime
 .It Fl d Ar human-datetime
-.It Fl Fl date Ar human-datetime
-Parse
+.It Fl Fl \|date Ar posix-datetime
+.It Fl Fl \|date Ar human-datetime
+Attempt to parse the arg
+.Ar posix-datetime
+as a POSIX time string
+.Dq CCYY\-MM\-DDThh:mm:ss[.frac][Z]
+where the minus (or hyphen)
+.Pq Sq \&\-
+and colon
+.Pq Sq \&:
+characters are literals, and:
+.Bl -bullet -compact
+.It
+.Cm CCYY
+represents a 4 (or more) digit year number,
+.It
+.Cm MM
+represents a 2 digit month number (1\-12),
+.It
+.Cm DD
+represents a 2 digit day of the month (1\-31),
+.It
+.Cm T
+represents either the character
+.Sq T
+or a single space character (in which case the
+space, at least, may need to be quoted to the shell to
+avoid the arg being split into two words),
+.It
+.Cm hh
+represents a 2 digit hour of the day (00\-23),
+.It
+.Cm mm
+represents a 2 digit minute of the hour (00\-59),
+.It
+.Cm ss
+represents a 2 digit second of the minute (00\-60)
+where 60 indicates the occurrence of a leap second,
+which POSIX systems ignore, resulting in the following
+second being generated instead (:00 of the next minute),
+.It
+.Cm .frac
+represents optional factional seconds, where the
+.Sq \&.
+can be a period
+.Pq Sq \&.
+or a comma
+.Pq Sq \&,
+and
+.Cm frac
+gives one or more digits, interpreted as if
+in a floating-point representation of the seconds,
+so 
+.Dq \&.3
+represents three tenths of a second, and
+.Dq \&,17
+represents seventeen hundredths of a second, etc.
+Note that if the period or comma is given, there
+must be at least one following digit.
+If no fraction of a second is to be specified,
+also omit the period (or comma).
+If omitted, the fractional seconds are set to 0,
+so specifying
+.Dq \&.0
+or
+.Dq \&,0
+is identical to omitting the
+.Cm \&.frac
+field entirely,
+.It
+.Cm Z
+represents an optional literal
+.Sq Z
+character, indicating the the time given is to
+be considered as a Co-ordinated Universal Time (UTC) value.
+If omitted, the time is considered as being in the local
+timezone, as specified by the
+.Ev TZ
+environment variable.
+.El
+.Pp
+Note that parsing of this string is quite strict.
+If success

CVS commit: src/usr.bin/touch

2024-02-09 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Feb  9 23:41:48 UTC 2024

Modified Files:
src/usr.bin/touch: touch.1 touch.c

Log Message:
Add a -R option, which is identical to -r, except that if the reference file
is a symbolic link, the times to use are taken from those of the symbolic
link itself, instead of from the file it references.  If the reference file
is not a symbolic link, -R and -r are identical.

This allows the BUGS entry in the manual page to be removed.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/touch/touch.1
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/touch/touch.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/touch

2024-02-09 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Feb  9 23:41:48 UTC 2024

Modified Files:
src/usr.bin/touch: touch.1 touch.c

Log Message:
Add a -R option, which is identical to -r, except that if the reference file
is a symbolic link, the times to use are taken from those of the symbolic
link itself, instead of from the file it references.  If the reference file
is not a symbolic link, -R and -r are identical.

This allows the BUGS entry in the manual page to be removed.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/touch/touch.1
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/touch/touch.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/touch/touch.1
diff -u src/usr.bin/touch/touch.1:1.27 src/usr.bin/touch/touch.1:1.28
--- src/usr.bin/touch/touch.1:1.27	Thu Feb  8 02:54:13 2024
+++ src/usr.bin/touch/touch.1	Fri Feb  9 23:41:48 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: touch.1,v 1.27 2024/02/08 02:54:13 kre Exp $
+.\"	$NetBSD: touch.1,v 1.28 2024/02/09 23:41:48 kre Exp $
 .\"
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\" @(#)touch.1	8.3 (Berkeley) 4/28/95
 .\"
-.Dd February 7, 2024
+.Dd February 9, 2024
 .Dt TOUCH 1
 .Os
 .Sh NAME
@@ -43,6 +43,7 @@
 .Op Fl acfhm
 .Op Fl d Ar posix-datetime|human-datetime
 .Op Fl Fl \|date Ar posix-datetime|human-datetime
+.Op Fl R Ar ref-file
 .Op Fl r Ar ref-file
 .Op Fl Fl \|reference Ar ref-file
 .Op Fl t Ar datetime
@@ -193,6 +194,7 @@ is not changed unless the
 .Fl a
 flag is also specified.
 .Pp
+.It Fl R Ar ref-file
 .It Fl r Ar ref-file
 .It Fl Fl \|reference Ar ref-file
 Use the access and modification times,
@@ -203,7 +205,15 @@ instead of the current time of day.
 If the
 .Ar ref-file
 is a symbolic link,
+then if the
+.Fl R
+form of this option was used,
+the times are taken from the symbolic link itself,
+otherwise
 the times are taken from the file referenced by it.
+If
+.Ar ref-file
+is not a symbolic link, all three forms are identical.
 .Pp
 .It Fl t Ar datetime
 Change the access and modification times of the
@@ -292,6 +302,7 @@ all conversions use decimal numbers.
 .Pp
 The
 .Fl d ,
+.Fl R ,
 .Fl r ,
 and
 .Fl t
@@ -301,10 +312,12 @@ each will be evaluated, and may cause an
 then the result from the last one specified is used.
 .Pp
 The options which specify any part of the time
-.Pq Fl d , Fl r , Fl t
+.Pq Fl d , Fl R, Fl r , Fl t
 apply to both the access and modification times
 (with
 .Fl r
+and
+.Fl R
 obtaining those values independently from the
 .Ar ref-file ) ,
 though which is actually applied depends upon
@@ -421,5 +434,3 @@ A
 .Nm
 utility appeared in
 .At v7 .
-.Sh BUGS
-A symbolic link can't be a reference file of access and/or modification time.

Index: src/usr.bin/touch/touch.c
diff -u src/usr.bin/touch/touch.c:1.38 src/usr.bin/touch/touch.c:1.39
--- src/usr.bin/touch/touch.c:1.38	Thu Feb  8 02:54:07 2024
+++ src/usr.bin/touch/touch.c	Fri Feb  9 23:41:48 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: touch.c,v 1.38 2024/02/08 02:54:07 kre Exp $	*/
+/*	$NetBSD: touch.c,v 1.39 2024/02/09 23:41:48 kre Exp $	*/
 
 /*
  * Copyright (c) 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1993\
 #if 0
 static char sccsid[] = "@(#)touch.c	8.2 (Berkeley) 4/28/95";
 #endif
-__RCSID("$NetBSD: touch.c,v 1.38 2024/02/08 02:54:07 kre Exp $");
+__RCSID("$NetBSD: touch.c,v 1.39 2024/02/09 23:41:48 kre Exp $");
 #endif /* not lint */
 
 #include 
@@ -65,7 +65,8 @@ __RCSID("$NetBSD: touch.c,v 1.38 2024/02
 static void	stime_arg0(const char *, struct timespec *);
 static void	stime_arg1(char *, struct timespec *);
 static void	stime_arg2(const char *, int, struct timespec *);
-static void	stime_file(const char *, struct timespec *);
+static void	stime_file(const char *, struct timespec *,
+		   int (const char *, struct stat *));
 static int	stime_posix(const char *, struct timespec *);
 static int	difftm(const struct tm *, const struct tm *);
 __dead static void	usage(void);
@@ -101,7 +102,7 @@ main(int argc, char *argv[])
 	if (clock_gettime(CLOCK_REALTIME, &ts[0]))
 		err(1, "clock_gettime");
 
-	while ((ch = getopt_long(argc, argv, "acd:fhmr:t:", touch_longopts,
+	while ((ch = getopt_long(argc, argv, "acd:fhmR:r:t:", touch_longopts,
 	NULL)) != -1)
 		switch (ch) {
 		case 'a':
@@ -123,9 +124,13 @@ main(int argc, char *argv[])
 		case 'm':
 			mflag = 1;
 			break;
+		case 'R':
+			timeset = 1;
+			stime_file(optarg, ts, lstat);
+			break;
 		case 'r':
 			timeset = 1;
-			stime_file(optarg, ts);
+			stime_file(optarg, ts, stat);
 			break;
 		case 't':
 			timeset = 1;
@@ -335,11 +340,12 @@ stime_arg2(const char *arg, int year, st
 }
 
 static void
-stime_file(const char *fname, struct timespec *tsp)
+stime_file(const char *fname, struct timespec *tsp,
+int statfunc(const char *, struct stat *))
 {
 	struct stat sb;
 
-	if (stat(fname,

CVS commit: src/usr.bin/touch

2024-02-09 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Feb 10 00:19:30 UTC 2024

Modified Files:
src/usr.bin/touch: touch.1 touch.c

Log Message:
Add a -D option to touch, which acts like the -d option added to
chmod/chown/chgrp (probably others) in the not too far distant past,
and causes the operation to be a no-op if no actual change would be
made (avoiding updating the file's ctime for no reason).

That is, with touch, -D causes no modifying sys call to be made to
a file if that file's atime and mtime are already set to the values
that would be used.   A common case for this is when a "-r ref-file"
is also a target file for the operation.

Unfortunately -d was already taken in touch, so next best available is -D.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/touch/touch.1
cvs rdiff -u -r1.39 -r1.40 src/usr.bin/touch/touch.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/touch

2024-02-09 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Feb 10 00:19:30 UTC 2024

Modified Files:
src/usr.bin/touch: touch.1 touch.c

Log Message:
Add a -D option to touch, which acts like the -d option added to
chmod/chown/chgrp (probably others) in the not too far distant past,
and causes the operation to be a no-op if no actual change would be
made (avoiding updating the file's ctime for no reason).

That is, with touch, -D causes no modifying sys call to be made to
a file if that file's atime and mtime are already set to the values
that would be used.   A common case for this is when a "-r ref-file"
is also a target file for the operation.

Unfortunately -d was already taken in touch, so next best available is -D.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/touch/touch.1
cvs rdiff -u -r1.39 -r1.40 src/usr.bin/touch/touch.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/touch/touch.1
diff -u src/usr.bin/touch/touch.1:1.28 src/usr.bin/touch/touch.1:1.29
--- src/usr.bin/touch/touch.1:1.28	Fri Feb  9 23:41:48 2024
+++ src/usr.bin/touch/touch.1	Sat Feb 10 00:19:30 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: touch.1,v 1.28 2024/02/09 23:41:48 kre Exp $
+.\"	$NetBSD: touch.1,v 1.29 2024/02/10 00:19:30 kre Exp $
 .\"
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\" @(#)touch.1	8.3 (Berkeley) 4/28/95
 .\"
-.Dd February 9, 2024
+.Dd February 10, 2024
 .Dt TOUCH 1
 .Os
 .Sh NAME
@@ -40,7 +40,7 @@
 .Nd change file access and modification times
 .Sh SYNOPSIS
 .Nm
-.Op Fl acfhm
+.Op Fl acDfhm
 .Op Fl d Ar posix-datetime|human-datetime
 .Op Fl Fl \|date Ar posix-datetime|human-datetime
 .Op Fl R Ar ref-file
@@ -77,6 +77,11 @@ The
 .Nm
 utility does not treat this as an error.
 No error messages are displayed and the exit value is not affected.
+.Pp 
+.It Fl D
+Do not attempt to adjust a
+.Ar file Ns 's
+times if they are already set to the values specified.
 .Pp
 .It Fl d Ar posix-datetime
 .It Fl d Ar human-datetime
@@ -360,6 +365,56 @@ of the
 .Ar path
 file to the current time of day.
 .Pp
+.Dl touch -Dh -d human-datetime -t CCYYMMDDhhmm.ss -R file file
+.Pp
+Provided
+.Ar file
+exists, this parses the
+.Ar human-datetime
+and 
+.Ar CCYYMMDDhhmm.ss
+arguments,
+verifying that they would be suitable for use with
+.Nm ,
+then does nothing, as the final time specification
+.Pq Fl R 
+specifies to take the times from
+.Ar file
+and apply them to
+.Ar file
+itself, changing nothing, which the
+.Fl D
+option then prevents from actually occurring.
+That is, this merely tests that the
+.Ar human-datetime
+and
+.Ar datetime
+argumments to
+.Fl d
+and
+.Fl t
+respectively are valid, and could be used to specify a time.
+Use of both
+.Fl h
+and
+.Fl R
+means this works if
+.Ar file
+is a symbolic link,
+even one which does not reference an existing file,
+as well as if it is some other file type.
+Use of
+.Fl R
+requires that
+.Ar file
+exists,
+though if it does not, and an error is generated for that reason,
+the
+.Fl d
+and
+.Fl t
+arguments would have already been successfully processed.
+.Pp
 .Dl touch -m -d '-1 day' somefile
 .Pp
 Set the modify time for

Index: src/usr.bin/touch/touch.c
diff -u src/usr.bin/touch/touch.c:1.39 src/usr.bin/touch/touch.c:1.40
--- src/usr.bin/touch/touch.c:1.39	Fri Feb  9 23:41:48 2024
+++ src/usr.bin/touch/touch.c	Sat Feb 10 00:19:30 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: touch.c,v 1.39 2024/02/09 23:41:48 kre Exp $	*/
+/*	$NetBSD: touch.c,v 1.40 2024/02/10 00:19:30 kre Exp $	*/
 
 /*
  * Copyright (c) 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1993\
 #if 0
 static char sccsid[] = "@(#)touch.c	8.2 (Berkeley) 4/28/95";
 #endif
-__RCSID("$NetBSD: touch.c,v 1.39 2024/02/09 23:41:48 kre Exp $");
+__RCSID("$NetBSD: touch.c,v 1.40 2024/02/10 00:19:30 kre Exp $");
 #endif /* not lint */
 
 #include 
@@ -91,18 +91,18 @@ main(int argc, char *argv[])
 {
 	struct stat sb;
 	struct timespec ts[2];
-	int aflag, cflag, hflag, mflag, ch, fd, len, rval, timeset;
+	int aflag, cflag, Dflag, hflag, mflag, ch, fd, len, rval, timeset;
 	char *p;
 	int (*change_file_times)(const char *, const struct timespec *);
 	int (*get_file_status)(const char *, struct stat *);
 
 	setlocale(LC_ALL, "");
 
-	aflag = cflag = hflag = mflag = timeset = 0;
+	aflag = cflag = Dflag = hflag = mflag = timeset = 0;
 	if (clock_gettime(CLOCK_REALTIME, &ts[0]))
 		err(1, "clock_gettime");
 
-	while ((ch = getopt_long(argc, argv, "acd:fhmR:r:t:", touch_longopts,
+	while ((ch = getopt_long(argc, argv, "acDd:fhmR:r:t:", touch_longopts,
 	NULL)) != -1)
 		switch (ch) {
 		case 'a':
@@ -111,6 +111,9 @@ main(int argc, char *argv[])
 		case 'c':
 			cflag = 1;
 			break;
+		case 'D':
+			Dflag = 1;
+			break;
 		case 'd':
 			timeset = 1;
 			if (!stime_posix(optarg, ts))
@@ -200,6 +203,11 @@ main(int argc, cha

CVS commit: src/usr.bin/kdump

2024-02-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Feb 11 01:08:57 UTC 2024

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

Log Message:
PR bin/57918

Redo the previous correctly, the test should be whether or not only the
bottom 32 bits are set, rather than whether any of bits 32..63 are set.
This makes no difference if u_long (or unsigned long long) is 64 bits,
it is the same test in that case, but if u_long were 128 bits there is
a notable difference (though for the particular issue observed in the PR,
it is likely to work either way).


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/usr.bin/kdump/kdump.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/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.141 src/usr.bin/kdump/kdump.c:1.142
--- src/usr.bin/kdump/kdump.c:1.141	Sat Feb 10 12:53:36 2024
+++ src/usr.bin/kdump/kdump.c	Sun Feb 11 01:08:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.141 2024/02/10 12:53:36 christos Exp $	*/
+/*	$NetBSD: kdump.c,v 1.142 2024/02/11 01:08:57 kre Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.141 2024/02/10 12:53:36 christos Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.142 2024/02/11 01:08:57 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -580,7 +580,7 @@ ioctldecode(u_long cmd)
 	char dirbuf[4], *dir = dirbuf;
 	int c;
 
-	if (0xULL & cmd) {
+	if (~0xULL & cmd) {
 		output_long(cmd, 1);
 		return;
 	}



CVS commit: src/usr.bin/kdump

2024-02-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Feb 11 01:08:57 UTC 2024

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

Log Message:
PR bin/57918

Redo the previous correctly, the test should be whether or not only the
bottom 32 bits are set, rather than whether any of bits 32..63 are set.
This makes no difference if u_long (or unsigned long long) is 64 bits,
it is the same test in that case, but if u_long were 128 bits there is
a notable difference (though for the particular issue observed in the PR,
it is likely to work either way).


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/usr.bin/kdump/kdump.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   >