FreeBSD/src 6ce85d6usr.sbin/daemon daemon.c daemon.8

daemon: Add option for output file mode

The daemon utility has always created its output file with a fixed mode
of 0600. This causes issues for log collection setups where the collector
does not run as root but instead relies on group access to the watched
daemon’s log file.

Introduce a new option that allows specifying the output file mode using
install(1)-style semantics. This enables non-root log collectors to access
the file as intended and improves compatibility with log rotation tools.

Reviewed by:    kevans
MFC after:      1 week
Relnotes:       yes
Differential Revision:  https://reviews.freebsd.org/D54930

(cherry picked from commit a3b90a1f008365d9f62773998f89f9c872e2bed5)
DeltaFile
+21-7usr.sbin/daemon/daemon.c
+15-2usr.sbin/daemon/daemon.8
+36-92 files

FreeBSD/src cc35db9usr.sbin/daemon daemon.c daemon.8

daemon: Add option for output file mode

The daemon utility has always created its output file with a fixed mode
of 0600. This causes issues for log collection setups where the collector
does not run as root but instead relies on group access to the watched
daemon’s log file.

Introduce a new option that allows specifying the output file mode using
install(1)-style semantics. This enables non-root log collectors to access
the file as intended and improves compatibility with log rotation tools.

Reviewed by:    kevans
MFC after:      1 week
Relnotes:       yes
Differential Revision:  https://reviews.freebsd.org/D54930

(cherry picked from commit a3b90a1f008365d9f62773998f89f9c872e2bed5)
DeltaFile
+21-7usr.sbin/daemon/daemon.c
+15-2usr.sbin/daemon/daemon.8
+36-92 files

FreeBSD/src 4bc40d5usr.sbin/daemon daemon.c daemon.8

daemon: Add option for output file mode

The daemon utility has always created its output file with a fixed mode
of 0600. This causes issues for log collection setups where the collector
does not run as root but instead relies on group access to the watched
daemon’s log file.

Introduce a new option that allows specifying the output file mode using
install(1)-style semantics. This enables non-root log collectors to access
the file as intended and improves compatibility with log rotation tools.

Reviewed by:    kevans
MFC after:      1 week
Relnotes:       yes
Differential Revision:  https://reviews.freebsd.org/D54930

(cherry picked from commit a3b90a1f008365d9f62773998f89f9c872e2bed5)
DeltaFile
+21-7usr.sbin/daemon/daemon.c
+15-2usr.sbin/daemon/daemon.8
+36-92 files

FreeBSD/src 74e3453usr.bin/diff diffdir.c, usr.bin/diff/tests diff_test.sh

diff: Improve directory loop detection

When we're done processing a directory, remove its entry from the tree
of visited inodes, ensuring that we only report a loop when we encounter
a descendant-to-ancestor link, not when we encounter a cousin-to-cousin
or sibling-to-sibling link.

MFC after:      1 week
Reported by:    Bakul Shah <bakul at iitbombay.org>
Sponsored by:   Klara, Inc.
Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D55248

(cherry picked from commit 71569594d860a59d8362770a56d806e1d31fb946)
DeltaFile
+17-3usr.bin/diff/diffdir.c
+5-0usr.bin/diff/tests/diff_test.sh
+22-32 files

FreeBSD/src 8e65c66usr.bin/xinstall xinstall.c, usr.bin/xinstall/tests install_test.sh

install: Expect EINTR while copying

Both copy_file_range() and read() / write() in our fallback loop can be
interrupted before copying anything at all, in which case it returns -1
and sets errno to EINTR.  If that happens, we should retry, not fail.

While here, drop the size argument from copy() (we always want to copy
the entire file anyway) and add test cases which exercise the metalog
and digest functionality.

PR:             293028
MFC after:      1 week
Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D55168

(cherry picked from commit 0fb940fd63dd9b6d6b848421c53b1e9ac8387265)
DeltaFile
+20-20usr.bin/xinstall/xinstall.c
+38-0usr.bin/xinstall/tests/install_test.sh
+58-202 files

FreeBSD/src f1a86b3bin/cp utils.c

cp: Expect EINTR while copying

Both copy_file_range() and copy_fallback() can be interrupted before
they have read anything at all, in which case they return -1 and set
errno to EINTR.  If that happens, we should retry, not fail.

PR:             293028
MFC after:      1 week
Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D55167

(cherry picked from commit 7aa30669d6e04444b8ad1e4863a6e674fcac4afc)
DeltaFile
+5-2bin/cp/utils.c
+5-21 files

FreeBSD/src cd24bdbusr.bin/xinstall xinstall.c, usr.bin/xinstall/tests install_test.sh

install: Expect EINTR while copying

Both copy_file_range() and read() / write() in our fallback loop can be
interrupted before copying anything at all, in which case it returns -1
and sets errno to EINTR.  If that happens, we should retry, not fail.

While here, drop the size argument from copy() (we always want to copy
the entire file anyway) and add test cases which exercise the metalog
and digest functionality.

PR:             293028
MFC after:      1 week
Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D55168

(cherry picked from commit 0fb940fd63dd9b6d6b848421c53b1e9ac8387265)
DeltaFile
+22-22usr.bin/xinstall/xinstall.c
+38-0usr.bin/xinstall/tests/install_test.sh
+60-222 files

FreeBSD/src 0c5c503usr.bin/diff diffdir.c, usr.bin/diff/tests diff_test.sh

diff: Improve directory loop detection

When we're done processing a directory, remove its entry from the tree
of visited inodes, ensuring that we only report a loop when we encounter
a descendant-to-ancestor link, not when we encounter a cousin-to-cousin
or sibling-to-sibling link.

MFC after:      1 week
Reported by:    Bakul Shah <bakul at iitbombay.org>
Sponsored by:   Klara, Inc.
Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D55248

(cherry picked from commit 71569594d860a59d8362770a56d806e1d31fb946)
DeltaFile
+17-3usr.bin/diff/diffdir.c
+5-0usr.bin/diff/tests/diff_test.sh
+22-32 files

FreeBSD/src 8409018bin/pwd pwd.c, bin/pwd/tests pwd_test.sh

pwd: Error out if writing to stdout failed

POSIX requires us to print a diagnostic and return a non-zero exit
code if writing to stdout failed.

MFC after:      1 week
Sponsored by:   Klara, Inc.
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D55227

(cherry picked from commit 5b398611607b0dab2f2550ef73f62d41dab6fac5)
DeltaFile
+21-0bin/pwd/tests/pwd_test.sh
+2-0bin/pwd/pwd.c
+23-02 files

FreeBSD/src a9ac7dabin/cp utils.c

cp: Expect EINTR while copying

Both copy_file_range() and copy_fallback() can be interrupted before
they have read anything at all, in which case they return -1 and set
errno to EINTR.  If that happens, we should retry, not fail.

PR:             293028
MFC after:      1 week
Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D55167

(cherry picked from commit 7aa30669d6e04444b8ad1e4863a6e674fcac4afc)
DeltaFile
+5-2bin/cp/utils.c
+5-21 files

FreeBSD/src e661c4cusr.bin/m4 eval.c, usr.bin/m4/tests m4_test.sh defn.m4

m4: Change defn processing order

Currently, defn pushes its arguments on the stack in order, which means
they are then processed in reverse order.  POSIX does not specify what
order they are processed in, which arguably suggests that they should be
processed in the order they are listed.  Push them in reverse order so
they will be processed in their original order.  This matches GNU m4.

PR:             292937
MFC after:      1 week
Sponsored by:   Klara, Inc.
Reviewed by:    obiwac, imp
Differential Revision:  https://reviews.freebsd.org/D55116

(cherry picked from commit 25a8168f86a1222388475ce858da405e4d06c1c3)
DeltaFile
+9-0usr.bin/m4/tests/m4_test.sh
+5-0usr.bin/m4/tests/defn.m4
+1-1usr.bin/m4/eval.c
+2-0usr.bin/m4/tests/Makefile
+1-0usr.bin/m4/tests/regress.defn.out
+18-15 files

FreeBSD/src ae75d4bbin/pwd pwd.c pwd.1

pwd: Clean up and adopt POSIX semantics

According to POSIX, the default should be -L.  Based on code history,
whoever first wrote BSD pwd(1) could not figure out how to implement
-L and therefore made -P the default (and only) option. Support for -L
was later added, but the default was never changed.

Clean up the code, make -L the default, and rewrite getcwd_logical() to
reject paths that contain dot or dot-dot, as required by POSIX.

MFC after:      1 week
Reviewed by:    olce
Differential Revision:  https://reviews.freebsd.org/D55146

(cherry picked from commit 2df923c5d2d02350abc29f61b603c5b9615b225c)
DeltaFile
+52-47bin/pwd/pwd.c
+2-2bin/pwd/pwd.1
+54-492 files

FreeBSD/src 11a22eabin/pwd Makefile, bin/pwd/tests pwd_test.sh Makefile

pwd: Add tests

MFC after:      1 week
Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D55153

(cherry picked from commit 36ec2b1c104f9e5383a160e21109e1308fce0364)
DeltaFile
+73-0bin/pwd/tests/pwd_test.sh
+6-2bin/pwd/Makefile
+4-0bin/pwd/tests/Makefile
+2-0etc/mtree/BSD.tests.dist
+85-24 files

FreeBSD/src f207a5cusr.bin/m4/tests m4_test.sh regress.gnuprefix.err

m4: Convert tests to ATF

MFC after:      1 week
Sponsored by:   Klara, Inc.
Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D55115

(cherry picked from commit 16e073df4a33646fa0e0fba5b41ddc6b44df3605)
DeltaFile
+240-0usr.bin/m4/tests/m4_test.sh
+44-0usr.bin/m4/tests/regress.gnuprefix.err
+0-44usr.bin/m4/tests/regress.gnuprefix.out
+0-32usr.bin/m4/tests/regress.sh
+8-5usr.bin/m4/tests/Makefile
+0-5usr.bin/m4/tests/legacy_test.sh
+292-865 files not shown
+299-8911 files

FreeBSD/src 77385e9bin/cp utils.c

cp: Expect EINTR while copying

Both copy_file_range() and copy_fallback() can be interrupted before
they have read anything at all, in which case they return -1 and set
errno to EINTR.  If that happens, we should retry, not fail.

PR:             293028
MFC after:      1 week
Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D55167

(cherry picked from commit 7aa30669d6e04444b8ad1e4863a6e674fcac4afc)
DeltaFile
+5-2bin/cp/utils.c
+5-21 files

FreeBSD/src 4917376bin/pwd pwd.c, bin/pwd/tests pwd_test.sh

pwd: Error out if writing to stdout failed

POSIX requires us to print a diagnostic and return a non-zero exit
code if writing to stdout failed.

MFC after:      1 week
Sponsored by:   Klara, Inc.
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D55227

(cherry picked from commit 5b398611607b0dab2f2550ef73f62d41dab6fac5)
DeltaFile
+21-0bin/pwd/tests/pwd_test.sh
+2-0bin/pwd/pwd.c
+23-02 files

FreeBSD/src 78c53adusr.bin/m4 eval.c, usr.bin/m4/tests m4_test.sh defn.m4

m4: Change defn processing order

Currently, defn pushes its arguments on the stack in order, which means
they are then processed in reverse order.  POSIX does not specify what
order they are processed in, which arguably suggests that they should be
processed in the order they are listed.  Push them in reverse order so
they will be processed in their original order.  This matches GNU m4.

PR:             292937
MFC after:      1 week
Sponsored by:   Klara, Inc.
Reviewed by:    obiwac, imp
Differential Revision:  https://reviews.freebsd.org/D55116

(cherry picked from commit 25a8168f86a1222388475ce858da405e4d06c1c3)
DeltaFile
+9-0usr.bin/m4/tests/m4_test.sh
+5-0usr.bin/m4/tests/defn.m4
+2-0usr.bin/m4/tests/Makefile
+1-1usr.bin/m4/eval.c
+1-0usr.bin/m4/tests/regress.defn.out
+18-15 files

FreeBSD/src f201382usr.bin/diff diffdir.c, usr.bin/diff/tests diff_test.sh

diff: Improve directory loop detection

When we're done processing a directory, remove its entry from the tree
of visited inodes, ensuring that we only report a loop when we encounter
a descendant-to-ancestor link, not when we encounter a cousin-to-cousin
or sibling-to-sibling link.

MFC after:      1 week
Reported by:    Bakul Shah <bakul at iitbombay.org>
Sponsored by:   Klara, Inc.
Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D55248

(cherry picked from commit 71569594d860a59d8362770a56d806e1d31fb946)
DeltaFile
+17-3usr.bin/diff/diffdir.c
+5-0usr.bin/diff/tests/diff_test.sh
+22-32 files

FreeBSD/src 9f1bff6usr.bin/xinstall xinstall.c, usr.bin/xinstall/tests install_test.sh

install: Expect EINTR while copying

Both copy_file_range() and read() / write() in our fallback loop can be
interrupted before copying anything at all, in which case it returns -1
and sets errno to EINTR.  If that happens, we should retry, not fail.

While here, drop the size argument from copy() (we always want to copy
the entire file anyway) and add test cases which exercise the metalog
and digest functionality.

PR:             293028
MFC after:      1 week
Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D55168

(cherry picked from commit 0fb940fd63dd9b6d6b848421c53b1e9ac8387265)
DeltaFile
+22-22usr.bin/xinstall/xinstall.c
+38-0usr.bin/xinstall/tests/install_test.sh
+60-222 files

FreeBSD/src 36fa675bin/pwd Makefile, bin/pwd/tests pwd_test.sh Makefile

pwd: Add tests

MFC after:      1 week
Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D55153

(cherry picked from commit 36ec2b1c104f9e5383a160e21109e1308fce0364)
DeltaFile
+73-0bin/pwd/tests/pwd_test.sh
+6-2bin/pwd/Makefile
+4-0bin/pwd/tests/Makefile
+2-0etc/mtree/BSD.tests.dist
+85-24 files

FreeBSD/src 24b95c5bin/pwd pwd.c pwd.1

pwd: Clean up and adopt POSIX semantics

According to POSIX, the default should be -L.  Based on code history,
whoever first wrote BSD pwd(1) could not figure out how to implement
-L and therefore made -P the default (and only) option. Support for -L
was later added, but the default was never changed.

Clean up the code, make -L the default, and rewrite getcwd_logical() to
reject paths that contain dot or dot-dot, as required by POSIX.

MFC after:      1 week
Reviewed by:    olce
Differential Revision:  https://reviews.freebsd.org/D55146

(cherry picked from commit 2df923c5d2d02350abc29f61b603c5b9615b225c)
DeltaFile
+52-47bin/pwd/pwd.c
+2-2bin/pwd/pwd.1
+54-492 files

FreeBSD/src 955fdd4usr.bin/m4/tests m4_test.sh regress.gnuprefix.out

m4: Convert tests to ATF

MFC after:      1 week
Sponsored by:   Klara, Inc.
Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D55115

(cherry picked from commit 16e073df4a33646fa0e0fba5b41ddc6b44df3605)
DeltaFile
+240-0usr.bin/m4/tests/m4_test.sh
+0-44usr.bin/m4/tests/regress.gnuprefix.out
+44-0usr.bin/m4/tests/regress.gnuprefix.err
+0-32usr.bin/m4/tests/regress.sh
+8-5usr.bin/m4/tests/Makefile
+0-5usr.bin/m4/tests/legacy_test.sh
+292-865 files not shown
+298-8911 files

FreeBSD/src 7786840lib/libc/net sockatmark.3

lib/libc/net/sockatmark.3: fix groff mdoc warning

PR:     293072

(cherry picked from commit 10fde719587c22085c95759a242e9c51d249d024)
DeltaFile
+1-1lib/libc/net/sockatmark.3
+1-11 files

FreeBSD/src c838c3fsbin/setkey setkey.8

sbin/setkey/setkey.8: cleanup groff mdoc warnings

PR:     293072

(cherry picked from commit c67d8acca30e9f96f0a56f197003d0a4c663a060)
DeltaFile
+8-7sbin/setkey/setkey.8
+8-71 files

FreeBSD/src e8dbf2bkernel t_time_arith.c, lib/libc/gen t_ctype.c t_arc4random.c

Add files missed in 56a7ce8416d181a2060d7a42

Skip usr.bin/diff3 tests as these contain text that gets misinterpreted
as merge conflict markers and blocks push with the relevant pre-receive
hook.

PR:     293186
DeltaFile
+1,543-0lib/libpthread/t_cancellation.c
+1,236-0lib/libc/gen/t_ctype.c
+1,224-0kernel/t_time_arith.c
+887-0lib/libm/t_next.c
+739-0usr.bin/xlint/lint1/init_c99.c
+670-0lib/libc/gen/t_arc4random.c
+6,299-0321 files not shown
+29,404-0327 files

FreeBSD/src 56a7ce8lib/libc/gen t_fpclassify.c, lib/libc/sys t_poll.c

Sync NetBSD/tests with upstream

Obtained from:  https://github.com/NetBSD/src (9c6226debedf)
DeltaFile
+71-7,358usr.bin/netpgpverify/t_netpgpverify.sh
+1,776-83lib/libc/sys/t_poll.c
+1,564-86lib/libutil/t_snprintb.c
+638-728lib/libm/t_log.c
+1,103-72lib/libc/gen/t_fpclassify.c
+446-446usr.bin/xlint/lint1/msg_247_portable_int.c
+5,598-8,773606 files not shown
+23,664-18,503612 files

FreeBSD/src 90d79ddsys/dev/asmc asmcvar.h asmc.c

asmc: Add MacPro3,1 temperature sensor support

Test and verified with Sonicblue7

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D54952
DeltaFile
+69-0sys/dev/asmc/asmcvar.h
+9-0sys/dev/asmc/asmc.c
+78-02 files

FreeBSD/src d2136eeetc/mtree BSD.usr.dist

BSD.usr.dist: remove obsolete usr/share/examples/drivers entry

In base 8f0a6a9aadb1f, usr/share/examples/drivers was cleaned up,
because it contained unmaintained scripts. The directory itself is
cleaned up by ObsoleteFiles.inc, but there was still an entry in
BSD.usr.dist that re-created the directory. Remove it.

Fixes:          8f0a6a9aadb1
MFC after:      3 days

(cherry picked from commit ac2f284258e4c6d5867aa6a411bd44df349fe416)
(cherry picked from commit c44a4859c3c00aa87d5bead34d8646e13c86ea85)
DeltaFile
+0-2etc/mtree/BSD.usr.dist
+0-21 files

FreeBSD/src 79eff4asys/netinet6 in6_mcast.c

netinet6: Return EAFNOSUPPORT for non-IPv6 addresses in mcast sockopts.

This is a non-functional change; it just returns the correct errno value
where IPv6 multicast socket options were passed non-AF_INET6 arguments,
in preparation for handling PR 193246 with a side-call into netinet as
xnu currently does.

Reviewed by:    glebius
Approved by:    glebius
PR:             193246 (with refinements)
Differential revision:  https://reviews.freebsd.org/D55233
DeltaFile
+11-8sys/netinet6/in6_mcast.c
+11-81 files

FreeBSD/src 625dc44usr.bin/tr tr.c

tr: fix class handling in unicode world

toupper/tolower logic was only handled for CCLASS_TOUPPER and
CCLASS_TOLOWER, add support for CCLASS ([:alpha:])

PR:             219900
MFC After:      1 week
DeltaFile
+34-0usr.bin/tr/tr.c
+34-01 files