Commit graph

15895 commits

Author SHA1 Message Date
Wolfram Schneider 271887ec35 update manpage URL 2023-12-28 10:48:04 +00:00
Jose Luis Duran a6889c1d5c bmake: Fix typo (triple S)
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/955
2023-12-27 20:24:32 -07:00
Lexi Winter 30ce26cacf nfsstat: update option strings in docs
Add the missing -q option to the nfsstat(1) manpage SYNOPSIS (it is
already documented in DESCRIPTION), and add the missing -E and -q
options to the built-in usage output.

PR:		275912
MFC after:	2 weeks
Pull Request:	https://github.com/freebsd/freebsd-src/pull/958
2023-12-27 10:57:59 -07:00
Wolfram Schneider c4368d03e5 improve handling of shell metacharacters in filenames
PR:		275967
MFC after:	1 week
2023-12-27 17:36:51 +00:00
Christos Margiolis 2b1c477d88 fortune: update mailing list search url
Markmail no longer exists.

Reviewed by:	markj
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D43209
2023-12-27 18:28:11 +02:00
Gordon Bergling c58205be7a tail(1): Fix a typo in a source code comment
- s/recieved/received/

MFC after:	3 days
2023-12-27 09:35:38 +01:00
Daniel Tameling b3ab6b5029 ncal(1): print the correct option name when -B is specified twice
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/911
2023-12-26 16:45:26 -07:00
Pin-Yi Kuo 4185d1f76a diff(1): fix a typo
On the manpage of diff(1), "when" is mistyped to "wen".

Event: Advanced UNIX Programming Course (Fall'23) at NTHU.
Signed-off-by: Pin-Yi Kuo <kuokuoyiyi@gapp.nthu.edu.tw>
Reviewed by: imp, zlei
Pull Request: https://github.com/freebsd/freebsd-src/pull/943
2023-12-26 10:07:55 -07:00
Pawel Jakub Dawidek eb4d13126d seq(1): Put separator only between the elements.
- Using non-default ('\n') separator will produce an output with the
  separator at the end of the output, eg.

	% echo "[$(seq -s ' ' 0 2)]"
	[0 1 2 ]

- The output should always be followed by a new line character. Currently:

	% seq -s ' ' 0 2
	0 1 2 %

This change makes seq(1) to behave the same way Linux seq(1):

	% echo "[$(seq -s ' ' 0 2)]"
	[0 1 2]

	% seq -s ' ' 0 2
	0 1 2
	%

Approved by:	oshogbo
Differential Revision:	https://reviews.freebsd.org/D43094
2023-12-21 21:54:05 -08:00
Dag-Erling Smørgrav 45438f9c8b find: Add a warning about -delete.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	pauamma_gundo.com
Differential Revision:	https://reviews.freebsd.org/D43162
2023-12-22 00:41:16 +01:00
Dag-Erling Smørgrav afdce08370 renice: Clean up the tests a bit.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	ngie, asomers
Differential Revision:	https://reviews.freebsd.org/D43087
2023-12-20 17:59:37 +01:00
Kyle Evans 0a82cd4f10 calendar: correct the search order for files
Include files that don't begin with a '/' are documented to search the
current directory, then /usr/share/calendar.  This hasn't been accurate
for years, since e061f95e7b ("Rework calendar(1) parser") rewrote a
lot of this.

Stash off the cwd before we do any chdir()ing around and use that to
honor the same order we'll follow for the -f flag.  This may result in
an extra lookup that will fail for the initial calendar file, but I
don't think it's worth the complexity to avoid it.

While we're here, fix the documentation to just reference the order
described in FILES so that we only need to keep it up to date in one
place.

Reviewed by:	bapt
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D42278
2023-12-17 23:53:51 -06:00
Yu-Hsun Chen 452c3e9514
mt(1): Fix typo
This is from the Advanced UNIX Programming Course (Fall’23) at NTHU.

MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/931
2023-12-17 18:49:42 +08:00
Yu-Hsun Chen 1a35ead682
mkimg(1): Fix typo
This is from the Advanced UNIX Programming Course (Fall’23) at NTHU.

MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/930
2023-12-17 18:49:28 +08:00
Yu-Hsun Chen 0ba51e3b63
fstat(1): Fix typo
This is from the Advanced UNIX Programming Course (Fall’23) at NTHU.

MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/929
2023-12-17 18:41:53 +08:00
Yu-Hsun Chen a2ee3070d8
awk(1): Fix typo
This is from the Advanced UNIX Programming Course (Fall’23) at NTHU.

MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/928
2023-12-17 18:40:29 +08:00
Kyle Evans a206524709 kdump: use print_mask_arg0 appropriately
Some callers are using print_mask_arg() when they should be using
print_mask_arg0(); the latter should be used when all flags are optional
and there's not a flag to be decoded with a 0-mask.  This turns:

nmount(0x6991e009000,0x8,0<><invalid>0)

into:

nmount(0x6991e009000,0x8,0)

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D43007
2023-12-13 10:49:03 -06:00
Raghu Ranganathan 7df526eb10
look(1): Correct the example's description
Remove an extra 'e' in the example command.  It is a prefix, not a typo.

This is from the Advanced UNIX Programming Course (Fall’23) at NTHU.

MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/913
2023-12-12 02:19:21 +08:00
Emmanuel Vadot 0fb9d5786b pkgbase: Move tr(1) to runtime
Since f7d16a627e ("certctl: Convert line endings before inspecting files.")
certctl is using tr(1). Add it to FreeBSD-runtime so we can have certctl working
without having the bloated FreeBSD-utilities.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
2023-12-09 12:21:02 +01:00
Dimitry Andric 06c3fb2749 Merge llvm-project main llvmorg-17-init-19304-gd0b54bb50e51
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-17-init-19304-gd0b54bb50e51, the
last commit before the upstream release/17.x branch was created.

PR:		273753
MFC after:	1 month
2023-12-08 18:34:50 +01:00
Alexander Motin 1f36ca5de5 vmstat: Rely on libxo for numbers humanization
This makes code cleaner, plus fixes such nonsense as humanized JSON
and XML, making all numbers raw without quotes, spaces, suffixes, etc.

MFC after:      2 weeks
2023-12-07 21:21:35 -05:00
Warner Losh bd234c0d4c sort: Only build FreeBSD-specific ALTMON_x stuff when ATLMON_1 is defined
On MacOS, we bootstrap sort. Since ALTMON_* are not defined there, the
build blows up. Since we don't need this feature for the FreeBSD build
process, and since we won't use it unless we actually install the NL
files that have this data in it, just #ifdef it out for now. In the
extremely unlikely event that the FreeBSD bootstrap/build process grows
this dependency, we can evaluate the best solution then (which most
likely is going to be not depend on the local's month names).

Fixes:			3d44dce90a (MacOS builds and github CI)
Sponsored by:		Netflix
Reviewed by:		jrtc27, jlduran@gmail.com, markj
Differential Revision:	https://reviews.freebsd.org/D42868
2023-12-07 13:42:52 -07:00
Alexander Motin 598d1ac85e vmstat: Let libxo properly humanize -m numbers
Raw numbers can be seen in json/xml or with --libxo=no-humanize.

MFC after:	2 weeks
2023-12-06 23:12:30 -05:00
Alexander Motin 6f048e7130 vmstat: Improve -z formatting for large names/values
MFC after:	2 weeks
2023-12-06 15:00:19 -05:00
Maxim Sobolev 62d47a4db4 vmstat: fix column names broken in c168508655
Loss of the trailing space in the multi-line format string has
resulted in column name being emitted as "FAILSLEEP", instead of
two columns "FAIL" and "SLEEP".
2023-12-04 17:39:21 -08:00
Pedro F. Giffuni 7e8afbb6d6 patch: fix locate_hunk in empty files
if `first_guess' is zero then main() assumes that locate_hunk has failed
and aborts the patch operation.  Instead, make sure to return 1 (the
line number) so that the patch operation can continue.

Issue originally found by Neels Hofmeyr in the regress suite of the diff
implementation for got, where the tests assume that applying a diff with
`patch' and then again with `patch -R' yields back the original file.

Obtained from:	OpenBSD (CVS patch.c,v 1.71)
2023-12-03 12:33:03 -05:00
Christos Margiolis 3d44dce90a sort: test against all month formats in month-sort
The CLDR specification [1] defines three possible month formats:

- Abbreviation (e.g Jan, Ιαν)
- Full (e.g January, Ιανουαρίου)
- Standalone (e.g January, Ιανουάριος)

Many languages use different case endings depending on whether the month
is referenced as a standalone word (nominative case), or in date context
(genitive, partitive, etc.). sort(1)'s -M option currently sorts months
by testing input against only the abbrevation format, which is
essentially a substring of the full format. While this works fine for
languages like English, where there are no cases, for languages where
there is a different case ending between the abbreviation/full and
standalone formats, it is not sufficient.

For example, in Greek, "May" can take the following forms:

Abbreviation: Μαΐ (genitive case)
Full: Μαΐου (genitive case)
Standalone: Μάιος (nominative case)

If we use the standalone format in Greek, sort(1) will not able to match
"Μαΐ" to "Μάιος" and the sort will fail.

This change makes sort(1) test against all three formats. It also works
when the input contains mixed formats.

[1] https://cldr.unicode.org/translation/date-time/date-time-patterns

Reviewed by:	markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D42847
2023-12-01 02:30:10 +02:00
Dag-Erling Smørgrav b70e57be2c tail: Clean up error messages.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D42842
2023-11-29 22:49:44 +01:00
Dag-Erling Smørgrav 621f45532c tail: Fix heap overflow in -F case.
The number of events we track can vary over time, but we only allocate
enough space for the exact number of events we are tracking when we
first begin, resulting in a trivially reproducable heap overflow.  Fix
this by allocating enough space for the greatest possible number of
events (two per file) and clean up the code a bit.

Also add a test case which triggers the aforementioned heap overflow,
although we don't currently have a way to detect it.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude, markj
Differential Revision:	https://reviews.freebsd.org/D42839
2023-11-29 22:49:38 +01:00
Mateusz Piotrowski 9f20787fe8 tail.1: Add an example for +n 1
MFC after:	3 days
Sponsored by:	Klara, Inc.
2023-11-28 17:55:58 +01:00
Mateusz Piotrowski 51c27021b2 tail.1: Lint with mandoc(1)
MFC after:	3 days
Sponsored by:	Klara, Inc.
2023-11-28 17:55:58 +01:00
Warner Losh 5e3934b15a usr.bin: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by:		Netflix
2023-11-26 22:24:01 -07:00
Warner Losh 0b8224d1cc Remove copyright strings ifdef'd out
We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by:		Netflix
2023-11-26 22:23:58 -07:00
Warner Losh 5b31cc94b1 sccs: Manual changes
For the uncommon items: Go through the tree and remove sccs tags that
didn't fit any nice pattern. If in the neighborhood, other SCM tags were
removed when they were detritis of long-ago CVS somehow in the early
mists of the project. Some adjacent copyrights stringswere removed (they
duplicated the copyright notices in the file). This also removed
non-standard formations of omission of SCCS tags (usually by adding an
extra #if 0 somewhere.

After this commit, a number of strings tagged with the 'what' @(#)
prefix remain, but they are primarily copyright notices.

Sponsored by:		Netflix
2023-11-26 22:23:58 -07:00
Warner Losh bdcbfde31e usr.bin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by:		Netflix
2023-11-26 22:23:30 -07:00
Ka Ho Ng d030761168 dirdeps: Update/fix Makefile.depend* for toolchain
This fixes make pseudo/toolchain.
2023-11-26 20:50:13 -05:00
Kyle Evans e4967d4d48 lockf: switch to strtonum() for parsing timeout
Convert waitsec to a long long to be able to hold the full domain of
alarm(3) timeout on all platforms, and let strtonum(3) handle the input
validation.  strtonum(3) also happens to provide a neater interface for
error handling, and it already includes our pre-existing empty input
check.

Sponsored by:	Klara, Inc.
2023-11-25 22:41:05 -06:00
Kyle Evans 09a7fe0a55 lockf: allow locking file descriptors
This is most useful inside a shell script, allowing one to lock just
portions of a script rather than having to wrap the entire script in a
lock.

PR:		262738
Reviewed by:	0mp, allanjude (both previous versions)
Co-authored-by:	Daniel O'Connor <darius@dons.net.au>
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D42718
2023-11-25 22:15:05 -06:00
Kyle Evans 296a5a4db1 lockf: add some tests
Provide basic coverage for the existing options, nothing deeper (e.g.,
pipe closing behavior) is tested in this set.

Reviewed by:	allanjude
Feedback from:	des
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D42714
2023-11-25 22:09:58 -06:00
Alexander Melkov 18425c19ca lockf: don't hold stdin/stdout/stderr open
None of these are essential in the lockf monitor (parent post-fork), so
close them to maintain the illusion that lockf hasn't been inserted into
the pipeline.  This ensures that the correct effects happen on other
programs in the pipeline if the locked command closes or redirects these
elsewhere.

The original patch used -s to close stdout/stderr rather than closing
them unconditionally, but it's not clear that we really care that much.
kevans dropped that part when taking the patch, patch is otherwise by
listed author.

PR:		112379
Reviewed by:	0mp, allanjude (both earlier version), kevans
Feedback from:	des
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D42713
2023-11-25 22:09:27 -06:00
Kyle Evans 35095fd23f lockf: correct omission in the usage statement
The -w flag was added without being noted in the usage statement; fix
that now.

While we're here, re-sort the getopt() string.

Reviewed by:	0mp, allanjude, des
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D42712
2023-11-25 22:08:40 -06:00
Kyle Evans 3041e6950d lockf: hide unavailable error with -n -s
The error message is expected, allow -s to suppress just that one since
it would loosely fall under the definition of "failure to acquire the
lock" described in the manpage for the -s option.

Reviewed by:	0mp, allanjude
Feedback from:	des
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D42711
2023-11-25 22:08:40 -06:00
Arthur Kiyanovski fec0c3fb08 Add myself (akiyano) to calendar.freebsd
Approved by: cperciva (mentor)
2023-11-20 20:50:52 +00:00
Alexander Motin d282baddb0 Add interface NVME to devstat
This allows to list only NVMe devices in systat, iostat, vmstat, etc.
Previously those were counted as OTHER.
2023-11-15 23:03:40 -05:00
Alexander Motin 7b21c447fb vmstat: Make disks reporting some more reasonable
MFC after:	1 month
2023-11-15 22:56:51 -05:00
Brooks Davis ec4c2adb50 Retire LLD_IS_LD option
The option was added to parallel the CLANG_IS_CC which was removed in
commit 20a66ab4bf.

Reviewed by:	imp, dim, emaste
Differential Revision:	https://reviews.freebsd.org/D42575
2023-11-13 21:34:14 +00:00
Kristof Provost 4b5634f4e5 netstat: fix missing tab in icmp6 output
PR:		275044
Submitted by:	sigsys@gmail.com
Reviewed by:	kp
MFC after:	1 week
2023-11-12 18:24:39 +01:00
Andrew Turner 83771b1914 llvm: Reduce overlinking with the minimal llvm
We only need to link against libz and libzstd when linking against the
fill libllvm, libllvmminimal doesn't use either library. Move adding
libz and libzstd to the list of libraries to link against to where
we decide to use the full libllvm.

Reported by:	Cristian Marussi <Cristian.Marussi@arm.com>
Reported by:	Colin S. Gordon <csgordon@fastmail.com>
Reviewed by:	dim
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42528
2023-11-10 09:57:44 +00:00
Ka Ho Ng f5b3e68629 dirdeps: Update clang-tblgen dependencies
This unbreaks clang-tblgen build against the host pseudo platform.

Sponsored by:	Juniper Networks, Inc.
MFC after:	3 days
Reviewed by:	sjg
Differential Revision:	https://reviews.freebsd.org/D42481
2023-11-08 19:43:29 -05:00
Kyle Evans e116e040f3 grep: don't rely on implementation-defined malloc(0) behavior
The very few places that rely on malloc/calloc of a zero-size region
won't attempt to dereference it, so just return NULL rather than rolling
the dice with the underlying malloc implementation.

Reported by:	brooks, Shawn Webb
2023-11-04 21:19:12 -05:00
Kenneth D. Merry 83823d063a Add IBM TS1170 density codes and specs.
These were obtained from a drive, but they agree with the IBM
documentation.

The bpi/bpmm values are the same as TS1160, but the number of
tracks is much larger (18944 tracks vs 8704 for TS1160).  The tapes
are also longer, 1337m total.  (According to the MAM on a sample JF
tape.  I don't have a JE tape handy to compare.)  The end result
is a 50TB raw capacity (150TB compressed) for TS1170 with a JF
cartridge vs 20TB raw capacity (60TB compressed) for TS1160 with
a JE cartridge.

lib/libmt/mtlib.c:
	Add the TS1170 density codes to the denstiy table in libmt.

usr.bin/mt/mt.1:
	Add the TS1170 density codes and specs to the density table
	in the mt(1) man page.  As usual for TS drives, there is an
	encrypted and non-encrypted density code (0x79 and 0x59
	respectively).

MFC after:	3 days
Sponsored by:	Spectra Logic
2023-10-31 15:20:36 -04:00
Stephen J. Kiernan e5b786625f dirdeps: Add missing dependency files
Some leaf directories were missing Makefile.depend files or needed
architecture-specific Makefile.depend.* files.
2023-10-29 17:08:29 -04:00
Kyle Evans 767c97c501 install: handle -m +X more accurately
As described by chmod(1), +X in the mode may be used to optionally set
the +x bit if the file is a directory if any of the execute/search bits
are set in the original mode.  The latter is not applicable because we
assume -m is a fresh mask, but a functional +X could be useful in the
former case if we're passing along a common INSTALL_MODE that's designed
to install either 0644 or 0755 depending simply on whether it's a
directory or not.

Reviewed by:	des
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D42273
2023-10-18 21:44:05 -05:00
Jose Luis Duran 3b5c984572 Remove $FreeBSD$: one line sh-pattern
Remove the $FreeBSD$ pattern added to the tests, as well as fixing the
mkimg_test.sh script to stop adding it when we rebase the tests.

Reviewed by: imp, emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/870
2023-10-18 09:15:18 -06:00
Warner Losh d2abbfede5 mkimg: Regenerate all the tests for gpt
Recent changes to mkimg has changed the generated GPT images to be more
correct. Use make rebase to regenerate the baseline.

Sponsored by:		Netflix
2023-10-17 15:56:19 -06:00
Warner Losh 83bd5a833c mkimg_test: remove vtoc8 images, they aren't needed
vtoc8 support expired with sparc64 removal, so remove them all.

Sponsored by:		Netflix
2023-10-17 15:56:19 -06:00
Warner Losh 9b42d3e12f mkimg: Ensure GPT Entry Array is at least 16k
UEFI v2.10 Section 5.3 documentes that the minimum reserved space after
the GPT header be at least 16kB. Enforce this minimum. Before, we'd only
set the number of entries to be the unpadded size. gpart's selective
enforcement of aspects of the GPT standard meant that these images would
work, but couldn't be changed (to add a partition or grow the size of a
partition). This ensures that gpart's overly picky standards don't cause
problems for people wishing to, for example, resize release images.

MFC after:		1 day (we want this in 14.0)
PR:			274312
Sponsored by:		Netflix
Reviewed by:		emaste
Differential Revision:	https://reviews.freebsd.org/D42245
2023-10-17 11:14:23 -06:00
Brooks Davis 8f9f7b4a42 procstat auxv: widen COMM column to MAXCOMLEN
For reasons unknown, procstat subcommands typically display the command
in a 16+overflow column format.  However, the command may be up to
MAXCOMLEN (19) characters long causing the column to spill into the next
one. Since there's plenty of room in the auxv case, bump the column
width up to 19 to avoid this issue.  While this is a format change 1)
users who want to parse the data should use libxo output and 2) this
makes it possible to parse reliably with cut.

Reviewed by:	markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42202
2023-10-16 17:58:54 +01:00
Xin LI 8f75390c66 file: Support testing multiple magic files.
This is based on upstream b74150490be904801378b2712fe0d532e1700124
but adapted to ATF.

Reviewed by: jlduran@gmail.com, markj, vangyzen
Differential Revision: https://reviews.freebsd.org/D42129
2023-10-09 10:44:42 -07:00
Jose Luis Duran 0d3a87569f file_test: Fix file test
Trimming of the line feed is no longer necessary after
d993c6b0db

Currently the tests:

  - bcachefs2
  - gpkg-1-zst
  - multiple

are failing, but a fix will be committed upstream.

This also reverts c5e957ad4 "file: fix test case for gpkg by removing the extra \n."

MFC after:	3 days
2023-10-08 21:44:14 -07:00
Dag-Erling Smørgrav 2821a7498f libfetch, fetch: Stop recommending the use of ca_root_nss.
MFC after:	3 days
Reviewed by:	kevans, emaste
Differential Revision:	https://reviews.freebsd.org/D42119
2023-10-08 06:35:15 +02:00
Ed Maste 6e5dcc6113 Connect mitigations(7) to the build
Also add some cross references.

Sponsored by:	The FreeBSD Foundation
2023-10-05 21:48:27 -04:00
Ed Maste aaff6a85ff fortune: use 115200 in serial example
Commit 4722ceb7d5 switched the default serial rate to 115200 bps.
Follow suit in the freebsd-tips fortune example.

Reviewed by:	bcr
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41495
2023-10-05 08:14:23 -04:00
Baptiste Daroussin e19b2ef976 genl: add a monitor subcommand
usage:
$ genl monitor <family> <multicats group>

this subcommand allows to monitor the message from a multicast group
of a given family when received.

If it knows how to parse the messages received it will dump the decoded
version, otherwise it will just inform a new message has been received

So far it only knows how to parse nlctrl notify messages, but the plan
to allow to make the parsing extensible via lua scripts

Differential Revision:	https://reviews.freebsd.org/D40372
2023-10-05 12:53:47 +02:00
Baptiste Daroussin 61ba55bcf7 bsddialog: import version 1.0 2023-10-04 18:12:03 +02:00
Jose Luis Duran f147cf0ee2 dtc: Ensure it is built in C++17 mode
Explicitly specify the C++ standard to be used in the Makefile.
This prevents macOS cross-builds from using the default gnu++98 and
fail.  This syncs dtc with upstream commit
39a58cfaab7d55c7975ebf905d859ba91a369fa0.

Reviewed by: emaste
Fixes: 29a55fd09b ("dtc: Sync with upstream commit 26a0fe5")
Differential Revision: https://reviews.freebsd.org/D42006
2023-09-29 09:26:51 -04:00
Dag-Erling Smørgrav d9d69a6f6f split: Improve GNU compatibility.
* Like GNU split, turn autoextend back on if given -a0.
* Add a test case that verifies that -a<non-zero> turns autoextend off.
* Add a test case that verifies that -a0 turns autoextend back on.

Sponsored by:	Klara, Inc.
Reviewed by:	christos, kevans
Differential Revision:	https://reviews.freebsd.org/D42011
2023-09-28 18:30:16 +02:00
Dag-Erling Smørgrav d7399551b0 split: Further option parsing improvements.
* Whenever possible, use strtonum() to parse numeric arguments.
* Improve usefulness and consistency of error messages.
* While here, fix some type and style issues.

Sponsored by:	Klara, Inc.
Reviewed by:	christos, kevans
Differential Revision:	https://reviews.freebsd.org/D42010
2023-09-28 18:30:15 +02:00
Baptiste Daroussin 0fcececbac nvi: import version 2.2.1 2023-09-27 18:14:45 +02:00
Alan Somers 1e3214571b printenv: fix typo in a comment
[skip ci]

Reported by:	gbe
MFC with:	c989957f28
Sponsored by:	Axcient
2023-09-27 09:02:58 -06:00
Jose Luis Duran 29a55fd09b dtc: Sync with upstream commit 26a0fe5
- 0206c0f ("Handle top-level /delete-node/ directives.")
- d612a9e ("Remove C++11 standard constrain")
- Remove extra white lines after the $FreeBSD$ tag removal

Reviewed by:	kevans (earlier), theraven, emaste
Differential Revision: https://reviews.freebsd.org/D41482
2023-09-26 12:59:17 -04:00
Wang-Yan-Hao c989957f28 printenv: Add test for printenv.
Reviewed by:	asomers
Differential Revision: https://reviews.freebsd.org/D41468
2023-09-25 10:10:20 -06:00
John Baldwin eba230afba Purge more stray embedded $FreeBSD$ strings
These do not use __FBSDID but instead use bare char arrays.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41957
2023-09-25 07:54:56 -07:00
John Baldwin f2f73fa7bd factor: Remove an empty #ifdef __FBSDID clause 2023-09-23 15:03:25 -07:00
Ed Maste 407e2d7cf1 lastcomm: update i386 tests for additional timestamp resolution
Fixes: 6f4ce7e89b ("lastcomm: improve timestamp display")
Sponsored by:	The FreeBSD Foundation
2023-09-22 14:47:03 -04:00
Ed Maste f079ef5b6a lastcomm: update amd64 tests for additional timestamp resolution
Fixes: 6f4ce7e89b ("lastcomm: improve timestamp display")
Sponsored by:	The FreeBSD Foundation
2023-09-22 13:54:24 -04:00
Michael Paepcke 6f4ce7e89b lastcomm: improve timestamp display
Adjust the lastcomm command to output timestamps with a precision of
seconds.

Reported by:	Dr. Andreas Longwitz
Reviewed by:	emaste
Relnotes:	Yes
Sponsored by:	DSS Gmbh
Pull Request:	https://github.com/freebsd/freebsd-src/pull/802
2023-09-22 10:59:45 -04:00
Ed Maste d5ef73a71f Add deprecation notices to publickey(5) tools
Reviewed by:	imp, manu
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40144
2023-09-20 07:31:14 -04:00
Mateusz Piotrowski cd056e3cd4 at.man: Move examples to the EXAMPLES section
MFC after:	3 days
2023-09-18 23:59:10 +02:00
Mateusz Piotrowski d13b8b3e72 at.man: Fix mdoc(7) macro usage
MFC after:	3 days
2023-09-18 23:59:10 +02:00
Simon J. Gerraty 9887588385 Merge bmake-20230909
Merge commit '1012cf15f75d1e9048779abd07270a37cdba590a'
2023-09-17 18:09:37 -07:00
Dag-Erling Smørgrav caf5283fc9 grep: Suppress EISDIR when reading.
MFC after:	1 week
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
2023-09-08 18:19:46 +00:00
Wolfram Schneider cd89fe3923 switch groff parameter -man to -mandoc for new groff release 1.23.0
PR: 273565
2023-09-07 14:59:12 +00:00
Ed Maste ee12faa062 bspatch: use C23 overflow checking math now that it is available
Reviewed by:	des
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41771
2023-09-07 10:36:50 -04:00
Dag-Erling Smørgrav cb8dd292c7 less: We have <stdckdint.h> now.
Reviewed by:	delphij
Differential Revision:	https://reviews.freebsd.org/D41736
2023-09-07 06:40:14 +00:00
Wolfram Schneider 035f7c9a36 switch groff parameter -man to -mandoc
groff 1.23.0 changed the semantics of the -man parameter, and many
manual pages are not rendered. The -mandoc parameter brings back
the old behavior, as in groff 1.22.4 and earlier.

PR: 273565, 273245

Reviewed by:	emaste, bapt
MFC after: 1 week for all supported branches (stable/12, 13, 14)
Differential Revision:	https://reviews.freebsd.org/D41737
2023-09-07 06:28:24 +00:00
Dag-Erling Smørgrav aacbe73842 unifdef: Handle redefined symbols correctly.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D41758
2023-09-06 17:11:13 +00:00
Baptiste Daroussin b37a6938e3 diff3: make the diff3 -E -m and diff3 -m behaviour match gnu diff3
In gnu diff3 3 way merging files where the new file and the target are
already the same will die and show what has failed to be merged except
if -E is passed in argument, in this case it will finish the merge.

This difference in behaviour was breaking one of the etcupdate testcase
with bsd diff3

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D41730
2023-09-06 17:06:39 +02:00
Dag-Erling Smørgrav 117c54a78c split: Fix linecount parsing.
The “undocumented kludge” which unfortunately can't be dropped for backward compatibility reasons was prone to segfaulting and would improperly allow a new linecount when one was already set.  Fix these issues and add regression tests.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D41757
2023-09-06 03:29:31 +00:00
Dag-Erling Smørgrav 851bf856d1 split: Code cleanup.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D41756
2023-09-06 03:29:31 +00:00
Dag-Erling Smørgrav cbea5eddb1 split: Add missing test cases.
This adds test cases for c4f7198f47 and ac17fc816e.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D41755
2023-09-06 03:29:28 +00:00
Kyle Evans 3141e51d2e localedef: add newlines to error messages
These won't be added elsewhere, so add a little bit of room to make
these messages a little easier to read.  The existing set is a mixed
bag, there are somewhere in the ballpark of 45, 46 printfs to stderr and
19 of those had newlines.

Reviewed by:	yuripv
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D41693
2023-09-05 14:08:59 -05:00
Kyle Evans 3a7ffe206c localedef: expand the default charmap
POSIX defines a number of other control characters as well as
alternative aliases for some that should be provided in the default set,
so let's go ahead and add those.

Reviewed by:	bapt, yuripv
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D41692
2023-09-05 14:08:59 -05:00
Kyle Evans 07bc20e474 localedef: correct definition of right-parenthesis in default charmap
It turns out that right parentheses do exist and are different than
left parentheses, so let's switch to that.

Sponsored by:	Klara, Inc.
2023-09-02 00:58:35 -05:00
Mark Johnston d5b5497e10 m4 tests: Update tests after $FreeBSD$ removal
Fixes:	d54a7d3373 ("Remove $FreeBSD$: one-line m4 tag")
2023-08-23 15:44:36 -04:00
Dag-Erling Smørgrav 7addfafe73 unifdef: Vendorize. 2023-08-21 19:52:27 +02:00
Dag-Erling Smørgrav e738085b94 Remove my middle name. 2023-08-17 15:08:30 +02:00
Warner Losh 6ef644f588 Remove $FreeBSD$: one-line lua tag
Remove /^--\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:34 -06:00
Warner Losh ae992a336e Remove $FreeBSD$: one-line catalog
Remove /^\s*\$\s*\$FreeBSD\$$\n/
2023-08-16 11:55:26 -06:00
Warner Losh 05248206f7 Remove $FreeBSD$: one-line bare tag
Remove /^\s*\$FreeBSD\$$\n/
2023-08-16 11:55:20 -06:00
Warner Losh b2c76c41be Remove $FreeBSD$: one-line nroff pattern
Remove /^\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:15 -06:00
Warner Losh fa9896e082 Remove $FreeBSD$: two-line nroff pattern
Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:10 -06:00
Warner Losh d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Warner Losh c857356409 Remove $FreeBSD$: alt one-line .c pattern
Remove /^\s*__RCSID\("\$FreeBSD\$"\);\n/
2023-08-16 11:54:53 -06:00
Warner Losh da5432eda8 Remove $FreeBSD$: alt two-line .c pattern
Remove /^\s*__RCSID\("\$FreeBSD\$"\);\n\n/
2023-08-16 11:54:48 -06:00
Warner Losh 1d386b48a5 Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:42 -06:00
Warner Losh e5d258c9e5 Remove $FreeBSD$: two-line .c pattern
Remove /^#include\s+<sys/cdefs.h>.*$\n\s+__FBSDID\("\$FreeBSD\$"\);\n/
2023-08-16 11:54:34 -06:00
Warner Losh 2a63c3be15 Remove $FreeBSD$: one-line .c comment pattern
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
2023-08-16 11:54:29 -06:00
Warner Losh 42b388439b Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
2023-08-16 11:54:23 -06:00
Warner Losh b3e7694832 Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-16 11:54:16 -06:00
Warner Losh d54a7d3373 Remove $FreeBSD$: one-line m4 tag
Remove /^dnl\s*\$FreeBSD\$.*$\n/
2023-08-16 11:54:09 -06:00
Doug Rabson 3af3571ca5 netstat(1): fix manpage date
MFC after:	1 week
2023-08-16 15:13:42 +01:00
Doug Rabson 182e8ae26d netstat(1): teach netstat to attach to jails
Add -j <jail> flag to netstat(1) to allow access to network information
from a jail.

MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D41446
2023-08-16 14:05:13 +01:00
Warner Losh bf46512a54 systat: Remove obsolete copyright string
This is unused, so remove it. We don't put a copyright string in most of
the other binaries. This one doesn't need one either.

Sponsored by:		Netflix
2023-08-15 21:22:50 -06:00
Ed Maste bfe6a0afaa etdump: warn only once for non El Torito bootable ISO images
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39869
2023-08-15 09:40:39 -04:00
Xin LI f80a33ea41 MFV: less v643.
MFC after:	2 weeks
2023-08-13 00:13:31 -07:00
Enji Cooper f05948d4e9 cpuset(8): move to /bin/
Summary:
This change moves /usr/bin/cpuset to /bin/cpuset so it is more readily
available on hosts where the /usr partition might not be mounted at the
time / has been mounted.

Remove some complexity from rc.subr(8) since /bin is assumed to always
be present if/when / is mounted.

MFC after:	2 weeks
MFC with:	0661f93892, 271d552379af

Test Plan:
- Test out rc.subr change.
- Confirm that the installation logic does what's needed.

Relnotes:	yes (moving cpuset may impact strict file permissions/mode checking)
Reviewers:	kevans
Subscribers:	imp
Differential Revision: https://reviews.freebsd.org/D40057
2023-08-11 00:49:02 -07:00
Enji Cooper c45e66dca3 Unbreak usr.bin/dc with OpenSSL 3
OpenSSL's BN_zero API has had a void return value since 1.1.x: chase the
change to unbreak the build on OpenSSL 3.x with MK_GH_BC == no.

MFC after:	2 weeks
Reviewed by:	emaste, kevans
Differential Revision:	https://reviews.freebsd.org/D41410
2023-08-10 23:33:44 -07:00
Poul-Henning Kamp 4ff782c06a tcopy: Pick up max blocksize from sysctl kern.maxphys 2023-08-10 14:58:18 +00:00
Pedro F. Giffuni 9610cbc09e patch: don't run off the end of path if it ends in '/'.
Found by fuzzing (afl) in OpenBSD.

Obtained from:	OpenBSD (CVS 1.65)
2023-08-06 22:27:27 -05:00
Martin Matuska b5a3a89c50 unzip: swtich to bsdunzip from libarchive
Unzip from FreeBSD has been ported to libarchive.
Change usr.bin/unzip to use bsdunzip from libarchive.

Differential Revision:	https://reviews.freebsd.org/D41239
PR:			272845 (exp-run)
MFC after:		1 month
2023-08-04 12:45:41 +02:00
Ed Maste 8a5c836b51 man: fix man -K search
Quote re arg to grep in case it has spaces, and quote [:blank:] tr arg
to avoid the shell interpreting [].

PR:		272729
Reviewed by:	Mina Galić <freebsd@igalic.co>
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41282
2023-08-02 16:46:57 -04:00
Ed Maste 77f6be4484 retire SHARED_TOOLCHAIN knob
Toolchain components were historically statically linked.  They became
normal dynamically linked executables in commit 6ab18ea64d.  There is
no need to keep a special case build option for the toolchain; users who
want statically linked toolchain (or any other) components can use the
existing NO_SHARED knob.

Reviewed by:	dim, sjg
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41266
2023-08-01 20:13:22 -04:00
Mark Johnston 2682a15527 xargs tests: Disable the test added in commit eab91d0081
This test has been triggering OOM kills in CI runs since it triggers an
allocation of 16GB.  Temporarily disable the test until the problem is
solved one way or another.
2023-07-31 10:44:32 -04:00
Stefan Eßer 382af2f8d7 usr.bin/gh-bc: fix Makefile for WITHOUT_NLS_CATALOGS case
Some macro definitions had been moved into a Makefile section
that depends on MK_NLS_CATALOGS != "no", leading to LTO and the
installation of tests being disabled in the WITHOUT_NLS_CATALOGS
case.

Reported by:	Yuri <yuri@aetern.org>
2023-07-29 20:57:32 +02:00
Mike Karels 372e3d561d netstat -i: compute most field widths dynamically
The network and address fields were sometimes truncated for netstat -i
without -W, and often much too wide for netstat -i with the -W option.
Fields such as normal packet counts often overflowed.  As a result,
columns didn't line up, and large white spaces made it harder to
follow a line across the display.  Change the code to compute the
required field sizes for network, address, and various packet counts.
Hoist the code to format network and address into a subroutine that
can be called twice, once to measure the required field widths,
and once to emit the values.  Use separate field widths for input
and output packets, byte counts, and error and drop counters.
These are left at defaults (the preceding values) with the -h
option, in which case the fields have a limited total width.
An extra space is included between the Network and Address, which
otherwise seemed too close.

Change the mention of -W with -i in the man page to say that most
field widths are computed dynamically in this case.

MFC after:	1 week
Reviewed by:	sjg, glebius
Differential Revision:	https://reviews.freebsd.org/D41160
2023-07-26 10:56:52 -05:00
Marius Strobl 4ef1c6f75d base: Remove support for the VTOC8 partitioning scheme
The removal of the sparc64 support in February 2020 obsoleted the
VTOC8 partitioning scheme as no other FreeBSD platform makes use
of it. Moreover, the code is bitrotting as nothing defines e. g.
LOADER_VTOC8_SUPPORT any more and, thus, should go now, too. With
this change, the following commits are reverted as far as VTOC8
is concerned and parts haven't already previously been deleted
along with prior sparc64 removals:
094fcb157d
a7d366e958
ba8d50d08b

The alignment example d9711c28ef
added to the VTOC8 section of gpart.8 is folded into the MBR one.

This should finally conclude the deorbit of sparc64-specific bits.

        We had joy, we had fun
        we ran Unix on a Sun.
        But that source and the song
        of FreeBSD have all gone.

Credits to Michael Bueker for the original "Unix on a Sun" and Rod
McKuen for the "Seasons in the Sun" lyrics.
2023-07-26 13:16:12 +02:00
Dimitry Andric f576172682 Move LIBADD lines from usr.bin/clang/*/Makefile one level up
Some utilities under usr.bin/clang were only linked to libz, while most
others were linked to libz and libzstd. Make this consistent, and remove
repetition, by moving these LIBADD lines to usr.bin/clang/clang.prog.mk
and usr.bin/clang/clang.prog.mk.

MFC after:	3 days
2023-07-23 22:04:55 +02:00
Ed Maste 8f8da1bcc7 seq: style(9) cleanup
This is in part for diff reduction with OpenBSD.

Sponsored by:	The FreeBSD Foundation
2023-07-21 10:17:24 -04:00
Dag-Erling Smørgrav a122c3c492 unifdef: Fix case where a multiline comment follows a directive.
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D41026
2023-07-19 14:47:23 +00:00
Jessica Clarke 587458b7d6 rpcgen: Perform shell-style word expansion on RPCGEN_CPP
Up until recently, CPP has been a list of space-separated words, with no
quotes, backslashes or other characters with special meaning to a shell.
However, as of 8fad2cda93, (escaped) quotes appear in CPP, and the
rudimentary parser in rpcgen is insufficient, since it will leave the
escaped quotes as escaped rather than performing one level of expansion
as would be done by a shell (whether in a script or a Makefile).

Rather than hack around this in all the places RPCGEN_CPP gets set,
implement proper expansion inside rpcgen. Note that this only deals with
a subset of shell syntax, since we don't handle any of:

  | & ; < > ( ) $ ` * ? [ # ˜ = %

having special meaning (with the exception of how a backslash behaves
inside double quotes, where \$ means a literal $ inside double quotes
but \a means a literal \a), instead using their literal value, but those
are all reasonable restrictions, and can be worked around by avoiding
their use; what's important is that we get the quoting and splitting
right.

This fixes -Winvalid-pp-token spew during build${libcompat}.

Reviewed by:	brooks
Fixes:		8fad2cda93 ("bsd.compat.mk: Provide new CPP and sub-make variables")
Differential Revision:	https://reviews.freebsd.org/D41013
2023-07-14 02:35:25 +01:00
Jose Luis Duran d234c8228c xargs: Install missing test output.
Fixes:		eab91d0081
MFC after:	1 week
Reviewed by:	des
Differential Revision:	https://reviews.freebsd.org/D41033
2023-07-13 23:39:51 +00:00
Dag-Erling Smørgrav c65845d0bb xargs: Fix test case count.
MFC after:	1 week
Sponsored by:	Klara, Inc.
2023-07-13 21:40:36 +00:00
Dag-Erling Smørgrav eab91d0081 xargs: Prevent overflow in linelen calculation if nargs is large.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D41023
2023-07-13 21:35:23 +00:00
Daniel Tameling 1048a870e3 xargs: disallow -R0 and -L0
Both cases were interpreted as these flags are unset. This meant that
-R0 got converted to -R5 and that -L0 didn't have any effect at all.
Since make at most 0 replacements isn't useful and since call utility
for every 0 lines read doesn't make sense, throw an error for these
two cases.

MFC after:	1 week
Reviewed by:	des, kevans
Differential Revision:	https://reviews.freebsd.org/D41022
2023-07-13 21:35:23 +00:00
Daniel Tameling 202adb2236 xargs: fix -R so that it accepts negative numbers again
fbc445addf converted the parsing of arguments to strtonum but made
the accepted range for -R too restrictive. As documented in the man
page, it should accept negative numbers.

Added a test for this, which was provided by Jose Luis Duran.

Fixes:		fbc445addf
MFC after:	1 week
Reviewed by:	des, kevans
Differential Revision:	https://reviews.freebsd.org/D41021
2023-07-13 21:35:23 +00:00
Jessica Clarke 9d843ba324 rpcgen: Clarify behaviour for idx
The re-initialisation of idx in the later else branch is a bit hidden,
and results in deviation from the earlier two paths. Use more consistent
code instead to make it abundantly clear what's going on.
2023-07-13 06:22:59 +01:00
Jessica Clarke e17dd921a2 ldd: Use __PATH_RTLD("32") over _COMPAT32_PATH_RTLD
This will allow the latter to be removed, reducing the boilerplate
needed for a new libcompat.

Reviewed by:	kib, brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40934
2023-07-09 18:50:24 +01:00
Martin Matuska e64780fbc3 xinstall: do not use copy_file_range(2) when BOOTSTRAPPING
Reported by:	arichardson
2023-07-09 01:25:23 +02:00
Martin Matuska 5a50d52f11 xinstall: use copy_file_range(2) with fallback to previous behavior
This allows to use special filesystem features like server-side
copying on NFS 4.2 or block cloning on OpenZFS 2.2.

Note: copy_file_range(2) is not used when a digest calculation is
requested as this would require to read the input file twice.

Reviewed by:	asomers, imp, rmacklem
Differential revision:	https://reviews.freebsd.org/D40898
2023-07-08 21:51:21 +02:00
Alfonso Gregory cccdaf507e Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:18 -06:00
Alfonso Gregory 1a7ac2bd24 Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:18 -06:00
Alfonso Gregory a1b6427a97 Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:18 -06:00
Alfonso Gregory 498a0a9c61 Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:18 -06:00
Mohamed Akram b35ea9bac9 man(1): use gzcat for .gz files
POSIX zcat appends the .Z suffix to file arguments causing the command to fail
with .gz files.

Signed-off-by: Mohamed Akram <mohd.akram@outlook.com>

Reviewed by:	markj
MFC after:	2 weeks
Pull Request:	https://github.com/freebsd/freebsd-src/pull/789
2023-07-04 15:42:55 -04:00
Eugene Grosbein 5aee3e14d4 syslog.3: document ident[N] format
When libc switched to generation of logs as per RFC 5424,
that change broke application ability to insert specific process id
using ident[N] format, the feature existed for decades.
Some processes rely on it (including logger and syslogd).

Later the regression was fixed but the feature remained undocumented.
This change documents it.

MFC after:	1 week
2023-07-03 19:46:40 +07:00
Simon J. Gerraty fcc8d72702 Separate dependencies on tools built for host.
When generated files depend on tools that need to be built for host,
we need to carefully separate them for the DIRDEPS_BUILD so we
only build them once.

Reviewed by:	stevek
Sponsored by:	Juniper Networks, Inc.
2023-06-29 23:52:03 -07:00
Dag-Erling Smørgrav 78baa63209 stdbuf: Code cleanup.
* Factor out path-setting code.
* Normalize usage().
* Remove unnecessary switch case.

Sponsored by:	Klara, Inc.
Reviewed by:	kevans, imp
Differential Revision:	https://reviews.freebsd.org/D40799
2023-06-29 15:30:05 +00:00
Dag-Erling Smørgrav b5b9eaa962 Restore and document -ps / -nps option.
Sponsored by:	Klara, Inc.
Reviewed by:	pauamma_gundo.com, pstef, kevans
Differential Revision:	https://reviews.freebsd.org/D40788
2023-06-29 13:59:49 +00:00
Yuri Pankov 24ec316c13 Correctly spell illumos (all lowercase) in man pages
From illumos FAQ:

    "illumos (pronounced i-llu-MOS and written in lowercase)"
2023-06-29 13:14:45 +02:00
Simon J. Gerraty 148ee84570 Merge bmake-20230622
Merge commit '3e39ce563b9ba25883e5aa37d9799eda9e57c1e0'
2023-06-27 13:57:58 -07:00
Cy Schubert e36b028933 systat: Chase 70ea484e3e, removing vdev_cache
As of 70ea484e3e vdev_cache has been removed. Stop reporting on it.
Without this systat reports:

	sysctl(kstat.zfs.misc.vdev_cache_stats.misses...) failed:
	No such file or directory

Reviewed by:		mav
Differential Revision:	https://reviews.freebsd.org/D40742
2023-06-27 11:34:29 -07:00
John Baldwin 1e80d4b188 xo: Disable -Wunused-but-set-variable.
Presumably these warnings will be fixed upstream at some point.

contrib/libxo/xo/xo.c:99:9: error: variable 'hflag' set but not used [-Werror,-Wunused-but-set-variable]
    int hflag = 0, jflag = 0, tflag = 0,
        ^
contrib/libxo/xo/xo.c:99:20: error: variable 'jflag' set but not used [-Werror,-Wunused-but-set-variable]
    int hflag = 0, jflag = 0, tflag = 0,
                   ^
contrib/libxo/xo/xo.c:99:31: error: variable 'tflag' set but not used [-Werror,-Wunused-but-set-variable]
    int hflag = 0, jflag = 0, tflag = 0,
                              ^
contrib/libxo/xo/xo.c💯2: error: variable 'zflag' set but not used [-Werror,-Wunused-but-set-variable]
        zflag = 0, qflag = 0, star1 = 0, star2 = 0;
        ^
contrib/libxo/xo/xo.c💯13: error: variable 'qflag' set but not used [-Werror,-Wunused-but-set-variable]
        zflag = 0, qflag = 0, star1 = 0, star2 = 0;
                   ^

Reviewed by:	sjg
Differential Revision:	https://reviews.freebsd.org/D40668
2023-06-27 10:19:32 -07:00
Warner Losh a1db51dbdb unzip(1): Comma after e.g.
Add comma after e.g. to make igor happy (oh, and I suppose to conform to
normal English grammar rules).

Sponsored by:		Netflix
2023-06-27 10:58:40 -06:00
Mingye Wang a227908571 unzip: add -O/-I encoding support
These are for compatibility with the info-zip version of unzip.

PR: 271657
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/752
2023-06-27 10:55:26 -06:00
Mohamed Akram 8edb6fb572 man(1): Support custom sections
PR: 271830
Signed-off-by: Mohamed Akram <mohd.akram@outlook.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/764
2023-06-27 07:51:27 -06:00
Tom Hukins e495600ce3 netstat(1): Use simpler language
Reviewed by: imp, Mina Galić
Pull Request: https://github.com/freebsd/freebsd-src/pull/771
2023-06-26 17:07:27 -06:00
Tom Hukins 3df959b5fe nohup(1): link to a related manual page
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/783
2023-06-26 16:36:25 -06:00
Ed Maste 5dae8905a5 seq: combine asprintf return value checks
Error handling is identical for all of these failure cases.

Sponsored by:	The FreeBSD Foundation
2023-06-25 19:57:17 -04:00
Benedict Reuschling 764464af49 Fix spelling of "behavior" to be consistent with the rest of the file 2023-06-23 05:48:01 +00:00
Dimitry Andric a324c34037 Merge llvm-project release/16.x llvmorg-16.0.4-0-gae42196bc493
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-16.0.4-0-gae42196bc493 (aka 16.0.4 release).

PR:		271047
MFC after:	1 month
2023-06-22 20:22:43 +02:00
Dimitry Andric 1ac55f4cb0 Merge llvm-project release/16.x llvmorg-16.0.1-0-gcd89023f7979
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-16.0.1-0-gcd89023f7979 (aka 16.0.1 release).

PR:		271047
MFC after:	1 month
2023-06-22 20:22:20 +02:00
Dimitry Andric bdd1243df5 Merge llvm-project main llvmorg-16-init-18548-gb0daacf58f41
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-16-init-18548-gb0daacf58f41.

PR:		271047
MFC after:	1 month
2023-06-22 20:20:56 +02:00
Dag-Erling Smørgrav db4c5b8a05 m4: Miscellaneous man page fixes.
Sponsored by:	Klara, Inc.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D40701
2023-06-21 20:59:03 +00:00
Dag-Erling Smørgrav 6c9ed64c94 m4: Add -G option which reverses -g.
This matches GNU m4's -G / --traditional option, and although BSD m4 in non-GNU mode is not exactly identical to GNU mode in traditional mode, it's close enough.

Sponsored by:	Klara, Inc.
Reviewed by:	kevans, imp
Differential Revision:	https://reviews.freebsd.org/D40697
2023-06-21 20:59:03 +00:00
Dag-Erling Smørgrav 47b32f8f93 m4: Support long options.
The option names are identical to those of the equivalent options in GNU m4, except of course for --gnu which does not exist in GNU m4.

While here, make the argument to -d / --debug optional, with the same default behavior as in GNU m4, and document it properly.

Sponsored by:	Klara, Inc.
Reviewed by:	kevans, imp
Differential Revision:	https://reviews.freebsd.org/D40694
2023-06-21 20:59:03 +00:00
Konstantin Belousov 5bd5470a2c top(8): restore erronously removed SWAIT array element
due to bad rebase.

Noted by:	kevans
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Fixes:	6a5e6a50bd55c3fb4933abe1edaad3a928700c42ESC
2023-06-21 08:43:11 +03:00
Konstantin Belousov 6a5e6a50bd top(8): add missed SLOCK state to the sorted_state[]
Put it near/after the sleep state.

Noted by:	Mark Millard <marklmi@yahoo.com>
Reviewed by:	kevans
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40607
2023-06-21 08:37:25 +03:00
Konstantin Belousov d636fc5bd1 top(8): document the actual sort order for process sorting
Noted by:	Mark Millard <marklmi@yahoo.com>
Reviewed by:	kevans
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40607
2023-06-21 08:37:24 +03:00
Konstantin Belousov bc2ac2585a top(8): use designated initializers for sorted_state[]
Also correct comments for individual state, duplicating the S* constants
descriptions from sys/proc.h [*].

Reviewed by:	kevans (previous version)
Noted by:	Mark Millard <marklmi@yahoo.com> [*]
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40607
2023-06-21 08:36:45 +03:00
Konstantin Belousov 5c6393451f top(8): designate the sorted_state[] array as constant
Reviewed by:	kevans
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40607
2023-06-21 08:36:33 +03:00
John Baldwin 9a55543f8e mt: Remove a set but unused variable.
The variable is unused because the -v (verbose) flag to
'mt getdensity' is a no-op.

Reported by:	GCC
Reviewed by:	ken
Differential Revision:	https://reviews.freebsd.org/D40653
2023-06-20 12:32:18 -07:00
John Baldwin 660d6c5c3d procstat: Remove set but unused variable. 2023-06-20 09:29:00 -07:00
John Baldwin e8f740fbc2 diff: Fully comment out the jackpot variable.
This fixes a set but unused warning.
2023-06-20 09:29:00 -07:00
John Baldwin ee0299e5f3 units: Remove set but unused variable.
Reported by:	GCC
2023-06-20 09:28:59 -07:00
John Baldwin 1291d48f06 mkuzip: Remove set but unused variable.
Reported by:	GCC
2023-06-20 09:28:59 -07:00
Ed Maste e54db9a9cc seq: fix check for rounding error/truncation
Based on OpenBSD 30f0fd29ba6c:
> We need to compare the printable version of the last value displayed,
> not the floating point representation.  Otherwise, we may print the
> last value twice.

PR:		271964
Reported by:	Daniel Kolesa
Reviewed by:	yuripv
Obtained from:	OpenBSD
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40601
2023-06-19 11:02:38 -04:00
Dag-Erling Smørgrav b7412da2e1 asa: Add some unit tests.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D40564
2023-06-15 19:24:59 +00:00
Dag-Erling Smørgrav f08f90e698 asa: Read from stdin if *argv is "-".
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D40563
2023-06-15 19:24:58 +00:00
Dag-Erling Smørgrav 9e379f9639 asa: Error out if writing to stdout failed.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D40562
2023-06-15 19:24:58 +00:00
Jessica Clarke 456c1199d3 resizewin: Stop printing bogus NUL to TTY
A char array has an implicit NUL terminating it, which sizeof will
include, so we need to subtract 1 here. Printing a NUL can cause issues
for things like CI environments that aren't expecting it, especially
with recent Jenkins being stricter about not putting NUL in XML files.

Fixes:		3d222369ac ("Add a small tool, resizewin(1), to query terminal for window size")
MFC after:	1 week
2023-06-14 23:58:36 +01:00
Richard Scheffenegger 8e7c2e14cf netstat: display c and C flags properly
Restructure c and C flag checks for string length to
work properly. Quickly bypass for non TCP protos too.

Reviewed By:		tuexen
Sponsored by:		NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D40480
2023-06-09 23:58:00 +02:00
Xin LI d101656818 hexdump: Partial lines cannot be repetitions of earlier lines.
When checking for repetitions of earlier lines, we compare the
first nread bytes of the line against the saved line. However,
when we read a partial line, it should never be treated as a
repetition of an earlier line, even if the first bytes match.

This change fixes a bug where a partial line could be
incorrectly identified as a repetition of an earlier line.

Reported-by:	Mark Adler <madler@alumni.caltech.edu>
PR:		118723
Reviewed-by:	emaste
MFC-after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D40471
2023-06-08 18:39:05 -07:00
Xin LI 1232c7884d od(1): Fix skip value handling
POSIX defines -j as the number of bytes that od(1) should skip over the
concatenated input files. The existing code tries to implement this behavior
by checking if the current address was smaller than the skip value. However,
this is not correct, because we adjust both the skip value and the address
at the same time when we do fseeko (when file is seekable) or getchar (when
file is not seekable).

This commit fixes the problem by expecting the skip value to be zero upon
return of next(). If the condition is not satisfied, a diagnostic message
will be issued.

Reported-by:	Mohamed Akram <mohd.akram@outlook.com>
Reviewed-by:	emaste
PR:		271832
MFC-after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D40446
2023-06-07 18:06:07 -07:00
Dag-Erling Smørgrav fbc445addf xargs: Consistently use strtonum() to parse arguments.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D40425
2023-06-05 20:50:54 +02:00
Dag-Erling Smørgrav 6d777389e1 xargs: Fix typo in error message.
MFC after:	1 week
Sponsored by:	Klara, Inc.
2023-06-05 18:11:44 +02:00
Dag-Erling Smørgrav 7ba6119e22 ctags: Don't undercount lines when handling // comments.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D40374
2023-06-05 17:53:45 +02:00
Mateusz Piotrowski 979754a15a nfsstat.1: Add a missing argument to -w
MFC after:	3 days
Sponsored by:	Klara Inc.
2023-06-05 14:33:55 +02:00
Ben Harris 37e3f5b23b Enable support for printing 8-byte integers. For some reason, most of the
code for this was present, but disabled.
This is required for POSIX compliance on platforms with 8-byte longs.

Obtained-From:	NetBSD
PR:		238586
Reported-By:	Mohamed Akram <mohd.akram@outlook.com>
MFC after:	2 weeks
2023-06-04 19:23:35 -07:00
Jan Schaumann ac17fc816e split(1): add '-c' to continue creating files
Currently, split(1) will clobber any existing output files:

$ split file; ls
xaa xab xac xad
$ split second-file; ls
xaa xab xac xad xae xaf

This patch adds a flag "-c" (mnemonic "create, don't overwrite" or
"continue where you left off"):

$ split file; ls
xaa xab xac xad
$ split -c second-file; ls
xaa xab xac xad xae xaf xag xah xai xaj

Reviewed by:	christos
Approved by:	kevans
Different Revision:	https://reviews.freebsd.org/D38553
2023-05-30 16:13:16 +03:00
Jan Schaumann c4f7198f47 split(1): auto-extend suffix length if required
If the input cannot be split into the number of files resulting from the
default suffix length, automatically extend the suffix length rather
than bailing out with 'too many files'.

Suffixes are extended such that the resulting files continue to sort
lexically and "cat *" would reproduce the input. For example, splitting
a 1M lines file into (default) 1000 lines per file would yield files
named 'xaa', 'xab', ..., 'xyy', 'xyz', 'xzaaa', 'xzaab', ..., 'xzanl'.

If '-a' is specified, the suffix length is not auto-extended.

This behavior matches GNU sort(1) since around version 8.16.

Reviewed by:	christos
Approved by:	kevans
Different Revision:	https://reviews.freebsd.org/D38279
2023-05-30 15:55:38 +03:00
Kajetan Staszkiewicz 4bf98559d9 pf: make contents of struct pfsync_state configurable
Make struct pfsync_state contents configurable by sending out new
versions of the structure in separate subheader actions. Both old and
new version of struct pfsync_state can be understood, so replication of
states from a system running an older kernel is possible. The version
being sent out is configured using ifconfig pfsync0 … version XXXX. The
version is an user-friendly string - 1301 stands for FreeBSD 13.1 (I
have checked synchronization against a host running 13.1), 1400 stands
for 14.0.

A host running an older kernel will just ignore the messages and count
them as "packets discarded for bad action".

Reviewed by:	kp
Sponsored by:	InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D39392
2023-05-30 14:28:56 +02:00
Baptiste Daroussin cb1fc924d2 genl: add new command to list genetlink(4)
This commands list genetlink protocols and its operations and
capabilities

Name: nlctrl
	ID: 0x10, Version: 00, header size: 2, max attributes: 10
	supported operations:
	 - ID: 0x3, Capabilities: 0xe (can modify; can get/dump;
has policy)
	multicast groups:
	 - ID: 0x30, Name: notify
Name: carp
	ID: 0x11, Version: 00, header size: 2, max attributes: 2
	supported operations:
	 - ID: 0x1, Capabilities: 0xe (can modify; can get/dump;
has policy)
	 - ID: 0x2, Capabilities: 0xb (requires admin permission;
can modify; has policy)

Reviewed by:		melifaro
Differential Revision:	https://reviews.freebsd.org/D40330
2023-05-30 13:36:43 +02:00
Enji Cooper 27234ad699 Fix the build post-dcf5d5603b3af8
I didn't compile test the prior code before committing.

MFC after:	1 week
MFC with:	dcf5d5603b
2023-05-27 19:18:43 -07:00
Enji Cooper dcf5d5603b Reduce ifdef soup by adding pre-3.0 compat support
This change creates a static inline function, BN_check_prime, for
pre-3.0 use which is implemented with the previous (1.1) compatible call
under the covers, `BN_is_prime_ex`.

The `nchecks` parameter value is maintained, even though it has no
noticable behavior change, given that the documentation clearly states
that at least 64 or 128 rounds are executed on the backend, depending on
how many bits there are in the given number being factored out.

MFC after:	1 week
Differential Revision:	 https://reviews.freebsd.org/D40305
2023-05-27 17:05:39 -07:00
Enji Cooper 537cd76643 factor: support OpenSSL 3
This change ports the BN APIs to an OpenSSL 3 compatible set of APIs.

This removes the need for requesting OpenSSL 1.1 compatible APIs.

MFC after:	1 week
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D40298
2023-05-27 11:11:44 -07:00
Enji Cooper c60be9ea6b Add simple factor/primes regression tests
This will help ensure that the change following this
one to support OpenSSL 3 is sane.

MFC after:	1 week
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D40297
2023-05-27 11:11:44 -07:00
Alexander V. Chernikov 656a39c1a0 netlink: use newly-added snl(3) array parsing for handling multipath
routes.

MFC after:	2 weeks
2023-05-27 11:13:14 +00:00
Mark Johnston e96ed17746 top: Use a cpuset_t to represent a CPU mask
The code attempts to detect holes in the CPU ID space, but previously
this would only work for up to sizeof(long)*8 CPUs.

MFC after:	2 weeks
2023-05-26 15:38:08 -04:00
Dmitry Chagin c2c9ac88c2 kdump: Add a facility to print numbers in decimal format always
To help grepping kdump output by pid or tid it makes sence to print
some numbers in decimal format always. Eg, process or thread identifier
at least, as they already printed in decimal format.
Switch to print pid/tid arguments of some Linux signal related syscalls
in decimal format.

Reviewed by:		jhb
Differential Revision:	https://reviews.freebsd.org/D40099
MFC after:		1 week
2023-05-26 19:35:08 +03:00