Commit graph

15763 commits

Author SHA1 Message Date
Dag-Erling Smørgrav
0d230c89f5 expand: Fix markup for the -t option.
PR:		274897
Fixes:		8993d785a261
MFC after:	3 days
Reviewed by:	gbe
Differential Revision:	https://reviews.freebsd.org/D45167

(cherry picked from commit f3eeeb959c9b00c89a2e1ff009c78162eb398656)
2024-05-15 15:59:30 +00:00
Jake Freeland
ba501a5517 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

(cherry picked from commit f239db4800ee9e7ff8485f96b7a68e6c38178c3b)
2024-05-11 18:57:44 -05:00
Jake Freeland
5757a523dc 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

(cherry picked from commit 4f2ada0d88219746fdfbc0907c28b0950ad18725)
2024-05-11 18:57:44 -05:00
Jake Freeland
9da71e6353 ktrace: Record detailed ECAPMODE violations
When a Capsicum violation occurs in the kernel, ktrace will now record
detailed information pertaining to the violation.

For example:
- When a namei lookup violation occurs, ktrace will record the path.
- When a signal violation occurs, ktrace will record the signal number.
- When a sendto(2) violation occurs, ktrace will record the recipient
  sockaddr.

For all violations, the syscall and ABI is recorded.

kdump is also modified to display this new information to the user.

Reviewed by:	oshogbo, markj
Approved by:	markj (mentor)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D40676

(cherry picked from commit 9bec84131215ed554f435e208399f36e982246f1)
2024-05-11 18:57:44 -05:00
Olivier Certner
9f06e6c990
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

(cherry picked from commit 9b30b96c1fa4ee0dfc540878fbb3247bf92d19eb)

ObsoleteFiles.inc: Remove /var/db/portsnap

This is a followup to commit "Remove remnants of portsnap(8)"
(9b30b96c1fa4).  I wasn't aware of OLD_DIRS.

Approved by:            markj (mentor)
MFC after:              1 day
MFC with:               9b30b96c1fa4
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D45023

(cherry picked from commit 54bbcc09a72b5d7a581f51416c9e635a33c2f884)

Approved by:            markj (mentor)
2024-05-09 15:52:53 +09:00
Collin Funk
ebc5b3b085 ctags: Use C99 bool instead of defining our own
Use stdbool.h definitions instead of defining non-standard ones.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>

Reviewed by:	markj
MFC after:	2 weeks
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1107

(cherry picked from commit 87b0195ace1a71a1a07244890be3aaef72e1ffcd)
2024-05-08 09:06:15 -04:00
Shawn Bayern
45764d1d48 Tighten boundary check in split(1) to prevent a potential buffer overflow.
(cherry picked from commit 95032b58a1ad0fde57518f17805ca721bb4563ad)
2024-05-05 22:59:08 -07:00
Martin Matuska
d2539274f4 libarchive: merge from vendor branch
Libarchive 3.7.3

New features:
  #1941 uudecode filter: support file name and file mode in raw mode
  #1943 7-zip reader: translate Windows permissions into UNIX
        permissions
  #1962 zstd filter now supports the "long" write option
  #2012 add trailing letter b to bsdtar(1) substitute pattern
  #2031 PCRE2 support
  #2054 add support for long options "--group" and "--owner" to tar(1)

Security fixes:
  #2101 Fix possible vulnerability in tar error reporting introduced
        in f27c173

Important bugfixes:
  #1974 ISO9660: preserve the natural order of links
  #2105 rar5: fix infinite loop if during rar5 decompression the last
        block produced no data
  #2027 xz filter: fix incorrect eof at the end of an lzip member
  #2043 zip: fix end-of-data marker processing when decompressing zip
        archives

(cherry picked from commit b9128a37faafede823eb456aa65a11ac69997284)
2024-04-30 08:46:59 +02:00
Kyle Evans
2c24df87e3 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.

(cherry picked from commit 8ceac8e13dccbe4e177c8f2f443b87b7d2e3edb3)
2024-04-29 00:29:02 -05:00
Xavier Beaudouin
fb4c7bf8ac 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.

(cherry picked from commit 4459abe334eb4dbd416fa8094a64afc065ccd1cc)
2024-04-29 00:29:02 -05:00
Mark Johnston
9f1d4502c2 install: Fix a compiler warning when bootstrapping
Fixes:		4336161cc9c6 ("install: Don't skip syncing in the common case.")
Reviewed by:	imp, des
Differential Revision:	https://reviews.freebsd.org/D44866

(cherry picked from commit 2f44f86575f9cba5da28b762c359f7a806400744)
2024-04-24 22:11:56 +00:00
Dag-Erling Smørgrav
34ee703400 install: Always use a temporary file.
Previously, we would only use a temporary file if explicitly asked to
with the `-S` option, and even then, only if the target file already
existed.  This meant that an outside observer looking for the target
file might see a partial file, and might see the file disappear and
then reappear.

With this patch, we always use a temporary file, ensuring atomicity.
The downside is slightly increased disk usage.  The upside is never
having to worry about, for instance, cron jobs randomly failing if
they happen to run simultaneously with `make installworld`.

The `-S` option is retained, partly for compatibility, and partly
to control the use of `fsync(2)`, which has a non-negligible cost
(approximately 10% increase in wall time for `make installworld`).

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	0mp, brooks, imp, markj
Differential Revision:	https://reviews.freebsd.org/D44742

(cherry picked from commit e5035d08578e372d40b4e2d4c3574b7583549bd6)

install: Simplify path construction.

There's no need to copy the path twice to split it into base and dir.
We simply call `basename()` first, then handle the two trivial cases in
which it isn't safe to call `dirname()`.

While here, add an early check that the destination is not an empty
string.  This would always fail eventually, so it may as well fail
right away.  Also add a test case for this shortcut.

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

(cherry picked from commit 17dc7017d7375b3463d65adffe1eb980b0f86795)

install: Don't skip syncing in the common case.

In `copy()`, if no digest was requested (which is the common case), we
use `copy_file_range()` to avoid needlessly copying the contents of the
file into user space and back.  When `copy_file_range()` returns
successfully (which, again, is the common case), we simply return, and
therefore never get to the point where we call `fsync()` if the `-S`
option was specified.  Fix this.

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

(cherry picked from commit 4336161cc9c631d40d00adee97dfc8161b6bec9f)

install: Remove the mmap(2) option.

We already removed it from cp(1) over a year ago but never followed up
here.  Do so now, for the same reasons: significant complexity for
little to no benefit.

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

(cherry picked from commit a0439a1b820fa0e742c00d095f5f5c06f5f19432)

install: Assorted nitpickery.

* Use `errc()` instead of manually setting `errno` before calling `err()`.
* Change one warning into a fatal error.
* Drop some unnecessary casts.
* `strlcat()` bounds checks were off-by-one.  This does not matter in
  practice because the subsequent code renders an overrun harmless.
* We were passing `SSIZE_MAX` to `copy_file_range()` instead of the
  requested size.  This only matters if we're asked to install a file
  which is still being written to while we are copying it.

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

(cherry picked from commit 000a533e6d1db9878296b32d1cc212e11a2cc718)
2024-04-24 22:11:55 +00:00
Dimitry Andric
4b8be30b44 Merge llvm-project release/18.x llvmorg-18.1.0-rc2-53-gc7b0a6ecd442
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/18.x llvmorg-18.1.0-rc2-53-gc7b0a6ecd442.

PR:		276104
MFC after:	1 month

(cherry picked from commit 74626c16ff489c0d64cf2843dfd522e7c544f3ce)
2024-04-19 23:14:16 +02:00
Dimitry Andric
b9d9368bac Merge llvm-project release/18.x llvmorg-18.1.0-rc2-0-gc6c86965d967
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/18.x llvmorg-18.1.0-rc2-0-gc6c86965d967.

PR:		276104
MFC after:	1 month

(cherry picked from commit b3edf4467982447620505a28fc82e38a414c07dc)
2024-04-19 23:14:15 +02:00
Dimitry Andric
a58f00ea91 Merge llvm-project main llvmorg-18-init-18359-g93248729cfae
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-18-init-18359-g93248729cfae, the
last commit before the upstream release/18.x branch was created.

PR:		276104
MFC after:	1 month

(cherry picked from commit 7a6dacaca14b62ca4b74406814becb87a3fefac0)
2024-04-19 23:14:13 +02:00
Dimitry Andric
cdc20ff6a7 Merge llvm-project main llvmorg-18-init-16595-g7c00a5be5cde
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-18-init-16595-g7c00a5be5cde.

PR:		276104
MFC after:	1 month

(cherry picked from commit 1db9f3b21e39176dd5b67cf8ac378633b172463e)
2024-04-19 23:14:10 +02:00
Dimitry Andric
c9157d925c Merge llvm-project main llvmorg-18-init-15088-gd14ee76181fb
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-18-init-15088-gd14ee76181fb.

PR:		276104
MFC after:	1 month

(cherry picked from commit 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
2024-04-19 23:12:03 +02:00
Colin Percival
7a2c2599a7 14.1: update stable/14 to -PRERELEASE
This marks the start of the FreeBSD 14.1 release cycle; the stable/14
tree is now in "code slush".

Developers are encouraged to prioritize fixing bugs (and/or merging bug
fixes from HEAD) over new features at this time.  Commit approval from
re@ is not required but if new features introduce problems they may be
removed from the release.

Approved by:	re (implicit)
2024-04-18 19:49:36 -07:00
Stephen J. Kiernan
ba1b5e122a dirdeps: Add missing dependency files
Some leaf directories were missing Makefile.depend files or needed
architecture-specific Makefile.depend.* files.

(cherry picked from commit e5b786625f7f82a1fa91e41823332459ea5550f9)
2024-04-15 20:32:03 -06:00
Collin Funk
342a51f110 which: Use size_t instead of ssize_t for pathlen
The "pathlen" variable is the return value of strlen(3) and is then
passed as an argument to malloc(3) and memcpy(3). The size_t type
matches the prototype for these functions. The size_t type is unsigned
so it can fit larger $PATH values than ssize_t. However, in practice
ssize_t should be larger enough so this change is just for clarity.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>

MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1113

(cherry picked from commit 8268a31bcceb9ebe32d380cab792c89c5d897d15)
2024-04-15 10:05:13 -04:00
Ricardo Branco
551f4b478b find: Add -readable, -writable & -executable options
Reviewed by:	jhb, Mina Galić
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1080

(cherry picked from commit e4b646ce16105efc943bc8ac2242a2220dfe18d8)
2024-04-08 10:34:32 -07:00
Ricardo Branco
1aebbbc69b find: Allow '/' to be used with -perm for GNU compatibility
In 2005, Gnu find deprecated '+' as the leading character for the -perm
argument, instead preferring '/' with the same meaning. Implement that
behavior here, and document it in the man page.

Reviewed by: imp, emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/1060

(cherry picked from commit 2a121b97e9673ff37062c9fa026eee969940d2e2)
2024-04-08 10:33:19 -07:00
Xin LI
a9288701de Revert "MFV: xz 5.6.0"
This commit reverts 8db56defa766eacdbaf89a37f25b11a57fd9787a,
rolling back the vendor import of xz 5.6.0 and restoring the
package to version 5.4.5.

The revert was not directly due to the attack (CVE-2024-3094):
our import process have removed the test cases and build scripts
that would have enabled the attack. However, reverting would
help to reduce potential confusion and false positives from
security scanners that assess risk based solely on version
numbers.

Another commit will follow to restore binary compatibility with
the liblzma 5.6.0 library by making the previously private
symbol (lzma_mt_block_size) public.

PR:		278127

(cherry picked from commit 2f9cd13d6c1824633251fb4267c9752d3b044a45)
2024-04-07 21:01:09 -07:00
Dag-Erling Smørgrav
ddee3ee4e0 usr.bin: Make lorder conditional on MK_TOOLCHAIN.
MFC after:	1 week
Reviewed by:	allanjude, markj
Differential Revision:	https://reviews.freebsd.org/D44558

(cherry picked from commit 125c4560bc70971b950d035cfcd2255b89984011)
2024-04-04 11:53:25 +02:00
Dag-Erling Smørgrav
80f2602e48 install: Prefer strsnvis() to strsvis().
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D44514

(cherry picked from commit 2cab4be46b0eeb64b8ade010bc16245151af5ccd)
2024-04-04 11:43:15 +02:00
Dag-Erling Smørgrav
ae2888dd0e touch: Allow setting the timestamp to -1.
Note that VFS internally interprets a timestamp of -1 as “do not set”,
so this has no effect, but at least touch won't incorrectly reject the
given date / time (1969-12-31 23:59:59 UTC) as invalid.

While here, fix some style issues.

MFC after:	1 week
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D44504

(cherry picked from commit aa69e0f212630bd6d4ec1c3c54e117be16653e8a)

touch: Add unit tests.

MFC after:	1 week
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D44505

(cherry picked from commit 74a4aa9b1517d92bfa85b0b1cd7d4c1262bb1ef9)
2024-04-04 11:43:12 +02:00
Collin Funk
8db49fc84c msgs: Use C99 bool instead of defining our own
Use stdbool.h definitions instead of defining non-standard ones.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Pull-request: https://github.com/freebsd/freebsd-src/pull/1105
(cherry picked from commit 912b52a62c72ca9c96a396148a6b30ff9c0917e7)
2024-04-02 09:53:51 -04:00
John F. Carr
8e3bd18c37 Translate linux_newlstat name argument
PR:	277847

(cherry picked from commit 55e2187a091b7c397b3682b5ded2143c43e31a18)
2024-03-27 10:27:23 +02:00
Eugene Grosbein
c7f1512739 MFC: mkimg(1): process non-seekable output gracefully
mkimg may make severe load only to fail in the end
if output is non-seekable pipe, socket or FIFO
unless output format is raw disk image.

Check it out and fail early. Make it clear in the manual.

(cherry picked from commit 7f0dc6e2cdfa0317c9917dd46e9da9d3897a8fbb)
2024-03-19 13:51:13 +07:00
Kyle Evans
b983d4f63c kdump: decode pollfd struct arrays coming from poll(2)
We'll handle these just as we do kevents, one per line with subsequent
lines indented sufficiently to distinguish them from the upcoming
return value.

Sample, with indentation stripped and revents changed to '...' in the
first one to keep the line length down:

CALL  poll(0x820610560,0x3,0)
STRU  struct pollfd[] = { { fd=0, events=0x1<POLLIN>, revents=0x11<...>
 { fd=1, events=0x4<POLLOUT>, revents=0x4<POLLOUT>}
 { fd=-1, events=0x4<POLLOUT>, revents=0} }
RET   poll 2

Reviewed by:	bapt, jhb

(cherry picked from commit 02c57f7b48772c5ec4e3a0a3405273b387b9bb08)
2024-03-18 10:52:58 -05:00
Warner Losh
b0f058525b awk: Fix the tests
I'd forgotten that we have to adjust the stderr tests from
upstream. Remove the OK files. Also remove system-status.*.  These
restore the fixes I made in 517e52b6c2 which were lost when I imported
the last version of awk.

Also, force LANG to be C.UTF-8 when testing to ensure that stray lang
settings don't fail tests.

Sponsored by:		Netflix

(cherry picked from commit ba7b7f94c239ce43343d7af403734fdc941b7664)
2024-03-11 22:53:47 -06:00
Dag-Erling Smørgrav
d85ea7e79b lorder: Clean up and improve robustness.
* Properly parse (no) command-line options.

* Ensure that errors go to stderr and result in a non-zero exit.

* Drop the special-case code for a single argument, as it will produce
  the wrong outcome if the file does not exist or is corrupted.

* Don't print anything until after we've collected all the data.

* Always create all temporary files before setting the trap.  This
  ensures that the trap can safely fire at any moment, regardless of any
  previous definition of `T`.

* Use a temporary file rather than a pipe between `nm` and `sed` to
  ensure proper termination if `nm` fails due to a missing or invalid
  input.

* The check for self-referential entries was conditional on testing our
  argument list against a regex looking for archives.  This was a
  needless and unreliable optimization; make the check unconditional.

* Document that lorder will not work properly if any of its inputs have
  spaces in their name.

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

(cherry picked from commit 5c7b986c21ed47545203e8f630fe2281b83112d2)

lorder: Add unit tests.

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

(cherry picked from commit 96da41b6dbf383436018f11ad8a672faab2d3789)

lorder: Undeprecate.

While lorder is not required by our current toolchain (or any toolchain
we've used in the past decade or two), it still occasionally shows up
in build systems of third party software, including The Open Group's
UNIX conformance test suite, and the maintenance cost is negligible.

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

(cherry picked from commit cf4d9bf8b38819da12c6d686d5cf6dbd6353cd61)

lorder: Don't rely on legacy syntax.

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

(cherry picked from commit aedb37dc49319a7cd1faf34f312a8a9fc01e611d)

lorder: Tweak invalid file test.

Different implementations of `nm` have different ways of telling you
that your file is not a valid object or library, but they all seem to
have “not recognized” as a common substring.

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

(cherry picked from commit aa80cfadff0bb715ca090cbd1b3561a1619251d5)
2024-03-11 13:19:06 +01:00
Dag-Erling Smørgrav
da29052897 diff: Fix --expand-tabs and --side-by-side.
* Overhaul column width and padding calculation.
* Rewrite print_space() so it is now a) correct and b) understandable.
* Rewrite tab expansion in fetch() for the same reason.

This brings us in line with GNU diff for all cases I could think of.

Sponsored by:	Klara, Inc.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D44014

(cherry picked from commit 53de23f4d140becc3166e87665b0064f215a220e)

diff: Bump manual page date.

Sponsored by:	Klara, Inc.

(cherry picked from commit 312b1076c6b0aff9bbcaff058b93385eaf607685)
2024-03-11 13:19:06 +01:00
Xin LI
965f92a282 MFV: xz 5.6.0.
(cherry picked from commit 8db56defa766eacdbaf89a37f25b11a57fd9787a)
2024-03-09 19:57:25 -08:00
Dimitry Andric
c4149abc5d Optionally create full debuginfo for llvm-related executables
Commit de6feefdb7 limited the amount of debuginfo generated for clang
and other llvm-related executables. This was done to save disk space and
memory during building, but it makes debugging any of these executables
much harder.

Add a new src.conf(5) setting, WITH_LLVM_FULL_DEBUGINFO, to generate
full debuginfo instead. This is off by default, but could for example be
enabled for release builds or snapshots, so llvm executables are easier
to debug.

Reviewed by:	emaste
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D43839

(cherry picked from commit 73ff7384e025033abc98fd5437a48beb8077a90b)
2024-03-08 09:15:34 +01:00
Eugene Grosbein
22f11923c6 mkimg.1: add new PARTITION SPECIFICATION section
The specification follows a commentary to the function parse_part()
in the source code and the code itself.

(cherry picked from commit d1797fb5bbaeb212501a72b916d647fb2e021d50)
2024-03-01 21:47:33 +07:00
Rick Parrish
e38dee6120 posixmqcontrol(1): manage posix message queues
(cherry picked from commit 0112f8c4a88e75342bdb6b9815fa220c5f645aa0)
2024-03-01 06:12:02 +02:00
Dag-Erling Smørgrav
181e968377 sdiff: Misc cleanup.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D43943

(cherry picked from commit 3cc86989bfbe27c91b5db592c2af33fef153e230)

sdiff: Fix --expand-tabs and --tabsize.

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

(cherry picked from commit a834edfccd14a8c0f152a3b0078469af8e05f3fd)

sdiff: Fix binary case.

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

(cherry picked from commit ad7bef8b890768e68a48bbfa6b92ebf635068504)
2024-02-24 13:12:49 +01:00
Dag-Erling Smørgrav
4ffc5ab03f patch: Support long context lines.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D43850

(cherry picked from commit 851a9da38f070675c42a6d69c41c47a5d29ee3d0)
2024-02-24 13:12:49 +01:00
Dag-Erling Smørgrav
fa778f0ce5 bintrans: Error out if writing to the output failed.
- Cover all code paths.
- When decoding, check all output files, not just the last one.
- A simple `ferror()` check is not enough as an error may later occur
  while flushing whatever remains in the output buffer.

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

(cherry picked from commit 5cb28f7979773715615cc2131fe40e0c5879ed1d)

bintrans: Fix uninitialized variable.

`prev` may be used uninitialized if `body` starts with a newline.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	bapt, emaste
Differential Revision:	https://reviews.freebsd.org/D43534

(cherry picked from commit bce34cba07bcfed9cd519a658e594c9910c8f210)

bintrans: Add base64 to name list in manual page.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	0mp, pstef
Differential Revision:	https://reviews.freebsd.org/D43558

(cherry picked from commit 64028ac3ba9668cff31bfe2c79d85a3b89e10953)

bintrans: Remove unused variable.

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

(cherry picked from commit bc2913d1736c2b299a265741a779014d001bd108)
2024-02-24 13:12:49 +01:00
Dimitry Andric
5fe7f76dd6 Remove usr.bin/clang/llvm-ar/llvm-cxxfilt-driver.cpp file
I accidentally copied this to the wrong place, or by accident to two
places, during the merge of llvmorg-17-init-19304-gd0b54bb50e51.

Fixes:		06c3fb2749bd
MFC after:	3 days

(cherry picked from commit 4015c064200e643ab110cdf831064c3c73f31b73)
2024-02-13 18:51:33 +01:00
Wolfram Schneider
47cb760dac man: support special characters in filenames
man.sh needs to handle double quotes and sub shell character
as '`' '$' etc.

PR:		275967
Reviewed by:	bapt

MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D43453

(cherry picked from commit b8a484ec343d163a40f7cf4a6026e880f992c738)
2024-01-31 14:47:33 +00:00
Tijl Coosemans
aaefd6898a join(1): Fix ordering in case of missing fields
The comparison function had the ordering reversed causing join(1) to
miss some matching lines.

PR:		232405
Submitted by:	Martijn van Duren <martijn@openbsd.org>

(cherry picked from commit 95bf75895ddcf17402b1f69dce26cb821c922476)
2024-01-31 09:53:11 +01:00
Mark Johnston
1c090bf880 top: Avoid printing a blank line when the ZFS ARC is empty
PR:		275994
MFC after:	2 weeks

(cherry picked from commit 1f62718d8ba26d813d8c2e826ac5f4caee4c6730)
2024-01-25 09:57:12 -05:00
Dag-Erling Smørgrav
559c7ac87d 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

(cherry picked from commit afdce0837014fb7a41fced959c9457f89e878052)
2024-01-21 17:08:48 +01:00
Wolfram Schneider
7169c947ab man(1): support spaces in filenames
The globbing function in exists() needs to handle white spaces.

PR:          275978
Reviewed by: kevans, bapt, emaste
Differential Revision: https://reviews.freebsd.org/D43222
MFC after:   1 week

(cherry picked from commit e3c7b76fa8105929ae9a785e5ffc44274b1b0a81)
2024-01-20 08:51:12 +00:00
Lexi Winter
d741d23133 nfsstat: make -q work without -e/-E
MFC after:	2 weeks
Pull Request:	https://github.com/freebsd/freebsd-src/pull/961

(cherry picked from commit f79b200b6aefb9bdcbe931c5b7ea604e259beee0)
2024-01-19 18:55:26 -07:00
Lexi Winter
be908114fd 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
Pull Request:	https://github.com/freebsd/freebsd-src/pull/958

(cherry picked from commit 30ce26cacfd626552c647c9327dd510e7f421d97)
2024-01-19 18:54:27 -07:00
Lexi Winter
f2ad8d3a13 mail: add volatile in grabh()
setjmp() requires that any stack variables modified between the setjmp
call and the longjmp() must be volatile.  This means that 'saveint' in
grabh() must be volatile, since it's modified after the setjmp().
Otherwise, the signal handler is not properly restored, resulting in a
crash (SIGBUS) if ^C is typed twice while composing.

PR:		276119
Reported by:	Christopher Davidson <christopher.davidson@gmail.com>
MFC after:	2 weeks
Pull Request:	https://github.com/freebsd/freebsd-src/pull/993

(cherry picked from commit 6c951b37170f1fb2ae8b4827070743e61b6eaed2)
2024-01-19 09:25:05 -05:00
Dag-Erling Smørgrav
cef433d3fb uniq: Replace NetBSD's unit tests with our own.
These new tests cover more functionality and are easier to extend.

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

(cherry picked from commit e762fd81e253d4ae9b9f7d2e65cf448633bbe527)

uniq: Fix interactive use.

Output a line as soon as it is possible to determine that it will have
to be output.  For the basic case, this means output each line as it is
read unless it is identical to the previous one.  For the -d case, it
means output the first instance as soon as the second is read, unless
the -c option was also given.  The -D and -u cases were already fine.

Add test cases for interactive use with no options and with -d.

Explicitly ignore -d when -D is also specified.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	rew, kevans
Differential Revision:	https://reviews.freebsd.org/D43382

(cherry picked from commit 11715600e626cf6cc4b4f564af97f6ae1e5fb0be)

uniq: Clean up and test obsolete options.

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

(cherry picked from commit e2ec8ee02a33e39b8ff86a56e8a1ef5e84ac7e62)

uniq: Error out if writing to the output failed.

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

(cherry picked from commit 899837e8f5741f9a847b63d9e7c8b76ccc033ab5)
2024-01-17 19:28:23 +01:00