Commit Graph

15897 Commits

Author SHA1 Message Date
Baptiste Daroussin
35e941ce55 systat: fix build with newer ncurses 2024-06-20 15:10:38 +02:00
Baptiste Daroussin
21817992b3 ncurses: vendor import version 6.5 2024-06-20 13:26:22 +02:00
Mark Johnston
d9220f64da uniq tests: Make uniq_test:stdout more reliable
When running regression tests in paralle, this one occasionally fails
because uniq exits with status 0.  I believe this is because the test is
a bit racy: it assumes that true(1) will exit before uniq writes to
standard out.

Just sleep for a bit to give the other end of the pipe to exit.

Reviewed by:	des
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45534
2024-06-13 20:00:47 -04:00
Ed Maste
0277c0c6f7 ktrace(1): add more xrefs
Following commit a87651e2ff add xrefs to intro(2) and sigaction(2),
and use a consistent form.

Suggested by:	kib, arrowd
Reviewed by:	kib (earlier)
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45555
2024-06-11 11:02:00 -04:00
Ed Maste
a87651e2ff ktrace(1): add xref to namei(9)
namei was mistaken for a typo (see GitHub pull request #1284).  Add an
xref to make it clear.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45546
2024-06-10 10:41:45 -04:00
Cosimo Cecchi
4472fd66d0 lam: fail on I/O errors
I/O errors should be reported; however lam currently does not
disambiguate between EOF because end-of-file was reached and EOF because
an I/O error occurred.
This commit changes lam to exit with EX_IOERR when an I/O error occurs.

Reviewed by:	imp, allanjude
Sponsored by:	Apple Inc.
Differential Revision:	https://reviews.freebsd.org/D45437
2024-06-06 17:24:15 +00:00
Cosimo Cecchi
7dd39ef4e0 comm: close a race condition when comm is fed from stdin
If one of the files has ended, we won't show the column, but we still
need to drain the file pointer to avoid potentially hitting a pipe
failure.

This commit moves the NULL offset checks inside show() so that getline()
and ferror() are still called on fp.

Reviewed by:	allanjude
Sponsored by:	Apple Inc.
Differential Revision:	https://reviews.freebsd.org/D45440
2024-06-06 17:04:38 +00:00
Cosimo Cecchi
63f5c101a1 comm: flush stdout for error checking prior to exiting
UNIX conformance wants utilities to catch any errors when doing I/O, as
opposed to relying on the implicit flush upon exit.
comm currently does not do that.
This commit adds handling of I/O errors on stdout prior to exit.

Reviewed by:	imp, allanjude
Sponsored by:	Apple Inc.
Differential Revision:	https://reviews.freebsd.org/D45439
2024-06-06 17:04:37 +00:00
Xin LI
3b35e7ee8d MFV: xz 5.6.2.
MFC after:	4 weeks
2024-06-03 18:14:43 -07:00
Wolfram Schneider
965fff9826 man(1): ignore absolute path for .so include
We want only a relative include, as ".so man1/foobar.1"

MFC after:	1 week
2024-06-03 16:00:42 +00:00
Warner Losh
d28bbfa271 localedef: Bootstrap better
Declare these functions in a macro-safe way instead of relying on
ifdefs.

Sponsored by:		Netflix
2024-05-30 21:59:15 -06:00
Wolfram Schneider
73eb53813f man(1) needs to check for .so files not only in the first line
PR: 279182

Some manual pages have a copyright notice or commit id before including
other files with the .so macro. We need to skip comments and empty lines
at the beginning of the manpage while checking for the first .so macro.

MFC after:	1 week
2024-05-26 05:48:40 +00:00
Simon J. Gerraty
9d3df31ec0 Merge bmake-20240520
Merge commit '29efb3dcaedd9cbabc6f96f35545baf2c8b28501'
2024-05-23 13:12:43 -07:00
Tom Hukins
2ce32ab21a Fix "version introduced" in two manual pages
Signed-off-by: Tom Hukins <tom@FreeBSD.org>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1252
2024-05-23 10:30:32 -06:00
Piotr Kubaj
b7f62c6042 usr.bin/top: fix displaying load average for loads of at least 100
After top registers load average of at least 100 which then gets reduced to
below 100, there are left stray digits.
Supporting load over 100 requires increasing the width only to 6, but since
we support over 1000 CPU's now, let's increase it to 7.

Reviewed by:	kib
Differential Revision: https://reviews.freebsd.org/D45284
2024-05-22 16:47:46 +02:00
Baptiste Daroussin
8aac90f18a mac_do: add a new MAC/do policy and mdo(1) utility
This policy enables a user to become another user without having to be
root (hence no setuid binary). it is configured via rules using sysctl
security.mac.do.rules

For example:
security.mac.do.rules=uid=1001:80,gid=0:any

The above rule means the user identifier by the uid 1001 is able to
become user 80
Any user of the group 0 are allowed to become any user on the system.

The mdo(1) utility expects the MAC/do policy to be installed and its
rules defined.

Reviewed by:	des
Differential Revision:	https://reviews.freebsd.org/D45145
2024-05-22 14:01:41 +02:00
Kyle Evans
6e824f3713 time: siginfo_recvd needs to be marked volatile
sig_atomic_t does not imply volatility, we must do it ourselves to avoid
caching of siginfo_recvd loads.

Sponsored by:	Klara, Inc.
2024-05-22 00:37:41 -05:00
Wolfram Schneider
37be4197f7 man: the exists function needs to validate the first parameter
This fixes an issue with the ".so " macro for FreeBSD
ports manual pages.

PR: 275978
Reported by:	Jamie Landeg-Jones <jamie@catflap.org>
MFC after:	1 week

Differential Revision:	https://reviews.freebsd.org/D45231 (discussion)
2024-05-20 16:02:21 +00:00
Dag-Erling Smørgrav
9c7f83bbb4 diff: Nits in tests.
Sponsored by:	Klara, Inc.
2024-05-20 16:27:50 +02:00
Dag-Erling Smørgrav
b780b6508b diff: Warn if the atomizer detected truncation.
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude, markj
Differential Revision:	https://reviews.freebsd.org/D45219
2024-05-20 15:26:46 +02:00
Ed Maste
fb623aab39 diff: honour -B flag with -q
PR:		278988
Reviewed by:	bapt
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45220
2024-05-17 20:03:56 -04:00
Lexi Winter
ae9c0ba8ef netstat(8): for -W, use IFNAMSIZ
If -W is specified, use IFNAMSIZ as the width of the Netif column,
instead of the default 12.

Reviewed by: imp,zlei,Mina Galić
Pull Request: https://github.com/freebsd/freebsd-src/pull/1223
2024-05-16 11:07:34 -06:00
Lexi Winter
d33b87e8cf netstat(1): increase width of Netif column
The previous width of Netif (10 or 8) was too short for modern interface
names; make it 12, which is long enough to display "epair0a.1000".

This came up in practice with genet(4) interfaces, since the base
interface name is long enough that with the previous limit, VLAN
identifiers would be truncated at 1 character in the IPv6 output:
"genet0.100" becomes "genet0.1".

The width is now fixed, and doesn't depend on the address family,
because there's no reason that length of the interface name would vary
based on the AF.

Reviewed by: imp,zlei,Mina Galić
Pull Request: https://github.com/freebsd/freebsd-src/pull/1223
2024-05-16 11:07:34 -06:00
Alexander Ziaee
1a720cbec5 man filesystems: fix xrefs after move to section 4
Reviewed by: des, imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1077
2024-05-16 10:25:29 -06:00
Joseph Mingrone
ea3751fb53
freebsd-tips: Tweak fortune to find font providing Unicode character
While here, remove my name and email address.

Reported by:	bapt
Sponsored by:	The FreeBSD Foundation
2024-05-15 11:34:39 -03:00
Simon J. Gerraty
c9f4001f81 Merge bmake-20240508
Merge commit '3c2ab5fddc576e58f3ffa70dc5fa95144646a513'
2024-05-13 22:19:20 -07:00
Joseph Mingrone
2735824564
freebsd-tips: Add fortune to find font providing Unicode character
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45183
2024-05-13 20:02:17 -03:00
Dag-Erling Smørgrav
f3eeeb959c expand: Fix markup for the -t option.
PR:		274897
Fixes:		8993d785a2
MFC after:	3 days
Reviewed by:	gbe
Differential Revision:	https://reviews.freebsd.org/D45167
2024-05-13 12:41:38 +02:00
Warner Losh
88cbbbb607 Revert "grdc: Add copyright"
It turns out this wasn't in 4.4BSD. I had a false positive for gdc.c
(which is in 4.4BSD, but part of gated, not this). gdc.c comes from the
ncurses tests, so it shouldn't have this copyright. This version is
mostly Amos Shapir and John Lupien's code. It comes from ncurses test
directory. ncurses has made dozens of improvements to this file since
we imported it in 1997 (which pre-dates their online history), so it's
not clear if their new copyright applies (which doesn't mention Amos
or John) or if some other copyright applies. In any case, it wasn't
4.4BSD, so revert this.

This reverts commit 6ed7d0e3ac.

Sponsored by:		Netflix
2024-05-10 14:12:19 -06:00
Warner Losh
6ed7d0e3ac grdc: Add copyright
Add the stock BSD copyright and license from the 4.4-Lite distribution
(indirected by SPDX).

Sponsored by:		Netflix
2024-05-10 09:22:44 -06:00
Gavin Atkinson
71ed1adda8 grdc: add countdown timer mode
PR: 35113
Differential Revision:	https://reviews.freebsd.org/D43463
2024-05-10 09:22:38 -06:00
Richard Scheffenegger
2a9aae9e5f tcp: add counter to track when SACK loss recovery uses TSO
Add a counter to track how frequently SACK has transmitted
more than one MSS using TSO. Instances when this will be
beneficial is the use of PRR, or when ACK thinning due to
GRO/LRO or ACK discards by the network are present.

Reviewed By:		tuexen, #transport
Sponsored by:		NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D45070
2024-05-08 14:37:33 +02:00
Simon J. Gerraty
548bfc56eb Merge bmake-20240430
Merge commit '507951f55039f9d1ceae507d510f8cb68225fbc5'
2024-05-03 15:48:32 -07:00
Dag-Erling Smørgrav
eea5f8d408 diff: Sort headers.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D45078
2024-05-03 17:03:50 +02:00
Shawn Bayern
95032b58a1 Tighten boundary check in split(1) to prevent a potential buffer overflow.
Before increasing sufflen, make sure the current name plus two (including
the terminating NUL character and the to-be-added character) does not
exceed the fixed buffer length, and stop immediately if this would occur.

In worst case scenario the code would write an nul character beyond the
boundary, however it would be caught by open(2) and based on the memory
layout, we do not believe this would constitute a security vulnerability.

MFC after:	3 days
2024-05-03 01:29:20 -07:00
Olivier Certner
9b30b96c1f
Remove remnants of portsnap(8)
This was prompted by noticing that '/var/db/portsnap' still exists on
newly-installed machines.

With this change, all mentions of portsnap(8) in the tree are gone,
except for the historical note in the AUTHORS section of manpage
phttpget(8).

locate(1) will thus start indexing again '/var/db/portsnap' on machines
where this directory still exists, which may be a good way to push
administrators to delete it.

Reviewed by:            cperciva
Approved by:            emaste (mentor)
MFC after:              3 days
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D45023
2024-04-30 22:44:34 +09:00
Nathan Huff
b2b8fa1a64 Add libxo support to du
Convert du to use libxo enabling structured output.

[[ minor style fixes by imp ]]

Signed-off-by: Nathan Huff <nhuff@acm.org>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1145
2024-04-29 08:22:39 -06:00
Kyle Evans
8ceac8e13d script: handle terminal resize on SIGWINCH
Add a -w flag to forward terminal resize events on to the child, which
can be useful in some circumstances to avoid terminal corruption.

Reviewed by:	des
Co-authored-by:	Xavier Beaudouin <xavier.beaudouin@klarasystems.com>
Sponsored by:	Modirum MDPay
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D44167
2024-04-26 11:39:00 -05:00
Xavier Beaudouin
4459abe334 script: minor style improvements
Fix some nits pointed out by checkstyle9.pl in advance of functional
changes to script(1).

Reviewed by:	des
Sponsored by:	Modirum MDPay
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D44167
2024-04-26 11:38:52 -05:00
Jake Freeland
f239db4800 ktrace: Remove CAPFAIL from default trace points
The CAPFAIL tracepoint was recently extended to report ECAPMODE
capability  violations for processes that do not enter capability mode.
This allows developers that are interested in Capsicumizing their
programs to determine where violations are being raised.

Previously, CAPFAIL only produced output for processes using Capsicum(4)
capabilties. Thus, most ktrace users never received log output from the
trace point. With the recent changes, this is no longer the case.

Having this trace point enabled by default will produce output for all
processes that use syscalls that are not permitted in capability mode.
This may lead to confusion for users that are not familiar with the
feature. Remove KTRFAC_CAPFAIL from ktrace's default points to avoid
this.

Approved by:	markj (mentor)
Reviewed by:	markj
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D44887
2024-04-23 19:26:14 -05:00
Jake Freeland
4f2ada0d88 ktrace: Describe CAPFAIL trace point in man page
Update the ktrace(1) man page to describe the recently improved
capability failure tracing.

Approved by:	markj (mentor)
Reviewed by:	markj
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D44886
2024-04-23 19:25:16 -05:00
Ed Maste
91d35fb663 Remove WITHOUT_CAPSICUM build support
Capsicum is non-optional as of c24c117b96 ("Remove
WITHOUT_{CAPSICUM,CASPER} options").

`#ifndef WITHOUT_CAPSICUM` is left in the source for the benefit of
downstream consumers, but is never defined in FreeBSD.

Reviewed by:	oshogbo
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D42077
2024-04-23 08:26:28 -04:00
Wolfram Schneider
14a5c1068d man: do not ignore the exit status of roff tools
PR:		223516
Approved by:	emaste, bapt
Differential Revision:	https://reviews.freebsd.org/D44798
2024-04-20 08:30:33 +00:00
rilysh
0bdcfb08f2 usr.bin/units: use else..if to avoid calling the next branch
Even if the first branch succeeds, next time it will still check for
the second branch (which will be false) as the first one was true.
Add an else..if statement to address this.

Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1165
2024-04-19 16:54:30 -06:00
Ricardo Branco
725a9f4732 bsdiff: Use mmap instead of malloc
Note: This follows the current style of the bsdiff.c and bspatch.c
files, which is rather far from style(9).

Reviewed by: imp, cpervica
Pull Request: https://github.com/freebsd/freebsd-src/pull/1076
2024-04-19 16:33:07 -06:00
Martin Tournoij
5fbdcd65fe xargs: use getline() instead of fgetln()
This replaces fgetln() with getline(). The main reason for this is
portability, making things easier for people who want to compile these
tools on non-FreeBSD systems.

I appreciate that's probably not the top concern for FreeBSD base tools,
but fgetln() is impossible to port to most platforms, as concurrent
access is essentially impossible to implement fully correct without the
line buffer on the FILE struct. Other than this, many generic FreeBSD
tools compile fairly cleanly on Linux with a few small changes.

Most uses of fgetln() pre-date getline() support (added in 2009 with
69099ba2ec), and there's been some previous patches (ee3ca711a8
8c98e6b1a7 1a2a4fc8ce) for other tools.

Obtained from:	https://github.com/dcantrell/bsdutils and
              	https://github.com/chimera-linux/chimerautils
Signed-off-by: Martin Tournoij <martin@arp242.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/893
2024-04-19 15:52:22 -06:00
Martin Tournoij
25696725b6 patch: use getline() instead of fgetln()
This replaces fgetln() with getline(). The main reason for this is
portability, making things easier for people who want to compile these
tools on non-FreeBSD systems.

I appreciate that's probably not the top concern for FreeBSD base tools,
but fgetln() is impossible to port to most platforms, as concurrent
access is essentially impossible to implement fully correct without the
line buffer on the FILE struct. Other than this, many generic FreeBSD
tools compile fairly cleanly on Linux with a few small changes.

Most uses of fgetln() pre-date getline() support (added in 2009 with
69099ba2ec), and there's been some previous patches (ee3ca711a8
8c98e6b1a7 1a2a4fc8ce) for other tools.

Obtained from:	https://github.com/dcantrell/bsdutils and
              	https://github.com/chimera-linux/chimerautils
Signed-off-by: Martin Tournoij <martin@arp242.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/893
2024-04-19 15:52:22 -06:00
Martin Tournoij
d3643c9efe join: use getline() instead of fgetln()
This replaces fgetln() with getline(). The main reason for this is
portability, making things easier for people who want to compile these
tools on non-FreeBSD systems.

I appreciate that's probably not the top concern for FreeBSD base tools,
but fgetln() is impossible to port to most platforms, as concurrent
access is essentially impossible to implement fully correct without the
line buffer on the FILE struct. Other than this, many generic FreeBSD
tools compile fairly cleanly on Linux with a few small changes.

Most uses of fgetln() pre-date getline() support (added in 2009 with
69099ba2ec), and there's been some previous patches (ee3ca711a8
8c98e6b1a7 1a2a4fc8ce) for other tools.

Obtained from:	https://github.com/dcantrell/bsdutils and
              	https://github.com/chimera-linux/chimerautils
Signed-off-by: Martin Tournoij <martin@arp242.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/893
2024-04-19 15:52:22 -06:00
Martin Tournoij
3abcc79c6a head: use getline() instead of fgetln()
This replaces fgetln() with getline(). The main reason for this is
portability, making things easier for people who want to compile these
tools on non-FreeBSD systems.

I appreciate that's probably not the top concern for FreeBSD base tools,
but fgetln() is impossible to port to most platforms, as concurrent
access is essentially impossible to implement fully correct without the
line buffer on the FILE struct. Other than this, many generic FreeBSD
tools compile fairly cleanly on Linux with a few small changes.

Most uses of fgetln() pre-date getline() support (added in 2009 with
69099ba2ec), and there's been some previous patches (ee3ca711a8
8c98e6b1a7 1a2a4fc8ce) for other tools.

Obtained from:	https://github.com/dcantrell/bsdutils and
              	https://github.com/chimera-linux/chimerautils
Signed-off-by: Martin Tournoij <martin@arp242.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/893
2024-04-19 15:52:22 -06:00
Martin Tournoij
9744821765 diff: use getline() instead of fgetln()
This replaces fgetln() with getline(). The main reason for this is
portability, making things easier for people who want to compile these
tools on non-FreeBSD systems.

I appreciate that's probably not the top concern for FreeBSD base tools,
but fgetln() is impossible to port to most platforms, as concurrent
access is essentially impossible to implement fully correct without the
line buffer on the FILE struct. Other than this, many generic FreeBSD
tools compile fairly cleanly on Linux with a few small changes.

Most uses of fgetln() pre-date getline() support (added in 2009 with
69099ba2ec), and there's been some previous patches (ee3ca711a8
8c98e6b1a7 1a2a4fc8ce) for other tools.

Obtained from:	https://github.com/dcantrell/bsdutils and
              	https://github.com/chimera-linux/chimerautils
Signed-off-by: Martin Tournoij <martin@arp242.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/893
2024-04-19 15:52:21 -06:00