Re: CVS commit: src/bin/echo

2024-05-14 Thread Robert Elz
Date:Wed, 15 May 2024 02:33:23 +0300
From:Valery Ushakov 
Message-ID:  

  | I vaguely remember I read somewhere that printf(1) was specifically
  | conceived to take no options, but that can be planted memories.  May
  | be it's indeed induced by the old state of affairs in our version.

POSIX printf(1) has no options (it says in its page "OPTIONS: None")
and our printf has no options, but implementations are allowed to
extend the standard, and add some, POSIX says (XCU 1.4) that when it
says "OPTIONS: None" what it means is:

  Default Behavior: When this section is listed as ``None.'', it means that
  the implementation need not support any options. Standard utilities that
  do not accept options, but that do accept operands, shall recognize "--"
  as a first argument to be discarded.

That is more or less what we do, but for backwards compat reasons, not
always.

  The requirement for recognizing "--" is because conforming applications
  need a way to shield their operands from any arbitrary options that the
  implementation may provide as an extension. For example, if the standard
  utility foo is listed as taking no options, and the application needed
  to give it a pathname with a leading , it could safely do
  it as:

foo -- -myfile

  and avoid any problems with -m used as an extension.

Other versions of printf(1) do have options, or at least, an option.
bash, ksh93 & zsh all have a "-v var" option to cause the output from
(the builtin) printf to be stored in var, rather than written to stdout.

It might be time to adjust our ptintf to be fully POSIX, and always handle
the "--" end of options option (it doesn't seem useful as a printf format,
and if needed, can always be written as printf -- --) rather than only
doing it sometimes.   Currently our printf used as "printf --" writes "--"
to stdout.   It really shouldn't.   When there is just 1 arg, and it
contains no %, it is also treated as a format, even if it starts with a '-'.

So, as you demonstrated, in our printf, printf -V prints "-V", but
if you try 'printf -V A B C' what you get is:

  sh: unknown option -- V
  Usage: printf format [arg ...]

(It would do the same if given a script with one of the -v var options
used in it).

The comments at the start of main() in our printf(1) source are nonsense
(though for backwards compat, we should just check for "--" rather than
using getopt() to do that for us, as we currently do, when we do it.)

kre

ps: I do appreciate that some of the mess that is there now is my doing,
but back when I did that I didn't understand POSIX as well as I do now.




Re: CVS commit: src/bin/echo

2024-05-14 Thread Robert Elz
Date:Tue, 14 May 2024 12:41:51 +0300
From:Valery Ushakov 
Message-ID:  

  | Unfortunately that advice is not true without further caveats.

That you have to actually write a valid printf(1) command, and not
simply s/echo/printf/ ?   Does that really need saying?


  | netbsd$ sh -c "printf '-V\n'"

printf -- -V\\n 

and it will work anywhere - our printf is specially hacked as once
upon a time it took no options, and this kind of thing would work.
Format strings starting with a '-' don't work in general however,
the '--' should be included if the format might begin with a '-'.

Even better would be

printf -- %s\\n -V

(where the -- is optional here).

kre

aside: I'd use '-V\n' inside "" as well.   But as a sh -c command
string I'd use:

sh -c 'printf -- -V\\n'




Re: CVS commit: src/distrib/common

2024-05-09 Thread Robert Elz
Date:Thu, 9 May 2024 17:44:16 -0400
From:Christos Zoulas 
Message-ID:  <9c618434-9d7b-4f1c-97ed-3260b7f36...@zoulas.com>

  | I am not sure either but the resulting cd does not boot anymore.

Which version?   It has been a long time since I needed to boot
from an optical drive, but I could try it.

Its a little hard to believe that the uid/gid settings could make
any difference, though the m9de settings might.

kre


Re: CVS commit: src/distrib/common

2024-05-09 Thread Robert Elz
Date:Thu, 9 May 2024 12:09:03 -0400
From:"Christos Zoulas" 
Message-ID:  <20240509160903.6e41bf...@cvs.netbsd.org>

  | Instead of augmenting the platform spec with an autogenerated one,
  | we should understand why we have missing entries in the first place.

Is it really important?   Everything was fine without it previously,
except that reproducible builds, weren't (as local info was being
used in the CD images).

As long as the "augmenting" is just providing info for files that
weren't otherwise specified (an issue I admit to not checking in the
change I made) - that is, as long as makefs takes the first entry in
the spec file it is given, should there be more than one for a file
(if it prefers to use the last, then that would just change the order
in which the augmentation file is included, no need to change makefs)
then I'm not really sure what the problem is.

That is, I don't see we need to add yet another manual maintenance step
that we need to make in order to add or remove a file from a CD image
(or whatever the image is destined for) when the information being added
isn't really important - but just needs to be consistent.

kre



CVS commit: src/distrib/common

2024-05-08 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu May  9 03:41:05 UTC 2024

Modified Files:
src/distrib/common: Makefile.bootcd

Log Message:
No point testing if the spec file is empty before running makespec,
the previous commands guarantee that cannot be the case, so makespec
was never being run.   Just run it unconditionally.

Seems to fix the build for me.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/distrib/common/Makefile.bootcd

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



CVS commit: src/distrib/common

2024-05-08 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu May  9 03:41:05 UTC 2024

Modified Files:
src/distrib/common: Makefile.bootcd

Log Message:
No point testing if the spec file is empty before running makespec,
the previous commands guarantee that cannot be the case, so makespec
was never being run.   Just run it unconditionally.

Seems to fix the build for me.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/distrib/common/Makefile.bootcd

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

Modified files:

Index: src/distrib/common/Makefile.bootcd
diff -u src/distrib/common/Makefile.bootcd:1.50 src/distrib/common/Makefile.bootcd:1.51
--- src/distrib/common/Makefile.bootcd:1.50	Wed May  8 16:08:08 2024
+++ src/distrib/common/Makefile.bootcd	Thu May  9 03:41:05 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.bootcd,v 1.50 2024/05/08 16:08:08 christos Exp $
+#	$NetBSD: Makefile.bootcd,v 1.51 2024/05/09 03:41:05 kre Exp $
 #
 # Makefile snipped to create a CD/DVD ISO
 #
@@ -322,7 +322,7 @@ image:
 .if defined(SPEC_EXTRA)
 	cat ${SPEC_EXTRA} >> ${WORKSPEC}
 .endif
-	if [ ! -s ${WORKSPEC} ]; then ${MAKESPEC} cdrom > ${WORKSPEC}; fi
+	${MAKESPEC} cdrom >> ${WORKSPEC}
 	${TOOL_MAKEFS} -N ${NETBSDSRCDIR}/etc -t cd9660 -F ${WORKSPEC} -xx \
 	${MAKEFS_TIMESTAMP} ${CDMAKEFSEXTRAOPTS} -o ${_CDMAKEFSOPTIONS:Q} \
 	${CDIMAGE} cdrom



Re: CVS commit: src/tests/lib/libm

2024-05-01 Thread Robert Elz
And yes, I know, it should have been 2^50 not 10^50...

kre


CVS commit: src/tests/lib/libm

2024-05-01 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu May  2 03:30:07 UTC 2024

Modified Files:
src/tests/lib/libm: t_fe_round.c

Log Message:
Use intmax_t instead of long int when trying to represent very large
integers (10^50 or so), so we don't exceed the capacity of systems where
long int is only 32 bits.

Hopefully will unbreak the i386 build, perhaps others.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/lib/libm/t_fe_round.c

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

Modified files:

Index: src/tests/lib/libm/t_fe_round.c
diff -u src/tests/lib/libm/t_fe_round.c:1.11 src/tests/lib/libm/t_fe_round.c:1.12
--- src/tests/lib/libm/t_fe_round.c:1.11	Thu May  2 00:01:48 2024
+++ src/tests/lib/libm/t_fe_round.c	Thu May  2 03:30:07 2024
@@ -9,6 +9,7 @@
 #include 
 #ifdef __HAVE_FENV
 #include 
+#include 
 #include 
 #include 
 
@@ -145,24 +146,28 @@ ATF_TC_BODY(fe_nearbyint, tc)
 
 #ifdef __HAVE_LONG_DOUBLE
 
+#define IM intmax_t
+
 /*
  * Use one bit more than fits in IEEE 754 binary64.
  */
 static const struct {
 	int round_mode;
 	long double input;
-	long int expected;
+	IM expected;
 } valuesl[] = {
-	{ FE_TOWARDZERO,	0x2.08p+52L, 0x20 },
-	{ FE_DOWNWARD,		0x2.08p+52L, 0x20 },
-	{ FE_UPWARD,		0x2.08p+52L, 0x21 },
-	{ FE_TONEAREST,		0x2.08p+52L, 0x20 },
-	{ FE_TOWARDZERO,	0x2.18p+52L, 0x21 },
-	{ FE_DOWNWARD,		0x2.18p+52L, 0x21 },
-	{ FE_UPWARD,		0x2.18p+52L, 0x22 },
-	{ FE_TONEAREST,		0x2.18p+52L, 0x22 },
+	{ FE_TOWARDZERO,	0x2.08p+52L, (IM)0x20 },
+	{ FE_DOWNWARD,		0x2.08p+52L, (IM)0x20 },
+	{ FE_UPWARD,		0x2.08p+52L, (IM)0x21 },
+	{ FE_TONEAREST,		0x2.08p+52L, (IM)0x20 },
+	{ FE_TOWARDZERO,	0x2.18p+52L, (IM)0x21 },
+	{ FE_DOWNWARD,		0x2.18p+52L, (IM)0x21 },
+	{ FE_UPWARD,		0x2.18p+52L, (IM)0x22 },
+	{ FE_TONEAREST,		0x2.18p+52L, (IM)0x22 },
 };
 
+#undef IM
+
 ATF_TC(fe_nearbyintl);
 ATF_TC_HEAD(fe_nearbyintl, tc)
 {
@@ -183,7 +188,7 @@ ATF_TC_BODY(fe_nearbyintl, tc)
 		"%s nearbyintl(%Lf) has fractional part %Lf",
 		rmname(values[i].round_mode), valuesl[i].input, fpart);
 		ATF_CHECK_MSG((long int)received == valuesl[i].expected,
-		"%s [%u] nearbyint(%Lf): got %Lf, expected %ld",
+		"%s [%u] nearbyint(%Lf): got %Lf, expected %jd",
 		rmname(values[i].round_mode), i,
 		valuesl[i].input, received, valuesl[i].expected);
 



CVS commit: src/tests/lib/libm

2024-05-01 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu May  2 03:30:07 UTC 2024

Modified Files:
src/tests/lib/libm: t_fe_round.c

Log Message:
Use intmax_t instead of long int when trying to represent very large
integers (10^50 or so), so we don't exceed the capacity of systems where
long int is only 32 bits.

Hopefully will unbreak the i386 build, perhaps others.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/lib/libm/t_fe_round.c

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



Re: CVS commit: src/lib/libutil

2024-05-01 Thread Robert Elz
Date:Wed, 1 May 2024 22:27:02 +0200
From:Roland Illig 
Message-ID:  <754bd755-be0a-4eff-aa7b-d53fce9b4...@gmx.de>

  | > Log Message:
  | > next should increement by 1 not 2.
  |
  | Are you sure?

I agree, that change should be reverted.

"next" is even documented to be two ...

 6  Despite what is stated above, ?next? is actually 2.  The input ?next
January?, instead of producing a timestamp for January of the
following year, produces one for January 2nd, of the current year.
Use caution with ?next? it rarely does what humans expect.  For
example, on a Sunday ?next sunday? means the following Sunday (7 days
hence) whereas ?next monday? means the monday that follows that (8
days hence) rather than ?tomorrow? or just ?Mon? (without the ?next?)
which is the nearest subsequent Monday.

and is actually more useful that way.   It is peculiar, but that's how it
has worked ~forever.

There are limits to how sane a half hearted (but still useful) attempt
to understand English idiom can possibly work, we really don't want to
attempt to turn parsedate into an AI machine.

kre




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

2024-04-19 Thread Robert Elz
Date:Fri, 19 Apr 2024 14:58:18 +
From:"Jonathan A. Kollasch" 
Message-ID:  <20240419145818.351d2f...@cvs.netbsd.org>

  |  - bail out if resulting __DATE__/__TIME__ replacement strings are empty

If you want to do that (not that it would be useful, even if the %b
(etc) conversions produced nothing, there would still be two spaces
in the output.   It is almost impossible to get date to exit with an
error code (and nothing on stdout) in cases like this.

But if this is worth keeping, then

if ${MKREPRO_TIME} == "" || ${MKREPRO_TIME} == ""

probably is not what you wanted.

kre



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

2024-04-19 Thread Robert Elz
Date:Fri, 19 Apr 2024 14:57:46 +0200
From:Martin Husemann 
Message-ID:  <20240419125746.gb26...@mail.duskware.de>

  | On Fri, Apr 19, 2024 at 02:47:23PM +0200, Martin Husemann wrote:
  | > The commit message could have explained that a bit.
  |
  | And it actually should have been "+%b %e %Y" - from the C18 standard draft:
  |
  | 6.10.8.1 Mandatory macros
  |
  | __DATE__ 
  |
  | The date of translation of the preprocessing translation unit: a
  | character string literal of the form "Mmm dd ", where the names of
  | the months are the same as those generated by the asctime function,

If that's still in the most recent C (in that form anyway) I'd be surprised,
as asctime() is more or less deprecated I think.

But if that is what is required, then the TOOL_DATE needs to be run with
LC_ALL=C (or LC_ALL=POSIX) so that you get the month name in English, rather
than whatever the local locale's short name for the month would be.

It is still a stupid format...

kre



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

2024-04-19 Thread Robert Elz
Date:Thu, 18 Apr 2024 19:23:54 +
From:"Jonathan A. Kollasch" 
Message-ID:  <20240418192354.1bcc1f...@cvs.netbsd.org>

  | Module Name:src
  | Committed By:   jakllsch
  | Date:   Thu Apr 18 19:23:54 UTC 2024
  |
  | Modified Files:
  | src/external/bsd/ntp/lib/libntp: Makefile
  |
  | Log Message:
  | Format MKREPRO_TIMESTAMP with "%b %d %Y" to correctly substitute __DATE__

I don't understand that change, it altered from

MKREPRO_DATE != ${TOOL_DATE} -u -r "${MKREPRO_TIMESTAMP}" "+%F"
to
MKREPRO_DATE != ${TOOL_DATE} -u -r "${MKREPRO_TIMESTAMP}" "+%b %d %Y"

%F is simply a shorthand for %Y-%m-%d (which is the correct way to write
locale independent dates), %b is a locale dependent name of the month, and
what's more this is in US-centric mon day year format, which we should avoid
(aside from anything else, it is a dumb format, with the smallest value unit
sitting in the middle, rather than at one end or the other).

If there is a problem where support for %F is missing somewhere, (and if
that happens in TOOL_DATE it must mean that we're using a locale strftime()
when building it, in which case we should add our version to the library)
please replace it with %Y-%m-%d (which is what it is defined to be) instead
of anything using %b (or %a or %B or %A) (or any other weird formats).

Further, if some format like that was needed for some reason, then it
probably should use %e rather than %d (to suppress the leading 0 on dates
before the 10th).   But don't just do that either.

If there isn't an actual problem using %F, please just revert this.

And lastly, and this applies to everyone - please do not request
pullups of anything (except perhaps urgent security fixes) immediately
after the change is committed - give it at least a few days, in case of
objection, breakage, ...

kre




CVS commit: src/external/mpl/bind/lib/plugins

2024-04-14 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Apr 14 08:29:54 UTC 2024

Modified Files:
src/external/mpl/bind/lib/plugins: Makefile

Log Message:
Revert previous until Christos has a chance to work out why it breaks
the builds.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/mpl/bind/lib/plugins/Makefile

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

Modified files:

Index: src/external/mpl/bind/lib/plugins/Makefile
diff -u src/external/mpl/bind/lib/plugins/Makefile:1.6 src/external/mpl/bind/lib/plugins/Makefile:1.7
--- src/external/mpl/bind/lib/plugins/Makefile:1.6	Sat Apr 13 17:22:33 2024
+++ src/external/mpl/bind/lib/plugins/Makefile	Sun Apr 14 08:29:54 2024
@@ -1,12 +1,10 @@
-#	$NetBSD: Makefile,v 1.6 2024/04/13 17:22:33 christos Exp $
+#	$NetBSD: Makefile,v 1.7 2024/04/14 08:29:54 kre Exp $
 
 LIBISMODULE=	yes
 MAKELINKLIB=	no
-.include 
-
-.if !defined(MLIBDIR)
 LIB=	filter-
 
+.include 
 
 SHLIB_MAJOR=0
 SRCS=	filter-.c
@@ -15,6 +13,5 @@ LIBDIR=	/usr/lib/named
 DIST=${IDIST}/bin/plugins
 
 .PATH: ${DIST}
-.endif
 
 .include 



CVS commit: src/external/mpl/bind/lib/plugins

2024-04-14 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Apr 14 08:29:54 UTC 2024

Modified Files:
src/external/mpl/bind/lib/plugins: Makefile

Log Message:
Revert previous until Christos has a chance to work out why it breaks
the builds.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/mpl/bind/lib/plugins/Makefile

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-04-12 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Apr 12 19:09:50 UTC 2024

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

Log Message:
Edgar Fuß pointed out that sh(1) did not mention comments (at all).
This has been true forever, and no-one else (including me) ever seems
to have noticed this ommission.

Correct that.

While in the area, improve the general sections on the Lexical structure
of the shell's input, and including some refinements to how quoting is
described.


To generate a diff of this commit:
cvs rdiff -u -r1.259 -r1.260 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.259 src/bin/sh/sh.1:1.260
--- src/bin/sh/sh.1:1.259	Tue Jan 16 14:30:22 2024
+++ src/bin/sh/sh.1	Fri Apr 12 19:09:50 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.259 2024/01/16 14:30:22 kre Exp $
+.\"	$NetBSD: sh.1,v 1.260 2024/04/12 19:09:50 kre Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -31,7 +31,7 @@
 .\"
 .\"	@(#)sh.1	8.6 (Berkeley) 5/4/95
 .\"
-.Dd December 9, 2022
+.Dd April 12, 2024
 .Dt SH 1
 .\" everything except c o and s (keep them ordered)
 .ds flags abCEeFfhIiLlmnpquVvXx
@@ -650,10 +650,14 @@ or
 must be enabled for this to work.
 .El
 .Ss Lexical Structure
-The shell reads input in terms of lines from a file and breaks it up into
-words at whitespace (blanks and tabs), and at certain sequences of
-characters that are special to the shell called
+The shell reads input in terms of lines from a file
+(or its standard input, or an argument string),
+removes comments,
+and then breaks it up into words at whitespace (blanks and tabs), and at
+certain sequences of characters that are special to the shell called
 .Dq operators .
+Unquoted whitespace is removed as part of this, after serving to
+separate words or operators.
 There are two types of operators: control operators and redirection
 operators (their meaning is discussed later).
 The following is a list of operators:
@@ -663,9 +667,76 @@ The following is a list of operators:
 .It "Redirection operators:"
 .Dl <  >  >|  <<  >>  <&  >&  <<-  <>
 .El
+.Pp
+The shell will detect an operator, which must be entirely unquoted,
+at any point in the input line (other than in comments, which have
+already been removed),
+and sometimes other than immediately after an unquoted dollar
+.Pq Sq \&$
+character, see
+.Sx Word Expansions
+below for defined sequences starting with
+.Pq Sq \&$
+which always form (part of) a word, even if some of the
+following characters would otherwise appear to be operators.
+.Pp
+For future proofing, it is advisable to precede and
+follow all operators with either line endings or whitespace.
+When recognizing an operator the longest sequence of characters
+present which form a valid operator are detected as that operator
+rather than shorter alternative sequences, so, for example,
+the sequence
+.Dl >&
+is always recognized as the two character redirection operator
+.Dq Li \&>&
+rather than the
+.Dq Li \&>
+redirection operator followed by control operator
+.Dq Li \&& .
+So while currently the sequence
+.Dl ;)
+is recognized as the two control operators
+.Dq Li \&;
+followed by
+.Dq Li \&) ,
+a future extension could create a new operator
+.Dq Li \&;)
+in which case that would be detected instead.
+Writing the sequence as
+.Dl ;\ )
+(note the space between the semicolon and parenthesis)
+guarantees that it will be recognized as two operators.
+Note that this does happen, the
+.Dq Li ;&
+control operator shown above is relatively new (by shell standards)
+and would once have been parsed as two operators.
+.Pp
+Also note that any of the redirection operators listed above may be
+immediately preceded by a digit sequence, with no intervening
+whitespace.
+Those digits form part of the redirection operator.
+See
+.Sx Redirections
+below for more details.
+.Ss Comments
+A shell comment begins with a
+.Sq Li 

CVS commit: src/bin/sh

2024-04-12 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Apr 12 19:09:50 UTC 2024

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

Log Message:
Edgar Fuß pointed out that sh(1) did not mention comments (at all).
This has been true forever, and no-one else (including me) ever seems
to have noticed this ommission.

Correct that.

While in the area, improve the general sections on the Lexical structure
of the shell's input, and including some refinements to how quoting is
described.


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

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



Re: CVS commit: src

2024-04-10 Thread Robert Elz
Date:Thu, 11 Apr 2024 02:15:39 +
From:"Taylor R Campbell" 
Message-ID:  <20240411021539.a3272f...@cvs.netbsd.org>

  | However, this means that update builds need manual intervention to
  | delete $DESTDIR/var/run/named or else checkflist will fail, so add a
  | note to UPDATING about this.

This is why I'd like to add a new keyword in the sets lists, like
"obsolete" is - probably "optional" to mark files that aren't installed
by the build, but might exist, and should simply be ignored if
found - it isn't an error for them to exist, but nor is it an error
for them to be absent.   Such files don't go in any of the constructed
sets files (whether they happen to exist or not).

Or since there is no particular set to list them in (as they belong
in none) perhaps an additional lists file to contain just these
optional files, (to keep the format, they'd still need some keyword,
so perhaps still "optional" - but excluding them from being added
to all sets .*z files would be automatic, as none would be built from
that one.

  | PR misc/57877

kre


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

2024-04-09 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Apr  9 21:02:17 UTC 2024

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

Log Message:
Revert previous, we have no /etc/skel/.editrc (currently anyway).
This change looks to have been accidentally included in the big
sets reduction/division.

This should fix the builds.


To generate a diff of this commit:
cvs rdiff -u -r1.274 -r1.275 src/distrib/sets/lists/etc/mi

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

Modified files:

Index: src/distrib/sets/lists/etc/mi
diff -u src/distrib/sets/lists/etc/mi:1.274 src/distrib/sets/lists/etc/mi:1.275
--- src/distrib/sets/lists/etc/mi:1.274	Tue Apr  9 15:17:24 2024
+++ src/distrib/sets/lists/etc/mi	Tue Apr  9 21:02:17 2024
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.274 2024/04/09 15:17:24 nia Exp $
+# $NetBSD: mi,v 1.275 2024/04/09 21:02:17 kre Exp $
 #
 # Note: end-user configuration files that are moved to another location
 #	should not be marked "obsolete"; they should just be removed from
@@ -356,7 +356,6 @@
 ./etc/shells	etc-sys-etc
 ./etc/shrc	etc-util-etc
 ./etc/skel/.cshrcetc-sys-etc
-./etc/skel/.editrcetc-sys-etc
 ./etc/skel/.loginetc-sys-etc
 ./etc/skel/.logoutetc-sys-etc
 ./etc/skel/.profileetc-sys-etc



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

2024-04-09 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Apr  9 21:02:17 UTC 2024

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

Log Message:
Revert previous, we have no /etc/skel/.editrc (currently anyway).
This change looks to have been accidentally included in the big
sets reduction/division.

This should fix the builds.


To generate a diff of this commit:
cvs rdiff -u -r1.274 -r1.275 src/distrib/sets/lists/etc/mi

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



CVS commit: src/sbin/ifconfig

2024-04-08 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Apr  8 09:25:25 UTC 2024

Modified Files:
src/sbin/ifconfig: ifconfig.8

Log Message:
Correct a very minor typo (s/id/is/)


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sbin/ifconfig/ifconfig.8

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

Modified files:

Index: src/sbin/ifconfig/ifconfig.8
diff -u src/sbin/ifconfig/ifconfig.8:1.126 src/sbin/ifconfig/ifconfig.8:1.127
--- src/sbin/ifconfig/ifconfig.8:1.126	Mon Apr  8 04:29:52 2024
+++ src/sbin/ifconfig/ifconfig.8	Mon Apr  8 09:25:25 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ifconfig.8,v 1.126 2024/04/08 04:29:52 yamaguchi Exp $
+.\"	$NetBSD: ifconfig.8,v 1.127 2024/04/08 09:25:25 kre Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -642,7 +642,7 @@ The available options are
 and
 .Li none .
 .It Cm laggportpri Ar interface Ar n
-If the interface id a
+If the interface is a
 .Xr lagg 4
 pseudo-interface, set the priority of
 .Ar interface



CVS commit: src/sbin/ifconfig

2024-04-08 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Apr  8 09:25:25 UTC 2024

Modified Files:
src/sbin/ifconfig: ifconfig.8

Log Message:
Correct a very minor typo (s/id/is/)


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sbin/ifconfig/ifconfig.8

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



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

2024-04-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Apr  7 21:33:12 UTC 2024

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

Log Message:
Revert last, unbreak build.   Unless the bind Makefiles start installing
a /var/run/named file (which in general would be wrong, as most sites run
named in a chroot these days) the file is obsolete, and should not, and
does not, get generated by the build, nor should it be included in any
sets.

Ideally we'd have an "optional" flag for the sets files, to allow them
to mention files that might exist, and don't matter (and are not included
in the sets), but that's a bigger change than is needed just to fix the
builds.


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

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

Modified files:

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1340 src/distrib/sets/lists/base/mi:1.1341
--- src/distrib/sets/lists/base/mi:1.1340	Sun Apr  7 15:02:08 2024
+++ src/distrib/sets/lists/base/mi	Sun Apr  7 21:33:12 2024
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1340 2024/04/07 15:02:08 christos Exp $
+# $NetBSD: mi,v 1.1341 2024/04/07 21:33:12 kre Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -6377,7 +6377,7 @@
 ./var/quotas	base-util-root
 ./var/run	base-sys-root
 ./var/run/lwresdbase-obsolete		obsolete
-./var/run/named	base-bind-root
+./var/run/named	base-obsolete		obsolete
 ./var/rwho	base-netutil-root
 ./var/shm	base-sys-root
 ./var/spool	base-sys-root



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

2024-04-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Apr  7 21:33:12 UTC 2024

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

Log Message:
Revert last, unbreak build.   Unless the bind Makefiles start installing
a /var/run/named file (which in general would be wrong, as most sites run
named in a chroot these days) the file is obsolete, and should not, and
does not, get generated by the build, nor should it be included in any
sets.

Ideally we'd have an "optional" flag for the sets files, to allow them
to mention files that might exist, and don't matter (and are not included
in the sets), but that's a bigger change than is needed just to fix the
builds.


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

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



CVS commit: src/bin/sh

2024-04-06 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Apr  6 14:20:27 UTC 2024

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

Log Message:
Redo the mktemp(1) part - some mktemp's (including ours) require the
's to be at the end of the name (like mk*temp(3)) so however well
it will work with mktemp implementations which allow the X's to be
anywhere in the final component of the name, it will work just as
well on them with the X's at the end.

But we don't normally need all of that mess - knowing which temp
file is which is useful only when debugging the script, and that's
(mostly) long done.   So, in normal uses now just use $(mktemp) and
allow mktemp to pick its own name - we don't need to know what it is.
Every mktemp(1) supports that mode of operation.

Bug when debugging the script (which for current purposes will be
taken to be when the -x flag is passed to the shell running it, to
trace what it does) then we will make the temp files have names we
can recognise (and in that case, also don't delete them when done).

While here, check for mktemp(1) failing, and abort if that
happens (we assume that if it fails it will write an error
message to stderr, so the script does not need to.)

As for the purpose of the script ... of course the header file
generated (or an equivalent elsewhere) could be generated and
maintained by hand, but why would anyone want to do all that
work when software can do it for us, and do it correctly without
human thought?

This also allows the options in the master list (option.list) to be
arranged in a way that is meaningful for them, unrelated to the order
the shell needs to have them in (or rearrange them to be at run time)
and have that order shuffled however is convenient.   Currently all
the posix standard options are first, then the "hybrid" options, and
finally the local ones for this shell.   Currently "pipefail" is in the
final set, but once the next posix version is published, that will
become a standard option, and get moved in the list - the shell won't
even notice as this script puts the options into shell desired order.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/bin/sh/mkoptions.sh

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/mkoptions.sh
diff -u src/bin/sh/mkoptions.sh:1.6 src/bin/sh/mkoptions.sh:1.7
--- src/bin/sh/mkoptions.sh:1.6	Fri Apr  5 22:22:17 2024
+++ src/bin/sh/mkoptions.sh	Sat Apr  6 14:20:27 2024
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: mkoptions.sh,v 1.6 2024/04/05 22:22:17 christos Exp $
+# $NetBSD: mkoptions.sh,v 1.7 2024/04/06 14:20:27 kre Exp $
 
 #
 # It would be more sensible to generate 2 .h files, one which
@@ -18,9 +18,20 @@ export LC_ALL=C	# for sort consistency
 IF="$1"
 OF="${3+$3/}$2"
 
-E_FILE=$(${MKTEMP:-mktemp} -t MKO.E.$$)
-O_FILE=$(${MKTEMP:-mktemp} -t MKO.O.$$)
-trap 'rm -f "${E_FILE}" "${O_FILE}"' EXIT
+case $- in
+*x*)
+	E_FILE=$(${MKTEMP:-mktemp} "${TMPDIR:-/tmp}/MKO.E.$$.XX") || exit 1
+	O_FILE=$(${MKTEMP:-mktemp} "${TMPDIR:-/tmp}/MKO.O.$$.XX") || {
+		rm -f "${E_FILE}"
+		exit 1
+	}
+	;;
+*)
+	E_FILE=$(${MKTEMP:-mktemp}) || exit 1
+	O_FILE=$(${MKTEMP:-mktemp}) || { rm -f "${E_FILE}"; exit 1; }
+	trap 'rm -f "${E_FILE}" "${O_FILE}"' EXIT
+	;;
+esac
 
 exec 5> "${E_FILE}"
 exec 6> "${O_FILE}"
@@ -41,8 +52,8 @@ ${SED:-sed} <"${IF}"			\
 	-e '/^#/d'			\
 	-e '/^[ 	]*\//d'		\
 	-e '/^[ 	]*\*/d'		\
-	-e '/^[ 	]*;/d'		|
-sort -b -k2,2f -k2,2			|
+	-e '/^[ 	]*;/d'			|
+sort -b -k2,2f -k2,2|
 while read line
 do
 	# Look for comments in various styles, and ignore them



CVS commit: src/bin/sh

2024-04-06 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Apr  6 14:20:27 UTC 2024

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

Log Message:
Redo the mktemp(1) part - some mktemp's (including ours) require the
's to be at the end of the name (like mk*temp(3)) so however well
it will work with mktemp implementations which allow the X's to be
anywhere in the final component of the name, it will work just as
well on them with the X's at the end.

But we don't normally need all of that mess - knowing which temp
file is which is useful only when debugging the script, and that's
(mostly) long done.   So, in normal uses now just use $(mktemp) and
allow mktemp to pick its own name - we don't need to know what it is.
Every mktemp(1) supports that mode of operation.

Bug when debugging the script (which for current purposes will be
taken to be when the -x flag is passed to the shell running it, to
trace what it does) then we will make the temp files have names we
can recognise (and in that case, also don't delete them when done).

While here, check for mktemp(1) failing, and abort if that
happens (we assume that if it fails it will write an error
message to stderr, so the script does not need to.)

As for the purpose of the script ... of course the header file
generated (or an equivalent elsewhere) could be generated and
maintained by hand, but why would anyone want to do all that
work when software can do it for us, and do it correctly without
human thought?

This also allows the options in the master list (option.list) to be
arranged in a way that is meaningful for them, unrelated to the order
the shell needs to have them in (or rearrange them to be at run time)
and have that order shuffled however is convenient.   Currently all
the posix standard options are first, then the "hybrid" options, and
finally the local ones for this shell.   Currently "pipefail" is in the
final set, but once the next posix version is published, that will
become a standard option, and get moved in the list - the shell won't
even notice as this script puts the options into shell desired order.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/bin/sh/mkoptions.sh

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



CVS commit: src/external/mit/libuv/lib

2024-04-05 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Apr  5 12:03:24 UTC 2024

Modified Files:
src/external/mit/libuv/lib: Makefile

Log Message:
Revert last, the .pic file is used elsewhere.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/mit/libuv/lib/Makefile

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

Modified files:

Index: src/external/mit/libuv/lib/Makefile
diff -u src/external/mit/libuv/lib/Makefile:1.8 src/external/mit/libuv/lib/Makefile:1.9
--- src/external/mit/libuv/lib/Makefile:1.8	Fri Apr  5 11:04:37 2024
+++ src/external/mit/libuv/lib/Makefile	Fri Apr  5 12:03:24 2024
@@ -1,12 +1,15 @@
-# $NetBSD: Makefile,v 1.8 2024/04/05 11:04:37 christos Exp $
+# $NetBSD: Makefile,v 1.9 2024/04/05 12:03:24 kre Exp $
 
-LIBISPRIVATE=yes
+LIBISPRIVATE=pic
 
 .include 
 
 MKLINT=	no
 LIB=	uv
 
+MAKESTATICLIB=yes
+MAKELINKLIB=yes
+
 .if ${LIBISPRIVATE:Uno} == "no"
 INCS=	uv.h uv/unix.h uv/bsd.h uv/errno.h uv/version.h uv/threadpool.h
 INCSDIR=/usr/include



CVS commit: src/external/mit/libuv/lib

2024-04-05 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Apr  5 12:03:24 UTC 2024

Modified Files:
src/external/mit/libuv/lib: Makefile

Log Message:
Revert last, the .pic file is used elsewhere.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/mit/libuv/lib/Makefile

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



Re: CVS commit: src/external

2024-04-05 Thread Robert Elz
Date:Fri, 5 Apr 2024 08:51:27 +
From:"Robert Elz" 
Message-ID:  <20240405085127.b998ef...@cvs.netbsd.org>

Christos, this seems to fix the builds, but I doubt it is really
done correctly (and I don't just mean the overlong line I left in
src/external/Makefile which was (temporarily) deliberate just to
reduce the diff).

kre

  | Modified Files:
  | src/external: Makefile
  | src/external/mit/libuv/lib: Makefile
  |
  | Log Message:
  | Probable hack fix for current build breakage.
  |
  | Make sure to build external/mit before external/mpl (as bind in mpl
  | needs libuv from mit) and in mit/libuv make sure to build the
  | static library with the new MAKESTATICLIB mechanism, as that is
  | what bind needs.
  |
  | To generate a diff of this commit:
  | cvs rdiff -u -r1.23 -r1.24 src/external/Makefile
  | cvs rdiff -u -r1.6 -r1.7 src/external/mit/libuv/lib/Makefile





CVS commit: src/external

2024-04-05 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Apr  5 08:51:27 UTC 2024

Modified Files:
src/external: Makefile
src/external/mit/libuv/lib: Makefile

Log Message:
Probable hack fix for current build breakage.

Make sure to build external/mit before external/mpl (as bind in mpl
needs libuv from mit) and in mit/libuv make sure to build the
static library with the new MAKESTATICLIB mechanism, as that is
what bind needs.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/external/Makefile
cvs rdiff -u -r1.6 -r1.7 src/external/mit/libuv/lib/Makefile

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

Modified files:

Index: src/external/Makefile
diff -u src/external/Makefile:1.23 src/external/Makefile:1.24
--- src/external/Makefile:1.23	Sun Dec 12 20:33:21 2021
+++ src/external/Makefile	Fri Apr  5 08:51:27 2024
@@ -1,7 +1,7 @@
-#	$NetBSD: Makefile,v 1.23 2021/12/12 20:33:21 maya Exp $
+#	$NetBSD: Makefile,v 1.24 2024/04/05 08:51:27 kre Exp $
 
 SUBDIR+= amdgpu-firmware apache2 atheros broadcom bsd cddl gpl2 gpl3 historical
-SUBDIR+= intel-fw-eula intel-fw-public ibm-public mpl mit nvidia-firmware ofl
+SUBDIR+= intel-fw-eula intel-fw-public ibm-public mit .WAIT mpl nvidia-firmware ofl
 SUBDIR+= public-domain realtek
 
 .include 

Index: src/external/mit/libuv/lib/Makefile
diff -u src/external/mit/libuv/lib/Makefile:1.6 src/external/mit/libuv/lib/Makefile:1.7
--- src/external/mit/libuv/lib/Makefile:1.6	Thu Sep 22 21:22:50 2022
+++ src/external/mit/libuv/lib/Makefile	Fri Apr  5 08:51:27 2024
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 2022/09/22 21:22:50 christos Exp $
+# $NetBSD: Makefile,v 1.7 2024/04/05 08:51:27 kre Exp $
 
 LIBISPRIVATE=pic
 
@@ -7,6 +7,9 @@ LIBISPRIVATE=pic
 MKLINT=	no
 LIB=	uv
 
+MAKESTATICLIB=yes
+MAKELINKLIB=yes
+
 .if ${LIBISPRIVATE:Uno} == "no"
 INCS=	uv.h uv/unix.h uv/bsd.h uv/errno.h uv/version.h uv/threadpool.h
 INCSDIR=/usr/include



CVS commit: src/external

2024-04-05 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Apr  5 08:51:27 UTC 2024

Modified Files:
src/external: Makefile
src/external/mit/libuv/lib: Makefile

Log Message:
Probable hack fix for current build breakage.

Make sure to build external/mit before external/mpl (as bind in mpl
needs libuv from mit) and in mit/libuv make sure to build the
static library with the new MAKESTATICLIB mechanism, as that is
what bind needs.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/external/Makefile
cvs rdiff -u -r1.6 -r1.7 src/external/mit/libuv/lib/Makefile

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-04-02 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Apr  3 04:40:23 UTC 2024

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

Log Message:
For i386, if ft[sg]etprec() are to be used, ensure there's a
prototype for them in scope (so include )

Might fix the i386 build.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 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.31 src/lib/libm/src/math_private.h:1.32
--- src/lib/libm/src/math_private.h:1.31	Tue Jan 23 15:45:07 2024
+++ src/lib/libm/src/math_private.h	Wed Apr  3 04:40:23 2024
@@ -11,7 +11,7 @@
 
 /*
  * from: @(#)fdlibm.h 5.1 93/09/24
- * $NetBSD: math_private.h,v 1.31 2024/01/23 15:45:07 christos Exp $
+ * $NetBSD: math_private.h,v 1.32 2024/04/03 04:40:23 kre Exp $
  */
 
 #ifndef _MATH_PRIVATE_H_
@@ -348,6 +348,9 @@ do {\
 
 /* Support switching the mode to FP_PE if necessary. */
 #if defined(__i386__) && !defined(NO_FPSETPREC)
+
+#include 
+
 #define	ENTERI() ENTERIT(long double)
 #define	ENTERIT(returntype)			\
 	returntype __retval;			\



CVS commit: src/lib/libm/src

2024-04-02 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Apr  3 04:40:23 UTC 2024

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

Log Message:
For i386, if ft[sg]etprec() are to be used, ensure there's a
prototype for them in scope (so include )

Might fix the i386 build.


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



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

2024-03-14 Thread Robert Elz
Date:Thu, 14 Mar 2024 20:53:13 +0100
From:Roland Illig 
Message-ID:  <9c7513f7-97b5-4d3b-9d66-dce483af7...@gmx.de>

  | I don't think the flags '+' and '0' make sense for strings, that's why I
  | decided to preserve existing behavior.

But the change only affected things when the # flag was given.   I agree
that + and 0 are meaningless for strings, but - isn't, and %-S would work,
I see no reason why %#-S shouldn't work as well.

Not exactly a serius problem, as clearly no-one ever seems to have
been bothered by it, but no-one intentionally writes the code as it
was (generating clear everything) - the ! was obviously just a thinko
for ~.

kre


CVS commit: src/usr.bin/stat

2024-03-14 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Mar 14 19:38:56 UTC 2024

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

Log Message:
While the change in 1.51 certainly retained binary compat with
what was in 1.50 (while silencing LINT) - it was clearly not the
correct change to make.   The code used !FLAG_POUND where it
clearly meant ~FLAG_POUND ... the former is 0, so &= 0 could
be replaced by =0 changing nothing.   But that's not what it
should have been doing, other flags should not have been
removed here, just FLAG_POUND.

This problem seems to have existed since support for %#s
was first added in 2011, which kind of suggests how rarely
that format, particularly with other flags (like %#-s)
has ever been used (with no other flags, the bug would not
be noticed).


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/usr.bin/stat/stat.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/stat/stat.c
diff -u src/usr.bin/stat/stat.c:1.51 src/usr.bin/stat/stat.c:1.52
--- src/usr.bin/stat/stat.c:1.51	Thu Mar 14 00:07:20 2024
+++ src/usr.bin/stat/stat.c	Thu Mar 14 19:38:56 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stat.c,v 1.51 2024/03/14 00:07:20 rillig Exp $ */
+/*	$NetBSD: stat.c,v 1.52 2024/03/14 19:38:56 kre Exp $ */
 
 /*
  * Copyright (c) 2002-2011 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #include 
 #if !defined(lint)
-__RCSID("$NetBSD: stat.c,v 1.51 2024/03/14 00:07:20 rillig Exp $");
+__RCSID("$NetBSD: stat.c,v 1.52 2024/03/14 19:38:56 kre Exp $");
 #endif
 
 #if ! HAVE_NBTOOL_CONFIG_H
@@ -1077,7 +1077,7 @@ format1(const struct stat *st,
 	 * First prefixlen chars are not encoded.
 	 */
 	if ((flags & FLAG_POUND) != 0 && ofmt == FMTF_STRING) {
-		flags = 0;
+		flags &= ~FLAG_POUND;
 		strncpy(visbuf, sdata, prefixlen);
 		/* Avoid GCC warnings. */
 		visbuf[prefixlen] = 0;



CVS commit: src/usr.bin/stat

2024-03-14 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Mar 14 19:38:56 UTC 2024

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

Log Message:
While the change in 1.51 certainly retained binary compat with
what was in 1.50 (while silencing LINT) - it was clearly not the
correct change to make.   The code used !FLAG_POUND where it
clearly meant ~FLAG_POUND ... the former is 0, so &= 0 could
be replaced by =0 changing nothing.   But that's not what it
should have been doing, other flags should not have been
removed here, just FLAG_POUND.

This problem seems to have existed since support for %#s
was first added in 2011, which kind of suggests how rarely
that format, particularly with other flags (like %#-s)
has ever been used (with no other flags, the bug would not
be noticed).


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/usr.bin/stat/stat.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/time

2024-02-18 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Feb 18 12:47:08 UTC 2024

Modified Files:
src/lib/libc/time: strftime.c

Log Message:
Revert this part:

strftime %s now uses tm_gmtoff if available.  (Problem and draft
patch reported by Dag-Erling Smørgrav.)

of the tzcode2924a update.   It is bogus.   The "problem" is/was a simple
misunderstanding of what strftime(%s) is intended to output.  The "fix"
breaks it.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/lib/libc/time/strftime.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/time/strftime.c
diff -u src/lib/libc/time/strftime.c:1.54 src/lib/libc/time/strftime.c:1.55
--- src/lib/libc/time/strftime.c:1.54	Sat Feb 17 14:54:47 2024
+++ src/lib/libc/time/strftime.c	Sun Feb 18 12:47:08 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: strftime.c,v 1.54 2024/02/17 14:54:47 christos Exp $	*/
+/*	$NetBSD: strftime.c,v 1.55 2024/02/18 12:47:08 kre Exp $	*/
 
 /* Convert a broken-down timestamp to a string.  */
 
@@ -35,7 +35,7 @@
 static char	elsieid[] = "@(#)strftime.c	7.64";
 static char	elsieid[] = "@(#)strftime.c	8.3";
 #else
-__RCSID("$NetBSD: strftime.c,v 1.54 2024/02/17 14:54:47 christos Exp $");
+__RCSID("$NetBSD: strftime.c,v 1.55 2024/02/18 12:47:08 kre Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -381,15 +381,11 @@ label:
 	tm.tm_mday = t->tm_mday;
 	tm.tm_mon = t->tm_mon;
 	tm.tm_year = t->tm_year;
-#ifdef TM_GMTOFF
-	mkt = timeoff(, t->TM_GMTOFF);
-#else
 	tm.tm_isdst = t->tm_isdst;
 #if defined TM_GMTOFF && ! UNINIT_TRAP
 	tm.TM_GMTOFF = t->TM_GMTOFF;
 #endif
 	mkt = mktime_z(sp, );
-#endif
 	/* If mktime fails, %s expands to the
 	   value of (time_t) -1 as a failure
 	   marker; this is better in practice



CVS commit: src/lib/libc/time

2024-02-18 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Feb 18 12:47:08 UTC 2024

Modified Files:
src/lib/libc/time: strftime.c

Log Message:
Revert this part:

strftime %s now uses tm_gmtoff if available.  (Problem and draft
patch reported by Dag-Erling Smørgrav.)

of the tzcode2924a update.   It is bogus.   The "problem" is/was a simple
misunderstanding of what strftime(%s) is intended to output.  The "fix"
breaks it.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/lib/libc/time/strftime.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/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.



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/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, [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, char 

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:   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, [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:   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-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 

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, ))
  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, ))
 		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(, 0, sizeof tm);
+
 	errno = 0;
 	val = strtol(arg, , 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();
 	else
 		tsp[0].tv_sec = tsp[1].tv_sec = mktime();
 
-	if (errno != 0 && tsp[1].tv_sec == NO_TIME)
+	if ((errno != 0 && tsp[1].tv_sec == NO_TIME) || difftm(, ))
 		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)
+{
+#define CHK(fld) do 

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.



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, , 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, , 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, , 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 

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: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: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: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()) == 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: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: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: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/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/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/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 

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

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

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

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 

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



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/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/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, )
-			== -1) {
+			if (ip6_str2scopeid(scope, sin6, ) == -1) {
 free(hostname2);
 return EAI_NODATA; /* XXX: is return OK? */
 			}



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

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



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


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



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
 



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



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



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: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: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.



  1   2   3   4   5   6   7   8   9   10   >